Please review any and all PUBLIC repositories, groups and associate files. These allow anyone on the Internet to access without authentication. Repository and group owners are responsible for their content and permission settings. Go to your project(s), click on Settings > General and expand the "Visibility, project features, permissions" to change this setting.

Commit 3a3418a0 authored by Mike Collins's avatar Mike Collins

RIGAL Compiler work on Ubuntu 64-bit machines allowing the -m32 compile flag...

RIGAL Compiler work on Ubuntu 64-bit machines allowing the -m32 compile flag along with warnings cleanup.
parent e27bd695
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -15,7 +15,7 @@ extern Void savea PV();
extern Void closea PV();
extern Void opens PP((Char d_drive));
extern void opens (char d_drive);
/********* loads input f : file specifikation string
output e : s_pointer of loud object **/
......
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include <ctype.h>
/******** GLOBRIG.H ******/
#define Char char
#define boolean char
......@@ -9,13 +15,8 @@
#define Static static
#define Local static
#define FileNotFound 1
char* __M__;
char* __M__;
#define Malloc(n) ((__M__ = malloc(n)) ? __M__ : (char*)_OutMem())
#include <ctype.h>
#include <stdio.h>
#include <string.h>
/* #include <malloc.h> commented out 8/24/09 */
/*#include <stdlib.h>*/
......@@ -4,16 +4,12 @@
#
# C compiler to use (Compiler path can be changed by the user)
CCFLAGS = -g
PCA = cc $(CCFLAGS) -c -D xsun=1 -I../include/
# Specify -DLE for Little-endian architectures (Big-endian is default)!
# Specify -Dbbs for BBS-version of scaner (LaTeX version is default)!
#CCFLAGS = -g -DLE -m32 -I/usr/include -I../include
CCFLAGS = -m32 -I/usr/include -I../include
#PCA = cc $(CCFLAGS) -D STATIC_CCFLAGS='"$(CCFLAGS)"' -c xsun=1 -I../include/ -I/usr/include
PCA = cc $(CCFLAGS) -D STATIC_CCFLAGS='"$(CCFLAGS)"' -c
# math lib for sin, cos, sqrt etc.
LIBS = -lm
# This is for sin, cos, sqrt etc.
# Other things are usually not changed by the user
.INIT: check$(rig)
# -------------------------------------------------
# MACRO DEFINITIONS
......@@ -49,6 +45,12 @@ normal: bins ../lib/riglib.a ../bin/anrig ../bin/genrigd ../bin/rig_lint test
bins: bin ../bin/rc ../bin/ic ../bin/v
bin:
-mkdir ../bin
#rigal_scratch:#
# rm -rf ../rigal_scratch
# cp -r ../rigv4_scripts ../rigal_scratch#
# mv ../rigal_scratch/Preloaded-examples-release-4 ../rigal_scratch/examples
../bin/rc:$(RCF_SRC) rc_.o
cc $(CCFLAGS) -o ../bin/rc rc_.o $(RCF_SRC)
......@@ -106,10 +108,10 @@ bin:
test: ../test/rigcrf.rig ../bin/rc ../lib/riglib.a ../bin/anrig ../bin/genrigd
(cd ../test;\
$(rig)/rc rigcrf;\
$(rig)/ic rigcrf rigcrf;\
$(rig)/rc rigcrf -c;\
rigcrf rigcrf)
../bin/rc rigcrf;\
../bin/ic rigcrf rigcrf;\
../bin/rc rigcrf -c;\
./rigcrf rigcrf)
##------------------ Hidden possibilities
z: anrigz genrigz
......@@ -135,35 +137,31 @@ tar: clean
cp ../rigsc.$(VERSION).tar.Z /info/ftp/pub/labs/pelab/rigal/
##--------------------------------------
clean:
mv ../test/rigcrf.rig .
-rm -f *.o */*.o *.RC2 */*.RC2 *.RC4 */*.RC4 */*.rsc ../lint/*.o ../lint/*.RC2 ../lint/*.RC4 \
../examples/hanoi ../*/*.rsc ../*/*.out ../*/*/*.out ../test/*
mv rigcrf.rig ../test/
-rm -f *.o */*.o *.RC2 */*.RC2 *.RC4 */*.RC4 */*.rsc
-rm -f ../lint/*.o ../lint/*.RC2 ../lint/*.RC4
-rm -f ../*/*.rsc ../*/*.out ../*/*/*.out
-rm -f ../test/rigcrf ../test/rigcrf.crf ../test/rigcrf.crt
-rm -f ../test/xcrg_0.c
##--------------------------------------
clean_bkups:
-rm -rf ../bin_bkup ../lib_bkup
##--------------------------------------
.c.o: $(INCLIB_SRC)
$(PCA) $< -o $@
check:
@echo '********************************************************'
@echo '*' User ERROR: you have not set \"rig\" environment variable to $(PWD)/../bin
@echo '********************************************************'
____FATAL___ERROR___
check$(rig):
@echo VARIABLE rig have been set to $(rig)
@echo ---------------------------------------
##----------------------------------------
# Prepare distribution
mkdist$(RFILE)$(RDIR):
@echo '*** to prepare for distribution write make mkdist RFILE=fff RDIR=/u/vaden/xyz/xyz/'
mkdist:
(cd $(RDIR);\
$(rig)/rc $(RFILE);\
$(rig)/anrig;\
$(rig)/genrigd S -p N.TMP;\
/bin/rm *.RC2 *.RC4 *.TMP)
cp ../include/* $(RDIR)
cp $(DISTLIB) $(RDIR)
(cd $(RDIR);\
echo 'cc -O -w -D xsun=1 ' $(DISTLIB) ' xc*.c -o ' $(RFILE) $(LIBS) > cmd)
mkdist2:
(cd $(RDIR);\
cc -O -w -D xsun=1 $(DISTLIB) xc*.c -o $(RFILE) $(LIBS) ;/bin/rm *.o)
## Prepare distribution
#mkdist$(RFILE)$(RDIR):
# @echo '*** to prepare for distribution write make mkdist RFILE=fff RDIR=/u/vaden/xyz/xyz/'
#mkdist:
# (cd $(RDIR);\
# ../bin/rc $(RFILE);\
# ../bin/anrig;\
# ../bin/genrigd S -p N.TMP;\
# /bin/rm *.RC2 *.RC4 *.TMP)
# cp ../include/* $(RDIR)
# cp $(DISTLIB) $(RDIR)
# (cd $(RDIR);\
# echo 'cc -O -w -D xsun=1 ' $(DISTLIB) ' xc*.c -o ' $(RFILE) $(LIBS) > cmd)
#mkdist2:
# (cd $(RDIR);\
### cc -O -w -D xsun=1 $(DISTLIB) xc*.c -o $(RFILE) $(LIBS) ;/bin/rm *.o)
......@@ -950,7 +950,6 @@ long p, ot;
ptr_ opptr; /* pointer po s-kodu operatora */
a aadr; /* a-adres atoma */
a opcel; /* rawen opptr.cel*/
boolean succmakeflag; /* uspehno oformleno imq */
/* ========= osnownaq procedura ========== */
......@@ -1225,7 +1224,6 @@ long *rez;
ptr_ p2, stmtbeg, p3;
boolean islist;
/* deskriptor atoma -selektora */
long n;
atomdescriptor *WITH;
......@@ -1567,11 +1565,18 @@ ptr_ *pl, *p;
y = pl->cel;
if (y != null_) {
pointr(y, &s2.sa);
*success = (s.svd->dtype == variable ||
s.svd->dtype == idvariable && s2.sad->dtype == idatom ||
s.svd->dtype == nvariable && s2.sad->dtype == number);
*success = (
(
(s.svd->dtype == variable ) )||
(
(s.svd->dtype == idvariable) &&
(s2.sad->dtype == idatom ) )||
(
(s.svd->dtype == nvariable ) &&
(s2.sad->dtype == number) )
);
} else
*success = (s.svd->dtype != idvariable && s.svd->dtype != nvariable);
*success = ( (s.svd->dtype != idvariable) && (s.svd->dtype != nvariable) );
/* if y=null */
} /* pl.nel<>0 */
......
......@@ -7,7 +7,7 @@
#ifdef MIPSEL
/* For DEC variant, ULTRIX computers,
/* Little endian variant of MIPS architecture:
Little endian variant of MIPS architecture:
changed ... */
#define dos 1
#endif
......@@ -45,8 +45,7 @@
#define m_wrong "1014 - Internal error - wrong Spointer"
static Void mess(messstr)
Char *messstr;
static Void mess(char *messstr)
{
printf("\n--------------------------\n");
printf("Paging manager : %s\n", messstr);
......@@ -191,7 +190,9 @@ dinformtype dinform;
Void init_dinform()
{
char dt;
_REC_dinformtype *WITH;
#ifdef bad_sets
long SET[4];
long SET1[4];
long SET2[4];
......@@ -199,19 +200,16 @@ Void init_dinform()
long SET5[5], SET6[5];
long SET7[9];
_REC_dinformtype *WITH;
#ifdef bad_sets
P_addsetr(P_expset(digit, 0L), '0', '9');
P_addset(P_expset(SET5, 0L), '~');
P_addset(SET5, '|');
P_addset(SET5, '`');
P_addset(SET5, '{');
P_setunion(letter, P_setunion(SET6,
P_setunion(SET4, P_setunion(SET2, P_addset(P_expset(SET, 0L), '_'),
P_addsetr(P_expset(SET1, 0L), 'A', 'Z')),
P_addsetr(P_expset(SET3, 0L), 'a', 'z')),
P_addset(SET5, '}')), P_addsetr(P_expset(SET7, 0L), 128, 255));
P_addset(P_expset( SET5, 0L), '~');
P_addset( SET5, '|');
P_addset( SET5, '`');
P_addset( SET5, '{');
P_setunion(letter, P_setunion( SET6,
P_setunion( SET4, P_setunion( SET2, P_addset(P_expset(SET, 0L), '_'),
P_addsetr(P_expset( SET1, 0L), 'A', 'Z')),
P_addsetr(P_expset( SET3, 0L), 'a', 'z')),
P_addset( SET5, '}')), P_addsetr(P_expset( SET7, 0L), 128, 255));
/* p2c: defsun3.z, line 805: Note:
* Line breaker spent 0.7+0.19 seconds, 5000 tries on line 1049 [251] */
/* all these additional characters are added only for compatibility
......@@ -259,9 +257,7 @@ longint adiscread, adiscwrite, adiscpage, sdiscread, sdiscwrite, sdiscpage;
/*******************************************************/
Static Void nextsp(sptr, length)
sa_pointer *sptr;
word length;
static void nextsp(sa_pointer *sptr,word length)
{
newstru *WITH; /* pazofpa -> newstru, 5-jul-93 */
WITH = &sptr->newstruct;
......@@ -278,8 +274,7 @@ word length;
/*******************************************************/
/**** pointx ieksejam vajadzibam - loti lidzigs vecajam pointr(s) ****/
Static long pointx(e1)
long e1;
static long pointx(long e1)
{
sa_pointer mm;
......@@ -302,7 +297,7 @@ long e1;
/******************************************** opena *****/
Void opena()
void opena()
{
long i;
a_block *WITH;
......@@ -328,8 +323,7 @@ struct LOC_putatm {
long intpage;
} ;
Local Void pagecheck(LINK)
struct LOC_putatm *LINK;
static void pagecheck(struct LOC_putatm *LINK)
{
long j, k, l, garums;
a_block *WITH;
......@@ -383,9 +377,7 @@ _L99: ;
/*********************************** putatm(ad,na,e) *****/
Void putatm(ad, na_, e)
Char *ad;
long na_, *e;
void putatm(char *ad, long na_,long *e)
{
struct LOC_putatm V;
long i;
......@@ -421,10 +413,7 @@ long na_, *e;
/************************************* pointa(e,ad,na) *****/
Void pointa(e, ad, na)
long e;
Char *ad;
long *na;
void pointa(long e,char *ad,long *na)
{
long i, j;
sa_pointer atbilde;
......@@ -441,7 +430,7 @@ long *na;
(*na)++;
}
} else {
WITH = &a_bufp[atbilde.struct_.page];
WITH = &a_bufp[(int) atbilde.struct_.page];
*na = WITH->inform[atbilde.struct_.offset - 1];
j = atbilde.struct_.offset + 1;
FORLIM = *na;
......@@ -473,8 +462,7 @@ Void closes()
/******************************************** vola *****/
Void vola(dr, dw, dp)
long *dr, *dw, *dp;
void vola(long *dr,long *dw,long *dp)
{
*dr = adiscread;
*dw = adiscwrite;
......@@ -484,8 +472,7 @@ long *dr, *dw, *dp;
/** * * * * * * s - m a n a g e r * * * * * * * * * * **/
/******************************************** opens *****/
Void opens(d_drive)
Char d_drive;
void opens(char d_drive)
{
s_buf *ptr;
long k;
......@@ -514,8 +501,7 @@ Char d_drive;
/****************************************** pointr (e1,e2) *****/
Void pointr(e1, e2)
long e1, *e2;
void pointr(long e1,long *e2)
{
sa_pointer sap;
/*printf(" pointr %p \n",e1);*/
......@@ -527,8 +513,7 @@ long e1, *e2;
/****************************************** points (e1,e2) *****/
Void points(e1, e2)
long e1, *e2;
void points(long e1,long *e2)
{
sa_pointer sap;
......@@ -540,8 +525,7 @@ long e1, *e2;
/***************************************** gets1 (e1,e2) *****/
Void gets1(e1, e2)
long *e1, *e2;
void gets1(long *e1,long *e2)
{
absadr absa;
object_type *WITH;
......@@ -559,8 +543,7 @@ long *e1, *e2;
/***************************************** gets2 (e1,e2) *****/
Void gets2(e1, e2)
long *e1, *e2;
void gets2(long *e1,long *e2)
{
absadr absa;
object_type *WITH;
......@@ -578,8 +561,7 @@ long *e1, *e2;
/***************************************** gets5 (e1,e2) *****/
Void gets5(e1, e2)
long *e1, *e2;
void gets5(long *e1,long *e2)
{
long i;
absadr absa;
......@@ -596,9 +578,7 @@ long *e1, *e2;
/*************************************** loads (f,e) *****/
Void loads(f, e)
Char *f;
long *e;
void loads(char *f, long *e)
{
FILE *infile;
sa_pointer bulta1, bulta2, rab1;
......@@ -789,8 +769,7 @@ struct LOC_saves {
} buffer;
} ;
Local Void move_(LINK)
struct LOC_saves *LINK;
static void move_(struct LOC_saves *LINK)
{
long i, garums;
object_type *WITH;
......@@ -812,8 +791,7 @@ struct LOC_saves *LINK;
nextsp(&LINK->bulta2, (int)(garums + 2));
}
Local Void writeblock(LINK)
struct LOC_saves *LINK;
static void writeblock(struct LOC_saves *LINK)
{
fwrite(LINK->buffer.U3.b1, sizeof(x512), 1, LINK->outfile);
/*** write 1 ***/
......@@ -821,9 +799,7 @@ struct LOC_saves *LINK;
/*************************************** saves (f,e) *****/
Void saves(f, e)
Char *f;
long *e;
void saves(char *f,long *e)
{
struct LOC_saves V;
long i, j, k;
......@@ -1007,8 +983,7 @@ struct LOC_savesn {
} buffer;
} ;
Local Void move__(LINK)
struct LOC_savesn *LINK;
static void move__(struct LOC_savesn *LINK)
{
long i, garums;
object_type *WITH;
......@@ -1027,8 +1002,7 @@ struct LOC_savesn *LINK;
nextsp(&LINK->bulta2, (int)garums);
}
Local Void writeblock_(LINK)
struct LOC_savesn *LINK;
static void writeblock_(struct LOC_savesn *LINK)
{
fwrite(LINK->buffer.U3.b1, sizeof(x512), 1, LINK->outfile);
......@@ -1038,9 +1012,7 @@ struct LOC_savesn *LINK;
/*************************************** savesn (f,e) *****/
Void savesn(f, e)
Char *f;
long *e;
void savesn(char *f, long *e)
{
struct LOC_savesn V;
long i, j, k;
......@@ -1200,8 +1172,7 @@ _Lara:
/*************************************** vols *****/
Void vols(dr, dw, dp)
long *dr, *dw, *dp;
void vols(long *dr,long *dw,long *dp)
{
*dr = sdiscread;
*dw = sdiscwrite;
......@@ -1216,8 +1187,7 @@ struct LOC_reopen {
absadr p2, p3;
} ;
Local Void move___(LINK)
struct LOC_reopen *LINK;
static void move___(struct LOC_reopen *LINK)
{
long i, garums;
object_type *WITH;
......@@ -1238,8 +1208,7 @@ struct LOC_reopen *LINK;
/*************************************** reopen (f,e) *****/
Void reopen(f, e)
long *f, *e;
void reopen(long *f,long *e)
{
struct LOC_reopen V;
long i, k;
......
......@@ -714,10 +714,28 @@ long op;
if (dts[0] == dummy && dts[1] == dummy || dts[0] == number ||
dts[1] == number) {
if (op == cgt && n[0] > n[1] || op == clt && n[0] < n[1] ||
op == cge && n[0] >= n[1] || op == cle && n[0] <= n[1])
if (
(
(dts[0] == dummy) &&
(dts[1] == dummy) ) ||
dts[0] == number ||
dts[1] == number
)
{
if (
(
(op == cgt ) &&
(n[0] > n[1] ) ) ||
(
(op == clt ) &&
(n[0] < n[1] ) ) ||
(
(op == cge ) &&
(n[0] >= n[1] ) ) ||
(
(op == cle ) &&
(n[0] <= n[1] ) )
)
rez = atomt;
else { /* arifmetika */
if (op >= cmult && op <= cminus) { /* sozdatx atom rezulxtata */
......@@ -796,12 +814,9 @@ long op;
}
_L33:
base--;
v[base - 2] = rez;
}
......@@ -1047,11 +1062,16 @@ long n;
case 17: /* #_ruletoatom, #_varntoatm */
if (k == null_)
*success = false;
else {
if (x.srd->dtype == rulename && rulenum == 16 ||
(((1L << ((long)x.svd->dtype)) &
((1L << ((long)fvariable + 1)) - (1L << ((long)variable)))) != 0 &&
rulenum == 17)) {
else
{
if (
(
(x.srd->dtype == rulename) &&
(rulenum == 16 ) )||
( (((1L << ((long)x.svd->dtype)) & ((1L << ((long)fvariable + 1)) - (1L << ((long)variable))) ) != 0 &&
(rulenum == 17)) )
)
{
gets1(&s, &y.sa);
WITH1 = y.sad;
WITH1->dtype = idatom;
......@@ -1327,7 +1347,6 @@ Void copyop()
/*======================*/
/* wyhod */
long k;
mpd x, y, z;
a r1, r2, r3;
......@@ -1440,7 +1459,7 @@ long o;
getval(&v[base - 3]);
getval(&v[base - 2]);
eqop1(o, v[base - 3], v[base - 2], &rez);
if (rez && o == cequ || !rez && o == cnequ)
if ( (rez && (o == cequ) ) || ( !rez && (o == cnequ) ) )
v[base - 3] = atomt;
else
v[base - 3] = null_;
......@@ -1952,14 +1971,13 @@ long code;
/*===============*/
/* inicializaciq */
/*===============*/
long k, k1;
long k1;
mpd x;
long iii;
Char m[10];
a rez, s;
atomdescriptor *WITH;
k = 1;
vs[0] = code;
debugrule = debug;
base = 1;
......@@ -2541,8 +2559,6 @@ Static Void errstrmes(n, m)
long n;
Char *m;
{
Char STR2[130];
switch (n) {
case 1:
......
......@@ -15,9 +15,7 @@ boolean debug;
long pp1, pp2, pp3, i;
main(argc, argv)
int argc;
Char *argv[];
int main(int argc, char *argv[])
{
out = NULL;
out_open = false;
......
......@@ -111,8 +111,15 @@ struct LOC_ley *LINK;
else
printf("Rigal internal error Push-101\n");
points(pp->UU.U1.curfragment, &x.sa);
if (x.smld->dtype == listmain && pp->nel == mainlistelnum ||
x.sfld->dtype == listfragm && pp->nel == fragmlistelnum) {
if (
(
(x.smld->dtype == listmain ) &&
(pp->nel == mainlistelnum ) ) ||
(
(x.sfld->dtype == listfragm ) &&
(pp->nel == fragmlistelnum ) )
)
{
/* w slu~ae dostiveniq konca fragmenta spiska */
gets5(&a1, &x1.sa);
if (x.smld->dtype == listmain) /* podceplenie */
......@@ -267,7 +274,7 @@ error_rec_type *error_rec_;
long len; /* current line length */
ptr_ p;
mpd y;
boolean is_ident, x_lists;
boolean is_ident;
/* srb,srl,slb,sll: string; */
/* Char table[256]; */
boolean maybe_octal;
......@@ -278,8 +285,6 @@ error_rec_type *error_rec_;
Char twochar_string[161];
long rline;
Char c;
long FORLIM;
int fff;
numberdescriptor *WITH;
......@@ -299,7 +304,6 @@ error_rec_type *error_rec_;
strcpy(V.fistack[0].f, first_file);
V.errflag = false;
x_lists = false;
for (V.i = 1; V.i <= 33; V.i++) {
twochar_symbols[V.i - 1][0] = twochar_string[V.i * 3 - 3];