UK4H@DKAUNI2.BITNET ("JAE ", Juergen A. Erhard) (02/14/90)
Hi folks, many, many comments on marks original msg I've read. And now, I'd like to (re)add my 2 cents worth to it. All (Mark@ecncdc, stephen, robert, dave) came up with some dynamic allocation scheme. Me too. Only Tim thought of something else, but that's after the second msg from Mark. My thoughts now: Best thing to do in M2 would be: record num:CARDINAL; chars:ARRAY (.0..<some limit>.) OF CHAR; end; On Tim's msg: Stupid thing, this one: > charPtr := SYSTEM.ADR(buffer.text[i]); > InOut.Write(charPtr:) Why not do: InOut.Write(buffer.text i ); See the point, Tim? > Hope this adds something to the discussion. Sure... Mark, what do you mean with > The actual characters are fixed in length, but <...> ???? Do you determine the storage size at run time, too??? Well, I'm writing an editor myself, and it uses some representation similar to the dynamic ones the others layed out. If only I could upload it onto this IBM here... Maybe this msg wasn't as clear as I'd like it to be, but sometimes (like today) I'm a bit confused (and confusing)... -jae ======================================================================== Juergen A. Erhard eMail: uk4h@dkauni2.bitnet phone: (+49) 721/591602 "You know that it's monday when you wake up and it's tuesday." Garfield DISCLAIMER: none, I don't speak legalese.
bailey%candide@GARGOYLE.UCHICAGO.EDU (Stephen Wilson Bailey) (02/15/90)
Right, you just ditch the ancillary pointer arithmetic entirely, using the array. I don't think you can avoid a pointer entirely, though. Specifically, type BufType = RECORD length: CARDINAL; text: ARRAY CARDINAL OF CHAR; END; But then: VAR buf: BufType; This will try to create a huge, static data object. What you must do instead is cast a smaller (ALLOCATEd) data object as an object of type BufType, and the only way to do this is with a pointer, per my original message. Steph
MARK@UCF1VM.BITNET (Mark Woodruff) (02/20/90)
In article <"90-02-14-14:03:50.03*UK4H"@DKAUNI2.BITNET>, "JAE (Juergen A. Erhard)" <UK4H@DKAUNI2.BITNET> says: > > >Mark, what do you mean with >> The actual characters are fixed in length, but <...> >???? >Do you determine the storage size at run time, too??? Yep. Each line for a given file has the same width, but the width can vary from file to file in the ring. The kicker is that the width of each line is determined at run time. > >Well, I'm writing an editor myself, and it uses some representation >similar to the dynamic ones the others layed out. If only I could upload >it onto this IBM here... > If you'd like a copy of mine, send me mail. It's in four modules: TextEd.Mod editor kernel, device independent TextIO.Mod simple line-oriented I/O EditIO.Mod full screen I/O Cursor.Mod PC BIOS dependent cursor shape routines It's about the tenth Modula-2 program I've ever written. It's BIG: around 3000 lines total (I'm not really sure why). The functions should be general enough to be ported to almost any sort of editor. >Juergen A. Erhard mark