home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!think.com!ames!agate!ucbvax!ko.hhs.dk!ARNE
- From: ARNE@ko.hhs.dk (Arne Vajhxj)
- Newsgroups: comp.os.vms
- Subject: Re: Help! SMG$GET_TERM_DATA/VAX PASCAL
- Message-ID: <01GR5BWLC7VM8WW9XB@kopc.hhs.dk>
- Date: 14 Nov 92 15:12:11 GMT
- Sender: daemon@ucbvax.BERKELEY.EDU
- Distribution: world
- Organization: The Internet
- Lines: 79
-
- > I'd _really_really_ appreciate it if someone could get the VAX PASCAL code
- > below my sig to work properly (and send me a copy... <grin>). Basically,
- > I'm having difficulties passing the buffer address to SMG$GET_TERM_DATA...
- > who's bright idea was it to define "Address - Unsigned Longword" as an
- > [UNSAFE] ^[UNSAFE] INTEGER????
-
- > [inherit('sys$library:starlet','sys$library:pascal$smg_routines')]
- > program termtab(input,output);
- > type
- > $DEFTYP = [UNSAFE] INTEGER; {as found in pascal$smg_routines.pas}
- > $DEFPTR = [UNSAFE] ^$DEFTYP; {ditto}
- >
- > var
- > stat : integer;
- > termadr : unsigned;
- > bufadr : $DEFPTR;
- > line : varying [12] of char; {arbitrary length string}
- > junk : integer;
- > i : integer;
- >
- > begin
- > stat := SMG$INIT_TERM_TABLE(%descr 'VT200_Series',termadr);
- > if not(odd(stat)) then $exit(stat);
- >
- > line := zero;
- > bufadr := iaddress(line.body); {this is what gives me problems, I think}
- >
- > {should return 4 character string "<esc>[2J"}
- > stat := SMG$GET_TERM_DATA(termadr,SMG$K_ERASE_WHOLE_DISPLAY,12,junk,bufadr);
- > if not(odd(stat)) then $exit(stat);
- > line.length := junk;
- >
- > writeln('length = ',junk:1); {this works okay... returns '4'}
- > writeln('"',line.body,'"'); {... but this doesn't}
- >
- > {display the entire string for debugging purposes}
- > for i:=1 to 12 do
- > writeln(i:2,' "',line.body[i],'" (',ord(line.body[i]):1,')');
- > end.
-
- The following SIMPLE modification works for me:
-
- [inherit('sys$library:starlet','sys$library:pascal$smg_routines')]
- program termtab(input,output);
-
- var
- stat : integer;
- termadr : unsigned;
- line : varying [12] of char; {arbitrary length string}
- junk : integer;
- i : integer;
-
- begin
- stat := SMG$INIT_TERM_TABLE(%descr 'VT200_Series',termadr);
- if not(odd(stat)) then $exit(stat);
-
- line := zero;
-
- {should return 4 character string "<esc>[2J"}
- stat := SMG$GET_TERM_DATA(termadr,SMG$K_ERASE_WHOLE_DISPLAY,12,junk,
- %REF line.body);
- if not(odd(stat)) then $exit(stat);
- line.length := junk;
-
- writeln('length = ',junk:1); {this works okay... returns '4'}
- writeln('"',line.body,'"'); {... but this doesn't} (* NOW IT DOES *)
-
- {display the entire string for debugging purposes}
- for i:=1 to 12 do
- writeln(i:2,' "',line.body[i],'" (',ord(line.body[i]):1,')');
- end.
-
- Arne
-
- Arne Vajhxj local DECNET: KO::ARNE
- Computer Department PSI: PSI%23831001304030::ARNE
- Business School of Southern Denmark Internet: ARNE@KO.HHS.DK
-
-
-