[Coco] Using the Basic09 type statement. CORRECTION

Wayne Campbell asa.rand at gmail.com
Thu Apr 15 01:56:46 EDT 2021


If you looked at the t-type.txt file I attached to my reply, you will see
that I addressed that issue.

On Tue, Apr 13, 2021, 11:26 AM James Jones <jejones3141 at gmail.com> wrote:

> One issue is that BASIC09 is like K&R 1st edition C. TYPEs, the equivalent
> of structs, share a common namespace for fields. You have two types with
> identically-named fields. That won't work. (I hasten to add that each
> procedure gets its own symbol table.)
>
> On Thu, Apr 8, 2021, 10:26 Wayne Campbell <asa.rand at gmail.com> wrote:
>
> > I went through the code and made corrections. The resulting code does
> work,
> > but it is not the best code. I would have liked to have just put the text
> > here in this message, but I'm having to use my phone right now and it
> gives
> > me more trouble than it's worth when it comes to trying to put text into
> an
> > email.
> >
> > On Sun, Apr 4, 2021, 12:49 PM Wayne Campbell <asa.rand at gmail.com> wrote:
> >
> > >  I'm seeing a few problems. Most notably, you're defining apage as type
> > > PAGE, but you have no type statement for type PAGE. As for the rest, I
> > > would have to actually enter the code in and run tests on it to figure
> > out
> > > exactly what you're doing wrong.
> > >
> > > On Sun, Apr 4, 2021, 7:01 AM <coco at jechar.ca> wrote:
> > >
> > >> Ignore original code. Equal signe were missing from three lines.
> > >> Program still has issues though.
> > >>
> > >> Revised Code
> > >>
> > >> PROCEDURE ttype
> > >>   0000
> > >>   0001      TYPE LINE=sline:STRING[17]
> > >>   0011      TYPE HEADER=head:STRING[21]
> > >>   0021 ERR     TYPE SCREEN=head:HEADER;sline:LINE[6]
> > >>   0049      (* Trying to say that type SCREEN is a HEDER followed by
> an
> > >> array of 6 LINEs s each consisting of up to 17 characters. *)
> > >>   00C2
> > >>   00C3      DIM aline:LINE
> > >>   00CC      DIM ahead:HEADER
> > >>   00D5      DIM apage:PAGE
> > >>   00DE
> > >>   00DF      apage.ahead="This is the Header field of the page"
> > >>   010E      apage.aline(1)="This is line ONE of the page."
> > >>   0138      apage.aline(2)="This is line TWO of the page."
> > >>   0162      apage.aline(3)="This is line THREE of the page."
> > >>   018E
> > >>   018F      PRINT apage
> > >>   0194
> > >>   0195      END
> > >> 00DD ERROR #024
> > >> 00E6 ERROR #066
> > >> 010D ERROR #071
> > >> 0114 ERROR #065
> > >> 0117 ERROR #066
> > >> 0137 ERROR #071
> > >> 013E ERROR #065
> > >> 0141 ERROR #066
> > >> 0161 ERROR #071
> > >> 0168 ERROR #065
> > >> 016B ERROR #066
> > >> 018D ERROR #071
> > >>
> > >>
> > >>
> > >> On 2021-04-04 10:14, coco at jechar.ca wrote:
> > >> > I am trying to create a type that consists of a field that is a 21
> > >> > character string
> > >> > followed by a field that is an array of 17 character strings. I read
> > >> > some documentation and am not sure it is even possible this was my
> > >> > attempt and it's errors,
> > >> >
> > >> > PROCEDURE ttype
> > >> >  0000
> > >> >  0001      TYPE LINE=sline:STRING[17]
> > >> >  0011      TYPE HEADER=head:STRING[21]
> > >> >  0021 ERR     TYPE SCREEN=head:HEADER;sline:LINE[6]
> > >> >  0049      (* Trying to say that type SCREEN is a HEDER followed by
> an
> > >> > array of 6 LINEs s each consisting of up to 17 characters. *)
> > >> >  00C2
> > >> >  00C3      DIM aline:LINE
> > >> >  00CC      DIM ahead:HEADER
> > >> >  00D5      DIM apage:PAGE
> > >> >  00DE
> > >> >  00DF      apage.ahead="This is the Header field of the page"
> > >> >  010E ERR     apage.aline(1) "This is line ONE of the page."
> > >> >  013F ERR     apage.aline(2) "This is line TWO of the page."
> > >> >  0170 ERR     apage.aline(3) "This is line THREE of the page."
> > >> >  01A3
> > >> >  01A4      PRINT apage
> > >> >  01A9
> > >> >  01AA      END
> > >> > 00DD ERROR #024
> > >> > 00E6 ERROR #066
> > >> > 010D ERROR #071
> > >> >
> > >> > Can this be fixed or am I trying to do the impossible.
> > >> >
> > >> > Charlie
> > >>
> > >> --
> > >> Coco mailing list
> > >> Coco at maltedmedia.com
> > >> https://pairlist5.pair.net/mailman/listinfo/coco
> > >>
> > >
> >
> > --
> > Coco mailing list
> > Coco at maltedmedia.com
> > https://pairlist5.pair.net/mailman/listinfo/coco
> >
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>


More information about the Coco mailing list