🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #4939

Re: Clever way to deal with this?

#4939
From: R.X. Getter
Date: Tue, 13 Feb 1990 18:07
29 lines
1348 bytes
In article <90043.054652MARK@UCF1VM.BITNET> Modula2 List <INFO-M2%UCF1VM.BITNET@PSUVM.PSU.EDU> writes:
>Anyone know of a clever way to express this in Modula-2?
>
>I have a data structure consisting of a cardinal value followed by a
>variable number of characters.  The cardinal indicates how many characters
>follow.

you need a linked list of characters to handle this.

TYPE
	string = RECORD
			numChars : CARDINAL;
			text     : POINTER TO Node;
	END;

	Node = RECORD
			char : CHAR;
			next : POINTER TO Node;
	END;

you will also need a bunch of utility procedures for manipulating this.
also, the cardinal value isn't really needed unless you're using it as
a reference. What are you doing? the only things I have ever seen which
use a structure like this are basic interpreters. that's how they 
do strings.

no sig yet,

	Robert Getter
Technical Details
Message-ID: <2197@ultb.isc.rit.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!ames!haven!udel!rochester!rit!ultb!rxg3321
References: <90043.054652MARK@UCF1VM.BITNET>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!ames!haven!udel!rochester!rit!ultb!rxg3321
From: rxg3321@ultb.isc.rit.edu (R.X. Getter)
Newsgroups: comp.lang.modula2
Subject: Re: Clever way to deal with this?
Message-ID: <2197@ultb.isc.rit.edu>
Date: 13 Feb 90 18:07:45 GMT
References: <90043.054652MARK@UCF1VM.BITNET>
Reply-To: rxg3321@ultb.isc.rit.edu (R.X. Getter )
Organization: Information Systems and Computing @ RIT, Rochester, New York
Lines: 29