======================================================================= 1 === Date: 1 Nov 1993 22:30:14 GMT From: Eric Muller Subject: Modula-3 Frequently Asked Questions (FAQ) Archive-name: Modula-3-faq Last-modified: Sep 9 1993 Modula-3 Frequently Asked Questions =================================== 1. The language 1.1 What is Modula-3? 1.2 Is Modula-3 a superset of Modula-2? 2. The documentation 2.1 Where can I get a description of Modula-3? 2.2 Where can I get other information on Modula-3? 3. The implementations 3.1 Where can I get an implementation? 3.2 What is SRC Modula-3? 3.3 What is m3pc? 3.4 What is GNU Modula-3? 4. Some specific questions 4.1 Why is "Hello World" so large? 4.2 Why objects and interfaces? 4.3 What is the story with Trestle and OpenWindows? 4.4 When is the next release of SRC Modula-3 ? 5. FTP 5.1 What if I don't have ftp access? 6. Contributing 6.1 Can I contribute Modula-3 software? 1.1. What is Modula-3? Modula-3 is a systems programming language that descends from Mesa, Modula-2, Cedar, and Modula-2+. It also resembles its cousins Object Pascal, Oberon, and Euclid. The goal of Modula-3 is to be as simple and safe as it can be while meeting the needs of modern systems programmers. Instead of exploring new features, we studied the features of the Modula family of languages that have proven themselves in practice and tried to simplify them into a harmonious language. We found that most of the successful features were aimed at one of two main goals: greater robustness, and a simpler, more systematic type system. Modula-3 retains one of Modula-2's most successful features, the provision for explicit interfaces between modules. It adds objects and classes, exception handling, garbage collection, lightweight processes (or threads), and the isolation of unsafe features. 1.2. Is Modula-3 a superset of Modula-2? No; valid Modula-2 programs are not valid Modula-3 programs. However, there is a tool to help convert Modula-2 programs to Modula-3. 2.1. Where can I get a description of Modula-3? The definition of Modula-3 is contained in: System Programming with Modula-3 Edited by Greg Nelson Prentice Hall Series in Innovative Technology ISBN 0-13-590464-1 L.C. QA76.66.S87 1991 also known as SPwM3. Here is the table of contents: 1. Introduction 2. Language Definition 3. Standard Interfaces 4. An Introduction to Programming with Threads 5. Thread Synchronization: A Formal Specification 6. I/O Streams: Abstract Types, Real Programs 7. Trestle Window System Tutorial 8. How the Language Got its Spots Chapters 2 and 3 have been reprinted in Sigplan Notices, Volume 27, Number 8, August 1992, pp 15-42. Sam Harbison has written a more tutorial book about Modula3: Modula-3 Samuel P. Harbison Prentice Hall, 1992 ISBN 0-13-596396-6 The errata sheet is available via anonymous ftp from gatekeeper.dec.com in pub/DEC/Modula-3/errata. 2.2. Where can I get other information on Modula-3? There is a Usenet newsgroup, comp.lang.modula3. The archives of that group are available via anonymous ftp from gatekeeper.dec.com in pub/DEC/Modula-3/comp.lang.modula3. If you do not have access to Usenet, there is a relay mailing list; send a message to m3-request@src.dec.com to be added to it. There are a couple high-level overview articles available: "Modula-3", Sam Harbison, Byte, Vol. 15, No. 12, November 1990, pp 385+. "Safe Programming with Modula-3", Sam Harbison, Dr. Dobb's Journal, Vol. 17, No. 10, October 1992, pp 88+. A description of the Modula-3 type system is in "The Modula-3 Type System", Luca Cardelli, Jim Donahue, Mick Jordan, Bill Kalsow, Greg Nelson, Conference Record of the Sixteenth Annual ACM Symposium on Principles of Programming Languages (POPL), Austin Texas, January 11-13 1989, pp 202-212. The Trestle window system toolkit, higher-level FormsVBT toolkit, and Zeus animation system available with Modula-3, are documented in the following reports: "Trestle Reference Manual", Mark S. Manasse and Greg Nelson, SRC Research Report 68, December 1991. "Trestle Tutorial", Mark S. Manasse and Greg Nelson, SRC Research Report 69, May 1, 1992. "VBTkit Reference Manual: A toolkit for Trestle", edited by Marc H. Brown and James R. Meehan. (soon to be a SRC Research Report) A draft version is available via anonymous FTP from gatekeeper.dec.com in pub/DEC/Modula-3/contrib/vbtkit.25Mar93.ps.Z. "The FormsVBT Reference Manual", Marc H. Brown and James R. Meehan, (soon to be a SRC Research Report). A draft version is available via anonymous FTP from gatekeeper.dec.com in pub/DEC/Modula-3/contrib/formsvbt.25Mar93.ps.Z and pub/DEC/Modula-3/contrib/formsvbt.AppC.26Mar93.ps.Z. "Zeus: A System for Algorithm Animation and Multi-View Editing", Marc H. Brown, SRC Research Report 75, February 28, 1992. Available via anonymous FTP from gatekeeper.dec.com in pub/DEC/SRC/research-reports/SRC-075*.ps.Z. "Color and Sound in Algorithm Animation", Marc H. Brown and John Hershberger, SRC Research Report 76a, August 30, 1991. Available via anonymous FTP from gatekeeper.dec.com in pub/DEC/SRC/research-reports/SRC-076a*.ps.Z. "The 1992 SRC Algorithm Animation Festival", Marc H. Brown, SRC Research Report 98, March 27, 1993. Available via anonymous ftp from gatekeeper.dec.com in pub/DEC/SRC/research-reports/SRC-098*.ps.Z. Hardcopy versions of these reports can be ordered by e-mail; send your request including a postal mail address to src-reports@src.dec.com. 3.1. Where can I get an implementation? Two implementations are available, SRC Modula-3 and a PC version of it (m3pc). Work is also progressing on GNU Modula-3. As far as we know, implementations are not available for VMS, Macintosh, or Alpha AXP/OSF. 3.2. What is SRC Modula-3? SRC Modula-3 was built by the DEC Systems Reseach Center and is available via anonymous ftp from gatekeeper.dec.com in pub/DEC/Modula-3/release. The current version, 2.11, implements the language defined in SPwM3. There are versions for the following machines: AIX386 IBM PC running AIX/PS2, AP3000 Apollo DN4500 running Domain/OS ARM Acorn R260 running RISC iX 1.21 DS3100 DECstation 3100 and 5000 running Ultrix 4.0 and 4.2 HP300 HP 9000/300 running HP-UX 8.0 HPPA HP 700/800 running HP-UX 8.0 IBMR2 IBM R6000 running AIX 3.1, IBMRT IBM RT running IBM/4.3, NEXT NeXT running ?? OKI Okidata 7300 (i860) running AT&T SVR4.0 SPARC SPARCstation running SunOS 4.1.x SUN3 SUN3 running SunOS SUN386 Sun 386i running SunOS 4.0.1 UMAX Encore Multimax running UMAX 4.3 (R4.1.1) VAX VAX running Ultrix 3.1 SRC Modula-3 includes a user manual, compiler, runtime library, some libraries and a few other goodies (see below). The compiler generates C as an intermediate language and should be fairly easy to port. Except for the very lowest levels of the thread implementation, the entire system is written in Modula-3. 3.3. What is m3pc? m3pc is available via anonymous ftp from gatekeeper.dec.com in pub/DEC/Modula-3/contrib/m3pc. From: laszlo@post.ifi.uni-klu.ac.at (Prof.Dr.Laszlo BOESZOERMENYI) Subject: M3 pn PC Date: 8 Mar 1993 13:13:52 GMT The Modula-3 system ported by us on the PC and available on the gatekeeper, runs with MSDOS, gnu c compiler and djgpp memory manager (detailed description in the read me file). You may compile, link and run Modula-3 programs, without threads. From the library modules only those are tested which are used by the compiler. In the course of a student project a "student-friendly" environment is in development. It will be available at end of June (hopefully). 3.4. What is GNU Modula-3? From: moss@cs.cmu.edu (Eliot Moss) Subject: GNU Modula-3 alpha release status Date: 25 Mar 93 17:53:12 GMT We said we'd try to get the initial (alpha) release of GNU Modula-3 out some time this month (March), and we're in the process of figuring out what to release and how to package it up. We expect to have something in roughly two weeks (watch this space for a notice). What would this be? First, it is a compiler for the VAX (only) under Ultrix (only), definitely without threads, and probably still failing a small number of the tests in the SRC test suite (which implies that not all of libm3 is likely to work either). The actual release information will detail more about what's working and what's not at that time. We DO currently pass all the compiler tests that the SRC compiler did when it was first released (i.e., the ones we fail are more obscure things that users uncovered over time). Second, the release itself will be a compressed tar file including sources and executables. The executables will probably work only if you put libraries, etc., in the expected places (otherwise, you'll need to rebuild from sources).The compiler is written in C and should be compiled with a recent version of gcc (so you'll need gcc installed). The system also uses gld (the GNU linker). This release should be most useful to people undertaking ports to other machines and operating systems, since it will give them a head start on understanding the compiler and getting the full system ready. It may be of some use for ordinary programming, but it really depends on whether you tend to use features that tickle the remaining bugs. We are indeed interested in alpha test reports, but only if they tell us something new (i.e., we'll provide a list of known deficiencies). When the release is made, we'll also start email discussions with the various parties who have indicated they might undertake ports, to help sort out who will do what. Regards, and thanks for your continued interest and encouragement -- EM From: moss@cs.cmu.edu (Eliot Moss) Subject: GNU Modula-3 pre-release Date: Wed, 5 May 1993 23:49:33 GMT At long last, the GNU Modula-3 project has a pre-release ready, for the VAX/Ultrix platform ONLY. Various folks had notified us of their interest in doing ports or alpha testing, and they have already been sent email with particulars on how to obtain the tar file, etc. There are a number of known bugs; I'll see about making a list available by ftp or something, for interested parties. It is our opinion that the prerelease is not mature enough for general use, but we wished to give a head start to those folks attempting ports, and we will make periodic patches available. If you want to use this compiler for serious program development or need something solid with debugging support for classroom use, you should wait until we've fixed more of the problems. (But to give a sense of what we HAVE accomplished, as I recall, all but 3 of the SRC compiler tests compile (there are 137 of them).) We hope to do a more general release, and support more platforms, in the summer. If you're interested in helping and have not previously contacted us, please send email to me and/or Rick Hudson (hudson@cs.umass.edu). Thanks to Digital and SRC for supporting us, and to Rick Hudson, Amer Diwan, and Norm Walsh, the guys who do all the hard work! 4.1. Why is "Hello World" so large? Modula-3 programs are larger than C programs for the following reasons: 1) The fixed runtime is substantially larger. It contains a garbage collector, a thread runtime, and exception support. Note that "Hello World" is virtually all runtime. For larger programs the runtime is not an issue. 2) The generated code includes runtime checks for out-of-bound array references and NIL pointer. Many of these checks could be removed by a better compiler. The current compiler is only a research prototype. 3) The compiler generates C code as its intermediate language consequently the final machine code suffers. For example, the compiler is constantly storing single-precision floating point values into memory to get around C's predisposition for double precision. 4.2. Why objects and interfaces? Allan Heydon on comp.lang.modula3, May 4th 1993: Modula-3 provides two separate mechanisms for data-hiding: one for hiding details about how interfaces are implemented, and the other for hiding details about how objects are implemented. The first data-hiding mechanism is realized by the distinction between interfaces and modules. Clients can only import interfaces, so the names declared in the modules implementing those interfaces are hidden from clients. Note that this mechanism has only two levels; a name is either declared in an interface, or it isn't. If a name is only declared in a module, it can't be used by a client. The second data-hiding mechanism is realized by opaque types and revelations. A Modula-3 interface may declare an object type to be opaque, in which case only a subset of the fields and methods of that object are revealed to clients importing the interface. Furthermore, the Modula-3 revelation mechanism allows a designer to reveal successively more fields and methods of an object in a series of interfaces. The fields and methods visible to a client then depends on which interfaces the client imports. The latter mechanism is quite flexible. As opposed to the interface/module data-hiding mechanism, opaque types allow you to define an arbitrary number of levels at which more and more information about the implementation of your object is revealed. See Sections 2.2.10, 2.4.6, and 2.4.7 of "Systems Programming with Modula-3" for more information about opaque types and about partial and complete revelations. 4.3. What is the story with Trestle and OpenWindows? Mark Manasse says: I think that the OpenWindows release should be enough (no need to get the MIT X release], although there are a few things in Trestle that trigger devastating bugs in OpenWindows. But the only library we depend on is Xlib, R4 or later. The main thing I know that crashes OW 2.0 is the code where we call GrabKey specifying AnyKey. You can either loop over all of the keys, or you can just comment out the call; programs won't run exactly the same, but you probably won't notice the difference. 4.4 When is the next release of SRC Modula-3 ? The next release will be 3.0. Here are some of the new things you will find in it: 1. the compiler has a new internal interface between the front-end and the back-end, M3CG. This interface is supposed to be easy to implement. 2. the front-end can compute in the target arithmetic system; in particular it is possible to cross-compile to machines with larger integers than the host. 3. one back-end has been implemented on top of gcc. The implementation of M3CG interface generates the tree representation used internally in gcc. From the gcc point of view, this back-end looks like a new front-end. Using this back-end, we have cross-compiled solitaire for mips, alpha and 386 processors; there is no reason to believe that there would be a problem for the other architectures supported by gcc. 4. Dave Hanson wrote another implementation of the M3CG that is self-contained. He is currently working on the 386 code generation (he has done the mips code generation already). 5. gdb has been modified to understand Modula-3 debugging information produced by the back-ends. gdb can now parse Modula-3 expressions, print Modula-3 values and evaluate some of the Modula-3 built-in operations. There is also a little bit of support for multi-threaded programs (you can look at the stacks of other threads). 6. there is a replacement for m3make, m3build, that does not rely on cpp/awk/sed/make and what not, and removes some of the limitations of m3make. m3makefiles are very similar. 7. libm3 has been significantly changed by the Interface Police, mostly in the area of OS interfaces and data structures. 8. for the OS interfaces, we still have the U* interfaces, but applications are not supposed to use those. Instead they should use a new set of interfaces that are os-independent; for example, there is a Pathname interface that manipulates file names; there is a Process interface that manipulate child processes. These interfaces enabled a prototype port of the C based version to Windows NT machines. 9. for the data structures, generics have been introduced and the various data structures are more consistent. 10. because of 6 and 8, we can think about going to different os than Unix. In particular a Windows NT port will be available at some point (may not be in 3.0). 11. the runtime has been improved quite a bit. 12. new platforms: Alpha running OSF/1, 386 running Linux. We will pay more attention to the porting instructions and support. 13. I am not sure about all the changes in the libraries other than libm3. I suspect that there will be few changes in trestle, but that mentor changed quite a bit. 14. The Windows NT port uses native threads. This should be a good model for other implementations of Thread using native threads. The current status is: . the front-end is very stable . the gcc-based back-end has been stable for 4 months . the gdb extensions are brand new and need some test . the interface police work is very stable . we are working on bringing the system up on the machines we have in the building, and building the export machinery. We don't have a date for the 3.0 release. Given the amount of changes introduced by 3.0, I suspect that the first few releases will not work out of the box for any machine but the ones for which we can test (decstations [mips and alpha], linux). Consequently, I expect a high rate of releases for a while. We will try to post accurate information about the status of each machine, but we can only rely what you tell us. At this point, I would not encourage anybody to start a new port. If you have a new port, or are close to complete one, you can send us your bits, we will try to put them in 3.0. 5.1. What if I don't have ftp access? Unfortunately, we cannot deliver Modula-3 other than by anonymous ftp. Fortunately, Prime Time Freeware (PTF) includes Modula-3. PTF is a set of two ISO-9660 CDroms filled with 3GB of freeware, issued semi-annually. The latest issue, Volume 1, Number 2, July 1992, contains SRC Modula-3 2.07. PTF is distributed via bookstores and mail. You can reach PTF using: Email: ptf@cfcl.com Fax: [1] (408) 738 2050 Voice: [1] (408) 738 4832 Mail: Prime Time Freeware 415-112 N. Mary Ave., Suite 50 Sunnyvale, CA 94086 USA 6.1. Can I contribute Modula-3 software? Certainly. Send us what you are willing to share, be it programs, libraries or other things. We'll put them in the distribution. Right now, the pub/DEC/Modula-3/contrib directory contains: m3rpc an rpc system from Xerox Parc M2toM3 a translator from Modula-2 to Modula-3 m3pc an implementation of Modula-3 for PCs. ---- Eric. ======================================================================= 2 === Date: Wed, 3 Nov 1993 15:26:23 GMT From: kramer@inf.fu-berlin.de (Markus) Subject: modula3-tutorial at university I am studying physics and am a student-teacher for informatics. I want to start a 1-week tutorial on modula3 in february 94. The tutorial is intended for beginners of modula3 with good knowledge of other high level languages. I want to post the materials I`ll have to prepare for the tutorial. Everybody who is interested to help to create a "short introduction into modula3 for programmers" is encouraged to conatact me. Markus Kramer --> kramer@inf.fu-berlin.de ======================================================================= 3 === Date: Fri, 5 Nov 1993 14:03:51 GMT From: pgs1002@cus.cam.ac.uk (Dr P.G. Sjoerdsma) Subject: Array initialisations I'm just starting to work in M3 after some years in C++. It's a great change but it leaves a few questions. If you can initialise a one dimensional array: TYPE T = ARRAY [1..3] OF REAL; CONST NilVec=T{0.0, 0.0, 1.0}; Why can't you give: TYPE T = ARRAY[1..2],[1..2] OF REAL; CONST NilMatrix = T{{0.0, 0.0},{0.0, 0.0}}; It seems logical. Or am I missing something here. By the way is it possible to initialise arrays like records: TYPE T = RECORD x: REAL := 0.0, y: REAL := 0.0 END; TYPE T = ARRAY[1..3] OF REAL := {0.0, 0.0, 0.0}; ?????? Thanks -- ___ (o o) -----------------------------ooO-(_)-Ooo----------------------------- Paul Sjoerdsma, Godwin Laboratory, Free School Lane, Cambridge CB2 3RS England fax: (44) (0)223-334871, email: pgs1002@cus.cam.ac.uk --------------------------------------------------------------------- ======================================================================= 4 === Date: Fri, 5 Nov 1993 17:20:59 GMT From: kirschnt@informatik.uni-muenchen.de (Torsten R. Kirschner) Subject: Re: Array initialisations pgs1002@cus.cam.ac.uk (Dr P.G. Sjoerdsma) writes: >If you can initialise a one dimensional array: >TYPE T = ARRAY [1..3] OF REAL; >CONST NilVec=T{0.0, 0.0, 1.0}; >Why can't you give: >TYPE T = ARRAY[1..2],[1..2] OF REAL; >CONST NilMatrix = T{{0.0, 0.0},{0.0, 0.0}}; >It seems logical. Or am I missing something here. Dear Paul, multi-dimensional array initialisation is done like this. The solution has been posted to comp.lang.modula3 some years ago, but unfortunately I cannot remeber the original authors name or address. TYPE A3 = ARRAY [1 .. 3] OF REAL; AA3 = ARRAY [1 .. 3] OF A3; VAR f := AA3{A3{1.0, 3.0, -4.0}, A3{1.0, 1.0, -2.0}, A3{-1.0, -2.0, 5.0}}; Yours, Torsten -- Torsten R. Kirschner Torsten.R.Kirschner@informatik.tu-muenchen.de ======================================================================= 5 === Date: 5 Nov 1993 17:36:08 GMT From: kalsow@src.dec.com (Bill Kalsow) Subject: Re: Array initialisations In article , pgs1002@cus.cam.ac.uk (Dr P.G. Sjoerdsma) writes: > > If you can initialise a one dimensional array: > TYPE T = ARRAY [1..3] OF REAL; > CONST NilVec=T{0.0, 0.0, 1.0}; > > Why can't you give: > TYPE T = ARRAY[1..2],[1..2] OF REAL; > CONST NilMatrix = T{{0.0, 0.0},{0.0, 0.0}}; > It seems logical. Or am I missing something here. You must specify the type of the inner arrays. If you introduced the name X for the inner type, your example would be: TYPE X = ARRAY [1..2] OF REAL; TYPE T = ARRAY [1..2] OF X; CONST NilMatrix = T{ X{0.0, 0.0}, X{0.0, 0.0} }; > By the way is it possible to initialise arrays like records: > > TYPE T = RECORD x: REAL := 0.0, y: REAL := 0.0 END; > TYPE T = ARRAY[1..3] OF REAL := {0.0, 0.0, 0.0}; ?????? No, you cannot specify initial values in an array type. You can initialize an array variable: VAR a := ARRAY [1..3] OF REAL := {0.0, ..}; - Bill Kalsow ======================================================================= 6 === Date: Sat, 6 Nov 1993 01:03:44 GMT From: Bob Hathaway Subject: Comp.Object FAQ Version 1.0.4 (11-05) Announcement This announces the November version 1.0.4 of the Comp.Object FAQ! It has many updates and corrections and has several very up-to-date appendices on object- oriented methodologies and systems. While a new section on miscellaneous commercial systems and libraries is in the works for completeness, this document may very well comprise the latest and most up-to-date collection of object-oriented systems and terminology in the world today! New noteworthy additions are the OO methodologies and OOA/OOD sections and ever expanding appendices. Future FAQs will contain a diff file. The FAQ is updated and posted monthly. Comments, suggestions, additions, updates, and new systems and site entries should be sent to rjh@geodesic.com. The FAQ is posted to the comp.object, comp.answers and news.answers newsgroups and is available via anonymous ftp from zaphod.uchicago.edu and rtfm.mit.edu, although new versions may take a short period of time to be installed. A hypertext version is also available; from the FAQ: Anonymous FTP Sites and Hypertext Server: anonymous@zaphod.uchicago.edu:/pub/comp.object-faq.1.0.4(.Z) (128.135.72.61) anonymous@rtfm.mit.edu:/pub/usenet/comp.object/*_Part_* http://cui_www.unige.ch/OSG/FAQ/OO-FAQ/index.html Mail Server: (See also section 1.24) mail mail-server@rtfm.mit.edu Subject: send usenet/comp.object/* Zaphod is preferred over rtfm for anonymous ftp retrieval, as it provides a single file. Rtfm contains the FAQ as posted. To use the hypertext system, see APPENDIX E, entries 27. Again, a short period of time may be required to retrieve the latest version, allowing the posted version to propagate and get out as quickly as possible. Thank you to the many people who have contributed their time and effort into helping this document spread the word about object-oriented technology and available systems! It is hoped it will be most useful in that endeavor. Best Regards! bob ======================================================================= 7 === Date: 8 Nov 93 15:46:14 +1000 From: visatsangi@vaxsar.vassar.edu Subject: Help: How to detect Int Overflow? ***** Summary: How does one detect Integer Overflow in Modula3 ? (Knowing that Interface FloatMode exists) --Thanks, Vivek. ***** I am sure this is a very trivial problem for you, but being new to M-3, we have tried different things, hoping something will work, but nothing has. Our professor was not sure how to handle it, either. We have told him that we may seek your help, so you will not be helping us "cheat" if you should render assistance. * The "bigger" problem: We are writing an interpreter for a small functional language. The language only has integers in its data types. This part of the code concerns the evaluator, which evaluates the parse tree. * The "smaller" problem: We need to detect arithmetic errors. We can easily detect divide by zero errors, but integer overflow requires us to check the flags. * Environment: SunSPARC station IPC, using the SRC release of M-3. * What, Where, How: On page 83 of %%Modula-3 by Harbison%% the FloatMode interface is explained. We want to check the IntOverlow flag before an after the evaluation. We declared a variable that is a SET OF Flag etc., etc. But the error is never detected, i.e when we do 2147483647+1 we get -1 without an error. Here is our code: Thank you for your kind help. I there is ever any service I may be to you, please do ask. I remain, Yours faithfully, Vivek Satsangi visatsangi@vaxsar.vassar.edu or visatsan@vaschu.vassar.edu MODULE Evaluator; (*=========================================================================*) (* Evaluator for Parse Trees *) (* ========================= *) (* Evaluates an expression tree and displays the final output. *) (*=========================================================================*) ... FROM FloatMode IMPORT Flag, GetFlags, NoFlags; FROM Errors IMPORT Check, Error; (* Check takes two parameters: A boolean and a TEXT. IF the boolean is false, Error message is printed *) PROCEDURE Eval (VAR n: Node ): Node RAISES {Error} = VAR ... ErrorFlags: SET OF Flag; BEGIN ErrorFlags:= NoFlags; TYPECASE n OF ... Nplus( p ) => results := NEW( Nnum, numval:= NARROW( Eval( p.op1 ), Nnum ).numval + NARROW( Eval( p.op2 ), Nnum ).numval ) | Nminus( m ) => ... Nstar( s ) => ... Ndiv( d ) => ... Nmod ( o ) => ... END; (* -- This is the code to handle integer overflows. It does not work. TYPECASE n OF Nplus, Nminus, Nstar => ErrorFlags:= GetFlags(); Check((NOT(Flag.IntOverflow IN ErrorFlags)),"Integer Overflow detected" ) ; ELSE END; *) RETURN results; END Eval; ... ======================================================================= 8 === Date: Wed, 10 Nov 93 21:00:22 -0800 From: heydon@src.dec.com Subject: Re: Help: How to detect Int Overflow? Vivek, The Modula-3 FloatMode interface defines a type "Behavior" which is one of the enumerated values: "Trap", "SetFlag", or "Ignore". It also provides mechanisms for reading and writing the state of the machine's behavior for each possible kind of numeric exception via the "GetBehavior" and "SetBehavior" procedures. Your technique for detecting integer overflow relies on the fact that the machine's default behavior for the "IntOverflow" exception is "SetFlag". However, this may not be the case. My guess is that the call: FloatMode.GetBehavior(FloatMode.Flag.IntOverflow) will return the result "FloatMode.Behavior.Ignore" on your machine. This would mean that integer overflows are being ignored by your system. Now, to correct this deficiency, you would think that you could simply call: FloatMode.SetBehavior(FloatMode.Flag.IntOverflow, FloatMode.Behavior.SetFlag) to tell the system that you want it to set the "IntOverflow" flag on an integer overflow. However, notice that the specification of the "SetBehavior" procedure can raise the "Failure" exception. This is because not all architectures support all 3 of the behaviors for each of the numeric exceptions. The first thing you should try is to set the behavior as described above. However, if that call raises the "Failure" exception, you will need to detect the overflow "manually". Once final point: in the event that you succeed in setting the behavior for the "IntOverflow" exception to "SetFlag", you will need to fix a problem in your code. Before you execute the arithmetic (integer) operation, you must first clear the system's "IntOverflow" flag: FloatMode.ClearFlag(FloatMode.Flag.IntOverflow) Your code attempts to do this by executing: ErrorFlags := NoFlags before executing the arithmetic operations, but that doesn't do what you need, since "ErrorFlags" is a local variable, so setting it to the empty set of flags does not clear the system's internal flags. In summary, the fact that "FloatMode.SetBehavior" is allowed to raise the "Failure" exception makes the interface nearly useless in practice. In the worst case, you must assume that the run-time system ignores all numeric exceptions. You therefore have to write the code to detect numeric exceptions manually if you want your code to be portable. - Allan Allan Heydon heydon@src.dec.com DEC Systems Research Center (415) 853-2142 130 Lytton Ave. (415) 853-2104 (FAX) Palo Alto, CA 94301 ======================================================================= 9 === Date: Wed, 10 Nov 93 21:01:05 -0800 From: heydon@src.dec.com Subject: Re: Help: How to detect Int Overflow? Attached below are the sources for a program I wrote recently to test the "FloatMode" interface. I thought they might be relevant to the question Vivek asked. When run on a DECstation 5000, the test program produces the following output: pebbles:overflow> mips/FloatModeTest Current Rounding Mode: TowardZero Current Flag Settings: Invalid: 0 Inexact: 0 OverFlow: 0 Underflow: 0 DivByZero: 0 IntOverflow: 0 IntDivByZero: 0 Current Flag Behavior Settings: Invalid: SetFlag Inexact: SetFlag OverFlow: SetFlag Underflow: SetFlag DivByZero: SetFlag IntOverflow: Ignore IntDivByZero: Trap Setting behavior for flag "IntOverflow": "Trap" => Failed "SetFlag" => Failed "Ignore" => Succeeded Current Flag Behavior Settings: Invalid: SetFlag Inexact: SetFlag OverFlow: SetFlag Underflow: SetFlag DivByZero: SetFlag IntOverflow: Ignore IntDivByZero: Trap Integer Overflow Test: 268435455 536870910 1073741820 2147483640 -16 Current Flag Settings: Invalid: 0 Inexact: 0 OverFlow: 0 Underflow: 0 DivByZero: 0 IntOverflow: 0 IntDivByZero: 0 Unsigned Overflow Test: 268435455 536870910 1073741820 2147483640 4294967280 4294967264 Current Flag Settings: Invalid: 0 Inexact: 0 OverFlow: 0 Underflow: 0 DivByZero: 0 IntOverflow: 0 IntDivByZero: 0 Setting behavior for flag "IntDivByZero": "Trap" => Succeeded "SetFlag" => Failed "Ignore" => Failed Current Flag Behavior Settings: Invalid: SetFlag Inexact: SetFlag OverFlow: SetFlag Underflow: SetFlag DivByZero: SetFlag IntOverflow: Ignore IntDivByZero: Trap Divide-by-Zero Test: Trapped with flag IntDivByZero Current Flag Settings: Invalid: 0 Inexact: 0 OverFlow: 0 Underflow: 0 DivByZero: 0 IntOverflow: 0 IntDivByZero: 0 The program tests the behavior of the system in the event of integer overflow (on both signed and unsigned integers) and integer division by zero. As you can see, the implementation of the FloatMode interface on this architecture supports only the "Ignore" behavior for the "IntOverflow" numeric exception, and only the "Trap" behavior for the "IntDivByZero" numeric exception. Since integer overflow is ignored, the program must manually test for it. Notice also that the system's exception flags are all initially reset, and that they are never set. Here are the three files and the m3makefile: ---------------------------- ShowFloatMode.i3 --------------------------------- (* Copyright (C) 1993, Digital Equipment Corporation. *) (* All rights reserved. *) (* See the file COPYRIGHT for a full description. *) (* *) (* Last modified on Wed Nov 10 21:01:01 PST 1993 by heydon *) (* Report various aspects of the floating-point mode for the current thread. *) INTERFACE ShowFloatMode; IMPORT Wr; CONST ModeName = ARRAY OF TEXT { "NearestElseEven", "TowardMinusInfinity", "TowardPlusInfinity", "TowardZero", "NearestElseAwayFromZero", "IBM370", "Other" }; FlagName = ARRAY OF TEXT { "Invalid", "Inexact", "OverFlow", "Underflow", "DivByZero", "IntOverflow", "IntDivByZero" }; BehaviorName = ARRAY OF TEXT { "Trap", "SetFlag", "Ignore" }; PROCEDURE RoundingMode(wr: Wr.T); (* Report the current rounding mode to "wr". *) PROCEDURE Flags(wr: Wr.T); (* Report the status of each "FloatMode.Flag" to "wr". *) PROCEDURE Behaviors(wr: Wr.T); (* Report the behavior for each "FloatMode.Flag" to "wr". *) END ShowFloatMode. ---------------------------- ShowFloatMode.m3 --------------------------------- (* Copyright (C) 1993, Digital Equipment Corporation. *) (* All rights reserved. *) (* See the file COPYRIGHT for a full description. *) (* *) MODULE ShowFloatMode; IMPORT Wr, FloatMode, Text, Fmt, Thread; <* FATAL Wr.Failure, Thread.Alerted *> CONST Indent = " "; VAR (* READONLY *) MaxFlagNameLen: CARDINAL; PROCEDURE ModeToText(mode: FloatMode.RoundingMode): TEXT = BEGIN RETURN ModeName[ORD(mode)] END ModeToText; PROCEDURE RoundingMode(wr: Wr.T) = BEGIN Wr.PutText(wr, "Current Rounding Mode:\n"); Wr.PutText(wr, Indent & ModeToText(FloatMode.GetRounding()) & "\n"); Wr.Flush(wr) END RoundingMode; PROCEDURE WriteFlagName(wr: Wr.T; f: FloatMode.Flag) = VAR name := FlagName[ORD(f)] & ":"; BEGIN Wr.PutText(wr, Indent); Wr.PutText(wr, Fmt.Pad(name, MaxFlagNameLen+2, align := Fmt.Align.Left)); END WriteFlagName; PROCEDURE FlagSetting(wr: Wr.T; f: FloatMode.Flag; set: BOOLEAN) = BEGIN WriteFlagName(wr, f); Wr.PutChar(wr, VAL(ORD('0') + ORD(set), CHAR)); Wr.PutChar(wr, '\n') END FlagSetting; PROCEDURE Flags(wr: Wr.T) = VAR flags := FloatMode.GetFlags(); BEGIN Wr.PutText(wr, "Current Flag Settings:\n"); FOR f := FIRST(FloatMode.Flag) TO LAST(FloatMode.Flag) DO FlagSetting(wr, f, f IN flags) END; Wr.Flush(wr) END Flags; PROCEDURE FlagBehavior(wr: Wr.T; f: FloatMode.Flag) = BEGIN WriteFlagName(wr, f); Wr.PutText(wr, BehaviorName[ORD(FloatMode.GetBehavior(f))]); Wr.PutChar(wr, '\n') END FlagBehavior; PROCEDURE Behaviors(wr: Wr.T) = BEGIN Wr.PutText(wr, "Current Flag Behavior Settings:\n"); FOR f := FIRST(FloatMode.Flag) TO LAST(FloatMode.Flag) DO FlagBehavior(wr, f) END; Wr.Flush(wr) END Behaviors; BEGIN MaxFlagNameLen := 0; FOR i := FIRST(FlagName) TO LAST(FlagName) DO IF Text.Length(FlagName[i]) > MaxFlagNameLen THEN MaxFlagNameLen := Text.Length(FlagName[i]) END END END ShowFloatMode. ---------------------------- FloatModeTest.m3 --------------------------------- (* Copyright (C) 1993, Digital Equipment Corporation. *) (* All rights reserved. *) (* See the file COPYRIGHT for a full description. *) (* *) MODULE FloatModeTest EXPORTS Main; IMPORT ShowFloatMode, Wr, Thread, Fmt, Text, FloatMode, Word; FROM Stdio IMPORT stdout; <* FATAL Wr.Failure, Thread.Alerted *> CONST Indent = " "; PROCEDURE SetBehavior(wr: Wr.T; f: FloatMode.Flag; b: FloatMode.Behavior) = VAR bName := ShowFloatMode.BehaviorName[ORD(b)] & "\""; BEGIN Wr.PutText(wr, Indent & "\""); Wr.PutText(wr, Fmt.Pad(bName, 8, align := Fmt.Align.Left) & " => "); TRY FloatMode.SetBehavior(f, b); Wr.PutText(wr, "Succeeded") EXCEPT FloatMode.Failure => Wr.PutText(wr, "Failed") END; Wr.PutChar(wr, '\n') END SetBehavior; PROCEDURE SetAllBehaviors(wr: Wr.T; f: FloatMode.Flag) = BEGIN Wr.PutText(wr, "Setting behavior for flag \"" & ShowFloatMode.FlagName[ORD(f)] & "\":\n"); FOR b := FIRST(FloatMode.Behavior) TO LAST(FloatMode.Behavior) DO SetBehavior(wr, f, b) END END SetAllBehaviors; PROCEDURE WriteTrap(wr: Wr.T; f: FloatMode.Flag) = BEGIN Wr.PutText(wr, Indent); Wr.PutText(wr, "Trapped with flag "); Wr.PutText(wr, ShowFloatMode.FlagName[ORD(f)]); Wr.PutChar(wr, '\n'); END WriteTrap; PROCEDURE Int(wr: Wr.T) = VAR i: INTEGER := LAST(INTEGER) DIV 8; BEGIN Wr.PutText(wr, "Integer Overflow Test:\n"); TRY LOOP Wr.PutText(wr, Indent & Fmt.Int(i) & "\n"); IF i <= 0 THEN EXIT END; i := i * 2 END EXCEPT FloatMode.Trap (flag) => WriteTrap(wr, flag) END END Int; PROCEDURE FmtUnsigned(x: Word.T): TEXT = (* Return the decimal representation of "x" as an unsigned integer in the range "[0, 2^Word.Size)". *) PROCEDURE P(x: Word.T): TEXT = BEGIN IF x = 0 THEN RETURN "" ELSE VAR ch := VAL(ORD('0') + Word.Mod(x, 10), CHAR); BEGIN RETURN P(Word.Divide(x, 10)) & Text.FromChar(ch) END END END P; BEGIN IF x = 0 THEN RETURN "0" ELSE RETURN P(x) END END FmtUnsigned; PROCEDURE Unsigned(wr: Wr.T) = CONST MSB = Word.Shift(1, Word.Size-1); VAR i: Word.T := LAST(INTEGER) DIV 8; last: Word.T := 0; BEGIN Wr.PutText(wr, "Unsigned Overflow Test:\n"); TRY LOOP Wr.PutText(wr, Indent & FmtUnsigned(i) & "\n"); IF Word.And(last, MSB) = MSB THEN EXIT END; last := i; i := Word.Times(i, 2); END EXCEPT FloatMode.Trap (flag) => WriteTrap(wr, flag) END END Unsigned; PROCEDURE DivBy(wr: Wr.T; zero: INTEGER) = VAR i: INTEGER; BEGIN Wr.PutText(wr, "Divide-by-Zero Test:\n"); TRY i := 1 DIV zero; Wr.PutText(wr, Indent & "No trap\n") EXCEPT FloatMode.Trap (flag) => WriteTrap(wr, flag) END END DivBy; BEGIN ShowFloatMode.RoundingMode(stdout); ShowFloatMode.Flags(stdout); ShowFloatMode.Behaviors(stdout); SetAllBehaviors(stdout, FloatMode.Flag.IntOverflow); ShowFloatMode.Behaviors(stdout); Int(stdout); ShowFloatMode.Flags(stdout); Unsigned(stdout); ShowFloatMode.Flags(stdout); SetAllBehaviors(stdout, FloatMode.Flag.IntDivByZero); ShowFloatMode.Behaviors(stdout); DivBy(stdout, 0); ShowFloatMode.Flags(stdout); END FloatModeTest. ------------------------------- m3makefile ------------------------------------ /* Copyright (C) 1992, Digital Equipment Corporation */ /* All rights reserved. */ /* See the file COPYRIGHT for a full description. */ /* */ module (ShowFloatMode) implementation (FloatModeTest) program (FloatModeTest) ------------------------------------------------------------------------------- Allan Heydon heydon@src.dec.com DEC Systems Research Center (415) 853-2142 130 Lytton Ave. (415) 853-2104 (FAX) Palo Alto, CA 94301 ======================================================================= 10 === Date: 12 Nov 93 13:15:48 GMT From: mikeg@psg.com (Mike Gallo) Subject: tech reports? What is the e-mail address for ordering technical reports from DEC SRC? -- I don't care about being famous, I just want to be great. -- Ray Charles ======================================================================= 11 === Date: Wed, 17 Nov 93 05:26:03 -0600 From: jsoft!ggf@uu4.psi.com (Gary Frederick) Subject: Modula-3 and ANDF Has anyone looked at turning Modula-3 V 3.0 into an ANDF producer? Gary ======================================================================= 12 === Date: Thu, 18 Nov 1993 10:22:30 GMT From: oneill@cs.sfu.ca (Melissa O'Neill) Subject: Exasperated! Trying to compile SRC Modula-3... SRC Modula-3, 2.11 is lists the NEXT platform among its supported architectures. Yet after trying to get the language to compile for the NeXT (OS version 3.1), I feel exasperated and I've been unable to get the system to compile correctly. This is the second time I've tried, and given up after investing a huge amount of effort for no result. The last time I tried, someone mentioned to me that a pre-built version of Modula-3 was available at cs.orst.edu in /pub/next/binaries/proglang/m3.NEXT.2.11.compressed. Unfortunately, I had several concerns about using the pre-built version. For one thing, paths had been hardwired to specific places (/usr/local) which didn't match my own configuration (while evaluating Modula-3, I didn't want to have to install it in /usr/local and on some of the machines I use, I even don't *have* write access to /usr/local). Also, Gary who did the build for the NEXT said, in the accompan ying README file: > You can probably save some space if you rebuild the libraries with -g > off. I built the original with -g on for everything. ... which seemed to indicate that re-building the system for myself would be a good idea. He also said: > There are messages about some of the archive names getting truncated > when building libm3. I am ignoring that for now... ... which seemed an issue of some concern to me, and something I should see for myself. So, building the system for myself seemed like this sensible thing to do. Plus, if I couldn't get it compile itself, I didn't feel that I could have much confidence in its reliability in my configuration. (And there was the fact that, Gary had done his build with '-O' where one might get improved performance by using '-O2'.) Try as I might, I could not get the thing to compile. Looking at Gary's pre-built version, I found some fixes that let things progress further than they went with the 'out of the box' code from gatekeeper.dec.com. For one thing, makefiles relied on 'dirname' which isn't a utility present on the NEXT. Hardly difficult to add, but annoying none the less. Also, Imake needed to use a 'traditional' cpp, so Gary had created a file called 'm3cpp' that invoked /lib/cpp with the '-traditional' flag. These changes allowed compilation to progress beyond a rudimentary point, but the built m3 compiler crashed on invocation (i.e. at the compilation of the first file in libm3). Looking at Gary's work again, it appeared that he had edited M3Machine.h, changing: #define _NILCHECKB(e) _M3__nil_check_char = ((char*)(e))[-1]; to: #define _NILCHECKB(e) _M3__nil_check_char = *((char*)(e)); ... so I did the same (although it hardly seemed an intuitive thing to do). And compilation progress further. It actually did compile some of the files in libm3 before flaking out. It died while trying to compile time/src/LongRealTime.i3, saying 'runtime error: Segmentation violation - possible attempt to dereference NIL'. I tried changing compiler parameters (turning off optimization, etc), but nothing seemed to help. I'm tired, exasperated and a little annoyed. I have the feeling that I shouldn't be put through all this. Please, if someone can tell me how I can build Modula-3 reliably under NEXTSTEP 3.1, I'll eager to listen. Melissa. Enc. : : new source -> compiling ../time/src/LongRealTime.i3 *** *** Segmentation violation - possible attempt to dereference NIL *** seconds #times operation -0.00 1 flattening search path -0.00 115 checking object timestamps -0.00 111 checking old link info -0.00 1 compiling Modula-3 -> C 0.00 3 removing temporary files 00000000000000003ACCHFDBDDA@.@G 6 garbage collection -000000000002GFELLKEIE.GF other --------------------------------------------------- -0.00 TOTAL Fatal Error: program "/tmp/local/lib/m3/m3compiler" got fatal signal 3 *** Exit 255 Stop. *** Exit 1 Stop. next_mach3.1% gdb /tmp/local/bin/m3 core GDB is free software and you are welcome to distribute copies of it under certain conditions; type "show copying" to see the conditions. There is absolutely no warranty for GDB; type "show warranty" for details. GDB 4.7 (NeXT 3.1), Copyright 1992 Free Software Foundation, Inc... Reading symbols from /tmp/local/bin/m3...done. Reading symbols from /usr/shlib/libsys_s.B.shlib...done. 0x5007974 in kill () (gdb) bt Reading in symbols for RefRefTbl_m.c...done. Reading in symbols for RTProc_m.c...done. Reading in symbols for TxtRefTbl_m.c...done. Reading in symbols for RTutils_m.c...done. Reading in symbols for IntegerToRefanyTable_m.c...done. #0 0x5007974 in kill () #1 0x135600 in ?? () #2 0xb4b88 in ?? () #3 0xba6e6 in ?? () #4 0x50083ac in _sigtramp () #5 0xac820 in _M_Uin () #6 0xac04e in _M_Uin () #7 0xab842 in _M_Uin () #8 0xab3ce in _M_Uin () #9 0xadb3e in _t4f1a2355_TC () #10 0xad840 in _M_Uin () #11 0xae1b0 in _t4796f6c9_TC () #12 0x39d7e in RefRefTbl__CopyEntries (t=0x13, old=0x819d2, new=0x61c5f0) at Re fRefTbl.m3:546 #13 0x5fe7a in RTProc__FromFingerprint (fp=0x675c98) at RTProc.m3:69 #14 0x3f1fa in TxtRefTbl__Rehash (t=0x676000, expand=0 '\000') at TxtRefTbl.m3: 649 #15 0x63182 in RTutils__Delta (v1=0x33a "", v2=0x616700 "") at RTutils.m3:48 #16 0x68046 in _fvmlib_init1 () #17 0x67f4a in _fvmlib_init1 () #18 0x43abc in IntegerToRefanyTable__In (table=0x61c5f0 "", key=1343, value=0x1 465d4) at IntegerToRefanyTable.m3:351 #19 0x43e18 in IntegerToRefanyTable__DoDelete (t=0x61c5f0, buck=0x0, hash=3, ke y=826, value=0x1465d4, probes=0x676000) at IntegerToRefanyTable.m3:525 #20 0xb8090 in ?? () #21 0xbb298 in ?? () (gdb) --- I am Woman, hear me Roa... oh, sorry, was I interrupting... no no, it wasn't important... no, really; it's fine. // Melissa O'Neill ======================================================================= 13 === Date: Sat, 20 Nov 1993 10:26:16 GMT From: pgs1002@cus.cam.ac.uk (Dr P.G. Sjoerdsma) Subject: Reading numbers I'm developing some code for spectral analysis and need to read a lot of numbers (LONGREAL). Unless I'm mistaken, and much to my surprise, there isn't a standard reader class that provides services like reading LONGREAL's or REAL's from an input stream. Is one supposed to implement all these services or is there somewhere code available. Uptill now I've fetched a word from an input stream and used Scan to convert and check it. It works but a class that would use for example the BNF syntax to check directly against the input would be more effective. Has this been done somewhere. Besides this I think it's a great language (after some years in C++). What is the current status on Release 3, and what are the major changes???? Paul -- ___ (o o) -----------------------------ooO-(_)-Ooo----------------------------- Paul Sjoerdsma, Godwin Laboratory, Free School Lane, Cambridge CB2 3RS England fax: (44) (0)223-334871, email: pgs1002@cus.cam.ac.uk --------------------------------------------------------------------- ======================================================================= 14 === Date: 21 Nov 1993 23:51:57 GMT From: browland@delphi.com (BRENT ROWLAND) Subject: ftp'able modula 3 text Does there exist a free Modula 3 definition and overview that can be gotten by ftp? I've gotten similar documents covering Oberon (-2) and would like to be able to compare them with Modula 3. Perhaps I missed them, but I already looked around on gatekeeper.dec.com. Please excuse me if this is a FAQ. Right after posting this I will rtfm. ======================================================================= 15 === Date: Mon, 22 Nov 1993 22:35:49 GMT From: dineen@apollo.hp.com (Terence H Dineen) Subject: Building M3 on HPUX 9.0? Can Modula-3 2.11 be built for either a HPPA or HP400 running HPUX 9.0? I have found that I needed to set BOOTOPTS = -Aa inorder to get the compiler sources to compile and that the resulting executable core dumps when I try to build libm3. Is there a straightforward hack to fix this. Or should I wait for 3.0? Thanks. ======================================================================= 16 === Date: 24 Nov 93 14:37:59 GMT From: edmundsa@cs.man.ac.uk (Andrew Edmunds) Subject: Trestle documentation I am doing a project which involves writing a graphics application and I would like to do it in Modula-3 using the Trestle interface to X. Since I'm a newcomer to both Modula-3 and X-windows programming, some extra documentation (apart from what comes with Modula-3) would be a big help. Does anyone know where I can get copies (either on-line or printed) of: 1) The Trestle Reference Manual 2) Trestle Tutorial Mark S. Manasse and Greg Nelson SRC Research Report 69 May 1, 1992 3) Any other documentation on Trestle Many thanks for your help. ======================================================================= 17 === Date: Wed, 24 Nov 93 09:40:09 -0800 From: heydon@src.dec.com Subject: Re: Reading numbers > I'm developing some code for spectral analysis and need to read a lot > of numbers (LONGREAL). Unless I'm mistaken, and much to my surprise, > there isn't a standard reader class that provides services like > reading LONGREAL's or REAL's from an input stream. Is one supposed to > implement all these services or is there somewhere code available. > Uptill now I've fetched a word from an input stream and used Scan to > convert and check it. It works but a class that would use for example > the BNF syntax to check directly against the input would be more > effective. Has this been done somewhere. Besides this I think it's a > great language (after some years in C++). See the "Lex" interface. In addition to procedures for scanning, skipping, and matching certain character patterns in a reader, this interface also has procedures for reading various Modula-3 values from readers as ASCII characters (Booleans, integers, reals, longreals) and returning them. For example, here is the "Lex" procedure for reading a longreal: PROCEDURE LongReal(rd: Rd.T; READONLY cs: SET OF CHAR := NonBlanks): LONGREAL RAISES {Rd.Failure, Convert.Failed, Error}; (* Interprets the longest prefix of rd made of cs's as a longreal. It does so by applying Convert.ToLongFloat to the text obtained by Scan(rd, cs). Raises Error if Convert.ToLongFloat does not use the entire prefix. *) ("Scan" is another procedure in the "Lex" interface that returns a text containing the longest prefix of characters in "cs" on "rd".) One problem with this design is that the longest prefix of characters in "cs" is used in the conversion. So if you use the default value for "cs" and your number is not followed by whitespace, the conversion will fail. Also, if the characters on the reader do not form a syntactically valid longreal, the reader will read all the way up to the first whitespace character, so on exit from this procedure, there is no indication as to which character in the stream caused the "parse" error. These deficiencies have been corrected in the version of the "Lex" interface that will be included with version 3.0 of the compiler. Also, the "Scan" and "Convert" interfaces have been dropped, since they are embodied by the new "Lex". - Allan ------------------------------------------------------------------------------- Allan Heydon heydon@src.dec.com DEC Systems Research Center (415) 853-2142 130 Lytton Ave. (415) 853-2104 (FAX) Palo Alto, CA 94301 ======================================================================= 18 === Date: Wed, 24 Nov 93 15:32:16 -0800 From: heydon@src.dec.com Subject: Re: Trestle documentation > Does anyone know where I can get copies (either on-line or printed) of: > > 1) The Trestle Reference Manual > > 2) Trestle Tutorial > Mark S. Manasse and Greg Nelson > SRC Research Report 69 > May 1, 1992 > > 3) Any other documentation on Trestle (1) is also available as a SRC Research Report: Trestle Reference Manual Mark S. Manasse and Greg Nelson SRC Research Report 68 December, 1991 As advertised in the FAQ posted on 11/01 to this group, hardcopy versions of these reports can be ordered by e-mail: send your request including a postal mail address to src-reports@src.dec.com. A revised version of (2) is also published as chapter 7 of "Systems Programming with Modula-3", edited by Greg Nelson. Both the Trestle Reference Manual and the Trestle Tutorial are also available on-line. Aside from the introductory chapter, the entire reference manual was produced automatically from the Trestle interfaces. And the Trestle Tutorial is in the compressed tar file "trestletutorial-2.11.tar.Z" of the SRC Modula-3 release. The advantages to the on-line version of the tutorial are that it is up-to-date with the latest Trestle interfaces, and the code stubs for the exercises are on-line, so you don't have to type everything in from scratch. The reference manual and the tutorial are all you need to start writing Trestle programs. You should also look into VBTkit and FormsVBT. These are toolkits that make it easy to build GUI's. These systems are both part of the SRC Modula-3 distribution. - Allan ------------------------------------------------------------------------------- Allan Heydon heydon@src.dec.com DEC Systems Research Center (415) 853-2142 130 Lytton Ave. (415) 853-2104 (FAX) Palo Alto, CA 94301 ======================================================================= 19 === Date: Wed, 24 Nov 1993 02:28:13 GMT From: dagenais@gutrune.vlsi.polymtl.ca (Michel Dagenais) Subject: m3make and interdependant libraries The newsgroup is relatively calm lately, as is usually the case when everyone awaits a major release :-). I have two libraries, let say A and B. Some modules in A use objects declared in B and some modules in B use objects declared in A but of course there are no circular dependencies among modules. Using m3make, let say for A, all the compilation of the modules and interfaces goes correctly but the library file (A.a) is not produced because m3make complains that it needs the compiled interfaces imported from B. Similarly, the B library cannot be constructed before the A library since it requires the compiled interfaces of library A. It is possible to compile the required interfaces by hand (with m3 instead of m3make) and bootstrap the library creation. It is also possible to merge the two libraries or decompose them differently in order to get rid of the interdependency. Is my understanding correct? Why are the imported compiled interfaces required when the library is built (m3 -o A.a *.[mi]o), and not simply at link time when an application will import the A and B libraries? -- --------------------------------------------------------------------- Prof. Michel Dagenais dagenais@vlsi.polymtl.ca Dept of Electrical and Computer Eng. Ecole Polytechnique de Montreal tel: (514) 340-4029 --------------------------------------------------------------------- ======================================================================= 20 === Date: Wed, 24 Nov 1993 22:56:46 GMT From: stuarth@csis.dit.csiro.au (Stuart Hungerford) Subject: Has anyone ported the Stanford Integer (SI) benchmarks to M3? Hi, I'm in the process of comparing the performance of various object-oriented languages across different architectures. One of the tests I'd like to run is the Standford Integer benchmarks. So I'm wondering if anyone out there has already ported the original C code to Modula 3? -- Stu /-----------------------------------------------------------------------------/ / Stuart Hungerford - CSIRO D.I.T. - Canberra, Australia /