> On Feb 2, 2018, at 1:03 PM, Paul Gilmartin
> <00000014e0e4a59b-dmarc-requ...@listserv.uga.edu> wrote:
> On 2018-02-02, at 02:24:51, Bernd Oppolzer wrote:
>> My string implementation uses two length fields in front of every string,
>> the first being the maxlength field, which tells the maximum length that the
>> string can hold, and the second one is the actual length, which obviously
>> be less or equal to the maxlength. Both length fields are two bytes, like in
>> PL/1 varchars,
>> so a string can by up to 32767 bytes in length. A string variable defined as
>> STRING (20)
>> occupies 24 bytes.
> That does not support defining substrings without copying.
> Why limit to 32767 (or even 65535)?
Because at the time, memory was very limited and there were other issues.
> On 2018-02-02, at 06:28:54, Martin Ward wrote:
>> The original Pascal string used a single byte for the length
>> at a time when a $70K machine had a mere 4K words of memory.
> I don't recall seeing that in Wirth's Pascal User Manual and Report,
> which I consider to describe the "original Pascal". And:
> Early Pascal compilers
> The first Pascal compiler was designed in Zürich for the CDC 6000 series
> mainframe computer family.
> Hardly computers of the scale you're considering.
Well, the first CDC computer I ever touched was in 1976, with a nice newly
minted Pascal compiler on it. I *think* it was derived from the UCSD P system,
but it may have been a direct descendant of one of the earlier compilers.
At the time, it was difficult to do some things in Pascal, if memory serves me
right (and it may be failing, I was a very young buck at that time!) - the
length of strings and arrays were embedded in the types. That hasn’t been the
case for decades, but the then just out of high school me might have
misunderstood. I know tangling with Pascall on an HP3K a little later was an
interesting experience, and that was a much more modern compiler.
Of course, around that time, we were having to write compilers in school - both
Pascal and Fortran. Fortran was much much easier. :)
> On 2018-02-01, at 20:13:21, Robin Vowels wrote:
>>> o It should be two pointers, first byte and last byte + 1.
>> The address of the start of the string and the length are probably better.
> I may have been biased by the Block Transfer instruction of the PDP-6 whose
> Block Transfer instruction, interruptible like MVCL, used front and back
> pointers. One register fewer to update on interrupt at the cost of one
> instruction more for strlen().
> Using two pointers avoids tempting implementers with the false economy of
> chiseling a few bits from the length field for flags or simply to save a
> byte. How did MVCL deal with such restrictions on XA?
> How should strings crossing segment boundaries be supported (286? ESA?)
> -- gil
Yikes! By going to baseless programming or at least finding a x386 or Motorola
chip somewhere would be my suggestion. :) (Pun Intended!)