home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume21
/
p2c
/
part07
< prev
next >
Wrap
Text File
|
1990-04-05
|
40KB
|
1,164 lines
Subject: v21i052: Pascal to C translator, Part07/32
Newsgroups: comp.sources.unix
Approved: rsalz@uunet.UU.NET
X-Checksum-Snefru: bf876f14 04e14e8f 2bae0911 4dd94a49
Submitted-by: Dave Gillespie <daveg@csvax.caltech.edu>
Posting-number: Volume 21, Issue 52
Archive-name: p2c/part07
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 7 (of 32)."
# Contents: examples/basic.p.2 src/HISTORY
# Wrapped by rsalz@litchi.bbn.com on Mon Mar 26 14:29:31 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'examples/basic.p.2' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'examples/basic.p.2'\"
else
echo shar: Extracting \"'examples/basic.p.2'\" \(18419 characters\)
sed "s/^X//" >'examples/basic.p.2' <<'END_OF_FILE'
X if v^.sval^ <> nil then
X dispose(v^.sval^);
X new(v^.sval^);
X v^.sval^^ := s;
X if not iseos then
X begin
X require(tokcomma);
X write('?? ');
X end;
X until iseos;
X end
X else
X begin
X readln(s);
X parse(addr(s), tok);
X tok0 := tok;
X repeat
X v := findvar;
X while tok = nil do
X begin
X write('?? ');
X readln(s);
X disposetokens(tok0);
X parse(addr(s), tok);
X tok0 := tok;
X end;
X tok1 := t;
X t := tok;
X v^.val^ := realexpr;
X if t <> nil then
X if t^.kind = tokcomma then
X t := t^.next
X else
X snerr;
X tok := t;
X t := tok1;
X if not iseos then
X require(tokcomma);
X until iseos;
X disposetokens(tok0);
X end;
X end;
X
X
X procedure cmdlet(implied : boolean);
X var
X v : varptr;
X old : basicstring;
X begin
X if implied then
X t := stmttok;
X v := findvar;
X require(tokeq);
X if v^.stringvar then
X begin
X old := v^.sval^;
X v^.sval^ := strexpr;
X if old <> nil then
X dispose(old);
X end
X else
X v^.val^ := realexpr;
X end;
X
X
X procedure cmdgoto;
X begin
X stmtline := mustfindline(intexpr);
X t := nil;
X gotoflag := true;
X end;
X
X
X procedure cmdif;
X var
X n : real;
X i : integer;
X begin
X n := realexpr;
X require(tokthen);
X if n = 0 then
X begin
X i := 0;
X repeat
X if t <> nil then
X begin
X if t^.kind = tokif then
X i := i + 1;
X if t^.kind = tokelse then
X i := i - 1;
X t := t^.next;
X end;
X until (t = nil) or (i < 0);
X end;
X if (t <> nil) and (t^.kind = toknum) then
X cmdgoto
X else
X elseflag := true;
X end;
X
X
X procedure cmdelse;
X begin
X t := nil;
X end;
X
X
X function skiploop(up, dn : tokenkinds) : boolean;
X label 1;
X var
X i : integer;
X saveline : lineptr;
X begin
X saveline := stmtline;
X i := 0;
X repeat
X while t = nil do
X begin
X if (stmtline = nil) or (stmtline^.next = nil) then
X begin
X skiploop := false;
X stmtline := saveline;
X goto 1;
X end;
X stmtline := stmtline^.next;
X t := stmtline^.txt;
X end;
X if t^.kind = up then
X i := i + 1;
X if t^.kind = dn then
X i := i - 1;
X t := t^.next;
X until i < 0;
X skiploop := true;
X 1 :
X end;
X
X
X procedure cmdfor;
X var
X l : loopptr;
X lr : looprec;
X saveline : lineptr;
X i, j : integer;
X begin
X lr.vp := findvar;
X if lr.vp^.stringvar then snerr;
X require(tokeq);
X lr.vp^.val^ := realexpr;
X require(tokto);
X lr.max := realexpr;
X if (t <> nil) and (t^.kind = tokstep) then
X begin
X t := t^.next;
X lr.step := realexpr;
X end
X else
X lr.step := 1;
X lr.homeline := stmtline;
X lr.hometok := t;
X lr.kind := forloop;
X lr.next := loopbase;
X with lr do
X if ((step >= 0) and (vp^.val^ > max)) or ((step <= 0) and (vp^.val^ < max)) then
X begin
X saveline := stmtline;
X i := 0;
X j := 0;
X repeat
X while t = nil do
X begin
X if (stmtline = nil) or (stmtline^.next = nil) then
X begin
X stmtline := saveline;
X errormsg('FOR without NEXT');
X end;
X stmtline := stmtline^.next;
X t := stmtline^.txt;
X end;
X if t^.kind = tokfor then
X if (t^.next <> nil) and (t^.next^.kind = tokvar) and (t^.next^.vp = vp) then
X j := j + 1
X else
X i := i + 1;
X if (t^.kind = toknext) then
X if (t^.next <> nil) and (t^.next^.kind = tokvar) and (t^.next^.vp = vp) then
X j := j - 1
X else
X i := i - 1;
X t := t^.next;
X until (i < 0) or (j < 0);
X skiptoeos;
X end
X else
X begin
X new(l);
X l^ := lr;
X loopbase := l;
X end;
X end;
X
X
X procedure cmdnext;
X var
X v : varptr;
X found : boolean;
X l : loopptr;
X begin
X if not iseos then
X v := findvar
X else
X v := nil;
X repeat
X if (loopbase = nil) or (loopbase^.kind = gosubloop) then
X errormsg('NEXT without FOR');
X found := (loopbase^.kind = forloop) and
X ((v = nil) or (loopbase^.vp = v));
X if not found then
X begin
X l := loopbase^.next;
X dispose(loopbase);
X loopbase := l;
X end;
X until found;
X with loopbase^ do
X begin
X vp^.val^ := vp^.val^ + step;
X if ((step >= 0) and (vp^.val^ > max)) or ((step <= 0) and (vp^.val^ < max)) then
X begin
X l := loopbase^.next;
X dispose(loopbase);
X loopbase := l;
X end
X else
X begin
X stmtline := homeline;
X t := hometok;
X end;
X end;
X end;
X
X
X procedure cmdwhile;
X var
X l : loopptr;
X begin
X new(l);
X l^.next := loopbase;
X loopbase := l;
X l^.kind := whileloop;
X l^.homeline := stmtline;
X l^.hometok := t;
X if not iseos then
X if realexpr = 0 then
X begin
X if not skiploop(tokwhile, tokwend) then
X errormsg('WHILE without WEND');
X l := loopbase^.next;
X dispose(loopbase);
X loopbase := l;
X skiptoeos;
X end;
X end;
X
X
X procedure cmdwend;
X var
X tok : tokenptr;
X tokline : lineptr;
X l : loopptr;
X found : boolean;
X begin
X repeat
X if (loopbase = nil) or (loopbase^.kind = gosubloop) then
X errormsg('WEND without WHILE');
X found := (loopbase^.kind = whileloop);
X if not found then
X begin
X l := loopbase^.next;
X dispose(loopbase);
X loopbase := l;
X end;
X until found;
X if not iseos then
X if realexpr <> 0 then
X found := false;
X tok := t;
X tokline := stmtline;
X if found then
X begin
X stmtline := loopbase^.homeline;
X t := loopbase^.hometok;
X if not iseos then
X if realexpr = 0 then
X found := false;
X end;
X if not found then
X begin
X t := tok;
X stmtline := tokline;
X l := loopbase^.next;
X dispose(loopbase);
X loopbase := l;
X end;
X end;
X
X
X procedure cmdgosub;
X var
X l : loopptr;
X begin
X new(l);
X l^.next := loopbase;
X loopbase := l;
X l^.kind := gosubloop;
X l^.homeline := stmtline;
X l^.hometok := t;
X cmdgoto;
X end;
X
X
X procedure cmdreturn;
X var
X l : loopptr;
X found : boolean;
X begin
X repeat
X if loopbase = nil then
X errormsg('RETURN without GOSUB');
X found := (loopbase^.kind = gosubloop);
X if not found then
X begin
X l := loopbase^.next;
X dispose(loopbase);
X loopbase := l;
X end;
X until found;
X stmtline := loopbase^.homeline;
X t := loopbase^.hometok;
X l := loopbase^.next;
X dispose(loopbase);
X loopbase := l;
X skiptoeos;
X end;
X
X
X procedure cmdread;
X var
X v : varptr;
X tok : tokenptr;
X found : boolean;
X begin
X repeat
X v := findvar;
X tok := t;
X t := datatok;
X if dataline = nil then
X begin
X dataline := linebase;
X t := dataline^.txt;
X end;
X if (t = nil) or (t^.kind <> tokcomma) then
X repeat
X while t = nil do
X begin
X if (dataline = nil) or (dataline^.next = nil) then
X errormsg('Out of Data');
X dataline := dataline^.next;
X t := dataline^.txt;
X end;
X found := (t^.kind = tokdata);
X t := t^.next;
X until found and not iseos
X else
X t := t^.next;
X if v^.stringvar then
X begin
X if v^.sval^ <> nil then
X dispose(v^.sval^);
X v^.sval^ := strexpr;
X end
X else
X v^.val^ := realexpr;
X datatok := t;
X t := tok;
X if not iseos then
X require(tokcomma);
X until iseos;
X end;
X
X
X procedure cmddata;
X begin
X skiptoeos;
X end;
X
X
X procedure cmdrestore;
X begin
X if iseos then
X restoredata
X else
X begin
X dataline := mustfindline(intexpr);
X datatok := dataline^.txt;
X end;
X end;
X
X
X procedure cmdgotoxy;
X var
X i : integer;
X begin
X i := intexpr;
X require(tokcomma);
X gotoxy(i, intexpr);
X end;
X
X
X procedure cmdon;
X var
X i : integer;
X l : loopptr;
X begin
X i := intexpr;
X if (t <> nil) and (t^.kind = tokgosub) then
X begin
X new(l);
X l^.next := loopbase;
X loopbase := l;
X l^.kind := gosubloop;
X l^.homeline := stmtline;
X l^.hometok := t;
X t := t^.next;
X end
X else
X require(tokgoto);
X if i < 1 then
X skiptoeos
X else
X begin
X while (i > 1) and not iseos do
X begin
X require(toknum);
X if not iseos then
X require(tokcomma);
X i := i - 1;
X end;
X if not iseos then
X cmdgoto;
X end;
X end;
X
X
X procedure cmddim;
X var
X i, j, k : integer;
X v : varptr;
X done : boolean;
X begin
X repeat
X if (t = nil) or (t^.kind <> tokvar) then snerr;
X v := t^.vp;
X t := t^.next;
X with v^ do
X begin
X if numdims <> 0 then
X errormsg('Array already dimensioned');
X j := 1;
X i := 0;
X require(toklp);
X repeat
X k := intexpr + 1;
X if k < 1 then badsubscr;
X if i >= maxdims then badsubscr;
X i := i + 1;
X dims[i] := k;
X j := j * k;
X done := (t <> nil) and (t^.kind = tokrp);
X if not done then
X require(tokcomma);
X until done;
X t := t^.next;
X numdims := i;
X if stringvar then
X begin
X hpm_new(sarr, j*4);
X for i := 0 to j-1 do
X sarr^[i] := nil;
X end
X else
X begin
X hpm_new(arr, j*8);
X for i := 0 to j-1 do
X arr^[i] := 0;
X end;
X end;
X if not iseos then
X require(tokcomma);
X until iseos;
X end;
X
X
X procedure cmdpoke;
X var
X trick :
X record
X case boolean of
X true : (i : integer);
X false : (c : ^char);
X end;
X begin
X $range off$
X trick.i := intexpr;
X require(tokcomma);
X trick.c^ := chr(intexpr);
X $if checking$ $range on$ $end$
X end;
X
X
X begin {exec}
X try
X repeat
X repeat
X gotoflag := false;
X elseflag := false;
X while (stmttok <> nil) and (stmttok^.kind = tokcolon) do
X stmttok := stmttok^.next;
X t := stmttok;
X if t <> nil then
X begin
X t := t^.next;
X case stmttok^.kind of
X tokrem : ;
X toklist : cmdlist;
X tokrun : cmdrun;
X toknew : cmdnew;
X tokload : cmdload(false, stringexpr);
X tokmerge : cmdload(true, stringexpr);
X toksave : cmdsave;
X tokbye : cmdbye;
X tokdel : cmddel;
X tokrenum : cmdrenum;
X toklet : cmdlet(false);
X tokvar : cmdlet(true);
X tokprint : cmdprint;
X tokinput : cmdinput;
X tokgoto : cmdgoto;
X tokif : cmdif;
X tokelse : cmdelse;
X tokend : cmdend;
X tokstop : escape(-20);
X tokfor : cmdfor;
X toknext : cmdnext;
X tokwhile : cmdwhile;
X tokwend : cmdwend;
X tokgosub : cmdgosub;
X tokreturn : cmdreturn;
X tokread : cmdread;
X tokdata : cmddata;
X tokrestore : cmdrestore;
X tokgotoxy : cmdgotoxy;
X tokon : cmdon;
X tokdim : cmddim;
X tokpoke : cmdpoke;
X otherwise
X errormsg('Illegal command');
X end;
X end;
X if not elseflag and not iseos then
X checkextra;
X stmttok := t;
X until t = nil;
X if stmtline <> nil then
X begin
X if not gotoflag then
X stmtline := stmtline^.next;
X if stmtline <> nil then
X stmttok := stmtline^.txt;
X end;
X until stmtline = nil;
X recover
X begin
X if escapecode = -20 then
X begin
X write('Break');
X end
X else if escapecode = 42 then
X begin end
X else
X case escapecode of
X -4 : write(#7'Integer overflow');
X -5 : write(#7'Divide by zero');
X -6 : write(#7'Real math overflow');
X -7 : write(#7'Real math underflow');
X -8, -19..-15 : write(#7'Value range error');
X -10 :
X begin
X new(ioerrmsg);
X misc_getioerrmsg(ioerrmsg^, ioresult);
X write(#7, ioerrmsg^);
X dispose(ioerrmsg);
X end;
X otherwise
X begin
X if excp_line <> -1 then
X writeln(excp_line);
X escape(escapecode);
X end;
X end;
X if stmtline <> nil then
X write(' in ', stmtline^.num:1);
X writeln;
X end;
X end; {exec}
X
X
X
X
X
Xbegin {main}
X new(inbuf);
X linebase := nil;
X varbase := nil;
X loopbase := nil;
X writeln('Chipmunk BASIC 1.0');
X writeln;
X exitflag := false;
X repeat
X try
X repeat
X write('>');
X readln(inbuf^);
X parseinput(buf);
X if curline = 0 then
X begin
X stmtline := nil;
X stmttok := buf;
X if stmttok <> nil then
X exec;
X disposetokens(buf);
X end;
X until exitflag or eof(input);
X recover
X if escapecode <> -20 then
X misc_printerror(escapecode, ioresult)
X else
X writeln;
X until exitflag or eof(input);
Xend.
X
X
X
X
END_OF_FILE
if test 18419 -ne `wc -c <'examples/basic.p.2'`; then
echo shar: \"'examples/basic.p.2'\" unpacked with wrong size!
fi
# end of 'examples/basic.p.2'
fi
if test -f 'src/HISTORY' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'src/HISTORY'\"
else
echo shar: Extracting \"'src/HISTORY'\" \(17901 characters\)
sed "s/^X//" >'src/HISTORY' <<'END_OF_FILE'
X
X
XSummary of changes to "p2c"
X------- -- ------- -- ---
X
X
XVersion 1.14:
X
X * Added partial support for Oregon Software Pascal's delete(f) procedure.
X
X * Changed file_iofunc to be a little more robust in case of errors.
X
X * Bug fix in p2clib.c:strrtrim: Changed to "while (*++s2) ;"
X Symptom: This function didn't do anything!
X
X * Bug fix in decl.c:p_type: Declared enums which were base types of sets.
X Symptom: In "type s = set of (a,b)", the enum was never declared.
X
X * Bug fix in decl.c:issafename: Avoided #defining existing field names.
X Symptom: "type r=record a:integer; end; const a=10;" produced bad code.
X
X * Bug fix in expr.c:makeexpr_charcast: Changed to recognize CONST names.
X Symptom: "const x='x'; var s : set of char; s := [x];" generated bad code.
X
XVersion 1.13:
X
X * Changed to interpret cpp-style "#include" as another include-file syntax.
X
X * Improved handling of WRITE field widths for packed arrays of char.
X
X * Improved handling of built-in identifiers in PascalCaseSens mode.
X
X * Bug fix in parse.c:p_function: used strcicmp to check for "FORWARD" keyword.
X Symptom: In PascalCaseSens mode, forward declarations had to be capitalized.
X
XVersion 1.12:
X
X * Added support for Sun/Berkeley Pascal.
X
X * Beefed up PascalCaseSens handling.
X
X * Added some extra parentheses to the P_clrbits macros. (!)
X
X * Added to sys.p2crc/trans.h the following configuration parameter:
X
X CharFileText Treat "file of char" as identical to "text".
X UseStrncmp Use strncmp, not memcmp, to compare packed arrays of char.
X MessageStderr Built-in "message(...)" should use stderr, not stdout.
X LiteralFiles Files opened without names should use file var's name.
X LiteralFile Specific files which should use LiteralFiles=1 mode.
X
XVersion 1.11:
X
X * Improved the "usage" message slightly.
X
X * Introduced "CollectNest=0" to help with include files of sub-procedures.
X
X * Changed to ignore "OVERLAY" keyword (a Turbo Pascal anachronism).
X
X * Introduced "BROKEN_OR" option in trans.h in case of compiler bugs.
X
X * Changed src/Makefile to check for presence of nroff before changing p2c.cat.
X
X * Taught strmax_func to understand string consts as well as string literals.
X
X * Changed system.imp to use __module to avoid ModuleNotation dependencies.
X
X * Prevented variables in varstructs from being declared "const".
X
X * Changed "checkvarchanged" in decl.c to observe constqual, volatilequal.
X
X * Introduced "expr_has_address" (in expr.c) as a variant on "expr_is_lvalue".
X
X * Bug fix in pexpr.c:p_funcarglist: for strings as conformant arrays, low=1.
X Symptom: Strings were passed as array [0..N] instead of [1..N].
X
X * Bug fix in decl.c:setupmeaning: added missing "break;" for MK_VARIANT case.
X Symptom: Special formatting for enumerated type names was broken.
X
X * Bug fix in p2c.h:P_getcmdline: removed "Const" keywords.
X Symptom: Prototype was inconsistent with definition in p2clib.c.
X
X * Bug fix in decl.c:addfield: changed to "tname && tname->name ? ...".
X Symptom: Reference to NULL formatting field names for unnamed records.
X
X * Bug fix in expr.c:fixblock: fixed getfbuf + get => fread to check var type.
X Symptom: "f:file of byte; i:integer; i:=f^; get(f);" used fread incorrectly.
X
X * Bug fix in lex.c:turbo_directive: checked return value of handle_include.
X Symptom: Turbo-style include directives messed up if file was not found.
X
X * Added to sys.p2crc/trans.h the following configuration parameter:
X
X CollectNest Kludge to make sub-procs be emitted as they are parsed.
X
XVersion 1.10:
X
X * Bug fix in comment.c:addnote: reference to "quiet" changed to "quietmode".
X Symptom: Failed to compile! (Sorry, about that!)
X
XVersion 1.09:
X
X * Made a few improvements to "-R" (regression-testing) mode.
X
X * Bug fix in decl.c:addfield: rewrote part of the issafename loop.
X Symptom: Various problems choosing names for fields of structs.
X
X * Bug fix in out.c:getcurtime: modified non-HASTIME case to use starttime.
X Symptom: Not safe to multiply raw time() result by 1000.
X
XVersion 1.08:
X
X * Changed "makeproto" commands in src/Makefile to "./makeproto".
X
X * Extended "ConstFormat" mechanism for all other kinds of identifiers.
X
X * Added a special format for Pascal include-file names.
X
X * Added "UseConsts=2" to force the use of "Const" instead of "const".
X
X * Added FileNameFilter option.
X
X * Added "-E" switch to halt after some number of errors.
X
X * Added DeclBufNCName for compilers which can't handle null macro arguments.
X
X * Handled the case of multiple parameters using a common conformant schema.
X
X * Incorporated several Oregon Pascal standard procedures from William Bader.
X
X * Fixed typo in documentation of "BraceLine" in sys.p2crc.
X
X * Bug fix: in funcs.c:handleread_text: add copyexpr to P_read[ln]paoc calls.
X Symptom: Dangling pointer problems generating calls to P_read[ln]paoc.
X
X * Bug fix: in pexpr.c:dots_n_hats:TOK_LBR case: changed to use p_ord_expr().
X Symptom: Arrays indexed by literal characters used "A", not 'A'.
X
X * Bug fix: in pexpr.c:p_setfactor: added two makeexpr_longcast calls.
X Symptom: Generated code used "1 << x" instead of "1L << x" in a few places.
X
X * Bug fix: in decl.c:setup_decl: defined SWORD equivalent to tp_sshort.
X Symptom: Signed words were translated as longs under some circumstances.
X
X * Bug fix: in parse.c:fixblock: "if" rearrangements now clear if-else flags.
X Symptom: Else-ifs were formed in inappropriate places.
X
X * Bug fix: in parse.c:fixblock: "continue" added after final eatstmt call.
X Symptom: Reference to an already-freed pointer.
X
X * Added to sys.p2crc/trans.h the following configuration parameters:
X
X ModuleFormat Analogous to ConstFormat but for module names.
X FunctionFormat Analogous to ConstFormat but for function names.
X VarFormat Analogous to ConstFormat but for variable names.
X FieldFormat Analogous to ConstFormat but for record field names.
X TypeFormat Analogous to ConstFormat but for type names.
X EnumFormat Analogous to ConstFormat, for enumeration constant names.
X IncludeFileName Format for include file names.
X FileNameFilter Function to call to "clean" file names for use by fopen.
X MaxErrors Number of errors/warnings/notes printed before aborting.
X DeclBufNCName Version of DeclBufName with no "storage class" arg.
X
XVersion 1.07:
X
X * Added "Integer16=2" mode to translate Pascal "integer" as C "int".
X
X * Added a warning when "%" is used for MOD of arguments that may be negative.
X
X * Made formatted output of booleans and reals closer to Pascal standards.
X
X * Now print warning when trying to use associated buffers of file params.
X
X * Added support for buffered "file of array" types.
X
X * Prevented warning message when main program ends with ";" instead of ".".
X
X * Changed to ignore RESET and REWRITE on standard file OUTPUT.
X
X * Bug fix: in decl.c:p_constdecl: Added mp->isactive=0 / ... / mp->isactive=1.
X Symptom: "const ten=10; procedure p; const ten=ten;" failed.
X
X * Bug fix: in pexpr.c:p_factor:MK_SPECIAL case: Checked mp->isfunction.
X Symptom: Passing a built-in like PAGE as a procedure parameter failed.
X
X * Bug fix: in pexpr.c:p_setfactor: Moved "val.i|=1<<first[i]->val.i" to ELSE.
X Symptom: The set constant [3..0] generated 0x8, not 0.
X
X * Bug fix: in p2clib.c:P_addsetr: Added "v1 > v2" test.
X Symptom: The set constructor [i..j] did not generate [] when i > j.
X
X * Bug fix: in p2clib.c:P_peek: Return ' ' if character was \n.
X Symptom: Line breaks were sometimes not converted to space on input.
X
X * Bug fix: in p2c.h: Added "#define CPUTFBUF(f,v) (PUTFBUF(f,char,v))".
X Symptom: Calls to this undefined routine were produced.
X
X * Bug fix: in parse.c:p_stmt:TOK_FOR clause: Added checks for limit=MAXINT.
X Symptom: "for i := j to maxint" generated an infinite loop.
X
X * Bug fix: in decl.c:outfieldlist: Added checking for empty unions.
X Symptom: "record case integer of 1: () end" produced an empty C union.
X
X * Added to sys.p2crc/trans.h the following configuration parameters:
X
X ArrayGetName Analogous to GetName for "file of array" types.
X ArrayGetFBufName Analogous to GetFBufName for "file of array" types.
X ArrayPutName Analogous to PutName for "file of array" types.
X ArrayPutFBufName Analogous to PutFBufName for "file of array" types.
X
XVersion 1.06:
X
X * Changed Makefile to look for ranlib in /bin, too.
X
X * Added ability to call dispose on a non-lvalue: clearing to NIL is omitted.
X
X * Added ForEvalOrder option: "in for x := y to z, y is evaluated before z".
X
X * Added more entries in the AvoidName and AvoidGlobalName lists.
X
X * Added checks for "__unix" cpp symbol synonymous with "unix".
X
X * Improved heuristic in arraysize() which returns NULL for "huge" arrays.
X
X * Added support for "rewrite(f)" creating an unnamed temporary file.
X
X * Added definition of "tmpfile" in p2c.h for systems that don't have it.
X
X * Bug fix in parse.c:usebraces: Added "sp != NULL &&" before findcomment.
X Symptom: Segmentation fault.
X
X * Bug fix in pexpr.c:dots_n_hats: Added "tp->basetype->fbase &&".
X Symptom: Segmentation fault.
X
X * Bug fix in parse.c:p_stmt:TOK_CASE clause: Changed to use p_ord_expr().
X Symptom: case 'A' of ... translated to switch("A"), not switch('A').
X
X * Bug fix in parse.c:p_stmt:TOK_FOR clause: Added tp_boolean to "small" types
X Symptom: for b := true downto false had unsigned-wraparound problems.
X
X * Bug fix in decl.c:outbasetype:TK_ENUM clause: Added test for mp == NULL.
X Symptom: Segmentation fault if null enum list.
X
X * Bug fix in expr.c:makeexpr_plus: a->nargs < 1: used gentle_cast on zero.
X Symptom: f(a-a) => "f()"; argument was converted to real const w/null value.
X
X * Bug fix in expr.c:makeexpr_plus: checked a->args[j] for TK_REAL/STRING, too.
X Symptom: 1+2.0 was incorrectly constant-folded, though 1.0+2 was correct.
X
X * Bug fix in p2c.h: removed trailing semicolon from FILEBUF definition.
X
X * Bug fix in decl.c:p_type: added a call to makefakestruct for TOK_FILEs.
X Symptom: "var f:file of record ... end" (for buffered f) produced bad code.
X
X * Added to sys.p2crc/trans.h the following configuration parameters:
X
X ForEvalOrder Initial value in for loop must be evaluated before limit.
X FreeRvalueName Name of a function or macro to free a pointer in an rvalue.
X
XVersion 1.05:
X
X * Added support for reading packed arrays of characters.
X
X * Made some changes for compatibility with Xenix.
X
X * Put in slightly better handling of the "#define BSD" stuff.
X
X * Changed trans.c to avoid declaring sbrk() itself.
X
X * Changed p2c.h to define _toupper(), _tolower() in a non-ASCII-dependent way.
X
XVersion 1.04:
X
X * Added "-V" switch to generate a log file with some details of translation.
X
X * Added "-M" switch to control memory usage during translation.
X
X * Added "TEST_MALLOC" stuff to measure memory allocated but never freed.
X
X * Added {SIGNED} and {UNSIGNED} comments preceding type "char" and "integer".
X
X * Added HighCharBits-related optimizations for characters 128 and above.
X
X * Eliminated unnecessary casting of CHR's argument by making it MK_SPECIAL.
X
X * Recognized "ch+'A'-'a'" idiom and translated as "_toupper(ch)".
X
X * Added P2CRC environment variable.
X
X * Bug fix in parse.c:p_search: emptied curcomments at top of do loop.
X Symptom: leading comment in module header was copied over by import.
X
X * Bug fix in funcs.c:func_addr and elsewhere: fixed handling of procedure ptrs
X Symptom: "var pr:procedure; p := addr(pr);" wrote "_PROCEDURE pr; p = pr".
X
X * Bug fix in expr.c:makeexpr_assign: no longer copy _PROCEDUREs with memcpy.
X Symptom: memcpy was used to copy _PROCEDUREs even though assignable.
X
X * Bug fix in pexpr.c:p_factor: always allow makeexpr_hat after p_funccall
X Symptom: FuncMacros for string functions produced expression of wrong type
X
X * Bug fix in decl.c:p_conststring: added gettok() just before p_expr.
X Symptom: String constants with constructor notation didn't work.
X
X * Bug fix in decl.c:isfilevar and elsewhere: don't assume EK_DOT's val.i != 0.
X Symptom: Reference to NULL arises from "literal" dot expressions.
X
X * Bug fix in expr.c:value_name: check for value in range for "'%ld'" format.
X Symptom: Char literals containing negative or nonprinting chars were made.
X
X * Bug fix in expr.c:type_sizeof: prevent multiple recursion for TK_ENUM types.
X Symptom: Infinite recursion occurred when convert_size used on enum types.
X
X * Bug fix in expr.c:makeexpr_assign: avoid using memcpy for _PROCEDURE types.
X Symptom: Procedure vars with static links used memcpy even if CopyStructs>0.
X
X * Added to sys.p2crc/trans.h the following configuration parameters:
X
X HighCharBits Do high-char optimizations (safest if chars are 8 bits).
X PascalEnumSize Size in bits of an enumerated type in Pascal.
X
XVersion 1.03:
X
X * Modified headers to compile under pure System V.
X
X * Added '::' operator in C expressions (e.g., FuncMacro definitions).
X
X * Added '##' comment delimiter to embedded configuration parameter comments.
X
X * In Turbo, RESET/REWRITE now open in read/write mode for binary files.
X
X * Added note/warning IDs and a mechanism for suppressing undesired notes.
X
X * Extended FuncMacros to apply to predefined and undeclared functions.
X
X * Added to sys.p2crc/trans.h the following configuration parameters:
X
X ReadWriteOpen Binary files always opened in read/write mode.
X EatNotes List of notes/warnings to be suppressed.
X
XVersion 1.02:
X
X * Added support for HP Pascal with HP-UX 6.2 and 6.5:
X BADDRESS, WADDRESS, ADDTOPOINTER, BITSIZE, FCALL.
X
X * Now initializes file variables embedded in records or allocated by NEW.
X
X * Better error messages in skipcomma, skipcloseparen.
X
X * Extended convert_offset in funcs.c to handle more cases.
X
X * Extended distribute_plus in expr.c to handle negated arguments.
X
X * Line breaker's behavior in difficult/large cases is improved.
X
X * Bug fix in decl.c:setup_decl: changed '... modula2 ? "WORD" : "UWORD"'
X to '... modula2 ? "UWORD" : "WORD"'
X Symptom: Turbo did not recognize "WORD" built-in type any more.
X
X * Bug fix in funcs.c:func_random: removed incorrect "->args[0]" after "ex".
X Symptom: Bus error parsing "random(4)".
X
X * Bug fix in funcs.c: decl_builtins: "randomize" function declared.
X Symptom: Turbo Pascal "randomize" not recognized.
X
X * Bug fix in funcs.c: blockread & blockwrite: size and nitems args swapped.
X Symptom: Return value for blockread & blockwrite was wrong.
X
X * Bug fix in p2clib.c:P_inset: condition changed to "val < *s++ ..."
X Symptom: Certain elements appeared to be in the set even though too large.
X
X * Bug fix in funcs.c:handleopen: called makeexpr_stringify for file name.
X Symptom: Reset lost file name in dialects with only packed arrays of char.
X
X * Bug fix in decl.c:declaretype: added declaresubtypes function.
X Symptom: _REC_xxx records sometimes emitted before the things they used.
X
X * Bug fix in expr.c:makeexpr_lstring, etc: added null terminator for strings.
X Symptom: Occasional spurious treatment of string constants.
X
X * Bug fix in parse.c:replaceexprexpr: now even less strict about types.
X Symptom: If had to replace char variable ch, missed ord(ch) usage.
X
X * Bug fix in out.c:adddeltas/applydelta: changed "> 1000" to ">= 1000".
X Symptom: Absolute indention of 0 did not work properly.
X
XVersion 1.01:
X
X * VAX Pascal support added.
X
X * UCSD Pascal support added.
X
X * MPW Pascal support added.
X
X * Partial Modula-2 support added.
X
X * Added -L command-line flag.
X
X * Support for non-local GOTO's added.
X
X * Improved code generation for certain set operations.
X
X * Special comment forms now recognized for (* *) as well as { }.
X
X * Added the "Synonym" feature.
X
X * Removed unnecessary type casts for ANYVAR parameters and FuncMacros.
X
X * Added comments in trans.h describing major p2c data structures.
X
X * Bug fix in parse.c:checkcommas: "if (sp->exp1)" added in SK_FOR case.
X Symptom: Bus error when initializer portion of FOR was null.
X
X * Bug fix in trans.c:main: setup_comment now called before setup_lex.
X Symptom: Initial comment in program disappeared.
X
X * Bug fix in pexpr.c:p_funccall: added func_reference function.
X Symptom: Static links were occasionally left out when they were needed.
X
X * Bug fix in funcs.c:decl_builtins: "pi" function declared.
X Symptom: Turbo Pascal "pi" not recognized since func_pi never called.
X
X * Bug fix in decl.c:outdeclarator and elsewhere: improved pointers to arrays.
X Symptom: An array-of-strings parameter was declared as "char **".
X
X * Bug fix in system.imp: Turbo Pascal's "getmem" was incorrectly declared.
X
X * Added to sys.p2crc/trans.h the following configuration parameters:
X
X Modula2 Use Modula-2 instead of Pascal syntax.
X ImplModules Modules use VAX notation rather than HP/UCSD notation.
X IgnoreNonAlpha Ignore non-alphanumeric characters in Pascal identifiers.
X StarArrays Control notation for array-valued parameters.
X InitialCalls List of functions to call at start of main program.
X SymbolFormat Format string for C identifiers derived from Pascal ones.
X ArrayMinName Name for lower-bound variables (Modula-2/VAX Pascal).
X ArrayMaxName Name for upper-bound variables (Modula-2/VAX Pascal).
X LabelVarName Name for jmp_buf variable associated with a stmt label.
X Synonym Declare a synonym for a Pascal keyword or identifier.
X AvoidName Added "Inline" to the list.
X StructFunction Added "P_remset" to the list.
X StrlapFunction Added "P_setxor" and "strpad" to the list.
X RemName Name of function or macro for VAX Pascal REM operator.
X StrPadName Name of function for VAX Pascal "pad" function.
X SetXorName Name of function for symmetrical set difference.
X SetRemName Name of function to remove an element from a set.
X
XVersion 1.00:
X
X(Initial public release)
END_OF_FILE
if test 17901 -ne `wc -c <'src/HISTORY'`; then
echo shar: \"'src/HISTORY'\" unpacked with wrong size!
fi
# end of 'src/HISTORY'
fi
echo shar: End of archive 7 \(of 32\).
cp /dev/null ark7isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 32 archives.
echo "Now see PACKNOTES and the README"
rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0