Update bootstrap and fix source change tests. Typo in command ine help.

This commit is contained in:
David Brown 2016-10-28 20:06:30 +01:00
parent 126ef6d479
commit 6a4748e2af
78 changed files with 1026 additions and 2564 deletions

View file

@ -317,14 +317,11 @@ void Files_Close (Files_File f)
int32 Files_Length (Files_File f)
{
int32 _o_result;
_o_result = f->len;
return _o_result;
return f->len;
}
Files_File Files_New (CHAR *name, LONGINT name__len)
{
Files_File _o_result;
Files_File f = NIL;
__DUP(name, name__len, CHAR);
__NEW(f, Files_FileDesc);
@ -335,9 +332,8 @@ Files_File Files_New (CHAR *name, LONGINT name__len)
f->len = 0;
f->pos = 0;
f->swapper = -1;
_o_result = f;
__DEL(name);
return _o_result;
return f;
}
static void Files_ScanPath (int16 *pos, CHAR *dir, LONGINT dir__len)
@ -385,7 +381,6 @@ static void Files_ScanPath (int16 *pos, CHAR *dir, LONGINT dir__len)
static BOOLEAN Files_HasDir (CHAR *name, LONGINT name__len)
{
BOOLEAN _o_result;
int16 i;
CHAR ch;
i = 0;
@ -394,13 +389,11 @@ static BOOLEAN Files_HasDir (CHAR *name, LONGINT name__len)
i += 1;
ch = name[i];
}
_o_result = ch == '/';
return _o_result;
return ch == '/';
}
static Files_File Files_CacheEntry (Platform_FileIdentity identity)
{
Files_File _o_result;
Files_File f = NIL;
int16 i, error;
f = Files_files;
@ -419,18 +412,15 @@ static Files_File Files_CacheEntry (Platform_FileIdentity identity)
f->identity = identity;
error = Platform_Size(f->fd, &f->len);
}
_o_result = f;
return _o_result;
return f;
}
f = f->next;
}
_o_result = NIL;
return _o_result;
return NIL;
}
Files_File Files_Old (CHAR *name, LONGINT name__len)
{
Files_File _o_result;
Files_File f = NIL;
int32 fd;
int16 pos;
@ -470,9 +460,8 @@ Files_File Files_Old (CHAR *name, LONGINT name__len)
error = Platform_Identify(fd, &identity, Platform_FileIdentity__typ);
f = Files_CacheEntry(identity);
if (f != NIL) {
_o_result = f;
__DEL(name);
return _o_result;
return f;
} else {
__NEW(f, Files_FileDesc);
Heap_RegisterFinalizer((void*)f, Files_Finalize);
@ -488,23 +477,20 @@ Files_File Files_Old (CHAR *name, LONGINT name__len)
f->next = Files_files;
Files_files = f;
Heap_FileCount += 1;
_o_result = f;
__DEL(name);
return _o_result;
return f;
}
} else if (dir[0] == 0x00) {
_o_result = NIL;
__DEL(name);
return _o_result;
return NIL;
} else {
Files_MakeFileName(dir, 256, name, name__len, (void*)path, 256);
Files_ScanPath(&pos, (void*)dir, 256);
}
}
} else {
_o_result = NIL;
__DEL(name);
return _o_result;
return NIL;
}
__RETCHK;
}
@ -544,9 +530,7 @@ void Files_GetDate (Files_File f, int32 *t, int32 *d)
int32 Files_Pos (Files_Rider *r, address *r__typ)
{
int32 _o_result;
_o_result = (*r).org + (*r).offset;
return _o_result;
return (*r).org + (*r).offset;
}
void Files_Set (Files_Rider *r, address *r__typ, Files_File f, int32 pos)
@ -673,9 +657,7 @@ void Files_ReadBytes (Files_Rider *r, address *r__typ, SYSTEM_BYTE *x, LONGINT x
Files_File Files_Base (Files_Rider *r, address *r__typ)
{
Files_File _o_result;
_o_result = (*r).buf->f;
return _o_result;
return (*r).buf->f;
}
void Files_Write (Files_Rider *r, address *r__typ, SYSTEM_BYTE x)
@ -759,17 +741,23 @@ void Files_Rename (CHAR *old, LONGINT old__len, CHAR *new, LONGINT new__len, int
error = Platform_Rename((void*)old, old__len, (void*)new, new__len);
if (!Platform_DifferentFilesystems(error)) {
*res = error;
__DEL(old);
__DEL(new);
return;
} else {
error = Platform_OldRO((void*)old, old__len, &fdold);
if (error != 0) {
*res = 2;
__DEL(old);
__DEL(new);
return;
}
error = Platform_New((void*)new, new__len, &fdnew);
if (error != 0) {
error = Platform_Close(fdold);
*res = 3;
__DEL(old);
__DEL(new);
return;
}
error = Platform_Read(fdold, (address)buf, 4096, &n);

View file

@ -127,7 +127,6 @@ void Heap_Unlock (void)
SYSTEM_PTR Heap_REGMOD (Heap_ModuleName name, Heap_EnumProc enumPtrs)
{
SYSTEM_PTR _o_result;
Heap_Module m;
if (__STRCMP(name, "Heap") == 0) {
__SYSNEW(m, 48);
@ -141,8 +140,7 @@ SYSTEM_PTR Heap_REGMOD (Heap_ModuleName name, Heap_EnumProc enumPtrs)
m->enumPtrs = enumPtrs;
m->next = (Heap_Module)(address)Heap_modules;
Heap_modules = (SYSTEM_PTR)m;
_o_result = (void*)m;
return _o_result;
return (void*)m;
}
void Heap_REGCMD (Heap_Module m, Heap_CmdName name, Heap_Command cmd)
@ -172,7 +170,6 @@ void Heap_INCREF (Heap_Module m)
static int32 Heap_NewChunk (int32 blksz)
{
int32 _o_result;
int32 chnk;
chnk = Heap_OSAllocate(blksz + 12);
if (chnk != 0) {
@ -184,8 +181,7 @@ static int32 Heap_NewChunk (int32 blksz)
Heap_bigBlocks = chnk + 12;
Heap_heapsize += blksz;
}
_o_result = chnk;
return _o_result;
return chnk;
}
static void Heap_ExtendHeap (int32 blksz)
@ -219,7 +215,6 @@ static void Heap_ExtendHeap (int32 blksz)
SYSTEM_PTR Heap_NEWREC (int32 tag)
{
SYSTEM_PTR _o_result;
int32 i, i0, di, blksz, restsize, t, adr, end, next, prev;
SYSTEM_PTR new;
Heap_Lock();
@ -267,12 +262,10 @@ SYSTEM_PTR Heap_NEWREC (int32 tag)
new = Heap_NEWREC(tag);
}
Heap_Unlock();
_o_result = new;
return _o_result;
return new;
} else {
Heap_Unlock();
_o_result = NIL;
return _o_result;
return NIL;
}
}
__GET(adr + 4, t, int32);
@ -320,13 +313,11 @@ SYSTEM_PTR Heap_NEWREC (int32 tag)
__PUT(adr + 8, 0, int32);
Heap_allocated += blksz;
Heap_Unlock();
_o_result = (SYSTEM_PTR)(address)(adr + 4);
return _o_result;
return (SYSTEM_PTR)(address)(adr + 4);
}
SYSTEM_PTR Heap_NEWBLK (int32 size)
{
SYSTEM_PTR _o_result;
int32 blksz, tag;
SYSTEM_PTR new;
Heap_Lock();
@ -338,8 +329,7 @@ SYSTEM_PTR Heap_NEWBLK (int32 size)
__PUT(tag + 4, -4, int32);
__PUT((int32)(address)new - 4, tag, int32);
Heap_Unlock();
_o_result = new;
return _o_result;
return new;
}
static void Heap_Mark (int32 q)

View file

@ -74,7 +74,6 @@ static void Modules_Append (CHAR *a, LONGINT a__len, CHAR *b, LONGINT b__len)
Modules_Module Modules_ThisMod (CHAR *name, LONGINT name__len)
{
Modules_Module _o_result;
Modules_Module m = NIL;
CHAR bodyname[64];
Modules_Command body;
@ -93,14 +92,12 @@ Modules_Module Modules_ThisMod (CHAR *name, LONGINT name__len)
Modules_Append((void*)Modules_resMsg, 256, name, name__len);
Modules_Append((void*)Modules_resMsg, 256, (CHAR*)"\" not found", 12);
}
_o_result = m;
__DEL(name);
return _o_result;
return m;
}
Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, LONGINT name__len)
{
Modules_Command _o_result;
Modules_Cmd c = NIL;
__DUP(name, name__len, CHAR);
c = mod->cmds;
@ -110,9 +107,8 @@ Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, LONGINT nam
if (c != NIL) {
Modules_res = 0;
Modules_resMsg[0] = 0x00;
_o_result = c->cmd;
__DEL(name);
return _o_result;
return c->cmd;
} else {
Modules_res = 2;
__MOVE(" command \"", Modules_resMsg, 11);
@ -121,9 +117,8 @@ Modules_Command Modules_ThisCommand (Modules_Module mod, CHAR *name, LONGINT nam
Modules_Append((void*)Modules_resMsg, 256, (CHAR*)".", 2);
Modules_Append((void*)Modules_resMsg, 256, name, name__len);
Modules_Append((void*)Modules_resMsg, 256, (CHAR*)"\" not found", 12);
_o_result = NIL;
__DEL(name);
return _o_result;
return NIL;
}
__RETCHK;
}

View file

@ -74,7 +74,6 @@ static void OPB_err (int16 n)
OPT_Node OPB_NewLeaf (OPT_Object obj)
{
OPT_Node _o_result;
OPT_Node node = NIL;
switch (obj->mode) {
case 1:
@ -102,8 +101,7 @@ OPT_Node OPB_NewLeaf (OPT_Object obj)
}
node->obj = obj;
node->typ = obj->typ;
_o_result = node;
return _o_result;
return node;
}
void OPB_Construct (int8 class, OPT_Node *x, OPT_Node y)
@ -131,34 +129,27 @@ void OPB_Link (OPT_Node *x, OPT_Node *last, OPT_Node y)
static int16 OPB_BoolToInt (BOOLEAN b)
{
int16 _o_result;
if (b) {
_o_result = 1;
return _o_result;
return 1;
} else {
_o_result = 0;
return _o_result;
return 0;
}
__RETCHK;
}
static BOOLEAN OPB_IntToBool (int64 i)
{
BOOLEAN _o_result;
_o_result = i != 0;
return _o_result;
return i != 0;
}
OPT_Node OPB_NewBoolConst (BOOLEAN boolval)
{
OPT_Node _o_result;
OPT_Node x = NIL;
x = OPT_NewNode(7);
x->typ = OPT_booltyp;
x->conval = OPT_NewConst();
x->conval->intval = OPB_BoolToInt(boolval);
_o_result = x;
return _o_result;
return x;
}
void OPB_OptIf (OPT_Node *x)
@ -198,26 +189,22 @@ void OPB_OptIf (OPT_Node *x)
OPT_Node OPB_Nil (void)
{
OPT_Node _o_result;
OPT_Node x = NIL;
x = OPT_NewNode(7);
x->typ = OPT_niltyp;
x->conval = OPT_NewConst();
x->conval->intval = 0;
_o_result = x;
return _o_result;
return x;
}
OPT_Node OPB_EmptySet (void)
{
OPT_Node _o_result;
OPT_Node x = NIL;
x = OPT_NewNode(7);
x->typ = OPT_settyp;
x->conval = OPT_NewConst();
x->conval->setval = 0x0;
_o_result = x;
return _o_result;
return x;
}
static void OPB_SetIntType (OPT_Node node)
@ -238,32 +225,27 @@ static void OPB_SetSetType (OPT_Node node)
OPT_Node OPB_NewIntConst (int64 intval)
{
OPT_Node _o_result;
OPT_Node x = NIL;
x = OPT_NewNode(7);
x->conval = OPT_NewConst();
x->conval->intval = intval;
OPB_SetIntType(x);
_o_result = x;
return _o_result;
return x;
}
OPT_Node OPB_NewRealConst (LONGREAL realval, OPT_Struct typ)
{
OPT_Node _o_result;
OPT_Node x = NIL;
x = OPT_NewNode(7);
x->conval = OPT_NewConst();
x->conval->realval = realval;
x->typ = typ;
x->conval->intval = -1;
_o_result = x;
return _o_result;
return x;
}
OPT_Node OPB_NewString (OPS_String str, int64 len)
{
OPT_Node _o_result;
OPT_Node x = NIL;
x = OPT_NewNode(7);
x->conval = OPT_NewConst();
@ -272,8 +254,7 @@ OPT_Node OPB_NewString (OPS_String str, int64 len)
x->conval->intval2 = OPM_Longint(len);
x->conval->ext = OPT_NewExt();
__COPY(str, *x->conval->ext, 256);
_o_result = x;
return _o_result;
return x;
}
static void OPB_CharToString (OPT_Node n)
@ -305,9 +286,7 @@ static void OPB_BindNodes (int8 class, OPT_Struct typ, OPT_Node *x, OPT_Node y)
static BOOLEAN OPB_NotVar (OPT_Node x)
{
BOOLEAN _o_result;
_o_result = (x->class >= 7 && ((x->class != 11 || x->subcl != 29) || x->left->class >= 7));
return _o_result;
return (x->class >= 7 && ((x->class != 11 || x->subcl != 29) || x->left->class >= 7));
}
void OPB_DeRef (OPT_Node *x)
@ -489,7 +468,6 @@ void OPB_In (OPT_Node *x, OPT_Node y)
static int64 OPB_log (int64 x)
{
int64 _o_result;
OPB_exp = 0;
if (x > 0) {
while (!__ODD(x)) {
@ -497,8 +475,7 @@ static int64 OPB_log (int64 x)
OPB_exp += 1;
}
}
_o_result = x;
return _o_result;
return x;
}
static void OPB_CheckRealType (int16 f, int16 nr, OPT_Const x)
@ -529,14 +506,12 @@ static OPT_Node NewOp__29 (int8 op, OPT_Struct typ, OPT_Node z);
static OPT_Node NewOp__29 (int8 op, OPT_Struct typ, OPT_Node z)
{
OPT_Node _o_result;
OPT_Node node = NIL;
node = OPT_NewNode(11);
node->subcl = op;
node->typ = typ;
node->left = z;
_o_result = node;
return _o_result;
return node;
}
void OPB_MOp (int8 op, OPT_Node *x)
@ -775,7 +750,6 @@ static int16 ConstCmp__14 (void);
static int16 ConstCmp__14 (void)
{
int16 _o_result;
int16 res;
switch (*ConstOp__13_s->f) {
case 0:
@ -836,8 +810,7 @@ static int16 ConstCmp__14 (void)
break;
}
(*ConstOp__13_s->x)->typ = OPT_booltyp;
_o_result = res;
return _o_result;
return res;
}
static void OPB_ConstOp (int16 op, OPT_Node x, OPT_Node y)
@ -1202,7 +1175,6 @@ static void NewOp__39 (int8 op, OPT_Struct typ, OPT_Node *x, OPT_Node y)
static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y)
{
BOOLEAN _o_result;
BOOLEAN ok, xCharArr, yCharArr;
xCharArr = (__IN((*x)->typ->comp, 0x0c, 32) && (*x)->typ->BaseTyp->form == 3) || *Op__38_s->f == 8;
yCharArr = (__IN((*y)->typ->comp, 0x0c, 32) && (*y)->typ->BaseTyp->form == 3) || *Op__38_s->g == 8;
@ -1228,8 +1200,7 @@ static BOOLEAN strings__41 (OPT_Node *x, OPT_Node *y)
OPB_Index(&*x, OPB_NewIntConst(0));
}
}
_o_result = ok;
return _o_result;
return ok;
}
void OPB_Op (int8 op, OPT_Node *x, OPT_Node y)
@ -2016,14 +1987,12 @@ static OPT_Node NewOp__54 (int8 class, int8 subcl, OPT_Node left, OPT_Node right
static OPT_Node NewOp__54 (int8 class, int8 subcl, OPT_Node left, OPT_Node right)
{
OPT_Node _o_result;
OPT_Node node = NIL;
node = OPT_NewNode(class);
node->subcl = subcl;
node->left = left;
node->right = right;
_o_result = node;
return _o_result;
return node;
}
void OPB_StPar1 (OPT_Node *par0, OPT_Node x, int8 fctno)

View file

@ -157,19 +157,16 @@ static void OPC_Str1 (CHAR *s, LONGINT s__len, int32 x)
static int16 OPC_Length (CHAR *s, LONGINT s__len)
{
int16 _o_result;
int16 i;
i = 0;
while (s[__X(i, s__len)] != 0x00) {
i += 1;
}
_o_result = i;
return _o_result;
return i;
}
static int16 OPC_PerfectHash (CHAR *s, LONGINT s__len)
{
int16 _o_result;
int16 i, h;
i = 0;
h = 0;
@ -177,8 +174,7 @@ static int16 OPC_PerfectHash (CHAR *s, LONGINT s__len)
h = 3 * h + (int16)s[__X(i, s__len)];
i += 1;
}
_o_result = (int)__MOD(h, 105);
return _o_result;
return (int)__MOD(h, 105);
}
void OPC_Ident (OPT_Object obj)
@ -320,9 +316,7 @@ void OPC_Andent (OPT_Struct typ)
static BOOLEAN OPC_Undefined (OPT_Object obj)
{
BOOLEAN _o_result;
_o_result = obj->name[0] == 0x00 || (((obj->mnolev >= 0 && obj->linkadr != (3 + OPM_currFile))) && obj->linkadr != 2);
return _o_result;
return obj->name[0] == 0x00 || (((obj->mnolev >= 0 && obj->linkadr != (3 + OPM_currFile))) && obj->linkadr != 2);
}
static void OPC_DeclareBase (OPT_Object dcl)
@ -391,13 +385,11 @@ static void OPC_DeclareBase (OPT_Object dcl)
int32 OPC_NofPtrs (OPT_Struct typ)
{
int32 _o_result;
OPT_Object fld = NIL;
OPT_Struct btyp = NIL;
int32 n;
if ((typ->form == 11 && typ->sysflag == 0)) {
_o_result = 1;
return _o_result;
return 1;
} else if ((typ->comp == 4 && __MASK(typ->sysflag, -256) == 0)) {
btyp = typ->BaseTyp;
if (btyp != NIL) {
@ -414,8 +406,7 @@ int32 OPC_NofPtrs (OPT_Struct typ)
}
fld = fld->link;
}
_o_result = n;
return _o_result;
return n;
} else if (typ->comp == 2) {
btyp = typ->BaseTyp;
n = typ->n;
@ -423,11 +414,9 @@ int32 OPC_NofPtrs (OPT_Struct typ)
n = btyp->n * n;
btyp = btyp->BaseTyp;
}
_o_result = OPC_NofPtrs(btyp) * n;
return _o_result;
return OPC_NofPtrs(btyp) * n;
} else {
_o_result = 0;
return _o_result;
return 0;
}
__RETCHK;
}
@ -608,7 +597,6 @@ static void OPC_DeclareTProcs (OPT_Object obj, BOOLEAN *empty)
OPT_Object OPC_BaseTProc (OPT_Object obj)
{
OPT_Object _o_result;
OPT_Struct typ = NIL, base = NIL;
int32 mno;
typ = obj->link->typ;
@ -622,8 +610,7 @@ OPT_Object OPC_BaseTProc (OPT_Object obj)
base = typ->BaseTyp;
}
OPT_FindField(obj->name, typ, &obj);
_o_result = obj;
return _o_result;
return obj;
}
static void OPC_DefineTProcMacros (OPT_Object obj, BOOLEAN *empty)
@ -734,18 +721,14 @@ static void OPC_DefineType (OPT_Struct str)
static BOOLEAN OPC_Prefixed (OPT_ConstExt x, CHAR *y, LONGINT y__len)
{
BOOLEAN _o_result;
int16 i;
BOOLEAN r;
__DUP(y, y__len, CHAR);
i = 0;
while ((*x)[__X(i + 1, 256)] == y[__X(i, y__len)]) {
i += 1;
}
r = y[__X(i, y__len)] == 0x00;
_o_result = r;
__DEL(y);
return _o_result;
return y[__X(i, y__len)] == 0x00;
}
static void OPC_CProcDefs (OPT_Object obj, int16 vis)
@ -1455,12 +1438,6 @@ void OPC_EnterProc (OPT_Object proc)
}
OPC_ProcHeader(proc, 1);
OPC_BegBlk();
if (proc->typ != OPT_notyp) {
OPC_BegStat();
OPC_Ident(proc->typ->strobj);
OPM_WriteString((CHAR*)" _o_result;", 12);
OPM_WriteLn();
}
scope = proc->scope;
OPC_IdentList(scope->scope, 0);
if (!scope->leaf) {

View file

@ -124,33 +124,25 @@ void OPM_LogWLn (void)
int64 OPM_SignedMaximum (int32 bytecount)
{
int64 _o_result;
int64 result;
result = 1;
result = __LSH(result, __ASHL(bytecount, 3) - 1, 64);
_o_result = result - 1;
return _o_result;
return result - 1;
}
int64 OPM_SignedMinimum (int32 bytecount)
{
int64 _o_result;
_o_result = -OPM_SignedMaximum(bytecount) - 1;
return _o_result;
return -OPM_SignedMaximum(bytecount) - 1;
}
int32 OPM_Longint (int64 n)
{
int32 _o_result;
_o_result = __VAL(int32, n);
return _o_result;
return __VAL(int32, n);
}
int16 OPM_Integer (int64 n)
{
int16 _o_result;
_o_result = __VAL(int16, n);
return _o_result;
return __VAL(int16, n);
}
static void OPM_ScanOptions (CHAR *s, LONGINT s__len)
@ -266,7 +258,6 @@ static void OPM_ScanOptions (CHAR *s, LONGINT s__len)
BOOLEAN OPM_OpenPar (void)
{
BOOLEAN _o_result;
CHAR s[256];
if (Platform_ArgCount == 1) {
OPM_LogWLn();
@ -274,7 +265,7 @@ BOOLEAN OPM_OpenPar (void)
OPM_LogWStr(Configuration_versionLong, 75);
OPM_LogW('.');
OPM_LogWLn();
OPM_LogWStr((CHAR*)"Based on Ofront by Software Templ OEG.", 39);
OPM_LogWStr((CHAR*)"Based on Ofront by J. Templ and Software Templ OEG.", 52);
OPM_LogWLn();
OPM_LogWStr((CHAR*)"Further development by Norayr Chilingarian, David Brown and others.", 68);
OPM_LogWLn();
@ -287,7 +278,7 @@ BOOLEAN OPM_OpenPar (void)
OPM_LogWStr((CHAR*)" options {files {options}}.", 28);
OPM_LogWLn();
OPM_LogWLn();
OPM_LogWStr((CHAR*)"Where options = [\"-\" {option} ].", 33);
OPM_LogWStr((CHAR*)"Options:", 9);
OPM_LogWLn();
OPM_LogWLn();
OPM_LogWStr((CHAR*)" Run time safety", 18);
@ -345,7 +336,7 @@ BOOLEAN OPM_OpenPar (void)
OPM_LogWLn();
OPM_LogWStr((CHAR*)" -A48 32 bit addresses, 64 bit alignment (e.g. Windows 32 bit on x86, linux 32 bit on arm).", 97);
OPM_LogWLn();
OPM_LogWStr((CHAR*)" -A88 66 bit addresses, 64 bit alignment (e.g. 64 bit platforms).", 71);
OPM_LogWStr((CHAR*)" -A88 64 bit addresses, 64 bit alignment (e.g. 64 bit platforms).", 71);
OPM_LogWLn();
OPM_LogWLn();
OPM_LogWStr((CHAR*)"All options are off by default, except where noted above.", 58);
@ -356,8 +347,7 @@ BOOLEAN OPM_OpenPar (void)
OPM_LogWLn();
OPM_LogWStr((CHAR*)"Repeating an option toggles its value.", 39);
OPM_LogWLn();
_o_result = 0;
return _o_result;
return 0;
} else {
OPM_AddressSize = 4;
OPM_GetAlignment(&OPM_Alignment);
@ -376,8 +366,7 @@ BOOLEAN OPM_OpenPar (void)
OPM_GlobalAlignment = OPM_Alignment;
__COPY(OPM_Model, OPM_GlobalModel, 10);
OPM_GlobalOptions = OPM_Options;
_o_result = 1;
return _o_result;
return 1;
}
__RETCHK;
}
@ -741,20 +730,16 @@ void OPM_SymRCh (CHAR *ch)
int32 OPM_SymRInt (void)
{
int32 _o_result;
int32 k;
Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (void*)&k, 4);
_o_result = k;
return _o_result;
return k;
}
int64 OPM_SymRInt64 (void)
{
int64 _o_result;
int64 k;
Files_ReadNum(&OPM_oldSF, Files_Rider__typ, (void*)&k, 8);
_o_result = k;
return _o_result;
return k;
}
void OPM_SymRSet (uint64 *s)
@ -797,9 +782,7 @@ void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done)
BOOLEAN OPM_eofSF (void)
{
BOOLEAN _o_result;
_o_result = OPM_oldSF.eof;
return _o_result;
return OPM_oldSF.eof;
}
void OPM_SymWCh (CHAR ch)

View file

@ -901,7 +901,6 @@ static void OPP_Receiver (int8 *mode, OPS_Name name, OPT_Struct *typ, OPT_Struct
static BOOLEAN OPP_Extends (OPT_Struct x, OPT_Struct b)
{
BOOLEAN _o_result;
if ((b->form == 11 && x->form == 11)) {
b = b->BaseTyp;
x = x->BaseTyp;
@ -911,8 +910,7 @@ static BOOLEAN OPP_Extends (OPT_Struct x, OPT_Struct b)
x = x->BaseTyp;
} while (!(x == NIL || x == b));
}
_o_result = x == b;
return _o_result;
return x == b;
}
static struct ProcedureDeclaration__16 {

View file

@ -97,7 +97,6 @@ static LONGREAL Ten__9 (int16 e);
static LONGREAL Ten__9 (int16 e)
{
LONGREAL _o_result;
LONGREAL x, p;
x = (LONGREAL)1;
p = (LONGREAL)10;
@ -110,23 +109,18 @@ static LONGREAL Ten__9 (int16 e)
p = p * p;
}
}
_o_result = x;
return _o_result;
return x;
}
static int16 Ord__7 (CHAR ch, BOOLEAN hex)
{
int16 _o_result;
if (ch <= '9') {
_o_result = (int16)ch - 48;
return _o_result;
return (int16)ch - 48;
} else if (hex) {
_o_result = ((int16)ch - 65) + 10;
return _o_result;
return ((int16)ch - 65) + 10;
} else {
OPS_err(2);
_o_result = 0;
return _o_result;
return 0;
}
__RETCHK;
}
@ -324,6 +318,7 @@ void OPS_Get (int8 *sym)
while (OPS_ch <= ' ') {
if (OPS_ch == 0x00) {
*sym = 64;
Get__1_s = _s.lnk;
return;
} else {
OPM_Get(&OPS_ch);

View file

@ -179,7 +179,6 @@ static void OPT_err (int16 n)
int16 OPT_IntSize (int64 n)
{
int16 _o_result;
int16 bytes;
if (n < 0) {
n = -(n + 1);
@ -188,77 +187,59 @@ int16 OPT_IntSize (int64 n)
while ((bytes < 8 && __ASH(n, -(__ASHL(bytes, 3) - 1)) != 0)) {
bytes += 1;
}
_o_result = bytes;
return _o_result;
return bytes;
}
OPT_Struct OPT_IntType (int32 size)
{
OPT_Struct _o_result;
if (size <= OPT_int8typ->size) {
_o_result = OPT_int8typ;
return _o_result;
return OPT_int8typ;
}
if (size <= OPT_int16typ->size) {
_o_result = OPT_int16typ;
return _o_result;
return OPT_int16typ;
}
if (size <= OPT_int32typ->size) {
_o_result = OPT_int32typ;
return _o_result;
return OPT_int32typ;
}
_o_result = OPT_int64typ;
return _o_result;
return OPT_int64typ;
}
OPT_Struct OPT_SetType (int32 size)
{
OPT_Struct _o_result;
if (size == OPT_set32typ->size) {
_o_result = OPT_set32typ;
return _o_result;
return OPT_set32typ;
}
_o_result = OPT_set64typ;
return _o_result;
return OPT_set64typ;
}
OPT_Struct OPT_ShorterOrLongerType (OPT_Struct x, int16 dir)
{
OPT_Struct _o_result;
int16 i;
__ASSERT(x->form == 4, 0);
__ASSERT(x->BaseTyp == OPT_undftyp, 0);
__ASSERT(dir == 1 || dir == -1, 0);
if (dir > 0) {
if (x->size < OPT_sinttyp->size) {
_o_result = OPT_sinttyp;
return _o_result;
return OPT_sinttyp;
}
if (x->size < OPT_inttyp->size) {
_o_result = OPT_inttyp;
return _o_result;
return OPT_inttyp;
}
if (x->size < OPT_linttyp->size) {
_o_result = OPT_linttyp;
return _o_result;
return OPT_linttyp;
}
_o_result = OPT_int64typ;
return _o_result;
return OPT_int64typ;
} else {
if (x->size > OPT_linttyp->size) {
_o_result = OPT_linttyp;
return _o_result;
return OPT_linttyp;
}
if (x->size > OPT_inttyp->size) {
_o_result = OPT_inttyp;
return _o_result;
return OPT_inttyp;
}
if (x->size > OPT_sinttyp->size) {
_o_result = OPT_sinttyp;
return _o_result;
return OPT_sinttyp;
}
_o_result = OPT_int8typ;
return _o_result;
return OPT_int8typ;
}
__RETCHK;
}
@ -285,7 +266,6 @@ void OPT_Align (int32 *adr, int32 base)
int32 OPT_SizeAlignment (int32 size)
{
int32 _o_result;
int32 alignment;
if (size < OPM_Alignment) {
alignment = 1;
@ -295,13 +275,11 @@ int32 OPT_SizeAlignment (int32 size)
} else {
alignment = OPM_Alignment;
}
_o_result = alignment;
return _o_result;
return alignment;
}
int32 OPT_BaseAlignment (OPT_Struct typ)
{
int32 _o_result;
int32 alignment;
if (typ->form == 13) {
if (typ->comp == 4) {
@ -312,8 +290,7 @@ int32 OPT_BaseAlignment (OPT_Struct typ)
} else {
alignment = OPT_SizeAlignment(typ->size);
}
_o_result = alignment;
return _o_result;
return alignment;
}
void OPT_TypSize (OPT_Struct typ)
@ -389,25 +366,20 @@ void OPT_TypSize (OPT_Struct typ)
OPT_Const OPT_NewConst (void)
{
OPT_Const _o_result;
OPT_Const const_ = NIL;
__NEW(const_, OPT_ConstDesc);
_o_result = const_;
return _o_result;
return const_;
}
OPT_Object OPT_NewObj (void)
{
OPT_Object _o_result;
OPT_Object obj = NIL;
__NEW(obj, OPT_ObjDesc);
_o_result = obj;
return _o_result;
return obj;
}
OPT_Struct OPT_NewStr (int8 form, int8 comp)
{
OPT_Struct _o_result;
OPT_Struct typ = NIL;
__NEW(typ, OPT_StrDesc);
typ->form = form;
@ -418,27 +390,22 @@ OPT_Struct OPT_NewStr (int8 form, int8 comp)
}
typ->size = -1;
typ->BaseTyp = OPT_undftyp;
_o_result = typ;
return _o_result;
return typ;
}
OPT_Node OPT_NewNode (int8 class)
{
OPT_Node _o_result;
OPT_Node node = NIL;
__NEW(node, OPT_NodeDesc);
node->class = class;
_o_result = node;
return _o_result;
return node;
}
OPT_ConstExt OPT_NewExt (void)
{
OPT_ConstExt _o_result;
OPT_ConstExt ext = NIL;
ext = __NEWARR(NIL, 1, 1, 1, 0, 256);
_o_result = ext;
return _o_result;
return ext;
}
void OPT_OpenScope (int8 level, OPT_Object owner)
@ -1120,7 +1087,6 @@ static void OPT_InSign (int8 mno, OPT_Struct *res, OPT_Object *par)
static OPT_Object OPT_InFld (void)
{
OPT_Object _o_result;
int32 tag;
OPT_Object obj = NIL;
tag = OPT_impCtxt.nextTag;
@ -1146,13 +1112,11 @@ static OPT_Object OPT_InFld (void)
obj->vis = 0;
obj->adr = OPM_SymRInt();
}
_o_result = obj;
return _o_result;
return obj;
}
static OPT_Object OPT_InTProc (int8 mno)
{
OPT_Object _o_result;
int32 tag;
OPT_Object obj = NIL;
tag = OPT_impCtxt.nextTag;
@ -1174,22 +1138,17 @@ static OPT_Object OPT_InTProc (int8 mno)
obj->vis = 0;
obj->adr = __ASHL(OPM_SymRInt(), 16);
}
_o_result = obj;
return _o_result;
return obj;
}
static OPT_Struct OPT_InTyp (int32 tag)
{
OPT_Struct _o_result;
if (tag == 4) {
_o_result = OPT_IntType(OPM_SymRInt());
return _o_result;
return OPT_IntType(OPM_SymRInt());
} else if (tag == 7) {
_o_result = OPT_SetType(OPM_SymRInt());
return _o_result;
return OPT_SetType(OPM_SymRInt());
} else {
_o_result = OPT_impCtxt.ref[__X(tag, 255)];
return _o_result;
return OPT_impCtxt.ref[__X(tag, 255)];
}
__RETCHK;
}
@ -1378,7 +1337,6 @@ static void OPT_InStruct (OPT_Struct *typ)
static OPT_Object OPT_InObj (int8 mno)
{
OPT_Object _o_result;
int16 i, s;
CHAR ch;
OPT_Object obj = NIL, old = NIL;
@ -1475,8 +1433,7 @@ static OPT_Object OPT_InObj (int8 mno)
}
}
}
_o_result = obj;
return _o_result;
return obj;
}
void OPT_Import (OPS_Name aliasName, OPS_Name name, BOOLEAN *done)

View file

@ -207,44 +207,35 @@ void OPV_AdrAndSize (OPT_Object topScope)
static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp)
{
int16 _o_result;
switch (class) {
case 7: case 0: case 2: case 4: case 9:
case 13:
_o_result = 10;
return _o_result;
return 10;
break;
case 5:
if (__IN(3, OPM_Options, 32)) {
_o_result = 10;
return _o_result;
return 10;
} else {
_o_result = 9;
return _o_result;
return 9;
}
break;
case 1:
if (__IN(comp, 0x0c, 32)) {
_o_result = 10;
return _o_result;
return 10;
} else {
_o_result = 9;
return _o_result;
return 9;
}
break;
case 3:
_o_result = 9;
return _o_result;
return 9;
break;
case 11:
switch (subclass) {
case 33: case 7: case 24: case 29: case 20:
_o_result = 9;
return _o_result;
return 9;
break;
case 16: case 21: case 22: case 23: case 25:
_o_result = 10;
return _o_result;
return 10;
break;
default:
OPM_LogWStr((CHAR*)"unhandled case in OPV.Precedence OPT.Nmop, subclass = ", 55);
@ -257,64 +248,50 @@ static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp
switch (subclass) {
case 1:
if (form == 7) {
_o_result = 4;
return _o_result;
return 4;
} else {
_o_result = 8;
return _o_result;
return 8;
}
break;
case 2:
if (form == 7) {
_o_result = 3;
return _o_result;
return 3;
} else {
_o_result = 8;
return _o_result;
return 8;
}
break;
case 3: case 4:
_o_result = 10;
return _o_result;
return 10;
break;
case 6:
if (form == 7) {
_o_result = 2;
return _o_result;
return 2;
} else {
_o_result = 7;
return _o_result;
return 7;
}
break;
case 7:
if (form == 7) {
_o_result = 4;
return _o_result;
return 4;
} else {
_o_result = 7;
return _o_result;
return 7;
}
break;
case 11: case 12: case 13: case 14:
_o_result = 6;
return _o_result;
return 6;
break;
case 9: case 10:
_o_result = 5;
return _o_result;
return 5;
break;
case 5:
_o_result = 1;
return _o_result;
return 1;
break;
case 8:
_o_result = 0;
return _o_result;
return 0;
break;
case 19: case 15: case 17: case 18: case 26:
case 27: case 28:
_o_result = 10;
return _o_result;
return 10;
break;
default:
OPM_LogWStr((CHAR*)"unhandled case in OPV.Precedence OPT.Ndop, subclass = ", 55);
@ -324,12 +301,10 @@ static int16 OPV_Precedence (int16 class, int16 subclass, int16 form, int16 comp
}
break;
case 10:
_o_result = 10;
return _o_result;
return 10;
break;
case 8: case 6:
_o_result = 12;
return _o_result;
return 12;
break;
default:
OPM_LogWStr((CHAR*)"unhandled case in OPV.Precedence, class = ", 43);
@ -358,13 +333,10 @@ static void OPV_Len (OPT_Node n, int64 dim)
static BOOLEAN OPV_SideEffects (OPT_Node n)
{
BOOLEAN _o_result;
if (n != NIL) {
_o_result = (n->class == 13 || OPV_SideEffects(n->left)) || OPV_SideEffects(n->right);
return _o_result;
return (n->class == 13 || OPV_SideEffects(n->left)) || OPV_SideEffects(n->right);
} else {
_o_result = 0;
return _o_result;
return 0;
}
__RETCHK;
}
@ -744,7 +716,6 @@ static void OPV_ActualPar (OPT_Node n, OPT_Object fp)
static OPT_Object OPV_SuperProc (OPT_Node n)
{
OPT_Object _o_result;
OPT_Object obj = NIL;
OPT_Struct typ = NIL;
typ = n->right->typ;
@ -752,8 +723,7 @@ static OPT_Object OPV_SuperProc (OPT_Node n)
typ = typ->BaseTyp;
}
OPT_FindField(n->left->obj->name, typ->BaseTyp, &obj);
_o_result = obj;
return _o_result;
return obj;
}
static void OPV_expr (OPT_Node n, int16 prec)
@ -1187,12 +1157,10 @@ static void OPV_CaseStat (OPT_Node n, OPT_Object outerProc)
static BOOLEAN OPV_ImplicitReturn (OPT_Node n)
{
BOOLEAN _o_result;
while ((n != NIL && n->class != 26)) {
n = n->link;
}
_o_result = n == NIL;
return _o_result;
return n == NIL;
}
static void OPV_NewArr (OPT_Node d, OPT_Node x)
@ -1523,21 +1491,16 @@ static void OPV_stat (OPT_Node n, OPT_Object outerProc)
OPM_WriteString((CHAR*)"__ENDMOD", 9);
}
} else {
OPC_ExitProc(outerProc, 0, 0);
OPM_WriteString((CHAR*)"return", 7);
if (n->left != NIL) {
OPM_WriteString((CHAR*)"_o_result = ", 13);
OPM_Write(' ');
if ((n->left->typ->form == 11 && n->obj->typ != n->left->typ)) {
OPM_WriteString((CHAR*)"(void*)", 8);
OPV_expr(n->left, 10);
} else {
OPV_expr(n->left, -1);
}
OPM_WriteString((CHAR*)";", 2);
OPM_WriteLn();
OPC_BegStat();
OPC_ExitProc(outerProc, 0, 0);
OPM_WriteString((CHAR*)"return _o_result", 17);
} else {
OPM_WriteString((CHAR*)"return", 7);
}
}
break;

View file

@ -56,14 +56,12 @@ void Out_Char (CHAR ch)
static int32 Out_Length (CHAR *s, LONGINT s__len)
{
int32 _o_result;
int32 l;
l = 0;
while ((l < s__len && s[__X(l, s__len)] != 0x00)) {
l += 1;
}
_o_result = l;
return _o_result;
return l;
}
void Out_String (CHAR *str, LONGINT str__len)
@ -152,7 +150,6 @@ static void Out_prepend (CHAR *t, LONGINT t__len, CHAR *s, LONGINT s__len, int16
LONGREAL Out_Ten (int16 e)
{
LONGREAL _o_result;
LONGREAL r, power;
r = (LONGREAL)1;
power = (LONGREAL)10;
@ -163,8 +160,7 @@ LONGREAL Out_Ten (int16 e)
power = power * power;
e = __ASHR(e, 1);
}
_o_result = r;
return _o_result;
return r;
}
static void Out_RealP (LONGREAL x, int16 n, BOOLEAN long_)

View file

@ -186,65 +186,47 @@ extern void Heap_InitHeap();
BOOLEAN Platform_TooManyFiles (int16 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_ERRORTOOMANYOPENFILES();
return _o_result;
return e == Platform_ERRORTOOMANYOPENFILES();
}
BOOLEAN Platform_NoSuchDirectory (int16 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_ERRORPATHNOTFOUND();
return _o_result;
return e == Platform_ERRORPATHNOTFOUND();
}
BOOLEAN Platform_DifferentFilesystems (int16 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_ERRORNOTSAMEDEVICE();
return _o_result;
return e == Platform_ERRORNOTSAMEDEVICE();
}
BOOLEAN Platform_Inaccessible (int16 e)
{
BOOLEAN _o_result;
_o_result = ((e == Platform_ERRORACCESSDENIED() || e == Platform_ERRORWRITEPROTECT()) || e == Platform_ERRORNOTREADY()) || e == Platform_ERRORSHARINGVIOLATION();
return _o_result;
return ((e == Platform_ERRORACCESSDENIED() || e == Platform_ERRORWRITEPROTECT()) || e == Platform_ERRORNOTREADY()) || e == Platform_ERRORSHARINGVIOLATION();
}
BOOLEAN Platform_Absent (int16 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_ERRORFILENOTFOUND() || e == Platform_ERRORPATHNOTFOUND();
return _o_result;
return e == Platform_ERRORFILENOTFOUND() || e == Platform_ERRORPATHNOTFOUND();
}
BOOLEAN Platform_TimedOut (int16 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_ETIMEDOUT();
return _o_result;
return e == Platform_ETIMEDOUT();
}
BOOLEAN Platform_ConnectionFailed (int16 e)
{
BOOLEAN _o_result;
_o_result = ((e == Platform_ECONNREFUSED() || e == Platform_ECONNABORTED()) || e == Platform_ENETUNREACH()) || e == Platform_EHOSTUNREACH();
return _o_result;
return ((e == Platform_ECONNREFUSED() || e == Platform_ECONNABORTED()) || e == Platform_ENETUNREACH()) || e == Platform_EHOSTUNREACH();
}
BOOLEAN Platform_Interrupted (int16 e)
{
BOOLEAN _o_result;
_o_result = e == Platform_EINTR();
return _o_result;
return e == Platform_EINTR();
}
int32 Platform_OSAllocate (int32 size)
{
int32 _o_result;
_o_result = Platform_allocate(size);
return _o_result;
return Platform_allocate(size);
}
void Platform_OSFree (int32 address)
@ -265,20 +247,17 @@ void Platform_Init (int32 argc, int32 argvadr)
BOOLEAN Platform_getEnv (CHAR *var, LONGINT var__len, CHAR *val, LONGINT val__len)
{
BOOLEAN _o_result;
CHAR buf[4096];
int16 res;
__DUP(var, var__len, CHAR);
res = Platform_getenv(var, var__len, (void*)buf, 4096);
if ((res > 0 && res < 4096)) {
__COPY(buf, val, val__len);
_o_result = 1;
__DEL(var);
return _o_result;
return 1;
} else {
_o_result = 0;
__DEL(var);
return _o_result;
return 0;
}
__RETCHK;
}
@ -329,7 +308,6 @@ void Platform_GetIntArg (int16 n, int32 *val)
int16 Platform_ArgPos (CHAR *s, LONGINT s__len)
{
int16 _o_result;
int16 i;
CHAR arg[256];
__DUP(s, s__len, CHAR);
@ -339,9 +317,8 @@ int16 Platform_ArgPos (CHAR *s, LONGINT s__len)
i += 1;
Platform_GetArg(i, (void*)arg, 256);
}
_o_result = i;
__DEL(s);
return _o_result;
return i;
}
void Platform_SetBadInstructionHandler (Platform_SignalHandler handler)
@ -362,11 +339,9 @@ void Platform_GetClock (int32 *t, int32 *d)
int32 Platform_Time (void)
{
int32 _o_result;
int32 ms;
ms = Platform_GetTickCount();
_o_result = (int)__MOD(ms - Platform_TimeStart, 2147483647);
return _o_result;
return (int)__MOD(ms - Platform_TimeStart, 2147483647);
}
void Platform_Delay (int32 ms)
@ -392,7 +367,6 @@ void Platform_GetTimeOfDay (int32 *sec, int32 *usec)
int16 Platform_System (CHAR *cmd, LONGINT cmd__len)
{
int16 _o_result;
int16 result;
__DUP(cmd, cmd__len, CHAR);
result = 127;
@ -404,127 +378,102 @@ int16 Platform_System (CHAR *cmd, LONGINT cmd__len)
}
Platform_cleanupProcess();
}
_o_result = __ASHL(result, 8);
__DEL(cmd);
return _o_result;
return __ASHL(result, 8);
}
int16 Platform_Error (void)
{
int16 _o_result;
_o_result = Platform_err();
return _o_result;
return Platform_err();
}
int16 Platform_OldRO (CHAR *n, LONGINT n__len, int32 *h)
{
int16 _o_result;
int32 fd;
fd = Platform_openro(n, n__len);
if (fd == Platform_invalidHandleValue()) {
_o_result = Platform_err();
return _o_result;
return Platform_err();
} else {
*h = fd;
_o_result = 0;
return _o_result;
return 0;
}
__RETCHK;
}
int16 Platform_OldRW (CHAR *n, LONGINT n__len, int32 *h)
{
int16 _o_result;
int32 fd;
fd = Platform_openrw(n, n__len);
if (fd == Platform_invalidHandleValue()) {
_o_result = Platform_err();
return _o_result;
return Platform_err();
} else {
*h = fd;
_o_result = 0;
return _o_result;
return 0;
}
__RETCHK;
}
int16 Platform_New (CHAR *n, LONGINT n__len, int32 *h)
{
int16 _o_result;
int32 fd;
fd = Platform_opennew(n, n__len);
if (fd == Platform_invalidHandleValue()) {
_o_result = Platform_err();
return _o_result;
return Platform_err();
} else {
*h = fd;
_o_result = 0;
return _o_result;
return 0;
}
__RETCHK;
}
int16 Platform_Close (int32 h)
{
int16 _o_result;
if (Platform_closeHandle(h) == 0) {
_o_result = Platform_err();
return _o_result;
return Platform_err();
} else {
_o_result = 0;
return _o_result;
return 0;
}
__RETCHK;
}
int16 Platform_Identify (int32 h, Platform_FileIdentity *identity, address *identity__typ)
{
int16 _o_result;
Platform_byHandleFileInformation();
if (Platform_getFileInformationByHandle(h) == 0) {
_o_result = Platform_err();
return _o_result;
return Platform_err();
}
(*identity).volume = Platform_bhfiVsn();
(*identity).indexhigh = Platform_bhfiIndexHigh();
(*identity).indexlow = Platform_bhfiIndexLow();
(*identity).mtimehigh = Platform_bhfiMtimeHigh();
(*identity).mtimelow = Platform_bhfiMtimeLow();
_o_result = 0;
return _o_result;
return 0;
}
int16 Platform_IdentifyByName (CHAR *n, LONGINT n__len, Platform_FileIdentity *identity, address *identity__typ)
{
int16 _o_result;
int32 h;
int16 e, i;
__DUP(n, n__len, CHAR);
e = Platform_OldRO((void*)n, n__len, &h);
if (e != 0) {
_o_result = e;
__DEL(n);
return _o_result;
return e;
}
e = Platform_Identify(h, &*identity, identity__typ);
i = Platform_Close(h);
_o_result = e;
__DEL(n);
return _o_result;
return e;
}
BOOLEAN Platform_SameFile (Platform_FileIdentity i1, Platform_FileIdentity i2)
{
BOOLEAN _o_result;
_o_result = (((i1.indexhigh == i2.indexhigh && i1.indexlow == i2.indexlow)) && i1.volume == i2.volume);
return _o_result;
return (((i1.indexhigh == i2.indexhigh && i1.indexlow == i2.indexlow)) && i1.volume == i2.volume);
}
BOOLEAN Platform_SameFileTime (Platform_FileIdentity i1, Platform_FileIdentity i2)
{
BOOLEAN _o_result;
_o_result = (i1.mtimehigh == i2.mtimehigh && i1.mtimelow == i2.mtimelow);
return _o_result;
return (i1.mtimehigh == i2.mtimehigh && i1.mtimelow == i2.mtimelow);
}
void Platform_SetMTime (Platform_FileIdentity *target, address *target__typ, Platform_FileIdentity source)
@ -542,160 +491,127 @@ void Platform_MTimeAsClock (Platform_FileIdentity i, int32 *t, int32 *d)
int16 Platform_Size (int32 h, int32 *l)
{
int16 _o_result;
Platform_largeInteger();
if (Platform_getFileSize(h) == 0) {
_o_result = Platform_err();
return _o_result;
return Platform_err();
}
*l = Platform_liLongint();
_o_result = 0;
return _o_result;
return 0;
}
int16 Platform_Read (int32 h, int32 p, int32 l, int32 *n)
{
int16 _o_result;
int16 result;
int32 lengthread;
result = Platform_readfile(h, p, l, &lengthread);
if (result == 0) {
*n = 0;
_o_result = Platform_err();
return _o_result;
return Platform_err();
} else {
*n = lengthread;
_o_result = 0;
return _o_result;
return 0;
}
__RETCHK;
}
int16 Platform_ReadBuf (int32 h, SYSTEM_BYTE *b, LONGINT b__len, int32 *n)
{
int16 _o_result;
int16 result;
int32 lengthread;
result = Platform_readfile(h, (address)b, b__len, &lengthread);
if (result == 0) {
*n = 0;
_o_result = Platform_err();
return _o_result;
return Platform_err();
} else {
*n = lengthread;
_o_result = 0;
return _o_result;
return 0;
}
__RETCHK;
}
int16 Platform_Write (int32 h, int32 p, int32 l)
{
int16 _o_result;
if (Platform_writefile(h, p, l) == 0) {
_o_result = Platform_err();
return _o_result;
return Platform_err();
} else {
_o_result = 0;
return _o_result;
return 0;
}
__RETCHK;
}
int16 Platform_Sync (int32 h)
{
int16 _o_result;
if (Platform_flushFileBuffers(h) == 0) {
_o_result = Platform_err();
return _o_result;
return Platform_err();
} else {
_o_result = 0;
return _o_result;
return 0;
}
__RETCHK;
}
int16 Platform_Seek (int32 h, int32 o, int16 r)
{
int16 _o_result;
int16 rc;
Platform_largeInteger();
Platform_setFilePointerEx(h, o, r, &rc);
if (rc == 0) {
_o_result = Platform_err();
return _o_result;
return Platform_err();
} else {
_o_result = 0;
return _o_result;
return 0;
}
__RETCHK;
}
int16 Platform_Truncate (int32 h, int32 limit)
{
int16 _o_result;
int16 rc;
int32 oldpos;
Platform_largeInteger();
Platform_getFilePos(h, &oldpos, &rc);
if (rc == 0) {
_o_result = Platform_err();
return _o_result;
return Platform_err();
}
Platform_setFilePointerEx(h, limit, Platform_seekset(), &rc);
if (rc == 0) {
_o_result = Platform_err();
return _o_result;
return Platform_err();
}
if (Platform_setEndOfFile(h) == 0) {
_o_result = Platform_err();
return _o_result;
return Platform_err();
}
Platform_setFilePointerEx(h, oldpos, Platform_seekset(), &rc);
if (rc == 0) {
_o_result = Platform_err();
return _o_result;
return Platform_err();
}
_o_result = 0;
return _o_result;
return 0;
}
int16 Platform_Unlink (CHAR *n, LONGINT n__len)
{
int16 _o_result;
if (Platform_deleteFile(n, n__len) == 0) {
_o_result = Platform_err();
return _o_result;
return Platform_err();
} else {
_o_result = 0;
return _o_result;
return 0;
}
__RETCHK;
}
int16 Platform_Chdir (CHAR *n, LONGINT n__len)
{
int16 _o_result;
int16 r;
r = Platform_setCurrentDirectory(n, n__len);
if (r == 0) {
_o_result = Platform_err();
return _o_result;
return Platform_err();
}
Platform_getCurrentDirectory((void*)Platform_CWD, 4096);
_o_result = 0;
return _o_result;
return 0;
}
int16 Platform_Rename (CHAR *o, LONGINT o__len, CHAR *n, LONGINT n__len)
{
int16 _o_result;
if (Platform_moveFile(o, o__len, n, n__len) == 0) {
_o_result = Platform_err();
return _o_result;
return Platform_err();
} else {
_o_result = 0;
return _o_result;
return 0;
}
__RETCHK;
}

View file

@ -25,7 +25,6 @@ static CHAR Reals_ToHex (int16 i);
REAL Reals_Ten (int16 e)
{
REAL _o_result;
LONGREAL r, power;
r = (LONGREAL)1;
power = (LONGREAL)10;
@ -36,13 +35,11 @@ REAL Reals_Ten (int16 e)
power = power * power;
e = __ASHR(e, 1);
}
_o_result = r;
return _o_result;
return r;
}
LONGREAL Reals_TenL (int16 e)
{
LONGREAL _o_result;
LONGREAL r, power;
r = (LONGREAL)1;
power = (LONGREAL)10;
@ -52,8 +49,7 @@ LONGREAL Reals_TenL (int16 e)
}
e = __ASHR(e, 1);
if (e <= 0) {
_o_result = r;
return _o_result;
return r;
}
power = power * power;
}
@ -62,11 +58,9 @@ LONGREAL Reals_TenL (int16 e)
int16 Reals_Expo (REAL x)
{
int16 _o_result;
int16 i;
__GET((address)&x + 2, i, int16);
_o_result = __MASK(__ASHR(i, 7), -256);
return _o_result;
return __MASK(__ASHR(i, 7), -256);
}
void Reals_SetExpo (REAL *x, int16 ex)
@ -80,11 +74,9 @@ void Reals_SetExpo (REAL *x, int16 ex)
int16 Reals_ExpoL (LONGREAL x)
{
int16 _o_result;
int16 i;
__GET((address)&x + 6, i, int16);
_o_result = __MASK(__ASHR(i, 4), -2048);
return _o_result;
return __MASK(__ASHR(i, 4), -2048);
}
void Reals_ConvertL (LONGREAL x, int16 n, CHAR *d, LONGINT d__len)
@ -122,13 +114,10 @@ void Reals_Convert (REAL x, int16 n, CHAR *d, LONGINT d__len)
static CHAR Reals_ToHex (int16 i)
{
CHAR _o_result;
if (i < 10) {
_o_result = (CHAR)(i + 48);
return _o_result;
return (CHAR)(i + 48);
} else {
_o_result = (CHAR)(i + 55);
return _o_result;
return (CHAR)(i + 55);
}
__RETCHK;
}

View file

@ -23,7 +23,6 @@ export void Strings_Replace (CHAR *source, LONGINT source__len, int16 pos, CHAR
int16 Strings_Length (CHAR *s, LONGINT s__len)
{
int16 _o_result;
int32 i;
__DUP(s, s__len, CHAR);
i = 0;
@ -31,13 +30,11 @@ int16 Strings_Length (CHAR *s, LONGINT s__len)
i += 1;
}
if (i <= 32767) {
_o_result = (int16)i;
__DEL(s);
return _o_result;
return (int16)i;
} else {
_o_result = 32767;
__DEL(s);
return _o_result;
return 32767;
}
__RETCHK;
}
@ -70,6 +67,7 @@ void Strings_Insert (CHAR *source, LONGINT source__len, int16 pos, CHAR *dest, L
}
if (pos > n1) {
Strings_Append(dest, dest__len, (void*)source, source__len);
__DEL(source);
return;
}
if ((pos + n2) < dest__len) {
@ -131,6 +129,7 @@ void Strings_Extract (CHAR *source, LONGINT source__len, int16 pos, int16 n, CHA
}
if (pos >= len) {
dest[0] = 0x00;
__DEL(source);
return;
}
i = 0;
@ -146,17 +145,15 @@ void Strings_Extract (CHAR *source, LONGINT source__len, int16 pos, int16 n, CHA
int16 Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len, int16 pos)
{
int16 _o_result;
int16 n1, n2, i, j;
__DUP(pattern, pattern__len, CHAR);
__DUP(s, s__len, CHAR);
n1 = Strings_Length(s, s__len);
n2 = Strings_Length(pattern, pattern__len);
if (n2 == 0) {
_o_result = 0;
__DEL(pattern);
__DEL(s);
return _o_result;
return 0;
}
i = pos;
while (i <= n1 - n2) {
@ -166,18 +163,16 @@ int16 Strings_Pos (CHAR *pattern, LONGINT pattern__len, CHAR *s, LONGINT s__len,
j += 1;
}
if (j == n2) {
_o_result = i;
__DEL(pattern);
__DEL(s);
return _o_result;
return i;
}
}
i += 1;
}
_o_result = -1;
__DEL(pattern);
__DEL(s);
return _o_result;
return -1;
}
void Strings_Cap (CHAR *s, LONGINT s__len)
@ -200,50 +195,42 @@ static BOOLEAN M__8 (CHAR *name, LONGINT name__len, CHAR *mask, LONGINT mask__le
static BOOLEAN M__8 (CHAR *name, LONGINT name__len, CHAR *mask, LONGINT mask__len, int16 n, int16 m)
{
BOOLEAN _o_result;
while ((((n >= 0 && m >= 0)) && mask[__X(m, mask__len)] != '*')) {
if (name[__X(n, name__len)] != mask[__X(m, mask__len)]) {
_o_result = 0;
return _o_result;
return 0;
}
n -= 1;
m -= 1;
}
if (m < 0) {
_o_result = n < 0;
return _o_result;
return n < 0;
}
while ((m >= 0 && mask[__X(m, mask__len)] == '*')) {
m -= 1;
}
if (m < 0) {
_o_result = 1;
return _o_result;
return 1;
}
while (n >= 0) {
if (M__8(name, name__len, mask, mask__len, n, m)) {
_o_result = 1;
return _o_result;
return 1;
}
n -= 1;
}
_o_result = 0;
return _o_result;
return 0;
}
BOOLEAN Strings_Match (CHAR *string, LONGINT string__len, CHAR *pattern, LONGINT pattern__len)
{
BOOLEAN _o_result;
struct Match__7 _s;
__DUP(string, string__len, CHAR);
__DUP(pattern, pattern__len, CHAR);
_s.lnk = Match__7_s;
Match__7_s = &_s;
_o_result = M__8((void*)string, string__len, (void*)pattern, pattern__len, Strings_Length(string, string__len) - 1, Strings_Length(pattern, pattern__len) - 1);
Match__7_s = _s.lnk;
__DEL(string);
__DEL(pattern);
return _o_result;
return M__8((void*)string, string__len, (void*)pattern, pattern__len, Strings_Length(string, string__len) - 1, Strings_Length(pattern, pattern__len) - 1);
}

View file

@ -234,12 +234,10 @@ export void Texts_WriteString (Texts_Writer *W, address *W__typ, CHAR *s, LONGIN
static Texts_FontsFont Texts_FontsThis (CHAR *name, LONGINT name__len)
{
Texts_FontsFont _o_result;
Texts_FontsFont F = NIL;
__NEW(F, Texts_FontDesc);
__COPY(name, F->name, 32);
_o_result = F;
return _o_result;
return F;
}
static void Texts_Find (Texts_Text T, int32 *pos, Texts_Run *u, int32 *org, int32 *off)
@ -338,22 +336,18 @@ static void Texts_Splice (Texts_Run un, Texts_Run v, Texts_Run w, Texts_Text bas
static Texts_Piece Texts_ClonePiece (Texts_Piece p)
{
Texts_Piece _o_result;
Texts_Piece q = NIL;
__NEW(q, Texts_PieceDesc);
__GUARDEQP(q, Texts_PieceDesc) = *p;
_o_result = q;
return _o_result;
return q;
}
static Texts_Elem Texts_CloneElem (Texts_Elem e)
{
Texts_Elem _o_result;
Texts_CopyMsg msg;
msg.e = NIL;
(*e->handle)(e, (void*)&msg, Texts_CopyMsg__typ);
_o_result = msg.e;
return _o_result;
return msg.e;
}
void Texts_CopyElem (Texts_Elem SE, Texts_Elem DE)
@ -369,14 +363,11 @@ void Texts_CopyElem (Texts_Elem SE, Texts_Elem DE)
Texts_Text Texts_ElemBase (Texts_Elem E)
{
Texts_Text _o_result;
_o_result = E->base;
return _o_result;
return E->base;
}
int32 Texts_ElemPos (Texts_Elem E)
{
int32 _o_result;
Texts_Run u = NIL;
int32 pos;
u = E->base->head->next;
@ -385,8 +376,7 @@ int32 Texts_ElemPos (Texts_Elem E)
pos = pos + u->len;
u = u->next;
}
_o_result = pos;
return _o_result;
return pos;
}
static void Texts_HandleAlien (Texts_Elem E, Texts_ElemMsg *msg, address *msg__typ)
@ -716,9 +706,7 @@ void Texts_ReadPrevElem (Texts_Reader *R, address *R__typ)
int32 Texts_Pos (Texts_Reader *R, address *R__typ)
{
int32 _o_result;
_o_result = (*R).org + (*R).off;
return _o_result;
return (*R).org + (*R).off;
}
void Texts_OpenScanner (Texts_Scanner *S, address *S__typ, Texts_Text T, int32 pos)