SCCS-vsn: usr.bin/pascal/pc0/Makefile 1.37
SCCS-vsn: usr.bin/pascal/src/stkrval.c 1.5
SCCS-vsn: usr.bin/pascal/src/lval.c 1.9
SCCS-vsn: usr.bin/pascal/src/stat.c 1.9
SCCS-vsn: usr.bin/pascal/src/forop.c 1.12
SCCS-vsn: usr.bin/pascal/src/rval.c 1.14
SCCS-vsn: usr.bin/pascal/src/call.c 1.20
-SCCSID = "@(#)Makefile 1.36 %G%"
+SCCSID = "@(#)Makefile 1.37 %G%"
INSTALLDIR = $(DESTDIR)/usr/lib
INSTALLNAME = ${INSTALLDIR}/pc0
INSTALLDIR = $(DESTDIR)/usr/lib
INSTALLNAME = ${INSTALLDIR}/pc0
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)call.c 1.19 %G%";
+static char sccsid[] = "@(#)call.c 1.20 %G%";
#include "whoami.h"
#include "0.h"
#include "whoami.h"
#include "0.h"
case TREC:
case TSET:
case TSTR:
case TREC:
case TSET:
case TSTR:
- q = rvalue( argv[1] , p1 -> type , LREQ );
+ q = stkrval( argv[1] , p1 -> type , LREQ );
break;
case TINT:
case TSCAL:
case TBOOL:
case TCHAR:
precheck( p1 -> type , "_RANG4" , "_RSNG4" );
break;
case TINT:
case TSCAL:
case TBOOL:
case TCHAR:
precheck( p1 -> type , "_RANG4" , "_RSNG4" );
- q = rvalue( argv[1] , p1 -> type , RREQ );
- postcheck( p1 -> type );
+ q = stkrval( argv[1] , p1 -> type , RREQ );
+ postcheck(p1 -> type, P2INT);
+ break;
+ case TDOUBLE:
+ q = stkrval( argv[1] , p1 -> type , RREQ );
+ sconv(p2type(q), P2DOUBLE);
break;
default:
q = rvalue( argv[1] , p1 -> type , RREQ );
break;
default:
q = rvalue( argv[1] , p1 -> type , RREQ );
- if ( isa( p1 -> type , "d" )
- && isa( q , "i" ) ) {
- putop( P2SCONV , P2DOUBLE );
- }
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)forop.c 1.11 %G%";
+static char sccsid[] = "@(#)forop.c 1.12 %G%";
#include "whoami.h"
#include "0.h"
#include "whoami.h"
#include "0.h"
goto byebye;
}
# ifdef PC
goto byebye;
}
# ifdef PC
+ sconv(p2type(inittype), P2INT);
putop( P2ASSIGN , P2INT );
putdot( filename , line );
/*
putop( P2ASSIGN , P2INT );
putdot( filename , line );
/*
goto byebye;
}
# ifdef PC
goto byebye;
}
# ifdef PC
+ sconv(p2type(termtype), P2INT);
putop( P2ASSIGN , P2INT );
putdot( filename , line );
/*
putop( P2ASSIGN , P2INT );
putdot( filename , line );
/*
putRV( 0 , cbn , initnlp -> value[ NL_OFFS ] ,
initnlp -> extra_flags , P2INT );
if ( opt( 't' ) ) {
putRV( 0 , cbn , initnlp -> value[ NL_OFFS ] ,
initnlp -> extra_flags , P2INT );
if ( opt( 't' ) ) {
+ postcheck(fortype, nl+T4INT);
+ sconv(P2INT, p2type(fortype));
putop( P2ASSIGN , p2type( fortype ) );
putdot( filename , line );
# endif PC
putop( P2ASSIGN , p2type( fortype ) );
putdot( filename , line );
# endif PC
putleaf( P2ICON , 1 , 0 , P2INT , 0 );
putop( ( arg[0] == T_FORU ? P2PLUS : P2MINUS ) , P2INT );
if ( opt( 't' ) ) {
putleaf( P2ICON , 1 , 0 , P2INT , 0 );
putop( ( arg[0] == T_FORU ? P2PLUS : P2MINUS ) , P2INT );
if ( opt( 't' ) ) {
+ postcheck(fortype, nl+T4INT);
}
putop( P2ASSIGN , P2INT );
putdot( filename , line );
}
putop( P2ASSIGN , P2INT );
putdot( filename , line );
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)lval.c 1.8 %G%";
+static char sccsid[] = "@(#)lval.c 1.9 %G%";
#include "whoami.h"
#include "0.h"
#include "whoami.h"
#include "0.h"
+ postcheck(p, ap);
+ sconv(p2type(ap),P2INT);
# endif PC
}
if (incompat(ap, p->type, el[1])) {
# endif PC
}
if (incompat(ap, p->type, el[1])) {
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)rval.c 1.13 %G%";
+static char sccsid[] = "@(#)rval.c 1.14 %G%";
#include "whoami.h"
#include "0.h"
#include "whoami.h"
#include "0.h"
put(2, O_CON2, (short)p->range[0]);
# endif OBJ
# ifdef PC
put(2, O_CON2, (short)p->range[0]);
# endif OBJ
# ifdef PC
- /*
- * make short constants ints
- */
putleaf( P2ICON , (short) p -> range[0]
putleaf( P2ICON , (short) p -> range[0]
# endif PC
break;
case 1:
# endif PC
break;
case 1:
put(2, O_CON1, p->value[0]);
# endif OBJ
# ifdef PC
put(2, O_CON1, p->value[0]);
# endif OBJ
# ifdef PC
- /*
- * make char constants ints
- */
putleaf( P2ICON , p -> value[0] , 0
putleaf( P2ICON , p -> value[0] , 0
# endif PC
break;
default:
# endif PC
break;
default:
put(1, O_NEG2 + (width(q) >> 2));
# endif OBJ
# ifdef PC
put(1, O_NEG2 + (width(q) >> 2));
# endif OBJ
# ifdef PC
- putop( P2UNARY P2MINUS , p2type( q ) );
+ sconv(p2type(q), P2INT);
+ putop( P2UNARY P2MINUS , P2INT );
# endif PC
return (isa(q, "d") ? q : nl+T4INT);
}
# endif PC
return (isa(q, "d") ? q : nl+T4INT);
}
put(1, O_NOT);
# endif OBJ
# ifdef PC
put(1, O_NOT);
# endif OBJ
# ifdef PC
- putop( P2NOT , P2INT );
+ sconv(p2type(q), P2INT);
+ putop( P2NOT , P2INT);
+ sconv(P2INT, p2type(q));
# endif PC
return (nl+T1BOOL);
case T_AND:
case T_OR:
p = rvalue(r[2], NIL , RREQ );
# endif PC
return (nl+T1BOOL);
case T_AND:
case T_OR:
p = rvalue(r[2], NIL , RREQ );
+# ifdef PC
+ sconv(p2type(p),P2INT);
+# endif PC
p1 = rvalue(r[3], NIL , RREQ );
p1 = rvalue(r[3], NIL , RREQ );
+# ifdef PC
+ sconv(p2type(p1),P2INT);
+# endif PC
if (p == NIL || p1 == NIL)
return (NIL);
if (isnta(p, "b")) {
if (p == NIL || p1 == NIL)
return (NIL);
if (isnta(p, "b")) {
* to force evaluation of all the expressions.
*/
putop( r[ 0 ] == T_AND ? P2AND : P2OR , P2INT );
* to force evaluation of all the expressions.
*/
putop( r[ 0 ] == T_AND ? P2AND : P2OR , P2INT );
+ sconv(P2INT, p2type(p));
# endif PC
return (nl+T1BOOL);
# endif PC
return (nl+T1BOOL);
* force these to be doubles for the divide
*/
p = rvalue( r[ 2 ] , NIL , RREQ );
* force these to be doubles for the divide
*/
p = rvalue( r[ 2 ] , NIL , RREQ );
- if ( isnta( p , "d" ) ) {
- putop( P2SCONV , P2DOUBLE );
- }
+ sconv(p2type(p), P2DOUBLE);
p1 = rvalue( r[ 3 ] , NIL , RREQ );
p1 = rvalue( r[ 3 ] , NIL , RREQ );
- if ( isnta( p1 , "d" ) ) {
- putop( P2SCONV , P2DOUBLE );
- }
+ sconv(p2type(p1), P2DOUBLE);
# endif PC
if (p == NIL || p1 == NIL)
return (NIL);
# endif PC
if (p == NIL || p1 == NIL)
return (NIL);
if ( ( p == NIL ) || ( p1 == NIL ) ) {
return NIL;
}
if ( ( p == NIL ) || ( p1 == NIL ) ) {
return NIL;
}
- if ( isa( p , "i" ) && isa( p1 , "d" ) ) {
- putop( P2SCONV , P2DOUBLE );
- }
+ tuac(p, p1, &rettype, &ctype);
p1 = rvalue( r[ 3 ] , contype , RREQ );
p1 = rvalue( r[ 3 ] , contype , RREQ );
- if ( isa( p , "d" ) && isa( p1 , "i" ) ) {
- putop( P2SCONV , P2DOUBLE );
- }
+ tuac(p1, p, &rettype, &ctype);
- if ( isa( p , "d" ) || isa( p1 , "d" ) ) {
- ctype = P2DOUBLE;
- rettype = nl + TDOUBLE;
- } else {
- ctype = P2INT;
- rettype = nl + T4INT;
- }
putop( mathop[ r[0] - T_MULT ] , ctype );
return rettype;
}
putop( mathop[ r[0] - T_MULT ] , ctype );
return rettype;
}
case T_MOD:
case T_DIV:
p = rvalue(r[2], NIL , RREQ );
case T_MOD:
case T_DIV:
p = rvalue(r[2], NIL , RREQ );
+# ifdef PC
+ sconv(p2type(p), P2INT);
+# endif PC
p1 = rvalue(r[3], NIL , RREQ );
p1 = rvalue(r[3], NIL , RREQ );
+# ifdef PC
+ sconv(p2type(p1), P2INT);
+# endif PC
if (p == NIL || p1 == NIL)
return (NIL);
if (isnta(p, "i")) {
if (p == NIL || p1 == NIL)
return (NIL);
if (isnta(p, "i")) {
* long op double or double op long
* we may have to do some coercing.
*/
* long op double or double op long
* we may have to do some coercing.
*/
- if ( isa( p , "i" ) && isa( p1 , "d" ) ) {
- putop( P2SCONV , P2DOUBLE );
- }
+ tuac(p, p1, &rettype, &ctype);
p1 = rvalue( r[ 3 ] , p , RREQ );
if ( p1 == NIL ) {
return NIL;
}
p1 = rvalue( r[ 3 ] , p , RREQ );
if ( p1 == NIL ) {
return NIL;
}
- if ( isa( p , "d" ) && isa( p1 , "i" ) )
- putop( P2SCONV , P2DOUBLE );
+ tuac(p1, p, &rettype, &ctype);
putop( relops[ r[0] - T_EQ ] , P2INT );
putop( relops[ r[0] - T_EQ ] , P2INT );
}
# endif PC
c = classify(p);
}
# endif PC
c = classify(p);
postcset( r[3] , &csetd );
}
putop( P2CALL , P2INT );
postcset( r[3] , &csetd );
}
putop( P2CALL , P2INT );
# endif PC
return (nl+T1BOOL);
default:
# endif PC
return (nl+T1BOOL);
default:
- if (bytes(l, l) <= 2) {
-# ifdef OBJ
- put(2, O_CON2, ( short ) l);
-# endif OBJ
-# ifdef PC
- /*
- * short constants are ints
- */
- putleaf( P2ICON , l , 0 , P2INT , 0 );
-# endif PC
- return (nl+T2INT);
- }
+ if (bytes(l, l) <= 2) {
+ put(2, O_CON2, ( short ) l);
+ return (nl+T2INT);
+ }
- putleaf( P2ICON , l , 0 , P2INT , 0 );
+ switch (bytes(l, l)) {
+ case 1:
+ putleaf(P2ICON, l, 0, P2CHAR, 0);
+ return nl+T1INT;
+ case 2:
+ putleaf(P2ICON, l, 0, P2SHORT, 0);
+ return nl+T2INT;
+ case 4:
+ putleaf(P2ICON, l, 0, P2INT, 0);
+ return nl+T4INT;
+ }
/*
* A floating point number
/*
* A floating point number
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)stat.c 1.8 %G%";
+static char sccsid[] = "@(#)stat.c 1.9 %G%";
#include "whoami.h"
#include "0.h"
#include "whoami.h"
#include "0.h"
case TBOOL:
case TCHAR:
case TSCAL:
case TBOOL:
case TCHAR:
case TSCAL:
+ postcheck(p, p1);
+ sconv(p2type(p1), p2type(p));
putop( P2ASSIGN , p2type( p ) );
putdot( filename , line );
break;
putop( P2ASSIGN , p2type( p ) );
putdot( filename , line );
break;
putdot( filename , line );
break;
case TDOUBLE:
putdot( filename , line );
break;
case TDOUBLE:
- if (isnta(p1,"d")) {
- putop( P2SCONV , P2DOUBLE );
- }
+ sconv(p2type(p1), p2type(p));
putop( P2ASSIGN , p2type( p ) );
putdot( filename , line );
break;
putop( P2ASSIGN , p2type( p ) );
putdot( filename , line );
break;
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)stkrval.c 1.4 %G%";
+static char sccsid[] = "@(#)stkrval.c 1.5 %G%";
#include "whoami.h"
#include "0.h"
#include "whoami.h"
#include "0.h"
- return rvalue( r , contype , required );
+ q = rvalue( r , contype , required );
+ if (isa(q, "sbci")) {
+ sconv(p2type(q),P2INT);
+ }
+ return q;
# ifdef PC
if ( required == RREQ ) {
putop( P2UNARY P2MUL , p2type( q ) );
# ifdef PC
if ( required == RREQ ) {
putop( P2UNARY P2MUL , p2type( q ) );
+ if (isa(q,"sbci")) {
+ sconv(p2type(q),P2INT);
+ }
put(2, O_CONC4, (int)p->value[0]);
# endif OBJ
# ifdef PC
put(2, O_CONC4, (int)p->value[0]);
# endif OBJ
# ifdef PC
- putleaf( P2ICON , p -> value[0] , 0 , P2CHAR , 0 );
+ putleaf(P2ICON, p -> value[0], 0, P2INT, 0);
- return rvalue( r , contype , required );
+ q = rvalue( r , contype , required );
+ if (isa(q,"sbci")) {
+ sconv(p2type(q),P2INT);
+ }
+ return q;
# endif OBJ
# ifdef PC
p = pcfunccod( r );
# endif OBJ
# ifdef PC
p = pcfunccod( r );
+ if (isa(p,"sbci")) {
+ sconv(p2type(p),P2INT);
+ }
if (width(p) <= 2)
put(1, O_STOI);
# endif OBJ
if (width(p) <= 2)
put(1, O_STOI);
# endif OBJ
+# ifdef PC
+ if (isa(p,"sbci")) {
+ sconv(p2type(p),P2INT);
+ }
+# endif PC
return (p);
case T_CSET:
p = rvalue(r, contype , required );
return (p);
case T_CSET:
p = rvalue(r, contype , required );
put(2, O_CONC4, cp[0]);
# endif OBJ
# ifdef PC
put(2, O_CONC4, cp[0]);
# endif OBJ
# ifdef PC
- putleaf( P2ICON , cp[0] , 0 , P2CHAR , 0 );
+ putleaf( P2ICON , cp[0] , 0 , P2INT , 0 );
# endif PC
return(nl+T1CHAR);
}
# endif PC
return(nl+T1CHAR);
}