======================================================================= 1 === Date: Sun, 1 Nov 1992 07:13:34 GMT From: dvorak@extro.ucc.su.OZ.AU (Darko Volaric) Subject: SRC M3 for 386BSD? Has anyone have a port of SRC M3 to 386BSD? If not, what is the best distribut- ion tar file to get that supports the BSD flavour of Unix and GNU C? Thanks in advamce for any help, Darko Volaric ======================================================================= 2 === Date: Sun, 1 Nov 92 20:04:00 -0800 From: worstell@eecs.ucdavis.edu (Glen Worstell) Subject: m3 on NeXT I've been trying to install version 2.07 on a NeXT, operating system 3.0, without success. The compiler seems to install but libm3 gives an error near the beginning: don't know how to make M3Config.m3 and another at the end: install: can't open libm3.a Do you have any hints? Sincerely, Glen. worstell@madrone.eecs.ucdavis.edu ======================================================================= 3 === Date: Mon, 2 Nov 92 16:36:37 GMT From: kalsow@src.dec.com (Bill Kalsow) Subject: Re: Cyclic Inheritance In article , adiwan@quick.fox. cs.cmu.edu (Amer Diwan) writes: > This is to report a problem in the SRC compiler and point out a possible grey > area in the Modula-3 report. > The problem happens when an object type A inherits from B and B inherits from > A. The compiler gives a reasonable error message in the simple cases when > both A and B are in the same module. For example: > TYPE A = A OBJECT i: INTEGER END; > If however they are in different modules, the linker goes into an infinite > loop (well, I killed it when it did not terminate after 30 minutes). Thanks for the bug report. I've fixed it here at SRC. The next released version of the system will include the fix. > I cannot find anything in the Modula-3 report that addresses circular > inheritance. It seems that in the general case, the work of detecting > circularity will have to be deferred to link time. Section 2.4.8 of SPwM3 defines recursive declarations and says which ones are allowed. Recursion in object supertypes is not allowed. Yes, in general the cycle cannot be detected until link time. - Bill Kalsow ======================================================================= 4 === Date: 2 Nov 92 17:45:38 GMT From: schindler@rz-berlin.mpg.de Subject: Mod-2 or Mod-3 for Mac Hi there, Are public domain Modula-2 or Modula-3 compilers available for Macs? Thanks - Michael Schindler e-mail: Schindler@fhi-berlin.mpg.dbp.de ======================================================================= 5 === Date: Tue, 3 Nov 1992 09:52:18 GMT From: paubert@piaf3.cern.ch (Pierre Aubert) Subject: modula-3 on HP 7XX Does someone have compile the compiler and the driver on an HP700 ? Is it possible ? Does patch exist ? Help please -- A++ Pierre +--------------------------+--------------------------+ | I'd rather be juggling | paubert@dxcern.cern.ch | +--------------------------+--------------------------+ ======================================================================= 6 === Date: 4 Nov 92 19:47:43 GMT From: chevalet@imag.fr (Chevallet Jean-Pierre) Subject: Re: Speaking of m3tk (was: Re: Extracting the subtype relation) In article <1992Oct18.203513.11615@alijku05.edvz.uni-linz.ac.at> ddean@risc.uni -linz.ac.at writes: >In article <1992Oct13.175550.12129@src.dec.com> mjordan@src.dec.com (Mick >Jordan) writes: >> In article <9210131655.AA21177@gidney.East.Sun.COM>, >Geoff.Wyant@East.Sun.COM (Geoffrey Wyant - Sun BOS SunLabs) writes: >> >> |> Why not use M3TK, the Modula-3 AST toolkit. This is one of the [...] >Modula-3 (a DECsystem 5000/240). The machine has 2.8 GB of disk, but I >can't build m3tk because I run out of space in /tmp (on the root >partition, as per DEC factory installed Ultrix 4.2A). I tried setting [...] Just want to know, what is M3TK ? NB : I'm SRC M3 compiler for treaching, for now I do appreaciate this language. -- CHEVALLET Jean-Pierre chevalet@imag.imag.fr LGI IMAG Bureau B305 chevalet@imag.UUCP "Faire, et en faisant, se faire" ======================================================================= 7 === Date: Thu, 5 Nov 1992 18:38:56 GMT From: jredford@shearson.com (John Redford) Subject: Openwindows dies Could someone please help me with this: I have compiled SRC-Modula-3 versions 2.08 and 2.09 on a SPARCstation2 running 4.1.2. When ever I try to display any X programs written in M3 it crashes an openwin xnews server. I do not have this problem with an X11R5 server. I have tried dynamic & static linking against openwin's libX11.a, as well as X11R5's and X11R4's. Nothing helps. Any ideas are appreciated. -- John Redford (AKA GArrow) | 3,600 hours of tape. jredford@shearson.com | 5 cans of Scotchguard. ======================================================================= 8 === Date: Fri, 6 Nov 92 00:54:07 GMT From: mjordan@src.dec.com (Mick Jordan) Subject: Re: Speaking of m3tk (was: Re: Extracting the subtype relation) In article <43060@imag.imag.fr>, chevalet@imag.fr (Chevallet Jean-Pierre) write s: |> Just want to know, what is M3TK ? |> Here is a copy of the last posting announcing M3TK, modified to refer to the latest release distribution available from gatekeeper. A new version is in test and will be released at the same time as the next SRC distribution. ----------------------------------------------------------------------------- Version 2 of the Modula-3 AST toolkit, a development of the otherwise defunct Olivetti Modula-3 implemention, is now available via ftp from gatekeeper.dec.com. There are no substantial changes from version 1, other than the implementation of the "twelve changes" to the language definition. That is, the toolkit supports the language defined in "Systems Programming with Modula-3", and is compatible with the conventions of the SRC Modula-3 implementation. The documentation on the toolkit components has been improved, particularly that for the AST specification. The system is made available under the same licence terms as the SRC compiler. In addition the original Olivetti sources are covered by a separate, non-restrictive, copyright notice. The toolkit is designed to support the creation of Modula-3 program development tools and is structured around a compiler front-end which uses a public Abstract Syntax Tree (AST) to represent program source. A description of the (original) system can be found in: "An Extensible Programming Environment for Modula-3", Mick Jordan, Proceedings of the Fourth ACM SIGSOFT Symposium on Software Development Environments, Software Engineering Notes, 15, 6, Dec 1990. A number of tools are provided with the toolkit, vis: * (m3check) A tool that is a step towards an integrated, incremental program development environment for Modula-3. It includes a compiler front end, a tool to scan the file system for source file changes and recompile changed (and dependent) units, a pre-linker to analyse a program for completeness, and a primitive browser. I have reworked this tool quite a bit in repsonse to user feedback. On a DECstation 5000, if compiled with optimisation, it compiles at about 500 lines a second and, since it caches interfaces and is interactive, can provide a fast turnround syntax/semantic checker, before invoking "m3make". * (m3fe) (Just a) compiler front-end (syntax/semantic analysis), with optional checks for unused variables, uncaught exceptions, etc. The compiler can compile multiple sources in one invocation and compiles each interface once only. * (m3modgen) A tool to generate skeleton modules from interfaces. * (m3seegen) A tool to generate a textual form of a generic instantiation, with optional substitution of the generic formals by the actuals. The toolkit is designed to be extensible, by virtue of the AST and a collection of reusable compiler components. I expect to add more tools over time, and hope that others will be motivated to do so. ** N.B. You must install version 2.06 (or later) of SRC Modula-3 before ** attempting to build the toolkit. The toolkit is stored in the directory /pub/DEC/Modula-3/release in the file m3tk-2.07.tar.Z. It is built in the same manner as other Modula-3 distributions, e.g. "m3make -f m3makefile.m3tk", assuming that you have already installed SRC Modula-3 (2.06 or later). You will get plenty of warning messages, but these are all harmless. Mick Jordan, Apr 24 1992. ======================================================================= 9 === Date: Fri, 6 Nov 1992 00:58:12 GMT From: michaelw@basser.cs.su.oz.au (Michael Wise) Subject: M3 for MIPS boxes We are currently running number of risc uniprocessors manufactured by MIPS, typically MIPS 3030 running RISCos 4.52. In the next while these will be moved to RISCos 5.01, and the R3000 boxes will be replaced by R4000-based systems. Is there a version of Modula-3 for these systems? (Could you please also mail m e any responses.) Thanks MichaelW Michael J. Wise Basser Department of Computer Science, F09 Sydney University, N.S.W. 2006 Australia Telephone: +61 2 692 4156 Messages: +61 2 692 3423 Facsimile: +61 2 692 3838 Internet: michaelw@cs.su.oz.au UUCP.net: {mcvax,nttlab,ukc,uunet}!munnari!karl.cs.su.oz.au!michaelw ACS.net: michaelw@cs.su.oz.au -- "We have met the enemy, and they is us" - Pogo (Walt Kelly), 1970 ======================================================================= 10 === Date: 10 Nov 1992 15:39:07 GMT From: kuschke@skuld.informatik.uni-dortmund.de (Michael Kuschke) Subject: Searching "m3bundle" to compile vbtkit Hello, I'm new to the SRC modula-3 System, so excuse if i ask a question that was asked hundred times before. I just started compiling the SRC Modula-3 distribution (V2.07, 09 in some parts). Everything worked ok, until I tried to compile the vbtkit. Here m3make complains the follwoing about m3bundle: Make: Cannot load .../modula-3/dist/bin/m3bundle. Stop. I'v successfully compiled and installed the boot Package, libm3, X11R4, trestle, data, tools and tcl stuff. What have i missed ? What else need's to be installed first ? Any help will be appreciated. Thanks in advance -Michael ======================================================================= 11 === Date: Tue, 10 Nov 92 12:36:31 EST From: Geoff.Wyant@East.Sun.COM (Geoffrey Wyant - Sun BOS SunLabs) Subject: Searching "m3bundle" to compile vbtkit > Hello, > > I'm new to the SRC modula-3 System, so excuse if i ask a question > that was asked hundred times before. > > I just started compiling the SRC Modula-3 distribution (V2.07, 09 > in some parts). Everything worked ok, until I tried to compile the > vbtkit. Here m3make complains the follwoing about m3bundle: > > Make: Cannot load .../modula-3/dist/bin/m3bundle. Stop. > > I'v successfully compiled and installed the boot Package, libm3, > X11R4, trestle, data, tools and tcl stuff. > What have i missed ? What else need's to be installed first ? > > Any help will be appreciated. > > Thanks in advance > -Michael > In general, you don't want to mix and match between releases. I think the way bindling works changed somewhat between the two releases. You'd be better off sticking with the 2.07 release until the official 2.09 release. --geoff ======================================================================= 12 === Date: Tue, 10 Nov 92 10:26:05 -0800 From: Subject: Re: Searching "m3bundle" to compile vbtkit Yes, the bundling machinery (i.e., m3bundle(1), Bundle.i3, Rsrc.i3) changed significantly just after 2.07 (or 2.08; I've forgotten). The current machinery is much simpler and more robust. Mixing code from different releases is a dicey proposition. Since we don't make that frequent releases, so there's a good chance that lots of stuff has changed between releases. ======================================================================= 13 === Date: Wed, 11 Nov 92 09:10:30 +0100 From: Michael Kuschke Subject: m3bundle in the SRC Modula-3 distribution Hello, first thanks for the fast answers. Maybe I should have been clearer when I worte that I've mixed stuff from version 2.07 and 2.09. My main goal is to compile the zeus algorithm-animation system which can be found on gatekeeper under /pub/DEC/Modula-3/test. Since this stuff is in 2.09 version only have two oportunitied: 1. Mix the official 2.07 release of the compiler and libaries and the 2.09 stuff unter festival92 or 2. use the "beta" release called 2.09 for all the stuff -- as far as it exist So I first mixed 2.09er stuff under festival92 with the compiler and libaries of version 2.07. Since that doesn't worked -- the m3bundle problem -- I recompiled the hole system again in the 2.09 version. Again it doesn't worked. It seems to me as if the bundle program isn't generated and installed if you just type "m3make -f m3makefile.... all install" for all the stuff you think you need. So maybe the question should be: "What version of m3bundle do I need to compile the version of vbtkit I need to compile the zeus system and where do I find this stuff ?" Again: Thanks, -Mic Michael Kuschke e-mail: kuschke@urd.informatik\ Computer Science Department - LS4 .uni-dortmund.de University of Dortmund D-4600 Dortmund 50,PO-Box 500500, Germany voice: +49 231 755 2676 ======================================================================= 14 === Date: Wed, 11 Nov 92 07:50:31 EST From: Geoff.Wyant@East.Sun.COM (Geoffrey Wyant - Sun BOS SunLabs) Subject: m3bundle in the SRC Modula-3 distribution > Maybe I should have been clearer when I worte that I've mixed stuff from > version 2.07 and 2.09. My main goal is to compile the zeus algorithm-animatio n > system which can be found on gatekeeper under /pub/DEC/Modula-3/test. Since > this stuff is in 2.09 version only have two oportunitied: > 1. Mix the official 2.07 release of the compiler and libaries and the 2.09 > stuff unter festival92 or > 2. use the "beta" release called 2.09 for all the stuff -- as far as it exi st > > So I first mixed 2.09er stuff under festival92 with the compiler and > libaries of version 2.07. Since that doesn't worked -- the m3bundle > problem -- I recompiled the hole system again in the 2.09 version. Again it > doesn't worked. It seems to me as if the bundle program isn't generated and > installed if you just type "m3make -f m3makefile.... all install" for all > the stuff you think you need. I think you have things left from the 2.07 'm3make' release. In particular, you r installed version of 'toplevel.tmpl' (in /lib/m3/toplevel.tmp l) may be the one distributed with 2.07. This is the file that m3make uses to gene rate makerules. Since bundling changed between the 2 releases the bundling rule in t his file changed as well. Try rebuilding and reinstalling the 2.09 m3make release. Hop this helps ! --geoff ======================================================================= 15 === Date: 12 Nov 92 14:06:35 GMT From: dagenais@vlsi.polymtl.ca (Michel Dagenais) Subject: Rotated text in Trestle My understanding of Trestle/X11 is that one cannot paint rotated text (e.g. the word DRAFT over a page at a 35 degree angle). Moreover, this is simply not available as a primitive under X11. Here are the solutions i can think of: - read font bitmaps from the X11 server and perform bitmap rotation (not very nice). - ask directly to the X11R5 font server for rotated characters (i dont think that font servers support this?!). - have a postscript VBT which gives its screen area to a postscript interpreter like GNU Ghostscript (using DPS kit is not an option for me since i dont have Display PostScript). - use my own fonts defined as Bezier Curves, such as the fonts available with GNU fontutils (perhaps not too efficient if the VBT restarts from Bezier Curves at each redisplay). - open a pipe with GNU Ghostscript and have it generate the desired bitmaps on the fly when a new character/size/angle is encountered, then use these as Trestle pixmaps. Comments? Advices? -- --------------------------------------------------------------------- Prof. Michel Dagenais dagenais@vlsi.polymtl.ca Dept of Electrical and Computer Eng. Ecole Polytechnique de Montreal tel: (514) 340-4029 --------------------------------------------------------------------- ======================================================================= 16 === Date: Thu, 12 Nov 92 12:53:45 EST From: Roger Hoover Subject: changes to pp for IBMR2 There are a few changes needed to get pp (in the tools package) to work under IBMR2, AIX 3.2 First, the y.tab.c, lex.yy.c files will not work. You must make the following changes and rerun "yacc Parse.yacc" (or bison -y) and "lex Parse.lex" in pp/src. The minor changes are: diff -c 2.08/pp/src/Parse.lex pp/src/Parse.lex *** 2.08/pp/src/Parse.lex Thu Apr 23 21:12:11 1992 --- pp/src/Parse.lex Thu Nov 12 12:32:49 1992 *************** *** 98,106 **** /* Make sure we have enough comment space allocated. */ static AllocComments(n) { extern char *malloc(); extern char *realloc(); ! if (nCommentsAlloced == 0) { nCommentsAlloced = n+10; comments = (struct Comment *) --- 98,107 ---- /* Make sure we have enough comment space allocated. */ static AllocComments(n) { + #ifndef _IBMR2 extern char *malloc(); extern char *realloc(); ! #endif if (nCommentsAlloced == 0) { nCommentsAlloced = n+10; comments = (struct Comment *) diff -c 2.08/pp/src/hash.h pp/src/hash.h *** 2.08/pp/src/hash.h Thu Dec 12 15:50:36 1991 --- pp/src/hash.h Thu Nov 12 12:31:56 1992 *************** *** 195,200 **** --- 195,203 ---- return(NULL); } + #ifdef _IBMR2 + extern void exit(); + #endif void install(where) PTRKEYWORDENTRY where; { ======================================================================= 17 === Date: 13 Nov 92 02:18:05 GMT From: brueni@csgrad.cs.vt.edu (Dennis Brueni) Subject: Some dumb questions Two easy questions for the gurus: (1) Is there a special term or phrase used to describe the first argument of a procedure implementing an object method (i.e., the "self" parameter)? (2) Deconstructors. I understand that they are not built in to the language. If you have an object which needs extra work (besides deallocation) to occur before it is collected, what do you do? Thanks in advance, -- --Dennis Brueni (N0JSQ) "The knack to flying lies in learning brueni@csgrad.cs.vt.edu how to throw yourself at the ground and miss." -- Douglas Adams ======================================================================= 18 === Date: 14 Nov 92 17:17:17 GMT From: moss@cs.cmu.edu (Eliot Moss) Subject: Re: Some dumb questions >>>>> On 13 Nov 92 02:18:05 GMT, brueni@csgrad.cs.vt.edu (Dennis Brueni) said: Dennis> Two easy questions for the gurus: Dennis> (1) Is there a special term or phrase used to describe the first Dennis> argument of a procedure implementing an object method Dennis> (i.e., the "self" parameter)? Not that I know of, though I might be inclined to call it "self" or "the object" or "the message target". Dennis> (2) Deconstructors. I understand that they are not built in to the Dennis> language. If you have an object which needs extra work Dennis> (besides deallocation) to occur before it is collected, what do Dennis> you do? Since the language design favors garbage collection, there is little role for explicit deconstructors. However, people DO recognize the need for special action in some cases. For example, a Modula-3 object might represent a window in an external user interface system such as X, and when the Modula-3 object is no longer referenced, the X window should be destroyed. Most examples are of this general nature. Currently there is a feature that allows certain methods to be called when leaving certain scopes (or when the program is about to exit). This attaches the action to control flow, a little bit like a TRY/FINALLY block. That approach helps in some cases, but is not fully general (in my opinion). Greg Nelson (and others) are in the final stages of refining a proposal for finalization ("destructors"). It is combined with a weak pointer facility since the two require similar support in the memory management subsystem and can conveniently be folded together into one mechanism. Note that MOST (but certainly not all) of the destructor code used in C++, Ada, and related languages is obviated by the heap storage + garbage collection approach of Modula-3. Hope this helps ... -- J. Eliot B. Moss, Associate Professor Visiting Associate Professor Department of Computer Science School of Computer Science Lederle Graduate Research Center Carnegie Mellon University University of Massachusetts 5000 Forbes Avenue Amherst, MA 01003 Pittsburgh, PA 15213-3891 (413) 545-4206, 545-1249 (fax) (412) 268-6767, 681-5739 (fax) Moss@cs.umass.edu Moss@cs.cmu.edu ======================================================================= 19 === Date: Mon, 16 Nov 1992 12:32:15 GMT From: sanders@inf.ethz.ch (Beverly Sanders) Subject: CFP: Conf. on Prog. Languages and System Architectures Call for Papers Conference on Programming Languages and System Architectures with a special session in honor of Niklaus Wirth on his 60th birthday 2th - 4th March, 1994 ETH Zurich, Switzerland The conference will provide an international forum for the presentation and discussion of recent research in the areas of programming languages and system architectures. Authors are invited to submit papers describing original research related to these areas. Particularly encouraged are contributions discussing their mutual influence. Also, unrefereed contributions of 5-20 min. duration, and of a technical and/or personal nature are solicited for an afternoon session honoring N. Wirth. Subjects of special interest include, but are not restricted to: Programming language design and history, Programming environments, Programming methods, Operating systems, Compiler construction, Innovative system architectures Send two copies of technical contributions to the program chair. Submissions should not exceed 15 pages and must not have been published or submitted for publication elsewhere. Where possible, include the e-mail address and fax number of the contact author. Potential contributors to the special session in honor of Niklaus Wirth should contact the program chair for more information. Proceedings will be published by Springer Verlag in the Lecture Notes in Computer Science series and will be distributed at the conference. Program Committee J. Gutknecht (Chair) ETH Zentrum CH-8092 Zurich, Switzerland e-mail: gutknecht@inf.ethz.ch e-fax: (+41 1) 251 96 78 R. P. Cook, Microsoft, Redmond, WA G. Coray, EPF Lausanne, CH O. J. Dahl, University of Oslo, N E. W. Dijkstra, Univ. of Texas, Austin, TX G. Goos, Techn. Univ, Karlsruhe, D S. Graham, Univ. of California, Berkeley, CA D. Gries, Cornell University, Ithaca, NY D. Hanson, Princeton Univ, Princeton, NJ B. Kernighan, AT&T Bell Labs, Murray Hill, NJ B. W. Lampson, DEC CRL, Cambridge, MA J. Ludewig, Techn. Univ., Stuttgart, D J. Misra, Univ. of Texas, Austin, TX H. Moessenboeck, ETH Zurich, CH R. Needham, Cambridge University, GB S. Owicki, DEC SRC, Palo Alto, CA G. Pomberger, Universitaet Linz, A P. Rechenberg, Universitaet Linz, A M. Reiser, IBM Research, Zurich, CH B. Sanders, ETH Zurich, CH P. Schulthess, Universitaet Ulm, D A. Shaw, Univ. of Washington, Seattle, WA P. D. Terry, Rhodes University, Grahamstown, SA L. Tesler, Apple Corp, Cupertino, CA J. Welsh, Univ. of Queensland, Brisbane, AU N. Wirth, ETH Zurich, CH Key Dates Deadline for receipt of submissions: 1st August, 1993 Acceptance notification: 1st November, 1993 Deadline for camera-ready final papers: 15th December, 1993 ======================================================================= 20 === Date: Mon, 16 Nov 1992 12:35:34 GMT From: sanders@inf.ethz.ch (Beverly Sanders) Subject: CFP: Conf. on Prog. Languages and System Architectures (LaTeX) \documentstyle[art10]{article} \pagestyle{empty} \newlength{\pageheight} \setlength{\pageheight}{11in} \newlength{\pagewidth} \setlength{\pagewidth}{8in} \setlength{\marginparwidth}{60pt} \setlength{\marginparsep}{10pt} \setlength{\topskip}{12pt} \setlength{\footskip}{12pt} \setlength{\headsep}{\baselineskip} \setlength{\footskip}{2\baselineskip} \setlength{\headheight}{0cm} % or 1.5cm for the ETH logo \setlength{\footheight}{0cm} % for a page number \setlength{\textwidth}{\pagewidth} \addtolength{\textwidth}{-2in} \setlength{\textheight}{\pageheight} \addtolength{\textheight}{-1in} \addtolength{\textheight}{-\headheight} \addtolength{\textheight}{-\footskip} %footheight is built into this one \addtolength{\textheight}{-\headsep} \newlength{\engineleftmargin} \setlength{\engineleftmargin}{0.15in} \newlength{\enginerightmargin} \setlength{\enginerightmargin}{0.15in} \newlength{\enginetopmargin} \setlength{\enginetopmargin}{0.15in} \setlength{\oddsidemargin}{\enginerightmargin} \setlength{\evensidemargin}{\engineleftmargin} \setlength{\topmargin}{\enginetopmargin} \def\es{} % eat space for nice formatting \def\deffield#1{\expandafter\def\csname leftinstitutionnamestring\endcsname{} \expandafter\def\csname #1\endcsname##1{ \expandafter\def\csname #1string\endcsname{##1}}} \deffield{leftinstitutionname} \def\makeheader{\es \es \addtolength{\textheight}{\headheight} %change the page parms around \addtolength{\textheight}{2cm} %change the page parms around \setlength{\headheight}{0cm} \addtolength{\textheight}{-\headheight} %\addtolength{\topmargin}{-0.66in} \setlength{\topmargin}{0in} %\addtolength{\topmargin}{0.5cm} \newsavebox{\ETHlogo} \sbox{\ETHlogo}{\es % Put The ETH logo in a box \setlength{\unitlength}{0.01mm}\es \begin{picture}(3300,1100) % E letter \thicklines \multiput(0,0)(20,0){22}{\line(1,3){333}} \multiput(0,0)(7,20){15}{\line(1,0){950}} \multiput(550,390)(7,20){12}{\line(1,0){420}} % T letter \multiput(1150,0)(20,0){22}{\line(1,3){333}} \linethickness{3mm} \put(330,880){\line(1,0){2000}} % gh - make T bar flush with E and H % H letter \thicklines \multiput(1900,0)(20,0){22}{\line(1,3){333}} \multiput(2470,0)(20,0){22}{\line(1,3){333}} \linethickness{3mm} \put(2200,500){\line(1,0){500}} \end{picture}\es } \es \unitlength=\textwidth\es \begin{picture}(0,0) \unitlength=1mm \put(0,12.5){\unitlength=\textwidth\line(1,0){1}} \unitlength=1mm \put(0,-2.5){\unitlength=\textwidth\line(1,0){1}} \end{picture}\es \unitlength=1mm \noindent \hfuzz=250pt \begin{picture}(33,10) \put(0,0){\usebox{\ETHlogo}} \end{picture} \begin{picture}(64,10) \put(0,8){\normalsize\it\sf Eidgen\"ossische} \put(0,4){\normalsize\it\sf Technische Hochschule} \put(0,0){\normalsize\it\sf Z\"urich} \end{picture} \hfill \begin{picture}(61,10) \put(0,8){\normalsize\it\sf Ecole polytechnique f\'ed\'erale de Zurich} \put(0,4){\normalsize\it\sf Politecnico federale di Zurigo} \put(0,0){\normalsize\it\sf Federal Institute of Technology at Zurich} \end{picture}\es \hbadness=10000\noindent\es \begin{tabular*}{\textwidth}{@{}l@{\extracolsep{\fill}}r@{}} {\elvrm\leftinstitutionnamestring}&{}\\ {\elvrm } & {}\\ {\elvrm } \end{tabular*}} % begin of old haupt \textwidth 16cm \parindent 0cm \topmargin 0cm \begin{document} \makeheader %\vspace{\baselineskip} \begin{center} Call for Papers\\ \vspace{\baselineskip} {\large \bf Conference on \\ Programming Languages and System Architectures\\ with a special session in honor of Niklaus Wirth on his 60th birthday\\} \vspace{\baselineskip} 2th - 4th March, 1994\\ ETH Z\"{u}rich, Switzerland\\ \end{center} \noindent The conference will provide an international forum for the presentation and discussion of recent research in the areas of programming languages and system architectures. Authors are invited to submit papers describing original research related to these areas. Particularly encouraged are contributions discussing their mutual influence. Also, unrefereed contributions of 5-20 min. duration, and of a technical and/or personal nature are solicited for an afternoon session honoring N. Wirth. \\[\baselineskip] Subjects of special interest include, but are not restricted to: \\[\baselineskip] Programming language design and history, Programming environments, Programming methods, Operating systems, Compiler construction, Innovative system architectures \\[\baselineskip] Send two copies of technical contributions to the program chair. Submissions should not exceed 15 pages and must not have been published or submitted for publication elsewhere. Where possible, include the e-mail address and fax number of the contact author. Potential contributors to the special session in honor of Niklaus Wirth should contact the program chair for more information. \\[\baselineskip] Proceedings will be published by Springer Verlag in the Lecture Notes in Computer Science series and will be distributed at the conference.\\ [\baselineskip] \vspace{\baselineskip} \noindent {\bf Program Committee} \small \noindent \begin{tabular}{ll} J. Gutknecht (Chair)& J. Ludewig, Techn. Univ., Stuttgart, D\\ ETH Zentrum & J. Misra, Univ. of Texas, Austin, TX\\ CH-8092 Z\"{u}rich& H. M\"{o}ssenb\"{o}ck, ETH Z\"{u}rich, CH\\ e-mail: gutknecht@inf.ethz.ch & R. Needham, Cambridge University, GB \\ e-fax: (+41 1) 251 96 78 & S. Owicki, DEC SRC, Palo Alto, CA\\ & G. Pomberger, Universitat Linz, A\\ R. P. Cook, Microsoft, Redmond, WA& P. Rechenberg, Universit\"{a}t Linz, A\\ G. Coray, EPF Lausanne, CH& M. Reiser, IBM Research, Z\"{u}rich, CH\\ O. J. Dahl, University of Oslo, N& B. Sanders, ETH Z\"{u}rich, CH\\ E. W. Dijkstra, Univ. of Texas, Austin, TX&P. Schulthess, Universit\"{a}t Ulm, D\\ G. Goos, Techn. Univ, Karlsruhe, D& A. Shaw, Univ. of Washington, Seattle, WA\ \ S. Graham, Univ. of California, Berkeley, CA &P. D. Terry, Rhodes University, Grahamstown, SA\\ D. Gries, Cornell University, Ithaca, NY & L. Tesler, Apple Corp, Cupertino, CA \\ D. Hanson, Princeton Univ, Princeton, NJ & J. Welsh, Univ. of Queensland, Brisb ane, AU\\ B. Kernighan, AT\&T Bell Labs, Murray Hill, NJ & N. Wirth, ETH Z\"{u}rich, CH\\ B. W. Lampson, DEC CRL, Cambridge, MA& \\ \end{tabular} \normalsize \vspace{\baselineskip} \noindent {\bf Key Dates} \\[\baselineskip] Deadline for receipt of submissions: 1st August, 1993\\ Acceptance notification: 1st November, 1993\\ Deadline for camera-ready final papers: 15th December, 1993 \end{document} ======================================================================= 21 === Date: 16 Nov 92 16:06:13 GMT From: dagenais@vlsi.polymtl.ca (Michel Dagenais) Subject: Re: Rotated text in Trestle (SUMMARY) Thanks for all the replies! Two replies suggested to go with a Postscript VBT and two with Bezier curves. (Implied is that the X11R5 font server would not supply rotated fonts :-)). While having a Postscript VBT to display encapsulated postscript diagrams is a very good idea, using postscript to communicate commands for a tree of VBTs that need to be redisplayed independently could be messy, not terribly efficient and does not fit well the Trestle structure. Mark Manasse provided a surprisingly simple recipe to get bitmaps from Bezier curves. I knew such things could be done on X11 but ignored that all the right hooks were present in Trestle (allocate an off-screen pixmap, draw the Bezier curves on it, capture the result in a memory pixmap and free the off-screen pixmap). Therefore, we will most likely take this path and use the GNU fontutils Bezier curves and font metrics. -- --------------------------------------------------------------------- Prof. Michel Dagenais dagenais@vlsi.polymtl.ca Dept of Electrical and Computer Eng. Ecole Polytechnique de Montreal tel: (514) 340-4029 --------------------------------------------------------------------- ======================================================================= 22 === Date: Mon, 16 Nov 92 16:37:39 EST From: Benoit Desrosiers Subject: installation problems I have installed m3 on a SPARCstation IPX with SunOS 4.1.2 and OpenWindow 3.0 and I have a problem running "solitaire" When I start it, the screen goes blank and after 5-10 seconds I got the message XIO: fatal IO error 32 (Broken pipe) on X server ":0.0" after 11 requests (9 known processed) with 0 events remaining. The connection was probably broken by a server shutdown or KillClient. /usr/openwin/bin/xinit: connection to X server lost. Any idea? P.S. tetris works very fine. thank you Benoit Desrosiers, UQAH (universite du Quebec a Hull) ======================================================================= 23 === Date: 17 Nov 92 11:01:22 GMT From: mlo@dcs.qmw.ac.uk (Mike Osborne) Subject: Cross-compiler problem Hi, I'm currently trying to get a port of m3-2.07 up and running under AUX3.0, by cross compiling from a Sun Sparc. I am running into a problem with the cross compiler, I wonder if anyone else has seen this and/or could suggest what is happening. (I have previously built a working cross compiler). The bootstrap_both part of the build fails, when the cross compiler gets to a file containing modula-3 code rather than C. It does this both when trying to cross compile the driver, and the compiler. A log of the first error message looks like this:- mkdir compiler/boot-AUX3 Tue Nov 17 10:28:48 GMT 1992 ================== bootstrap compiler for AUX3 /import/exampleexec/exec/bin/m3 -w1 -make -why -boot -times -g -times -Y0@../.. new source -> recreating ../../libm3/Csupport/src/generic/M3Runtime.h new source -> recreating ../../libm3/Csupport/src/generic/dtoa.h new source -> recreating ../../libm3/Csupport/src/AUX3/M3Machine.h new source -> recreating ../../libm3/Csupport/src/generic/M3Runtime.c new source -> recreating ../../libm3/Csupport/src/generic/M3Runtime2.c new source -> recreating ../../libm3/Csupport/src/AUX3/dtoa.c new source -> recreating ../../libm3/Csupport/src/generic/M3_BUILTIN.ic new source -> recreating ../src/builtinOps/Abs.i3 *** *** runtime error: *** Segmentation violation - possible attempt to dereference NIL *** pc = 0xf7fff858 *** A look at the core file using xdbx gives a stack trace like this (xdbx) where kill() at 0xf775c120 RTMisc__FatalErrorPC(pc = -134219688, msgA = 0x169ac8 "", msgB = (nil), msgC = (nil)), line 137 in "RTMisc.m3" RTSignal__PossibleNilDereference(sig = 11, code = 3, scp = 0xf7ffeff8), line 39 in "RTSignal.m3" _sigtramp() at 0xf7732c4c RTHeap__AllocateUntracedRef(tc = 1364832), line 893 in "RTHeap.m3" String__Add(x = 0x14d360 ""), line 61 in "String.m3" `Decl_m`_init_(), line 81 in "Decl.m3" (xdbx) It looks as though something related to the following declaration is causing trouble (line 81 in Decl.m3) VAR cString := String.Add ("C"); PROCEDURE ParseExternalPragma (READONLY fail: Token.Set; VAR alias: String.T)= I must be doing something wrong here, because I have previously built a working cross compiler, from the same sources. Is there any procedure you need to follo w with respect to cleaning up before re-making the cross compiler? Mike -- Michael Osborne Internet: mlo@dcs.qmw.ac.uk Computer Science Department JANET: mlo@uk.ac.qmw.dcs Queen Mary & Westfield College Mile End Road Telephone: +44 71-975 5244/5/9 LONDON, E1 4NS, UK Fax: +44 81-980 6533 ======================================================================= 24 === Date: Fri, 20 Nov 1992 12:07:34 GMT From: jch@rdg.dec.com (John Haxby) Subject: Failing system calls and threads [First, an apology, this is rather longer that I thought it would be.] Hello, While I was writing `cat' (as one does) I tripped up over an interesting problem around system calls. The problem revolves around accurately dealing with system call failures. In C this is easy, one writes: if (write (fd, buf, sz) < 0) if (errno == EINTR) /* try again */ else perror ("write") (more-or-less). The equivalent code in SRC Modula-3 (2.07) is somewhat similar, at least in spirit, and this is where the problems arise. Obviously, if some other thread gets to run between the call to write() and the examination of errno then the value of errno may no longer be valid or useful when you come to look at it. The obvious way around this is to protect the code with some suitable mutex, eg LOCK Cerrno.mu DO write (...) IF Cerrno.errno ... END but this has at least three significant problems: the overhead in acquiring a lock around every system call is non-negligable (I assume); not all uses of errno are guaranteed to be protected (especially in uses within C libraries); only one outstanding system call is can be permitted (in an environement that uses kernel-supported threads). I was thinking about all this while I was making the children's breakfast this morning: these problems do make using the present Modula-3 implementation somewhat tricky for a good many of the (commercial) applications I had in mind. However, whilst putting milk on the Rice Krispies, it occurred to me that there is a solution, at least for ULTRIX and probably BSD UNIX. Before I suggest a solution, though, am I barking up the right tree? Does what I say make sense or have I missed something in the implementation? The solution comes from knowing that errno is introduced by the C library and not by the kernel: the kernel returns a result and an indication of whether that result is an error code or a returned value. On a VAX, the indication is the carry flag, on a (DEC) mips machine, the indication is left in a register when the syscall instruction `returns'. The implementation of the solution involves re-writing all of the system calls so that the are of the form (expressed in C) int err = sysfunc (&res, arg1, arg2, ...); The &res is only written to the if the return result is non-zero; the return result is otherwise what would be written to errno. The Modula-3 implementation of, say, Unix.write would then look something like this (syntax notwithstanding :-): PROCEDURE write (fd: INT; buf: REFANY; sz: INTEGER): INTEGER RAISES{syserr} = VAR err: INTEGER; res: INTEGER; BEGIN err := system.syscall (system.write, res, fd, buf, sz); IF err # 0 THEN RAISE syserr(err) ELSE RETURN res END END write. Does this make sense? Will it avoid the problems I mentioned earlier? And, a question for the other implementations: can this form of solution be used? (specifically, are there any implementations out there where errno is explicitly known by the kernel?) -- John Haxby, Definitively Wrong. Digital Reading, England <...!uknet!wessex!jch> ---------------------------------------------------------------- The opinions expressed herein are my own, not my employers. ======================================================================= 25 === Date: Fri, 20 Nov 92 07:46:14 -0600 From: Michael Kuschke Subject: Re: m3bundle in the SRC Modula-3 distribution --------- > I think you have things left from the 2.07 'm3make' release. In particular, > your installed version of 'toplevel.tmpl' (in dir>/lib/m3/toplevel.tmpl) may be the one distributed with 2.07. This is the > file that m3make uses to generate makerules. Since bundling changed between > the 2 releases the bundling rule in this file changed as well. Try > rebuilding and reinstalling the 2.09 m3make release. Hmm, I've reinstalled m3make.2-09 another time, but it still behaves the same. As far as I can locate the problem there is no place where a program called "m3bundle" is generated. > Hop this helps ! Unforunately not. I'll give version 2.10 a try. thanks, -Mic Michael Kuschke e-mail: kuschke@urd.informatik. Computer Science Department - LS4 .uni-dortmund.de University of Dortmund D-4600 Dortmund 50,PO-Box 500500, Germany voice: +49 231 755 2676 Man muss mit allem rechnen, sogar mit dem Schoensten. ======================================================================= 26 === Date: 20 Nov 92 17:25:01 GMT From: rlp@drutx.ATT.COM (PrehnRL) Subject: Can modula 3 be compiled on sun 490? I tried compiling on my SPARC 1+ but it died during the late stages of libm3 due to lack of space on "/" (~2.3k blocks) So I tried building on our sun 490. m3make -f m3makefile.libm3 all install Refused to install the sed,awk,imake & toplevel.tmpl*, recmkdir m3mkpath files. I copied to requested places from m3make/src. Also had to copy m3make/SPARc/config to $PREFIX/lib/m3) The following erros then occurred: cd libm3; /wa32/mod3/bin/m3make all ============================= Building in SPARC sed -e 's:PUB:/wa32/mod3/include/m3:g' -e 's:LIB:/wa32/mod3/lib/m3:g' \ < ../config/src/M3Config.m3 > M3Config.m3 /wa32/mod3/bin/m3 -w1 -make -why -nostd -times -g -a libm3.a -F.PGM_SOURCES new source -> compile ../Csupport/src/generic/M3Runtime.c new source -> compile ../Csupport/src/generic/M3Runtime2.c new source -> compile ../Csupport/src/SPARC/dtoa.c new source -> compile ../Csupport/src/generic/M3_BUILTIN.ic new source -> compile ../C/src/generic/Cerrno.i3 *** *** runtime error: *** ASSERT failed *** file "OS.m3", line 109 *** *** *** runtime error: *** Segmentation violation - possible attempt to dereference NIL *** pc = 0xf7ffe860 *** *** Quit - core dumped make: Fatal error: Command failed for target `libm3.a' Current working directory /wa32/rlp/M3/libm3/SPARC cd libm3; /wa32/mod3/bin/m3make install ============================= Building in SPARC (cd ../Csupport/src/generic; install -c -m 644 M3Runtime.h /wa32/mod3/lib/m3) [dwprp rlp] I didn't get this on my workstation, it went a lot further before it complained about running out of space in "/". Both workstation & 490 are running 4.1.1. Building on another workstation (4.1.2) produced the following: ... fieldlist/src/Fieldlist.m3 line 80 encountered reserved word, underscore appended. ... ../fieldlist/src/FieldList.m3", line 117: warning: C reserved word, appending u nderscore (char) 1 warning encountered ... new source -> compile ../sx/src/SxSyntax.m3 "../sx/src/SxSyntax.m3", line 970: warning: potentially unhandled exception (Sx .PrintError) "../sx/src/SxSyntax.m3", line 970: warning: potentially unhandled exception (Wr .Failure) "../sx/src/SxSyntax.m3", line 970: warning: potentially unhandled exception (Th read.Alerted) "../sx/src/SxSyntax.mning: potentially unhandled exception (Thread.Alerted) "../sx/src/SxSyntax.m3", line 975: warning: psrc/SxSyntax.m3", line 975: warnin g: potentially unhandled exception (Thread.Alerted) 9 warnings encountered missing library -> archive libm3.a ... ar: filename ExtendedFloat.io truncated to ExtendedFloat.i ar: filename IntegerToIntegerTable.io truncated to IntegerToIntege ar: filename IntegerToRefanyTable.io truncated to IntegerToRefany ar: filename IntegerToTextTable.io truncated to IntegerToTextTa ar: filename RefanyToIntegerTable.io truncated to RefanyToInteger ar: filename RefanyToRefanyTable.io truncated to RefanyToRefanyT ar: filename RefanyToTextTable.io truncated to RefanyToTextTab ar: filename TextToIntegerTable.io truncated to TextToIntegerTa ar: filename TextToRefanyTable.io truncated to TextToRefanyTab ar: filename TextToTextTable.io truncated to TextToTextTable ar: filename ColorNameCache.io truncated to ColorNameCache. ar: filename IntensityScale.io truncated to IntensityScale. ar: filename RGBSortPrivate.io truncated to RGBSortPrivate. ar: filename ExtendedFloat.mo truncated to ExtendedFloat.m lost some data here when making X11R4: ============================= Building in SPARC /local/rlp/mod3//bin/m3 -w1 -make -why -g -a libm3X11R4.a -F.PGM_SOURCES new source -> compile ../src/X/X.i3 "../src/X/X.i3", line 3145: warning: C reserved word, appending underscore (def ault) "../src/X/X.i3", line 3161: warning: C reserved word, appending underscore (def ault) the resulting lib files are as follows: -rw-r--r-- 1 rlp idsx 1730 Nov 18 18:13 M3Machine.h -rw-r--r-- 1 rlp idsx 12184 Nov 18 18:13 M3Runtime.h -rw-r--r-- 1 rlp idsx 7185 Nov 18 17:12 config -rwxr-xr-x 1 rlp idsx 32768 Nov 18 17:12 imake* -rw-r--r-- 1 rlp idsx 5520556 Nov 18 18:15 libm3.a -rw-r--r-- 1 rlp idsx 457390 Nov 18 18:14 libm3.ax -rw-r--r-- 1 rlp idsx 411190 Nov 18 18:20 libm3X11R4.a -rw-r--r-- 1 rlp idsx 181677 Nov 18 18:20 libm3X11R4.ax -rwxr-xr-x 1 rlp idsx 5324800 Nov 18 17:47 m3compiler* -rwxr-xr-x 1 rlp idsx 1302 Nov 18 17:12 m3makeaux* Questions are: 1) Is there hope for 490 compilation? 2) Do the messages from the SPARC compilation mean that it will not work properly? ============================================================================ Robert Prehn AT&T Bell Labs Room 1F50 11900 North Pecos Denver, Co 80234 drutx!rlp (303) 538-4554 ======================================================================= 27 === Date: 20 Nov 92 17:25:01 GMT From: rlp@drutx.ATT.COM (PrehnRL) Subject: Can modula 3 be compiled on sun 490? I tried compiling on my SPARC 1+ but it died during the late stages of libm3 due to lack of space on "/" (~2.3k blocks) So I tried building on our sun 490. m3make -f m3makefile.libm3 all install Refused to install the sed,awk,imake & toplevel.tmpl*, recmkdir m3mkpath files. I copied to requested places from m3make/src. Also had to copy m3make/SPARc/config to $PREFIX/lib/m3) The following erros then occurred: cd libm3; /wa32/mod3/bin/m3make all ============================= Building in SPARC sed -e 's:PUB:/wa32/mod3/include/m3:g' -e 's:LIB:/wa32/mod3/lib/m3:g' \ < ../config/src/M3Config.m3 > M3Config.m3 /wa32/mod3/bin/m3 -w1 -make -why -nostd -times -g -a libm3.a -F.PGM_SOURCES new source -> compile ../Csupport/src/generic/M3Runtime.c new source -> compile ../Csupport/src/generic/M3Runtime2.c new source -> compile ../Csupport/src/SPARC/dtoa.c new source -> compile ../Csupport/src/generic/M3_BUILTIN.ic new source -> compile ../C/src/generic/Cerrno.i3 *** *** runtime error: *** ASSERT failed *** file "OS.m3", line 109 *** *** *** runtime error: *** Segmentation violation - possible attempt to dereference NIL *** pc = 0xf7ffe860 *** *** Quit - core dumped make: Fatal error: Command failed for target `libm3.a' Current working directory /wa32/rlp/M3/libm3/SPARC cd libm3; /wa32/mod3/bin/m3make install ============================= Building in SPARC (cd ../Csupport/src/generic; install -c -m 644 M3Runtime.h /wa32/mod3/lib/m3) [dwprp rlp] I didn't get this on my workstation, it went a lot further before it complained about running out of space in "/". Both workstation & 490 are running 4.1.1. Building on another workstation (4.1.2) produced the following: ... fieldlist/src/Fieldlist.m3 line 80 encountered reserved word, underscore appended. ... ../fieldlist/src/FieldList.m3", line 117: warning: C reserved word, appending u nderscore (char) 1 warning encountered ... new source -> compile ../sx/src/SxSyntax.m3 "../sx/src/SxSyntax.m3", line 970: warning: potentially unhandled exception (Sx .PrintError) "../sx/src/SxSyntax.m3", line 970: warning: potentially unhandled exception (Wr .Failure) "../sx/src/SxSyntax.m3", line 970: warning: potentially unhandled exception (Th read.Alerted) "../sx/src/SxSyntax.mning: potentially unhandled exception (Thread.Alerted) "../sx/src/SxSyntax.m3", line 975: warning: psrc/SxSyntax.m3", line 975: warnin g: potentially unhandled exception (Thread.Alerted) 9 warnings encountered missing library -> archive libm3.a ... ar: filename ExtendedFloat.io truncated to ExtendedFloat.i ar: filename IntegerToIntegerTable.io truncated to IntegerToIntege ar: filename IntegerToRefanyTable.io truncated to IntegerToRefany ar: filename IntegerToTextTable.io truncated to IntegerToTextTa ar: filename RefanyToIntegerTable.io truncated to RefanyToInteger ar: filename RefanyToRefanyTable.io truncated to RefanyToRefanyT ar: filename RefanyToTextTable.io truncated to RefanyToTextTab ar: filename TextToIntegerTable.io truncated to TextToIntegerTa ar: filename TextToRefanyTable.io truncated to TextToRefanyTab ar: filename TextToTextTable.io truncated to TextToTextTable ar: filename ColorNameCache.io truncated to ColorNameCache. ar: filename IntensityScale.io truncated to IntensityScale. ar: filename RGBSortPrivate.io truncated to RGBSortPrivate. ar: filename ExtendedFloat.mo truncated to ExtendedFloat.m lost some data here when making X11R4: ============================= Building in SPARC /local/rlp/mod3//bin/m3 -w1 -make -why -g -a libm3X11R4.a -F.PGM_SOURCES new source -> compile ../src/X/X.i3 "../src/X/X.i3", line 3145: warning: C reserved word, appending underscore (def ault) "../src/X/X.i3", line 3161: warning: C reserved word, appending underscore (def ault) the resulting lib files are as follows: -rw-r--r-- 1 rlp idsx 1730 Nov 18 18:13 M3Machine.h -rw-r--r-- 1 rlp idsx 12184 Nov 18 18:13 M3Runtime.h -rw-r--r-- 1 rlp idsx 7185 Nov 18 17:12 config -rwxr-xr-x 1 rlp idsx 32768 Nov 18 17:12 imake* -rw-r--r-- 1 rlp idsx 5520556 Nov 18 18:15 libm3.a -rw-r--r-- 1 rlp idsx 457390 Nov 18 18:14 libm3.ax -rw-r--r-- 1 rlp idsx 411190 Nov 18 18:20 libm3X11R4.a -rw-r--r-- 1 rlp idsx 181677 Nov 18 18:20 libm3X11R4.ax -rwxr-xr-x 1 rlp idsx 5324800 Nov 18 17:47 m3compiler* -rwxr-xr-x 1 rlp idsx 1302 Nov 18 17:12 m3makeaux* Questions are: 1) Is there hope for 490 compilation? 2) Do the messages from the SPARC compilation mean that it will not work properly? ============================================================================ Robert Prehn AT&T Bell Labs Room 1F50 11900 North Pecos Denver, Co 80234 drutx!rlp (303) 538-4554 ======================================================================= 28 === Date: 20 Nov 92 20:55:00 GMT From: mdixon@parc.xerox.com (Mike Dixon) Subject: Re: Failing system calls and threads actually, this turns out to be a non-problem; if you look in Thread.m3 you'll discover that it maintains a separate value of errno for each thread, and swaps it in and out of the global variable on each thread switch. thus errno is essentially a thread-local variable, and you can go ahead and use code like if (write (fd, buf, sz) < 0) if (errno == EINTR) /* try again */ else perror ("write") without fear of interference from other threads. .mike. ======================================================================= 29 === Date: Sun, 22 Nov 92 11:13:21 MET From: bnaudts%banruc60.BITNET@pucc.Princeton.EDU Subject: ARM-R260 Hi, I have been trying to get the Modula-3 version 2.07 working on the ARM based R260, but without succes. I have tried to fix the many compilation errors (most of them were problems with setjmp), but after that, the driver simply crashed (Quit. core dumped). Is there anyone who can help me? Bart Naudts bnaudts@banruc60.bitnet or naudts@phs.uia.ac.be ======================================================================= 30 === Date: Sat, 21 Nov 92 21:34:42 PST From: frode@toaster.SFSU.EDU (Frode Odegard) Subject: Failing system calls and threads John Haxby writes about the errno problem. This is indeed a known problem. The solution you suggest is something we tried for a UNIX Modula-2 library we put out last year - it seems to work. The library has a "layer" with Modula-2 definition modules for system calls, where the wrapper scheme you mention is used. The global 'errno' is fetched and returned as a function result. In the upper layer, threads can safely make system calls without worrying about errno. To my knowledge, Sun has a rather more exotic solution to the problem, which I believe involves some compiler/linker enhancements (?). A few "standard" C libraries are stateful and utilize global variables - they ordinarily are not reentrant. So somehow I think they manage to store local copies of those global variables in a portion of the thread's workspace. It does make a lot of sense to implement system calls the way you suggest, since Modula-3 has exceptions. What are SRC's plans here, I wonder. - Frode -------------------------------------------------------------------- Odegard Labs, Inc., 100 Bush St., Suite 2101, San Francisco, CA 94104-3909, USA; +1-415-434-4242, +1-415-434-4243(fax), frode@odegard.com(internet) ======================================================================= 31 === Date: Mon, 23 Nov 92 17:36:12 GMT From: mjordan@src.dec.com (Mick Jordan) Subject: Re: Failing system calls and threads In article <1992Nov20.120734.23671@rdg.dec.com>, jch@rdg.dec.com (John Haxby) w rites: |> Obviously, if some other thread gets to run between the call to write() and |> the examination of errno then the value of errno may no longer be valid or |> useful when you come to look at it. |> |> The obvious way around this is to protect the code with some suitable |> mutex, eg |> |> LOCK Cerrno.mu DO |> write (...) |> IF Cerrno.errno ... |> END |> |> but this has at least three significant problems: the overhead in acquiring |> a lock around every system call is non-negligable (I assume); not all uses |> of errno are guaranteed to be protected (especially in uses within C |> libraries); only one outstanding system call is can be permitted (in an |> environement that uses kernel-supported threads). In general, when you are dealing with a library that exports shared global variables, written in any language (including Modula-3), multi-threaded clients must use locks to synchronise the operations and access to the variables. In the specific case you mention of errno, one of the standard tricks in the C world is to treat errno as a macro and define it as a function that accesses a thread specific value. This is what thread-friendly C libraries do. But most systems dont have thread-friendly libraries and unless all C code has been recompiled against the functional errno, the solution doesnt work. However, the overhead in acquiring the lock is (should be) negligible in comparision with entering the operating system. So, for example, we chose your first solution for the Olivetti Modula-3 library. |> The solution comes from knowing that errno is introduced by the C library |> and not by the kernel: the kernel returns a result and an indication of |> whether that result is an error code or a returned value. On a VAX, the |> indication is the carry flag, on a (DEC) mips machine, the indication |> is left in a register when the syscall instruction `returns'. The |> implementation of the solution involves re-writing all of the system calls |> so that the are of the form (expressed in C) |> |> int err = sysfunc (&res, arg1, arg2, ...); |> |> The &res is only written to the if the return result is non-zero; the |> return result is otherwise what would be written to errno. The Modula-3 |> implementation of, say, Unix.write would then look something like this |> (syntax notwithstanding :-): |> |> Does this make sense? Will it avoid the problems I mentioned earlier? |> And, a question for the other implementations: can this form of solution be |> used? (specifically, are there any implementations out there where errno is |> explicitly known by the kernel?) In the days before Modula code and C code intermixed so easily, it was possible to adopt this solution, since the Modula libraries typically preempted all the Unix interface and dealt directly with the Unix kernel entry rather than the C library. In general, of course, it is neither possible nor desirable to modify the code of the library to make it more thread friendly. In particular one cant usually find a layer just below the surface on which you can layer a more suitable veneer. Therefore if large scale exploitation of C and C++ code from Modula-3 is to be possible, we have to lobby for thread-friendly designs at the C and C++ level. Mick Jordan ======================================================================= 32 === Date: Mon, 23 Nov 92 17:36:12 GMT From: mjordan@src.dec.com (Mick Jordan) Subject: Re: Failing system calls and threads In article <1992Nov20.120734.23671@rdg.dec.com>, jch@rdg.dec.com (John Haxby) w rites: |> Obviously, if some other thread gets to run between the call to write() and |> the examination of errno then the value of errno may no longer be valid or |> useful when you come to look at it. |> |> The obvious way around this is to protect the code with some suitable |> mutex, eg |> |> LOCK Cerrno.mu DO |> write (...) |> IF Cerrno.errno ... |> END |> |> but this has at least three significant problems: the overhead in acquiring |> a lock around every system call is non-negligable (I assume); not all uses |> of errno are guaranteed to be protected (especially in uses within C |> libraries); only one outstanding system call is can be permitted (in an |> environement that uses kernel-supported threads). In general, when you are dealing with a library that exports shared global variables, written in any language (including Modula-3), multi-threaded clients must use locks to synchronise the operations and access to the variables. In the specific case you mention of errno, one of the standard tricks in the C world is to treat errno as a macro and define it as a function that accesses a thread specific value. This is what thread-friendly C libraries do. But most systems dont have thread-friendly libraries and unless all C code has been recompiled against the functional errno, the solution doesnt work. However, the overhead in acquiring the lock is (should be) negligible in comparision with entering the operating system. So, for example, we chose your first solution for the Olivetti Modula-3 library. |> The solution comes from knowing that errno is introduced by the C library |> and not by the kernel: the kernel returns a result and an indication of |> whether that result is an error code or a returned value. On a VAX, the |> indication is the carry flag, on a (DEC) mips machine, the indication |> is left in a register when the syscall instruction `returns'. The |> implementation of the solution involves re-writing all of the system calls |> so that the are of the form (expressed in C) |> |> int err = sysfunc (&res, arg1, arg2, ...); |> |> The &res is only written to the if the return result is non-zero; the |> return result is otherwise what would be written to errno. The Modula-3 |> implementation of, say, Unix.write would then look something like this |> (syntax notwithstanding :-): |> |> Does this make sense? Will it avoid the problems I mentioned earlier? |> And, a question for the other implementations: can this form of solution be |> used? (specifically, are there any implementations out there where errno is |> explicitly known by the kernel?) In the days before Modula code and C code intermixed so easily, it was possible to adopt this solution, since the Modula libraries typically preempted all the Unix interface and dealt directly with the Unix kernel entry rather than the C library. In general, of course, it is neither possible nor desirable to modify the code of the library to make it more thread friendly. In particular one cant usually find a layer just below the surface on which you can layer a more suitable veneer. Therefore if large scale exploitation of C and C++ code from Modula-3 is to be possible, we have to lobby for thread-friendly designs at the C and C++ level. Mick Jordan ======================================================================= 33 === Date: Mon, 23 Nov 92 18:10:35 GMT From: Eric Muller Subject: Re: Failing system calls and threads In article <1992Nov20.120734.23671@rdg.dec.com>, jch@rdg.dec.com (John Haxby) w rites: |> Obviously, if some other thread gets to run between the call to write() and |> the examination of errno then the value of errno may no longer be valid or |> useful when you come to look at it. In SRC Modula-3, it will be. The thread machinery takes care of saving/restoring errno when a thread switch occurs. It's that simple. -- Eric. ======================================================================= 34 === Date: Mon, 23 Nov 92 18:10:35 GMT From: Eric Muller Subject: Re: Failing system calls and threads In article <1992Nov20.120734.23671@rdg.dec.com>, jch@rdg.dec.com (John Haxby) w rites: |> Obviously, if some other thread gets to run between the call to write() and |> the examination of errno then the value of errno may no longer be valid or |> useful when you come to look at it. In SRC Modula-3, it will be. The thread machinery takes care of saving/restoring errno when a thread switch occurs. It's that simple. -- Eric. ======================================================================= 35 === Date: 23 Nov 92 20:54:06 GMT From: chevalet@imag.fr (Chevallet Jean-Pierre) Subject: Can't use trestle I've install the 2.07 version of SRC Modula3 : it`s seems to work fine except for the trestle library. The use of the given make file produce : boole [76] ~/Modula-3/trestle/apps> m3make -f m3makefile.old /users1/enseigt/chevalet/Modula-3/bin/m3 -w1 -make -why -g -D/users1/enseigt/chevalet/Modula-3/include/m3 -commands -o Hello Hello.m3 ../mips/libm3ui.a -lm3X11R4 -lX11 inhale ../mips/libm3ui.a inhale /users1/enseigt/chevalet/Modula-3/lib/m3/libm3X11R4.a inhale -lX11 inhale /users1/enseigt/chevalet/Modula-3/lib/m3/libm3.a inhale -lm missing interface "Trestle" imported by: Hello.m3 missing interface "TextVBT" imported by: Hello.m3 Fatal Error: incomplete program Fatal Error: incomplete program *** Error code 255 make: Fatal error: Command failed for target `Hello' I've wrote my own m3makefile : M3DEFPATH = -D/users1/enseigt/chevalet/Modula-3/include/m3:/users1/enseigt/chevalet/Modula- 3/trestle/SPARC M3LIBPATH = -L/users1/enseigt/chevalet/Modula-3/lib/m3 import_lib (m3X11R4) import_lib (m3ui) implementation(Hello) program (Hello) When I do use it, it compile the Hello.m3 and says : /users1/enseigt/chevalet/Modula-3/bin/m3 -w1 -make -why -g -D/users1/enseigt/chevalet/Modula-3/include/m3:/users1/enseigt/chevalet/Modula- 3/trestle/SPARC -L/users1/enseigt/chevalet/Modula-3/lib/m3 -o Hello ./Hello.m3 -lm3X11R4 -lm3ui program missing -> link Hello ld: Undefined symbol _XCreateColormap _XCreatePixmapCursor _XRootWindow _XFree _XConvertSelection _XStoreColors _XFreeFontInfo _XDrawImageString _XFillRectangle _XSetWMProtocols _XKeysymToKeycode _XPeekEvent _XNextEvent _XGetVisualInfo _XQueryBestTile _XBlackPixel _XGetWindowProperty _XSetIOErrorHandler _XSendEvent _XCreatePixmap _XSetSelectionOwner _XQueryColors _XConfigureWindow _XSetClipRectangles _XCopyPlane _XIconifyWindow _XQueryBestStipple _XDisplayHeight _XDefaultScreen _XLoadQueryFont _XFreeFontNames _XSetInputFocus _XChangeGC _XCreateFontCursor _XGetImage _XInternAtom _XUngrabKey _XMapWindow _XScreenCount _XDisplayWidthMM _XGetSelectionOwner _XResizeWindow _XChangeProperty (etc ...) What does it mean ? What's the problem ? Jean-Pierre. -- CHEVALLET Jean-Pierre chevalet@imag.imag.fr LGI IMAG Bureau B305 chevalet@imag.UUCP "Faire, et en faisant, se faire" ======================================================================= 36 === Date: Mon, 23 Nov 92 22:04:50 GMT From: kalsow@src.dec.com (Bill Kalsow) Subject: Re: Can modula 3 be compiled on sun 490? In article <22563@drutx.ATT.COM>, rlp@drutx.ATT.COM (PrehnRL) writes: > Questions are: > 1) Is there hope for 490 compilation? Yes. It looks like your configuration file is bad. Your problems started when the install failed and you had to manually copy files around. I'd guess that /wa32/mod3/lib/m3/m3compiler wasn't installed. Why did the install fail? What does "m3 -\?" say is the value of pass 0? > 2) Do the messages from the SPARC compilation mean that it will not work > properly? No, they're just warnings from a picky compiler. - Bill Kalsow ======================================================================= 37 === Date: Mon, 23 Nov 92 22:04:50 GMT From: kalsow@src.dec.com (Bill Kalsow) Subject: Re: Can modula 3 be compiled on sun 490? In article <22563@drutx.ATT.COM>, rlp@drutx.ATT.COM (PrehnRL) writes: > Questions are: > 1) Is there hope for 490 compilation? Yes. It looks like your configuration file is bad. Your problems started when the install failed and you had to manually copy files around. I'd guess that /wa32/mod3/lib/m3/m3compiler wasn't installed. Why did the install fail? What does "m3 -\?" say is the value of pass 0? > 2) Do the messages from the SPARC compilation mean that it will not work > properly? No, they're just warnings from a picky compiler. - Bill Kalsow ======================================================================= 38 === Date: Mon, 23 Nov 92 22:41:20 GMT From: mann@src.dec.com (Tim Mann) Subject: Re: Failing system calls and threads In article <1992Nov23.181035.17514@src.dec.com> Eric Muller writes: > >The thread machinery takes care of >saving/restoring errno when a thread switch occurs. It's that simple. > This trick won't work on a multiprocessor. Also, you're unlikely to be able to implement it in a runtime that uses kernel-provided threads instead of having its own scheduler. --Tim ======================================================================= 39 === Date: Mon, 23 Nov 92 22:41:20 GMT From: mann@src.dec.com (Tim Mann) Subject: Re: Failing system calls and threads In article <1992Nov23.181035.17514@src.dec.com> Eric Muller writes: > >The thread machinery takes care of >saving/restoring errno when a thread switch occurs. It's that simple. > This trick won't work on a multiprocessor. Also, you're unlikely to be able to implement it in a runtime that uses kernel-provided threads instead of having its own scheduler. --Tim ======================================================================= 40 === Date: 24 Nov 92 07:18:05 GMT From: Olin.Shivers@cs.cmu.edu Subject: Garbage collection I recall reading in an SRC tech report, a long time ago, some estimate on the number of errors in systems programs that were related to storage management. But I can't recall the TR or the statistic. It seems like a useful number. Does anyone recognise the source of this data? -Olin ======================================================================= 41 === Date: Tue, 24 Nov 1992 10:28:49 GMT From: jch@rdg.dec.com (John Haxby) Subject: Re: Failing system calls and threads In article <1992Nov23.173612.16490@src.dec.com>, mjordan@src.dec.com (Mick Jord an) writes: |> In general, when you are dealing with a library that exports shared global |> variables, written in any language (including Modula-3), multi-threaded clie nts |> must use locks to synchronise the operations and access to the variables. |> In the specific case you mention of errno, one of the standard tricks in |> the C world is to treat errno as a macro and define it as a function that |> accesses a thread specific value. This is what thread-friendly C libraries |> do. But most systems dont have thread-friendly libraries and unless all |> C code has been recompiled against the functional errno, the solution |> doesnt work. The problem with protecting each system call is that it enforces a policy of exactly one system call in progress at any one time. This is a non-policy for user-level threads, but is a significant loss for threads supported by the kernel. In particular (and obviously), the only way to get a disk read and a disk write system call outstanding at the same time is to have kernel thread support since the I/O to fast devices provides no support for the SELECT system call (at least on BSD, OSF/1 and ULTRIX--I don't know for sure about the other variations). -- John Haxby, Definitively Wrong. Digital Reading, England <...!uknet!wessex!jch> ---------------------------------------------------------------- The opinions expressed herein are my own, not my employers. ======================================================================= 42 === Date: 24 Nov 92 12:18:17 GMT From: viggo@nada.kth.se (Viggo Kann) Subject: Easy input/output At our institute we are thinking of changing the language in the first programming course for the undergraduate students from Pascal to Modula-3. We are going to try Modula-3 in one course starting in Januari 1993. The main problem with M3, as I see it, is the clumsy input and output, not suited at all for students which have not programmed in any other language. I don't even know if the SRC Modula-3 interfaces Wr, Rd, Stdio, FileStream and WrClass are part of the standard Modula-3. My question is if anyone has a Modula-3 interface for easy input and output, (in particular from stdin and to stdout). Ideally the interface should be modelled after Pascals very easy input and output. Dr Viggo Kann E-mail: viggo@nada.kth.se Theoretical CS Fax: +46 8-790 09 30 NADA, Dept of Numerical Analysis and Computing Science KTH, Royal Institute of Technology S-100 44 Stockholm, SWEDEN ======================================================================= 43 === Date: 24 Nov 92 14:42:37 GMT From: mhcoffin@tolstoy.uwaterloo.ca (Michael Coffin) Subject: Re: Easy input/output In article <1992Nov24.121817.5362@kth.se> viggo@nada.kth.se (Viggo Kann) writes : > At our institute we are thinking of changing the language in the first > programming course for the undergraduate students from Pascal to > Modula-3. We are going to try Modula-3 in one course starting in > Januari 1993. > > The main problem with M3, as I see it, is the clumsy input and output, > not suited at all for students which have not programmed in any other > language. I don't even know if the SRC Modula-3 interfaces Wr, Rd, > Stdio, FileStream and WrClass are part of the standard Modula-3. > > My question is if anyone has a Modula-3 interface for easy input and > output, (in particular from stdin and to stdout). Ideally the > interface should be modelled after Pascals very easy input and output. We also are switching to Modula-3 for some of our courses, and I have had the same problem. Having to import five or six interfaces to write very simple programs seems kind of silly. Also, stdout seems to be buffered in our version of the distibution, which makes it necessary to call Wr.Flush if you want to prompt for an input and then read from stdin. So I have wrote a simple interface and implemented it. I would be happy to mail it to anyone who wants it, but be warned that it I haven't yet had time to thoroughly test my implementation. I'll append the interface so you can see if it's what you're looking for. (I also have some documentation for the interface, in texinfo format.) Michael Coffin mhcoffin@tolstoy.waterloo.edu Dept. of Computer Science office: (519) 888-4820 University of Waterloo home: (519) 884-6877 Waterloo, Ontario, Canada N2L 3G1 ======================================================================== INTERFACE IO; IMPORT Rd, Wr; TYPE InFile = Rd.T; (* input file *) OutFile = Wr.T; (* output file *) VAR stdin: InFile; (* pre-opened input file *) stdout: OutFile; (* pre-openen output file *) stderr: OutFile; (* pre-opened error output *) (*** opening and closing files ***********************************) PROCEDURE OpenRead (VAR file: InFile; READONLY file_name: TEXT): BOOLEAN; (* open `file_name' for reading; return FALSE if unable *) PROCEDURE OpenWrite (VAR file: OutFile; READONLY file_name: TEXT): BOOLEAN; (* open `file_name' for writing; return FALSE if unable *) PROCEDURE OpenAppend(VAR file: OutFile; READONLY file_name: TEXT): BOOLEAN; (* open `file_name' for appending; return FALSE if unable *) PROCEDURE CloseInFile(file: InFile); (* close an InFile *) PROCEDURE CloseOutFile(file: OutFile); (* close an OutFile *) (* if you don't do this you will loose data *) (* input functions ************************************************) (* all input functions read from `stdin' if `file' is NIL *) PROCEDURE AtEOF (file: InFile := NIL) : BOOLEAN; (* return true `file' is at EOF *) PROCEDURE GetChar (VAR c: CHAR; file: InFile := NIL): BOOLEAN; (* get a character and assign to c or return FALSE *) PROCEDURE GetLine (VAR str: TEXT; file: InFile := NIL) : BOOLEAN; (* get a line and assign it to `str' or return FALSE *) PROCEDURE SkipUpto(upto: SET OF CHAR; file: InFile := NIL): BOOLEAN; (* skip characters until the next characters is in `upto' *) (* return false if this is impossible---i.e., if EOF is encountered *) PROCEDURE GetMany (many: SET OF CHAR; file: InFile := NIL): TEXT; (* return characters as long as they are in `many' *) PROCEDURE GetText (VAR i: TEXT; file: InFile := NIL; READONLY skip := Spaces; READONLY grab := NonSpaces): BOOLEAN; PROCEDURE GetInt (VAR i: INTEGER; file: InFile := NIL; READONLY skip := Spaces; READONLY grab := NonSpaces): BOOLEAN; PROCEDURE GetReal(VAR r: REAL; file: InFile := NIL; READONLY skip := Spaces; READONLY grab := NonSpaces): BOOLEAN; (* the above procedures all operate as follows: first, read and discard characters in `skip' (e.g., whitespace) second, grab maximal sequence of charactes in `grab' (e.g., non-whitespa ce) third, try to convert what was grabbed to the indicated type if this succeeds, assign to the first parameter and return TRUE else return FALSE *) CONST (* some useful character sets for the procedure above *) All = SET OF CHAR {'\000'..'\377'}; Asciis = SET OF CHAR {'\000'..'\177'}; Controls = SET OF CHAR {'\000'..'\037', '\177'}; Spaces = SET OF CHAR {' ', '\t', '\n', '\r', '\f'}; Digits = SET OF CHAR {'0'..'9'}; Uppers = SET OF CHAR {'A'..'Z'}; Lowers = SET OF CHAR {'a'..'z'}; Letters = Uppers + Lowers; AlphaNumerics = Letters + Digits; Graphics = Asciis - Controls; Punctuation = Graphics - AlphaNumerics; NonSpaces = Graphics - Spaces; (* output functions ************************************************) (* all output functions write to stdout if a file is not specified *) PROCEDURE PutChar (c: CHAR; file: OutFile := NIL); (* write c *) PROCEDURE PutLine(str: TEXT := ""; file: OutFile := NIL); (* write str and append a newline *) PROCEDURE PutText(string: TEXT; file: OutFile := NIL); (* write str; don't append a newline *) PROCEDURE PutInt(i: INTEGER; file: OutFile := NIL; radix: [2 .. 16] := 10); (* write an integer `i' using the indicated radix. *) PROCEDURE PutReal(r: REAL; file: OutFile := NIL; precision: CARDINAL := 6; style := Style.Mix); (* write a real number `r' using indicated precision and style *) TYPE Style = {Flo, AltFlo, Sci, AltSci, Mix}; (* formatting styles for REALs: Flo: xxx.yyy AltFlo: xxx.yyy (trailing zeros are suppressed) Sci: xxx.yyy'E'exponent ('D' for LONGREAL) AltSci: xxx.yyy'E'exponent (trailing zeros are suppressed) Mix: == AltFlo unles AltSci is shorter; if AltFlow is selected and there are no zeros after the decimal point, the decimal point is suppressed. *) END IO. ======================================================================= 44 === Date: Tue, 24 Nov 92 09:38:29 -0600 From: Michael Kuschke Subject: Problems compiling SRC Modula-3 distribution fixed Hallo, this weekend I've successfully installed version 2.10 of the SRC Modula-3 system. The missed application m3bundle is now included and so everything compiled well. Thanks for creating this new version. I've been able to compile the zeus-algorithm animation stuff too. -Michael PS: If possible I would like to be added to the m3 mailinglist. Is it possible on this way or have I to write to m3-request ? Thanks in advance. Michael Kuschke e-mail: kuschke@urd.informatik\ Computer Science Department - LS4 .uni-dortmund.de University of Dortmund D-4600 Dortmund 50,PO-Box 500500, Germany voice: +49 231 755 2676 Man muss mit allem rechnen, sogar mit dem Schoensten. ======================================================================= 45 === Date: 24 Nov 92 16:29:45 GMT From: dalet@onecert.fr (Groupe SUPAERO) Subject: Mysterious system error I am trying to install Modula-3 on an apollo series 400, and when i build the libraries, i got: m3make -f m3makefile.libm3 all cd libm3; /usr/local/bin/m3make all ============================= Building in AP3000 /usr/local/bin/m3 -w1 -make -why -nostd -times -g -a libm3.a -F.PGM_SOURCES OS status: stranded or corrupted cleanup handler record (process manager/process fault manager) *** Exit 10 Stop. What the hell does it mean? Could someone help me? Thanks in advance. ======================================================================= 46 === Date: Tue, 24 Nov 1992 23:33:26 GMT From: gantz@advtech.uswest.com (Chris Gantz) Subject: Need expert help w/ re: to generics Hello Everyone, I've been working on this Modula-3 program for the last couple of weeks and I am determined to find the correct solution. I've investigated many Modula-3 text books and documents with regard to Modula-3, but I just don't know what is wrong. The code below compiles but when I run it gives me an allocation error, (ie a segmentation violation). So I am appealing to some Modula-3 experts on the net for help.... Code is below along with error messages. ----------------------------------------------------------- (*****************************************************************************) (* *) (* Christopher A. Gantz *) (* *) (* This is an implementation of a Queue that utilizes the following features *) (* of the Modula-3 Programming Language, Modules, Exceptions, Branded *) (* objects and Generic Modules. *) (* *) (*****************************************************************************) GENERIC INTERFACE Queue(Elem); EXCEPTION QueueEmpty; NotInQueue; TYPE QueueElem = OBJECT val: Elem.T; next, prev: QueueElem END; T <: Public_T; Public_T = OBJECT METHODS enqueue(x : Elem.T); dequeue(): Elem.T RAISES {QueueEmpty}; head() : Elem.T RAISES {QueueEmpty}; tail() : Elem.T RAISES {QueueEmpty}; find(x : Elem.T) : QueueElem RAISES {NotInQueue, QueueEmpty}; length() : CARDINAL; isempty() : BOOLEAN; END; <*INLINE*> PROCEDURE New(): T; END Queue. (*****************************************************************************) (* *) (* Christopher A. Gantz *) (* *) (* This is an implementation of a Queue that utilizes the following features *) (* of the Modula-3 Programming Language, Modules, Exceptions, Branded *) (* objects and Generic Modules. *) (* *) (*****************************************************************************) GENERIC MODULE Queue(Elem); REVEAL T = Public_T BRANDED OBJECT m: MUTEX; n: CARDINAL; hd, tl: QueueElem; METHODS enqueue(x : Elem.T) := Enqueue; dequeue(): Elem.T RAISES {QueueEmpty} := Dequeue; head(): Elem.T RAISES {QueueEmpty} := Head; tail(): Elem.T RAISES {QueueEmpty} := Tail; find(x : Elem.T): QueueElem RAISES {NotInQueue, QueueEmpty} := Fin d; length(): CARDINAL := Length; isempty(): BOOLEAN := IsEmpty; END; PROCEDURE New(): T = BEGIN RETURN NEW(T, m:=NEW(MUTEX), n:=0, hd:=NIL, tl:=NIL); END New; PROCEDURE Head(self: T): Elem.T = VAR elem: QueueElem; BEGIN IF IsEmpty(self) THEN RAISE QueueEmpty; END; LOCK self.m DO elem := self.hd; END; RETURN elem.val; END Head; PROCEDURE Tail(self: T): Elem.T = VAR elem: QueueElem; BEGIN IF IsEmpty(self) THEN RAISE QueueEmpty; END; LOCK self.m DO elem := self.tl; END; RETURN elem.val END Tail; PROCEDURE Enqueue(self: T; x: Elem.T) = VAR newElement: QueueElem; BEGIN newElement := NEW(QueueElem, val := x, next := NIL, prev := NIL); LOCK self.m DO IF (self.tl # NIL) THEN self.tl.next := newElement; newElement.prev := self.tl; END; self.tl := newElement; IF self.n = 0 THEN self.hd := self.tl; END; END; INC(self.n); END Enqueue; PROCEDURE Find(self: T; x: Elem.T): QueueElem RAISES {NotInQueue, QueueEmpty} = VAR tmp : QueueElem; NotFound : BOOLEAN := TRUE; BEGIN IF IsEmpty(self) THEN RAISE QueueEmpty; END; tmp := self.hd; WHILE (tmp # NIL) AND (NotFound) DO IF tmp.val # x THEN tmp := tmp.next; ELSE NotFound := FALSE; END; END; IF tmp = NIL THEN RAISE NotInQueue; END; RETURN tmp; END Find; PROCEDURE Dequeue(self: T) : Elem.T RAISES {QueueEmpty} = VAR result : Elem.T; BEGIN IF IsEmpty(self) THEN RAISE QueueEmpty; END; LOCK self.m DO result := self.hd.val; self.hd := self.hd.next; self.hd.prev := NIL; END; DEC(self.n); RETURN result; END Dequeue; PROCEDURE Length(self: T): CARDINAL = BEGIN RETURN self.n; END Length; PROCEDURE IsEmpty(self: T): BOOLEAN = BEGIN RETURN ((self.n = 0) AND (self.hd = NIL) AND (self.tl = NIL)); END IsEmpty; BEGIN END Queue. (*****************************************************************************) (* *) (* Christopher A. Gantz *) (* *) (*****************************************************************************) INTERFACE Integer; TYPE T = INTEGER; END Integer. (*****************************************************************************) (* *) (* Christopher A. Gantz *) (* *) (* This is an implementation of a Queue that utilizes the following features *) (* of the Modula-3 Programming Language, Modules, Exceptions, Branded *) (* objects and Generic Modules. *) (* *) (*****************************************************************************) INTERFACE IntQueue = Queue(Integer) END IntQueue. (*****************************************************************************) (* *) (* Christopher A. Gantz *) (* *) (* This is an implementation of a Queue that utilizes the following features *) (* of the Modula-3 Programming Language, Modules, Exceptions, Branded *) (* objects and Generic Modules. *) (* *) (*****************************************************************************) MODULE IntQueue = Queue(Integer) END IntQueue. (*****************************************************************************) (* *) (* Christopher A. Gantz *) (* *) (*****************************************************************************) INTERFACE Float; TYPE T = REAL; END Float. (*****************************************************************************) (* *) (* Christopher A. Gantz *) (* *) (* This is an implementation of a Queue that utilizes the following features *) (* of the Modula-3 Programming Language, Modules, Exceptions, Branded *) (* objects and Generic Modules. *) (* *) (*****************************************************************************) INTERFACE RealQueue = Queue(Float) END RealQueue. (*****************************************************************************) (* *) (* Christopher A. Gantz *) (* *) (* This is an implementation of a Queue that utilizes the following features *) (* of the Modula-3 Programming Language, Modules, Exceptions, Branded *) (* objects and Generic Modules. *) (* *) (*****************************************************************************) MODULE RealQueue = Queue(Float) END RealQueue. (*****************************************************************************) (* *) (* Christopher A. Gantz *) (* *) (* This is an implementation of a Queue that utilizes the following features *) (* of the Modula-3 Programming Language, Modules, Exceptions, Branded *) (* objects and Generic Modules. *) (* *) (*****************************************************************************) MODULE Main; IMPORT Fmt, Wr, RealQueue, IntQueue; FROM IntQueue IMPORT QueueEmpty, NotInQueue; FROM Stdio IMPORT stdout; VAR intq : IntQueue.T; realq : RealQueue.T; i_val : INTEGER := 0; r_val : REAL := 0.0; b_val : BOOLEAN := FALSE; i_qelem : IntQueue.QueueElem; r_qelem : RealQueue.QueueElem; len : CARDINAL := 0; BEGIN Wr.PutText(stdout, "\nInvoking: IntQueue.New()\n"); intq := IntQueue.New(); Wr.PutText(stdout, "Invoking: RealQueue.New()\n"); realq := RealQueue.New(); Wr.PutText(stdout, "\nInvoking: intq.head()\n"); TRY i_val := intq.head(); EXCEPT QueueEmpty => Wr.PutText(stdout, "head() applied to an empty Queue\n"); END; Wr.PutText(stdout, "i_val = " & Fmt.Int(i_val) & "\n"); Wr.PutText(stdout, "Invoking: intq.tail()\n"); TRY i_val := intq.tail(); EXCEPT QueueEmpty => Wr.PutText(stdout, "tail() applied to an empty Queue\n"); END; Wr.PutText(stdout, "i_val = " & Fmt.Int(i_val) & "\n"); Wr.PutText(stdout, "\nInvoking: intq.enqueue(9)\n"); intq.enqueue(9); Wr.PutText(stdout, "Invoking: intq.enqueue(7)\n"); intq.enqueue(7); Wr.PutText(stdout, "Invoking: intq.enqueue(5)\n"); intq.enqueue(5); Wr.PutText(stdout, "\nInvoking: intq.find(5)\n"); TRY i_qelem := intq.find(5); EXCEPT NotInQueue => Wr.PutText(stdout, "value 5 is not in the Queue\n"); | QueueEmpty => Wr.PutText(stdout, "find() applied to an empty Queue\n"); END; Wr.PutText(stdout, "\nInvoking: intq.dequeue()\n"); TRY i_val := intq.dequeue(); EXCEPT | QueueEmpty => Wr.PutText(stdout, "dequeue() applied to an empty Queue\n"); END; Wr.PutText(stdout, "i_val = " & Fmt.Int(i_val) & "\n"); Wr.PutText(stdout, "\nInvoking: intq.length()\n"); len := intq.length(); Wr.PutText(stdout, "intq.length() = " & Fmt.Int(len) & "\n"); IF intq.isempty() THEN Wr.PutText(stdout, "\nintq is empty\n"); ELSE Wr.PutText(stdout, "\nintq is NOT empty\n"); END; Wr.PutText(stdout, "\nInvoking: realq.enqueue(12.0)\n"); realq.enqueue(12.0); Wr.PutText(stdout, "Invoking: realq.enqueue(32.0)\n"); realq.enqueue(32.0); Wr.PutText(stdout, "Invoking: realq.enqueue(3.145)\n"); realq.enqueue(3.145); Wr.PutText(stdout, "\nInvoking: realq.head()\n"); TRY r_val := realq.head(); EXCEPT QueueEmpty => Wr.PutText(stdout, "head() applied to an empty Queue\n"); END; Wr.PutText(stdout, "r_val = " & Fmt.Real(r_val) & "\n"); Wr.PutText(stdout, "\nInvoking: realq.tail()\n"); TRY r_val := realq.tail(); EXCEPT QueueEmpty => Wr.PutText(stdout, "tail() applied to an empty Queue\n"); END; Wr.PutText(stdout, "r_val = " & Fmt.Real(r_val) & "\n"); Wr.PutText(stdout, "\nInvoking: realq.find(5.0)\n"); TRY r_qelem := realq.find(5.0); EXCEPT NotInQueue => Wr.PutText(stdout, "value 3.145 is not in the Queue\n"); | QueueEmpty => Wr.PutText(stdout, "find() applied to an empty Queue\n"); END; Wr.PutText(stdout, "\nInvoking: realq.dequeue(32.0)\n"); TRY r_val := realq.dequeue(); EXCEPT | QueueEmpty => Wr.PutText(stdout, "dequeue() applied to an empty Queue\n"); END; Wr.PutText(stdout, "r_val = " & Fmt.Real(r_val) & "\n"); Wr.PutText(stdout, "\nInvoking: realq.length()\n"); len := realq.length(); Wr.PutText(stdout, "realq.length() = " & Fmt.Int(len) & "\n"); IF realq.isempty() THEN Wr.PutText(stdout, "\nrealq is empty\n"); ELSE Wr.PutText(stdout, "\nrealq is NOT empty\n"); END; Wr.PutText(stdout,"\ndone.\n"); Wr.Close(stdout); END Main. ------------------------------------------ Output: *** *** runtime error: *** Segmentation violation - possible attempt to dereference NIL *** pc = 0xf7fff4f0 *** Invoking: IntQueue.New() Invoking: RealQueue.New() Invoking: intq.head() Christopher A. Gantz Email: gantz@advtech.uswest.com U S WEST Advanced Tech. cag@cs.colorado.edu 4001 Discovery Dr. Phone: (303) 541-6556 Boulder, CO 80303 -- Christopher A. Gantz Email: gantz@advtech.uswest.com U S WEST Advanced Tech. cag@cs.colorado.edu 4001 Discovery Dr. Phone: (303) 541-6556 Boulder, CO 80303