🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #306

Re: Can you nest subroutines in C?

#306
From: Marco Papa
Date: Sun, 02 Jul 1989 19:22
35 lines
1703 bytes
In article <4524@crash.cts.com> wade@pnet01.cts.com (Wade Bickel) writes:
>papa@pollux.usc.edu (Marco Papa) writes:
>>In article <4495@crash.cts.com> wade@pnet01.cts.com (Wade Bickel)
>>writes: 
>>Can you have "procedure pointers"
>>in M2 (i.e., variables that hold addresses of subroutines, and that get called
>>just by referencing the variable, and that of course can be assigned to)?

>        In a word, YES.  Modula-2 is not PASCAL.  It allows pointer math and
>procedure pointers, and all the other goodies of this nature not included in
>PASCAL.

I've been told by a third party the this is not entirely true. Can you have 
procedure pointers as fields of data structure as in:

struct xpr {
	long (*xpr_open)();
	long (*xpr_close)();
	....
}

...
struct xpr *io;

io->xpr_open = MyOpen;
io->xpr_close = MyClose;

Can you do that in M2?  I'd really like to know? Also does M2 provide
setjmp/longjmp in one of the libraries?

-- Marco Papa 'Doc'
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
uucp:...!pollux!papa       BIX:papa       ARPAnet:pollux!papa@oberon.usc.edu
"There's Alpha, Beta, Gamma, Diga and Caligari!" -- Rick Unland
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Technical Details
Message-ID: <18213@usc.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!usc!pollux.usc.edu!papa
References: <4524@crash.cts.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!usc!pollux.usc.edu!papa
From: papa@pollux.usc.edu (Marco Papa)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Can you nest subroutines in C?
Message-ID: <18213@usc.edu>
Date: 2 Jul 89 19:22:08 GMT
References: <4524@crash.cts.com>
Sender: news@usc.edu
Reply-To: papa@pollux.usc.edu (Marco Papa)
Organization: Felsina Software, Los Angeles, CA
Lines: 35