Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!mit-eddie!uw-beaver!apollo!mishkin From: mishkin@apollo.uucp (Nathaniel Mishkin) Newsgroups: comp.sys.apollo Subject: Re: Apollo Pascal and Modules Message-ID: <3869b66d.c366@apollo.uucp> Date: Wed, 11-Nov-87 09:33:00 EST Article-I.D.: apollo.3869b66d.c366 Posted: Wed Nov 11 09:33:00 1987 Date-Received: Fri, 13-Nov-87 22:00:57 EST References: <678@zycad.UUCP> Reply-To: mishkin@apollo.UUCP (Nathaniel Mishkin) Organization: Apollo Computer, Chelmsford, MA Lines: 35 In article <678@zycad.UUCP> kjb@zycad.UUCP (Kevin Buchs) writes: >One may call any >procedure/function defined in any non-main module from any >module including the main module. There is one thing I >don't understand: Why can one not make calls to >procedures/functions in the "main" module from one of the >non-main modules? I can't claim to being a Pascal purist who understands the "deep" reasons for this sort of behavior, but I think the jist of the answer is this: Apollo extends Pascal by allowing multiple modules and supporting "global" ("external") and "non-global" ("internal") procedures. Procedures declared in "program"s are implicitly (and un-overridably) treated as "internal". I suspect this is because this is a "natural" extension of standard Pascal where all procedures could be thought of as being "internal". >I am using the trivial workaround now of having a 1 line >main module which calls a routine in a non-main module. >In other words, I took all the code out of the main module >and put in into a non-main module, where I can call it >from any other non-main module. > >Are there other more clever workarounds, perhaps involving >the use of extern qualifiers? Another technique is to have no "program" but instead have all "module"s, put the stuff that would have been in the "program"'s "begin/end" block into a procedure called (say) "main", and use the binder's "-entry" option: bind -b myprogram mymod1.bin mymod2.bin -entry main -- -- Nat Mishkin Apollo Computer Inc. Chelmsford, MA {decvax,mit-eddie,umix}!apollo!mishkin