Article View: bit.listserv.simula
Article #459Re: Type casting in Simula?
From: Gorel Hedin
Date: Thu, 09 Dec 1993 15:18
Date: Thu, 09 Dec 1993 15:18
40 lines
2287 bytes
2287 bytes
In article q70@ugle.unit.no, chris@mtdhp1.marintek.sintef.no (Christian Steinebach) writes: > > Is there a way to convince a Simula compiler that an integer > is actually a pointer to character string or array of character > strings? The Lund compiler contains some library functions > (argv and envp) which return pointers to the commandline > arguments and the environment, respectively. But HOW do I > access the character strings when Simula insists in telling > me that my pointer is an integer? > > Christian > The external library routines argv and envp you are referring to are part of the Simula compiler and runtime system, and I don't think they were intended to be called directly by a normal user program. Because to use them you really need to know what is going on in the runtime system. Instead, if you want to access the command line given to a program, you can use the Simula class "CmdLineClass" which is available in the "simlib" library supplied with the Lund compiler. This class embeds the calls to argv and envp and supplies a Simula interface on a higher level. As a more concrete answer to your question, the results of argv and envp need to be converted to Simula objects by other library routines in the system, and this is done inside the CmdLineClass. The C-strings cannot be used directly as Simula texts because Simula texts have another layout than C-strings, and they are moved around by the garbage collector. If the CmdLineClass does not fit your needs, you can probably get help from Lund Software. ---- Gorel Hedin Dept of Computer Science Lund University
Technical Details
Message-ID:
<2e7fkq$d8p@nic.lth.se>Path:
arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!sunic!news.lth.se!niping!gorelReferences:
<2e6mre$q70@ugle.unit.no>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113dd9,c7d2d639a1959b7e X-Google-Attributes: gid113dd9,public X-Google-ArrivalTime: 1993-12-10 05:37:35 PST Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!sunic!news.lth.se!niping!gorel From: gorel@dna.lth.se (Gorel Hedin) Newsgroups: bit.listserv.simula Subject: Re: Type casting in Simula? Date: 9 Dec 1993 15:18:50 GMT Organization: Dept of Comp Science, LTH Lines: 41 Distribution: world Message-ID: <2e7fkq$d8p@nic.lth.se> References: <2e6mre$q70@ugle.unit.no> Reply-To: gorel@dna.lth.se NNTP-Posting-Host: niping.dna.lth.se