mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 19:12:25 +00:00
introducing new integer types in SYSTEM module. -- noch.
This commit is contained in:
parent
0aecdbd935
commit
747943b008
26 changed files with 921 additions and 671 deletions
|
|
@ -12,6 +12,7 @@ uses double # as concatenation operator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
|
#include <stdint.h> /* for type sizes -- noch */
|
||||||
//#include <string.h>
|
//#include <string.h>
|
||||||
|
|
||||||
extern void *memcpy(void *dest, const void *src, unsigned long n);
|
extern void *memcpy(void *dest, const void *src, unsigned long n);
|
||||||
|
|
@ -52,6 +53,10 @@ typedef void *SYSTEM_PTR;
|
||||||
//#define *SYSTEM_PTR void
|
//#define *SYSTEM_PTR void
|
||||||
//typedef unsigned char SYSTEM_BYTE;
|
//typedef unsigned char SYSTEM_BYTE;
|
||||||
#define SYSTEM_BYTE unsigned char
|
#define SYSTEM_BYTE unsigned char
|
||||||
|
typedef int8_t SYSTEM_INT8;
|
||||||
|
typedef int16_t SYSTEM_INT16;
|
||||||
|
typedef int32_t SYSTEM_INT32;
|
||||||
|
typedef int64_t SYSTEM_INT64;
|
||||||
|
|
||||||
/* runtime system routines */
|
/* runtime system routines */
|
||||||
extern long SYSTEM_DIV();
|
extern long SYSTEM_DIV();
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ uses double # as concatenation operator
|
||||||
*/
|
*/
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
//#include <alloca.h>
|
//#include <alloca.h>
|
||||||
|
#include <stdint.h> /* for type sizes -- noch */
|
||||||
//#include <string.h>
|
//#include <string.h>
|
||||||
|
|
||||||
extern void *memcpy(void *dest, const void *src, unsigned long n);
|
extern void *memcpy(void *dest, const void *src, unsigned long n);
|
||||||
|
|
@ -52,6 +53,10 @@ typedef void *SYSTEM_PTR;
|
||||||
//#define *SYSTEM_PTR void
|
//#define *SYSTEM_PTR void
|
||||||
//typedef unsigned char SYSTEM_BYTE;
|
//typedef unsigned char SYSTEM_BYTE;
|
||||||
#define SYSTEM_BYTE unsigned char
|
#define SYSTEM_BYTE unsigned char
|
||||||
|
typedef int8_t SYSTEM_INT8;
|
||||||
|
typedef int16_t SYSTEM_INT16;
|
||||||
|
typedef int32_t SYSTEM_INT32;
|
||||||
|
typedef int64_t SYSTEM_INT64;
|
||||||
|
|
||||||
/* runtime system routines */
|
/* runtime system routines */
|
||||||
extern long SYSTEM_DIV();
|
extern long SYSTEM_DIV();
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ uses double # as concatenation operator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
|
#include <stdint.h> /* for type sizes -- noch */
|
||||||
|
|
||||||
//extern void *memcpy(void *dest, const void *src, long n);
|
//extern void *memcpy(void *dest, const void *src, long n);
|
||||||
extern void *memcpy(void *dest, const void *src, size_t n);
|
extern void *memcpy(void *dest, const void *src, size_t n);
|
||||||
|
|
@ -37,6 +38,10 @@ typedef double LONGREAL;
|
||||||
typedef unsigned long SET;
|
typedef unsigned long SET;
|
||||||
typedef void *SYSTEM_PTR;
|
typedef void *SYSTEM_PTR;
|
||||||
typedef unsigned char SYSTEM_BYTE;
|
typedef unsigned char SYSTEM_BYTE;
|
||||||
|
typedef int8_t SYSTEM_INT8;
|
||||||
|
typedef int16_t SYSTEM_INT16;
|
||||||
|
typedef int32_t SYSTEM_INT32;
|
||||||
|
typedef int64_t SYSTEM_INT64;
|
||||||
|
|
||||||
/* runtime system routines */
|
/* runtime system routines */
|
||||||
extern long SYSTEM_DIV();
|
extern long SYSTEM_DIV();
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ uses double # as concatenation operator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
|
#include <stdint.h> /* for type sizes -- noch */
|
||||||
|
|
||||||
//extern void *memcpy(void *dest, const void *src, long n);
|
//extern void *memcpy(void *dest, const void *src, long n);
|
||||||
extern void *memcpy(void *dest, const void *src, size_t n);
|
extern void *memcpy(void *dest, const void *src, size_t n);
|
||||||
|
|
@ -37,6 +38,10 @@ typedef double LONGREAL;
|
||||||
typedef unsigned long SET;
|
typedef unsigned long SET;
|
||||||
typedef void *SYSTEM_PTR;
|
typedef void *SYSTEM_PTR;
|
||||||
typedef unsigned char SYSTEM_BYTE;
|
typedef unsigned char SYSTEM_BYTE;
|
||||||
|
typedef int8_t SYSTEM_INT8;
|
||||||
|
typedef int16_t SYSTEM_INT16;
|
||||||
|
typedef int32_t SYSTEM_INT32;
|
||||||
|
typedef int64_t SYSTEM_INT64;
|
||||||
|
|
||||||
/* runtime system routines */
|
/* runtime system routines */
|
||||||
extern long SYSTEM_DIV();
|
extern long SYSTEM_DIV();
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ uses double # as concatenation operator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
|
#include <stdint.h> /* for type sizes -- noch */
|
||||||
|
|
||||||
//extern void *memcpy(void *dest, const void *src, long n);
|
//extern void *memcpy(void *dest, const void *src, long n);
|
||||||
extern void *memcpy(void *dest, const void *src, size_t n);
|
extern void *memcpy(void *dest, const void *src, size_t n);
|
||||||
|
|
@ -37,6 +38,10 @@ typedef double LONGREAL;
|
||||||
typedef unsigned long SET;
|
typedef unsigned long SET;
|
||||||
typedef void *SYSTEM_PTR;
|
typedef void *SYSTEM_PTR;
|
||||||
typedef unsigned char SYSTEM_BYTE;
|
typedef unsigned char SYSTEM_BYTE;
|
||||||
|
typedef int8_t SYSTEM_INT8;
|
||||||
|
typedef int16_t SYSTEM_INT16;
|
||||||
|
typedef int32_t SYSTEM_INT32;
|
||||||
|
typedef int64_t SYSTEM_INT64;
|
||||||
|
|
||||||
/* runtime system routines */
|
/* runtime system routines */
|
||||||
extern long SYSTEM_DIV();
|
extern long SYSTEM_DIV();
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ uses double # as concatenation operator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
|
#include <stdint.h> /* for type sizes -- noch */
|
||||||
|
|
||||||
extern void *memcpy(void *dest, const void *src, unsigned long n);
|
extern void *memcpy(void *dest, const void *src, unsigned long n);
|
||||||
extern void *malloc(unsigned long size);
|
extern void *malloc(unsigned long size);
|
||||||
|
|
@ -51,6 +52,10 @@ typedef void *SYSTEM_PTR;
|
||||||
//#define *SYSTEM_PTR void
|
//#define *SYSTEM_PTR void
|
||||||
//typedef unsigned char SYSTEM_BYTE;
|
//typedef unsigned char SYSTEM_BYTE;
|
||||||
#define SYSTEM_BYTE unsigned char
|
#define SYSTEM_BYTE unsigned char
|
||||||
|
typedef int8_t SYSTEM_INT8;
|
||||||
|
typedef int16_t SYSTEM_INT16;
|
||||||
|
typedef int32_t SYSTEM_INT32;
|
||||||
|
typedef int64_t SYSTEM_INT64;
|
||||||
|
|
||||||
/* runtime system routines */
|
/* runtime system routines */
|
||||||
extern long SYSTEM_DIV();
|
extern long SYSTEM_DIV();
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ uses double # as concatenation operator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
|
#include <stdint.h> /* for type sizes -- noch */
|
||||||
|
|
||||||
//extern void *memcpy(void *dest, const void *src, long n);
|
//extern void *memcpy(void *dest, const void *src, long n);
|
||||||
extern void *memcpy(void *dest, const void *src, size_t n);
|
extern void *memcpy(void *dest, const void *src, size_t n);
|
||||||
|
|
@ -37,6 +38,10 @@ typedef double LONGREAL;
|
||||||
typedef unsigned long SET;
|
typedef unsigned long SET;
|
||||||
typedef void *SYSTEM_PTR;
|
typedef void *SYSTEM_PTR;
|
||||||
typedef unsigned char SYSTEM_BYTE;
|
typedef unsigned char SYSTEM_BYTE;
|
||||||
|
typedef int8_t SYSTEM_INT8;
|
||||||
|
typedef int16_t SYSTEM_INT16;
|
||||||
|
typedef int32_t SYSTEM_INT32;
|
||||||
|
typedef int64_t SYSTEM_INT64;
|
||||||
|
|
||||||
/* runtime system routines */
|
/* runtime system routines */
|
||||||
extern long SYSTEM_DIV();
|
extern long SYSTEM_DIV();
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ uses double # as concatenation operator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
|
#include <stdint.h> /* for type sizes -- noch */
|
||||||
|
|
||||||
//extern void *memcpy(void *dest, const void *src, long n);
|
//extern void *memcpy(void *dest, const void *src, long n);
|
||||||
extern void *memcpy(void *dest, const void *src, size_t n);
|
extern void *memcpy(void *dest, const void *src, size_t n);
|
||||||
|
|
@ -37,6 +38,10 @@ typedef double LONGREAL;
|
||||||
typedef unsigned long SET;
|
typedef unsigned long SET;
|
||||||
typedef void *SYSTEM_PTR;
|
typedef void *SYSTEM_PTR;
|
||||||
typedef unsigned char SYSTEM_BYTE;
|
typedef unsigned char SYSTEM_BYTE;
|
||||||
|
typedef int8_t SYSTEM_INT8;
|
||||||
|
typedef int16_t SYSTEM_INT16;
|
||||||
|
typedef int32_t SYSTEM_INT32;
|
||||||
|
typedef int64_t SYSTEM_INT64;
|
||||||
|
|
||||||
/* runtime system routines */
|
/* runtime system routines */
|
||||||
extern long SYSTEM_DIV();
|
extern long SYSTEM_DIV();
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ uses double # as concatenation operator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
|
#include <stdint.h> /* for type sizes -- noch */
|
||||||
|
|
||||||
//extern void *memcpy(void *dest, const void *src, long n);
|
//extern void *memcpy(void *dest, const void *src, long n);
|
||||||
extern void *memcpy(void *dest, const void *src, size_t n);
|
extern void *memcpy(void *dest, const void *src, size_t n);
|
||||||
|
|
@ -37,6 +38,10 @@ typedef double LONGREAL;
|
||||||
typedef unsigned long SET;
|
typedef unsigned long SET;
|
||||||
typedef void *SYSTEM_PTR;
|
typedef void *SYSTEM_PTR;
|
||||||
typedef unsigned char SYSTEM_BYTE;
|
typedef unsigned char SYSTEM_BYTE;
|
||||||
|
typedef int8_t SYSTEM_INT8;
|
||||||
|
typedef int16_t SYSTEM_INT16;
|
||||||
|
typedef int32_t SYSTEM_INT32;
|
||||||
|
typedef int64_t SYSTEM_INT64;
|
||||||
|
|
||||||
/* runtime system routines */
|
/* runtime system routines */
|
||||||
extern long SYSTEM_DIV();
|
extern long SYSTEM_DIV();
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ uses double # as concatenation operator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
|
#include <stdint.h> /* for type sizes -- noch */
|
||||||
|
|
||||||
extern void *memcpy(void *dest, const void *src, unsigned long n);
|
extern void *memcpy(void *dest, const void *src, unsigned long n);
|
||||||
extern void *malloc(unsigned long size);
|
extern void *malloc(unsigned long size);
|
||||||
|
|
@ -51,6 +52,10 @@ typedef void *SYSTEM_PTR;
|
||||||
//#define *SYSTEM_PTR void
|
//#define *SYSTEM_PTR void
|
||||||
//typedef unsigned char SYSTEM_BYTE;
|
//typedef unsigned char SYSTEM_BYTE;
|
||||||
#define SYSTEM_BYTE unsigned char
|
#define SYSTEM_BYTE unsigned char
|
||||||
|
typedef int8_t SYSTEM_INT8;
|
||||||
|
typedef int16_t SYSTEM_INT16;
|
||||||
|
typedef int32_t SYSTEM_INT32;
|
||||||
|
typedef int64_t SYSTEM_INT64;
|
||||||
|
|
||||||
/* runtime system routines */
|
/* runtime system routines */
|
||||||
extern long SYSTEM_DIV();
|
extern long SYSTEM_DIV();
|
||||||
|
|
|
||||||
|
|
@ -10,3 +10,7 @@ PTR 4 4
|
||||||
PROC 4 4
|
PROC 4 4
|
||||||
RECORD 1 1
|
RECORD 1 1
|
||||||
ENDIAN 0 0
|
ENDIAN 0 0
|
||||||
|
SYSTEM.INT8 1 1
|
||||||
|
SYSTEM.INT16 2 2
|
||||||
|
SYSTEM.INT32 4 4
|
||||||
|
SYSTEM.INT64 8 4
|
||||||
|
|
|
||||||
|
|
@ -10,3 +10,7 @@ PTR 8 8
|
||||||
PROC 8 8
|
PROC 8 8
|
||||||
RECORD 1 1
|
RECORD 1 1
|
||||||
ENDIAN 1 0
|
ENDIAN 1 0
|
||||||
|
SYSTEM.INT8 1 1
|
||||||
|
SYSTEM.INT16 2 2
|
||||||
|
SYSTEM.INT32 4 4
|
||||||
|
SYSTEM.INT64 8 8
|
||||||
|
|
|
||||||
|
|
@ -10,3 +10,7 @@ PTR 4 4
|
||||||
PROC 4 4
|
PROC 4 4
|
||||||
RECORD 1 1
|
RECORD 1 1
|
||||||
ENDIAN 1 0
|
ENDIAN 1 0
|
||||||
|
SYSTEM.INT8 1 1
|
||||||
|
SYSTEM.INT16 2 2
|
||||||
|
SYSTEM.INT32 4 4
|
||||||
|
SYSTEM.INT64 8 4
|
||||||
|
|
|
||||||
|
|
@ -10,3 +10,7 @@ PTR 4 4
|
||||||
PROC 4 4
|
PROC 4 4
|
||||||
RECORD 1 1
|
RECORD 1 1
|
||||||
ENDIAN 0 0
|
ENDIAN 0 0
|
||||||
|
SYSTEM.INT8 1 1
|
||||||
|
SYSTEM.INT16 2 2
|
||||||
|
SYSTEM.INT32 4 4
|
||||||
|
SYSTEM.INT64 8 4
|
||||||
|
|
|
||||||
|
|
@ -10,3 +10,7 @@ PTR 4 4
|
||||||
PROC 4 4
|
PROC 4 4
|
||||||
RECORD 1 1
|
RECORD 1 1
|
||||||
ENDIAN 1 0
|
ENDIAN 1 0
|
||||||
|
SYSTEM.INT8 1 1
|
||||||
|
SYSTEM.INT16 2 2
|
||||||
|
SYSTEM.INT32 4 4
|
||||||
|
SYSTEM.INT64 8 4
|
||||||
|
|
|
||||||
|
|
@ -10,3 +10,7 @@ PTR 8 8
|
||||||
PROC 8 8
|
PROC 8 8
|
||||||
RECORD 1 1
|
RECORD 1 1
|
||||||
ENDIAN 1 0
|
ENDIAN 1 0
|
||||||
|
SYSTEM.INT8 1 1
|
||||||
|
SYSTEM.INT16 2 2
|
||||||
|
SYSTEM.INT32 4 4
|
||||||
|
SYSTEM.INT64 8 8
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,10 @@ struct {CHAR ch; BOOLEAN x;} b;
|
||||||
struct {CHAR ch; SHORTINT x;} si;
|
struct {CHAR ch; SHORTINT x;} si;
|
||||||
struct {CHAR ch; INTEGER x;} i;
|
struct {CHAR ch; INTEGER x;} i;
|
||||||
struct {CHAR ch; LONGINT x;} li;
|
struct {CHAR ch; LONGINT x;} li;
|
||||||
|
struct {CHAR ch; SYSTEM_INT8 x;} i8;
|
||||||
|
struct {CHAR ch; SYSTEM_INT16 x;} i16;
|
||||||
|
struct {CHAR ch; SYSTEM_INT32 x;} i32;
|
||||||
|
struct {CHAR ch; SYSTEM_INT64 x;} i64;
|
||||||
struct {CHAR ch; SET x;} s;
|
struct {CHAR ch; SET x;} s;
|
||||||
struct {CHAR ch; REAL x;} r;
|
struct {CHAR ch; REAL x;} r;
|
||||||
struct {CHAR ch; LONGREAL x;} lr;
|
struct {CHAR ch; LONGREAL x;} lr;
|
||||||
|
|
@ -40,6 +44,11 @@ int main()
|
||||||
printf("RECORD %d %lu\n", (sizeof rec2 == 65) == (sizeof rec0 == 1), sizeof rec2 - 64);
|
printf("RECORD %d %lu\n", (sizeof rec2 == 65) == (sizeof rec0 == 1), sizeof rec2 - 64);
|
||||||
x = 1;
|
x = 1;
|
||||||
printf("ENDIAN %hhd %d\n", *(char*)&x, 0);
|
printf("ENDIAN %hhd %d\n", *(char*)&x, 0);
|
||||||
|
printf("SYSTEM.INT8 %lu %lu\n", sizeof(SYSTEM_INT8), (char*)&i8.x - (char*)&i8);
|
||||||
|
printf("SYSTEM.INT16 %lu %lu\n", sizeof(SYSTEM_INT16), (char*)&i16.x - (char*)&i16);
|
||||||
|
printf("SYSTEM.INT32 %lu %lu\n", sizeof(SYSTEM_INT32), (char*)&i32.x - (char*)&i32);
|
||||||
|
printf("SYSTEM.INT64 %lu %lu\n", sizeof(SYSTEM_INT64), (char*)&i64.x - (char*)&i64);
|
||||||
|
|
||||||
|
|
||||||
if (sizeof(CHAR)!=1) printf("error: CHAR should have size 1\n");
|
if (sizeof(CHAR)!=1) printf("error: CHAR should have size 1\n");
|
||||||
if (sizeof(BOOLEAN)!=1) printf("error: BOOLEAN should have size 1\n");
|
if (sizeof(BOOLEAN)!=1) printf("error: BOOLEAN should have size 1\n");
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *)
|
MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *)
|
||||||
(* build parse tree *)
|
(* build parse tree *)
|
||||||
|
|
||||||
IMPORT OPT, OPS, OPM;
|
IMPORT OPT, OPS, OPM, SYSTEM;
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
(* symbol values or ops *)
|
(* symbol values or ops *)
|
||||||
|
|
@ -18,10 +18,14 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *)
|
||||||
SProc = 8; CProc = 9; IProc = 10; Mod = 11; Head = 12; TProc = 13;
|
SProc = 8; CProc = 9; IProc = 10; Mod = 11; Head = 12; TProc = 13;
|
||||||
|
|
||||||
(* Structure forms *)
|
(* Structure forms *)
|
||||||
Undef = 0; Byte = 1; Bool = 2; Char = 3; SInt = 4; Int = 5; LInt = 6;
|
Undef = 0; Byte = 1; Bool = 2; Char = 3;
|
||||||
|
SInt = 4; Int = 5; LInt = 6;
|
||||||
Real = 7; LReal = 8; Set = 9; String = 10; NilTyp = 11; NoTyp = 12;
|
Real = 7; LReal = 8; Set = 9; String = 10; NilTyp = 11; NoTyp = 12;
|
||||||
Pointer = 13; ProcTyp = 14; Comp = 15;
|
Pointer = 13; ProcTyp = 14;
|
||||||
intSet = {SInt..LInt}; realSet = {Real, LReal};
|
Int8 = 16; Int16 = 17; Int32 = 18; Int64 = 19;
|
||||||
|
Comp = (*15*)20;
|
||||||
|
|
||||||
|
intSet = {SInt..LInt, Int8..Int64}; realSet = {Real, LReal};
|
||||||
|
|
||||||
(* composite structure forms *)
|
(* composite structure forms *)
|
||||||
Basic = 1; Array = 2; DynArr = 3; Record = 4;
|
Basic = 1; Array = 2; DynArr = 3; Record = 4;
|
||||||
|
|
@ -405,6 +409,8 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *)
|
||||||
ELSE err(69)
|
ELSE err(69)
|
||||||
END ;
|
END ;
|
||||||
z^.typ := OPT.booltyp
|
z^.typ := OPT.booltyp
|
||||||
|
ELSE
|
||||||
|
OPM.WriteString("/* this should not happen. handle this. OPB.MOp(); -- noch */"); OPM.WriteLn;
|
||||||
END
|
END
|
||||||
END ;
|
END ;
|
||||||
x := z
|
x := z
|
||||||
|
|
@ -476,7 +482,7 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *)
|
||||||
CASE f OF
|
CASE f OF
|
||||||
Undef:
|
Undef:
|
||||||
res := eql
|
res := eql
|
||||||
| Byte, Char..LInt:
|
| Byte, Char..LInt,Int8..Int64:
|
||||||
IF xval^.intval < yval^.intval THEN res := lss
|
IF xval^.intval < yval^.intval THEN res := lss
|
||||||
ELSIF xval^.intval > yval^.intval THEN res := gtr
|
ELSIF xval^.intval > yval^.intval THEN res := gtr
|
||||||
ELSE res := eql
|
ELSE res := eql
|
||||||
|
|
@ -503,6 +509,8 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *)
|
||||||
IF xval^.intval # yval^.intval THEN res := neq
|
IF xval^.intval # yval^.intval THEN res := neq
|
||||||
ELSE res := eql
|
ELSE res := eql
|
||||||
END
|
END
|
||||||
|
ELSE
|
||||||
|
OPM.WriteString("/* this should not happen. handle this. OPB.ConstCmp(); -- noch */"); OPM.WriteLn;
|
||||||
END ;
|
END ;
|
||||||
x^.typ := OPT.booltyp; RETURN res
|
x^.typ := OPT.booltyp; RETURN res
|
||||||
END ConstCmp;
|
END ConstCmp;
|
||||||
|
|
@ -676,6 +684,8 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *)
|
||||||
IF f IN {Bool, Set, NilTyp, Pointer} THEN err(108)
|
IF f IN {Bool, Set, NilTyp, Pointer} THEN err(108)
|
||||||
ELSE xval^.intval := BoolToInt(ConstCmp() # lss)
|
ELSE xval^.intval := BoolToInt(ConstCmp() # lss)
|
||||||
END
|
END
|
||||||
|
ELSE
|
||||||
|
OPM.WriteString("/* this should not happen. handle this. OPB.ConstOp(); -- noch */ "); OPM.WriteLn;
|
||||||
END
|
END
|
||||||
END ConstOp;
|
END ConstOp;
|
||||||
|
|
||||||
|
|
@ -885,6 +895,8 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *)
|
||||||
ELSE err(108); typ := OPT.undftyp
|
ELSE err(108); typ := OPT.undftyp
|
||||||
END ;
|
END ;
|
||||||
NewOp(op, typ, z, y)
|
NewOp(op, typ, z, y)
|
||||||
|
ELSE
|
||||||
|
OPM.WriteString(" /* OPB.Op(), not handled case possibility; -- noch */ "); OPM.WriteLn;
|
||||||
END
|
END
|
||||||
END ;
|
END ;
|
||||||
x := z
|
x := z
|
||||||
|
|
@ -935,10 +947,39 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *)
|
||||||
PROCEDURE CheckAssign(x: OPT.Struct; ynode: OPT.Node); (* x := y *)
|
PROCEDURE CheckAssign(x: OPT.Struct; ynode: OPT.Node); (* x := y *)
|
||||||
VAR f, g: INTEGER; y, p, q: OPT.Struct;
|
VAR f, g: INTEGER; y, p, q: OPT.Struct;
|
||||||
BEGIN
|
BEGIN
|
||||||
|
IF OPM.Verbose THEN
|
||||||
|
OPM.LogWLn; OPM.LogWStr("PROCEDURE CheckAssign"); OPM.LogWLn;
|
||||||
|
END;
|
||||||
y := ynode^.typ; f := x^.form; g := y^.form;
|
y := ynode^.typ; f := x^.form; g := y^.form;
|
||||||
|
IF OPM.Verbose THEN
|
||||||
|
OPM.LogWStr("y.form = "); OPM.LogWNum(y.form, 0); OPM.LogWLn;
|
||||||
|
OPM.LogWStr("f = "); OPM.LogWNum(f, 0); OPM.LogWLn;
|
||||||
|
OPM.LogWStr("g = "); OPM.LogWNum(g, 0); OPM.LogWLn;
|
||||||
|
OPM.LogWStr("ynode.typ.syze = "); OPM.LogWNum(ynode.typ.size, 0); OPM.LogWLn;
|
||||||
|
END;
|
||||||
IF (ynode^.class = Ntype) OR (ynode^.class = Nproc) & (f # ProcTyp) THEN err(126) END ;
|
IF (ynode^.class = Ntype) OR (ynode^.class = Nproc) & (f # ProcTyp) THEN err(126) END ;
|
||||||
CASE f OF
|
CASE f OF
|
||||||
Undef, String:
|
Undef, String:
|
||||||
|
| Int8:
|
||||||
|
IF (ynode.typ.size > OPM.Int8Size) THEN
|
||||||
|
IF OPM.Verbose THEN OPM.LogWStr("f of int8"); OPM.LogWLn END;
|
||||||
|
err(113)
|
||||||
|
END
|
||||||
|
| Int16:
|
||||||
|
IF (ynode.typ.size > OPM.Int16Size) THEN
|
||||||
|
IF OPM.Verbose THEN OPM.LogWStr("f of int16"); OPM.LogWLn END;
|
||||||
|
err(113)
|
||||||
|
END
|
||||||
|
| Int32:
|
||||||
|
IF (ynode.typ.size > OPM.Int32Size) THEN
|
||||||
|
IF OPM.Verbose THEN OPM.LogWStr("f of int32"); OPM.LogWLn END;
|
||||||
|
err(113)
|
||||||
|
END
|
||||||
|
| Int64:
|
||||||
|
IF ynode.typ.size > OPM.Int64Size THEN
|
||||||
|
IF OPM.Verbose THEN OPM.LogWStr("f of int64"); OPM.LogWLn END;
|
||||||
|
err(113)
|
||||||
|
END
|
||||||
| Byte:
|
| Byte:
|
||||||
IF ~(g IN {Byte, Char, SInt}) THEN err(113) END
|
IF ~(g IN {Byte, Char, SInt}) THEN err(113) END
|
||||||
| Bool, Char, SInt, Set:
|
| Bool, Char, SInt, Set:
|
||||||
|
|
@ -988,6 +1029,8 @@ MODULE OPB; (* RC 6.3.89 / 21.2.94 *) (* object model 17.1.93 *)
|
||||||
END
|
END
|
||||||
ELSE (*DynArr*) err(113)
|
ELSE (*DynArr*) err(113)
|
||||||
END
|
END
|
||||||
|
ELSE (* In case of not estimated f it would crash -- noch *)
|
||||||
|
OPM.WriteString("/* this should not happen. handle this. OPB.CheckAssign function -- noch */"); OPM.WriteLn;
|
||||||
END ;
|
END ;
|
||||||
IF (ynode^.class = Nconst) & (g < f) & (g IN {SInt..Real}) & (f IN {Int..LReal}) THEN
|
IF (ynode^.class = Nconst) & (g < f) & (g IN {SInt..Real}) & (f IN {Int..LReal}) THEN
|
||||||
Convert(ynode, x)
|
Convert(ynode, x)
|
||||||
|
|
@ -1059,6 +1102,10 @@ avoid unnecessary intermediate variables in voc
|
||||||
| SInt: x := NewIntConst(OPM.MinSInt)
|
| SInt: x := NewIntConst(OPM.MinSInt)
|
||||||
| Int: x := NewIntConst(OPM.MinInt)
|
| Int: x := NewIntConst(OPM.MinInt)
|
||||||
| LInt: x := NewIntConst(OPM.MinLInt)
|
| LInt: x := NewIntConst(OPM.MinLInt)
|
||||||
|
| Int8: x := NewIntConst(OPM.MinInt8)
|
||||||
|
| Int16: x := NewIntConst(OPM.MinInt16)
|
||||||
|
| Int32: x := NewIntConst(OPM.MinInt32)
|
||||||
|
| Int64: err(111)(*x := NewIntConst(OPM.MinInt64)*) (* int64 constants not implemented yet *)
|
||||||
| Set: x := NewIntConst(0); x^.typ := OPT.inttyp
|
| Set: x := NewIntConst(0); x^.typ := OPT.inttyp
|
||||||
| Real: x := NewRealConst(OPM.MinReal, OPT.realtyp)
|
| Real: x := NewRealConst(OPM.MinReal, OPT.realtyp)
|
||||||
| LReal: x := NewRealConst(OPM.MinLReal, OPT.lrltyp)
|
| LReal: x := NewRealConst(OPM.MinLReal, OPT.lrltyp)
|
||||||
|
|
@ -1074,6 +1121,10 @@ avoid unnecessary intermediate variables in voc
|
||||||
| SInt: x := NewIntConst(OPM.MaxSInt)
|
| SInt: x := NewIntConst(OPM.MaxSInt)
|
||||||
| Int: x := NewIntConst(OPM.MaxInt)
|
| Int: x := NewIntConst(OPM.MaxInt)
|
||||||
| LInt: x := NewIntConst(OPM.MaxLInt)
|
| LInt: x := NewIntConst(OPM.MaxLInt)
|
||||||
|
| Int8: x := NewIntConst(OPM.MaxInt8)
|
||||||
|
| Int16: x := NewIntConst(OPM.MaxInt16)
|
||||||
|
| Int32: x := NewIntConst(OPM.MaxInt32)
|
||||||
|
| Int64: err(111); (*x := NewIntConst(OPM.MaxInt64)*) (* int64 contstants not implemented yet *)
|
||||||
| Set: x := NewIntConst(OPM.MaxSet); x^.typ := OPT.inttyp
|
| Set: x := NewIntConst(OPM.MaxSet); x^.typ := OPT.inttyp
|
||||||
| Real: x := NewRealConst(OPM.MaxReal, OPT.realtyp)
|
| Real: x := NewRealConst(OPM.MaxReal, OPT.realtyp)
|
||||||
| LReal: x := NewRealConst(OPM.MaxLReal, OPT.lrltyp)
|
| LReal: x := NewRealConst(OPM.MaxLReal, OPT.lrltyp)
|
||||||
|
|
@ -1090,6 +1141,9 @@ avoid unnecessary intermediate variables in voc
|
||||||
IF (x^.class = Ntype) OR (x^.class = Nproc) THEN err(126)
|
IF (x^.class = Ntype) OR (x^.class = Nproc) THEN err(126)
|
||||||
ELSIF f = Int THEN Convert(x, OPT.sinttyp)
|
ELSIF f = Int THEN Convert(x, OPT.sinttyp)
|
||||||
ELSIF f = LInt THEN Convert(x, OPT.inttyp)
|
ELSIF f = LInt THEN Convert(x, OPT.inttyp)
|
||||||
|
ELSIF f = Int64 THEN Convert(x, OPT.int32typ)
|
||||||
|
ELSIF f = Int32 THEN Convert(x, OPT.int16typ)
|
||||||
|
ELSIF f = Int16 THEN Convert(x, OPT.int8typ)
|
||||||
ELSIF f = LReal THEN Convert(x, OPT.realtyp)
|
ELSIF f = LReal THEN Convert(x, OPT.realtyp)
|
||||||
ELSE err(111)
|
ELSE err(111)
|
||||||
END
|
END
|
||||||
|
|
@ -1097,6 +1151,9 @@ avoid unnecessary intermediate variables in voc
|
||||||
IF (x^.class = Ntype) OR (x^.class = Nproc) THEN err(126)
|
IF (x^.class = Ntype) OR (x^.class = Nproc) THEN err(126)
|
||||||
ELSIF f = SInt THEN Convert(x, OPT.inttyp)
|
ELSIF f = SInt THEN Convert(x, OPT.inttyp)
|
||||||
ELSIF f = Int THEN Convert(x, OPT.linttyp)
|
ELSIF f = Int THEN Convert(x, OPT.linttyp)
|
||||||
|
ELSIF f = Int8 THEN Convert(x, OPT.int16typ)
|
||||||
|
ELSIF f = Int16 THEN Convert(x, OPT.int32typ)
|
||||||
|
ELSIF f = Int32 THEN Convert(x, OPT.int64typ)
|
||||||
ELSIF f = Real THEN Convert(x, OPT.lrltyp)
|
ELSIF f = Real THEN Convert(x, OPT.lrltyp)
|
||||||
ELSIF f = Char THEN Convert(x, OPT.linttyp)
|
ELSIF f = Char THEN Convert(x, OPT.linttyp)
|
||||||
ELSE err(111)
|
ELSE err(111)
|
||||||
|
|
@ -1129,7 +1186,7 @@ avoid unnecessary intermediate variables in voc
|
||||||
CheckLeaf(x, FALSE); MOp(adr, x)
|
CheckLeaf(x, FALSE); MOp(adr, x)
|
||||||
| sizefn: (*SIZE*)
|
| sizefn: (*SIZE*)
|
||||||
IF x^.class # Ntype THEN err(110); x := NewIntConst(1)
|
IF x^.class # Ntype THEN err(110); x := NewIntConst(1)
|
||||||
ELSIF (f IN {Byte..Set, Pointer, ProcTyp}) OR (x^.typ^.comp IN {Array, Record}) THEN
|
ELSIF (f IN {Byte..Set, Int8..Int64, Pointer, ProcTyp}) OR (x^.typ^.comp IN {Array, Record}) THEN
|
||||||
typSize(x^.typ); x^.typ^.pvused := TRUE; x := NewIntConst(x^.typ^.size)
|
typSize(x^.typ); x^.typ^.pvused := TRUE; x := NewIntConst(x^.typ^.size)
|
||||||
ELSE err(111); x := NewIntConst(1)
|
ELSE err(111); x := NewIntConst(1)
|
||||||
END
|
END
|
||||||
|
|
@ -1137,7 +1194,7 @@ avoid unnecessary intermediate variables in voc
|
||||||
MOp(cc, x)
|
MOp(cc, x)
|
||||||
| lshfn, rotfn: (*SYSTEM.LSH, SYSTEM.ROT*)
|
| lshfn, rotfn: (*SYSTEM.LSH, SYSTEM.ROT*)
|
||||||
IF (x^.class = Ntype) OR (x^.class = Nproc) THEN err(126)
|
IF (x^.class = Ntype) OR (x^.class = Nproc) THEN err(126)
|
||||||
ELSIF ~(f IN intSet + {Byte, Char, Set}) THEN err(111)
|
ELSIF ~(f IN intSet + {Byte, Char, Set, Int8, Int16, Int32, Int64}) THEN err(111)
|
||||||
END
|
END
|
||||||
| getfn, putfn, bitfn, movefn: (*SYSTEM.GET, SYSTEM.PUT, SYSTEM.BIT, SYSTEM.MOVE*)
|
| getfn, putfn, bitfn, movefn: (*SYSTEM.GET, SYSTEM.PUT, SYSTEM.BIT, SYSTEM.MOVE*)
|
||||||
IF (x^.class = Ntype) OR (x^.class = Nproc) THEN err(126)
|
IF (x^.class = Ntype) OR (x^.class = Nproc) THEN err(126)
|
||||||
|
|
@ -1164,6 +1221,8 @@ avoid unnecessary intermediate variables in voc
|
||||||
ELSIF f # Bool THEN err(120); x := NewBoolConst(FALSE)
|
ELSIF f # Bool THEN err(120); x := NewBoolConst(FALSE)
|
||||||
ELSE MOp(not, x)
|
ELSE MOp(not, x)
|
||||||
END
|
END
|
||||||
|
ELSE
|
||||||
|
OPM.WriteString("/* this should not happen, needs to be handled. procedure StPar0; -- noch */"); OPM.WriteLn;
|
||||||
END ;
|
END ;
|
||||||
par0 := x
|
par0 := x
|
||||||
END StPar0;
|
END StPar0;
|
||||||
|
|
@ -1393,7 +1452,7 @@ avoid unnecessary intermediate variables in voc
|
||||||
BEGIN (* ftyp^.comp = DynArr *)
|
BEGIN (* ftyp^.comp = DynArr *)
|
||||||
f := atyp^.comp; ftyp := ftyp^.BaseTyp; atyp := atyp^.BaseTyp;
|
f := atyp^.comp; ftyp := ftyp^.BaseTyp; atyp := atyp^.BaseTyp;
|
||||||
IF fvarpar & (ftyp = OPT.bytetyp) THEN (* ok, but ... *)
|
IF fvarpar & (ftyp = OPT.bytetyp) THEN (* ok, but ... *)
|
||||||
IF ~(f IN {Array, DynArr}) OR ~(atyp^.form IN {Byte..SInt}) THEN err(-301) END (* ... warning 301 *)
|
IF ~(f IN {Array, DynArr}) OR ~(atyp^.form IN {Byte..SInt, Int8..Int64}) THEN err(-301) END (* ... warning 301 *)
|
||||||
ELSIF f IN {Array, DynArr} THEN
|
ELSIF f IN {Array, DynArr} THEN
|
||||||
IF ftyp^.comp = DynArr THEN DynArrParCheck(ftyp, atyp, fvarpar)
|
IF ftyp^.comp = DynArr THEN DynArrParCheck(ftyp, atyp, fvarpar)
|
||||||
ELSIF ftyp # atyp THEN
|
ELSIF ftyp # atyp THEN
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,12 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *)
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
(* structure forms *)
|
(* structure forms *)
|
||||||
Byte = 1; Bool = 2; Char = 3; SInt = 4; Int = 5; LInt = 6;
|
Byte = 1; Bool = 2; Char = 3;
|
||||||
|
SInt = 4; Int = 5; LInt = 6;
|
||||||
Real = 7; LReal = 8; Set = 9; String = 10; NilTyp = 11; NoTyp = 12;
|
Real = 7; LReal = 8; Set = 9; String = 10; NilTyp = 11; NoTyp = 12;
|
||||||
Pointer = 13; ProcTyp = 14; Comp = 15;
|
Pointer = 13; ProcTyp = 14;
|
||||||
|
Int8 = 16; Int16 = 17; Int32 = 18; Int64 = 19;
|
||||||
|
Comp = (*15*)20;
|
||||||
|
|
||||||
(* composite structure forms *)
|
(* composite structure forms *)
|
||||||
Array = 2; DynArr = 3; Record = 4;
|
Array = 2; DynArr = 3; Record = 4;
|
||||||
|
|
@ -170,8 +173,9 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *)
|
||||||
ELSE OPM.WriteStringVar(OPM.modName)
|
ELSE OPM.WriteStringVar(OPM.modName)
|
||||||
END ;
|
END ;
|
||||||
OPM.Write(Underscore)
|
OPM.Write(Underscore)
|
||||||
ELSIF (obj = OPT.sysptrtyp^.strobj) OR (obj = OPT.bytetyp^.strobj) THEN
|
ELSIF (obj = OPT.sysptrtyp^.strobj) OR (obj = OPT.bytetyp^.strobj) OR (obj = OPT.int8typ^.strobj) OR (obj = OPT.int16typ^.strobj) OR (obj = OPT.int32typ^.strobj) OR (obj = OPT.int64typ^.strobj) THEN
|
||||||
OPM.WriteString("SYSTEM_")
|
OPM.WriteString("SYSTEM_")
|
||||||
|
|
||||||
END ;
|
END ;
|
||||||
OPM.WriteStringVar(obj^.name)
|
OPM.WriteStringVar(obj^.name)
|
||||||
END
|
END
|
||||||
|
|
@ -614,6 +618,10 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *)
|
||||||
| SInt: RETURN OPM.SIntAlign
|
| SInt: RETURN OPM.SIntAlign
|
||||||
| Int: RETURN OPM.IntAlign
|
| Int: RETURN OPM.IntAlign
|
||||||
| LInt: RETURN OPM.LIntAlign
|
| LInt: RETURN OPM.LIntAlign
|
||||||
|
| Int8: RETURN OPM.Int8Align
|
||||||
|
| Int16: RETURN OPM.Int16Align
|
||||||
|
| Int32: RETURN OPM.Int32Align
|
||||||
|
| Int64: RETURN OPM.Int64Align
|
||||||
| Real: RETURN OPM.RealAlign
|
| Real: RETURN OPM.RealAlign
|
||||||
| LReal: RETURN OPM.LRealAlign
|
| LReal: RETURN OPM.LRealAlign
|
||||||
| Set: RETURN OPM.SetAlign
|
| Set: RETURN OPM.SetAlign
|
||||||
|
|
@ -857,6 +865,7 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *)
|
||||||
| OPM.mainlinkstat: OPM.Write("M")
|
| OPM.mainlinkstat: OPM.Write("M")
|
||||||
| OPM.notcoloroutput: OPM.Write("f")
|
| OPM.notcoloroutput: OPM.Write("f")
|
||||||
| OPM.forcenewsym: OPM.Write("F")
|
| OPM.forcenewsym: OPM.Write("F")
|
||||||
|
| OPM.verbose: OPM.Write("v")
|
||||||
ELSE
|
ELSE
|
||||||
(* this else is necessary cause
|
(* this else is necessary cause
|
||||||
if someone defined a new option in OPM module
|
if someone defined a new option in OPM module
|
||||||
|
|
@ -1283,6 +1292,9 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *)
|
||||||
END
|
END
|
||||||
| SInt, Int, LInt:
|
| SInt, Int, LInt:
|
||||||
OPM.WriteInt(con^.intval)
|
OPM.WriteInt(con^.intval)
|
||||||
|
| Int8, Int16, Int32, Int64:
|
||||||
|
OPM.WriteInt(con^.intval)
|
||||||
|
|
||||||
| Real:
|
| Real:
|
||||||
OPM.WriteReal(con^.realval, "f")
|
OPM.WriteReal(con^.realval, "f")
|
||||||
| LReal:
|
| LReal:
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
|
||||||
mainlinkstat* = 15; (* generate code for main module and then link object file statically *)
|
mainlinkstat* = 15; (* generate code for main module and then link object file statically *)
|
||||||
notcoloroutput* = 16; (* turn off color output *)
|
notcoloroutput* = 16; (* turn off color output *)
|
||||||
forcenewsym* = 17; (* force new symbol file *)
|
forcenewsym* = 17; (* force new symbol file *)
|
||||||
|
verbose* = 18; (* verbose *)
|
||||||
defopt* = {inxchk, typchk, ptrinit, ansi, assert}; (* default options *)
|
defopt* = {inxchk, typchk, ptrinit, ansi, assert}; (* default options *)
|
||||||
|
|
||||||
nilval* = 0;
|
nilval* = 0;
|
||||||
|
|
@ -96,10 +97,14 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
|
||||||
SourceFileName : ARRAY 256 OF CHAR;
|
SourceFileName : ARRAY 256 OF CHAR;
|
||||||
ByteSize*, CharSize*, BoolSize*, SIntSize*, IntSize*,
|
ByteSize*, CharSize*, BoolSize*, SIntSize*, IntSize*,
|
||||||
LIntSize*, SetSize*, RealSize*, LRealSize*, PointerSize*, ProcSize*, RecSize*,
|
LIntSize*, SetSize*, RealSize*, LRealSize*, PointerSize*, ProcSize*, RecSize*,
|
||||||
|
Int8Size*, Int16Size*, Int32Size*, Int64Size*, (* these are constants actually, we need it to pass to GetProperty function; -- noch *)
|
||||||
CharAlign*, BoolAlign*, SIntAlign*, IntAlign*,
|
CharAlign*, BoolAlign*, SIntAlign*, IntAlign*,
|
||||||
|
Int8Align*, Int16Align*, Int32Align*, Int64Align*, (* need this for SYSTEM types; -- noch *)
|
||||||
LIntAlign*, SetAlign*, RealAlign*, LRealAlign*, PointerAlign*, ProcAlign*, RecAlign*,
|
LIntAlign*, SetAlign*, RealAlign*, LRealAlign*, PointerAlign*, ProcAlign*, RecAlign*,
|
||||||
ByteOrder*, BitOrder*, MaxSet*: INTEGER;
|
ByteOrder*, BitOrder*, MaxSet*: INTEGER;
|
||||||
MinSInt*, MinInt*, MinLInt*, MaxSInt*, MaxInt*, MaxLInt*, MaxIndex*: LONGINT;
|
MinSInt*, MinInt*, MinLInt*, MaxSInt*, MaxInt*, MaxLInt*, MaxIndex*: LONGINT;
|
||||||
|
MinInt8*, MaxInt8*, MinInt16*, MaxInt16*, MinInt32*, MaxInt32* : LONGINT;
|
||||||
|
MinInt64*, MaxInt64* : SYSTEM.INT64;
|
||||||
MinReal*, MaxReal*, MinLReal*, MaxLReal*: LONGREAL;
|
MinReal*, MaxReal*, MinLReal*, MaxLReal*: LONGREAL;
|
||||||
|
|
||||||
noerr*: BOOLEAN;
|
noerr*: BOOLEAN;
|
||||||
|
|
@ -122,7 +127,7 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
|
||||||
oldSFile, newSFile, HFile, BFile, HIFile: Files.File;
|
oldSFile, newSFile, HFile, BFile, HIFile: Files.File;
|
||||||
|
|
||||||
S: INTEGER;
|
S: INTEGER;
|
||||||
stop, useLineNo, useParFile, dontAsm-, dontLink-, mainProg-, mainLinkStat-, notColorOutput-, forceNewSym-: BOOLEAN;
|
stop, useLineNo, useParFile, dontAsm-, dontLink-, mainProg-, mainLinkStat-, notColorOutput-, forceNewSym-, Verbose-: BOOLEAN;
|
||||||
|
|
||||||
|
|
||||||
(* ------------------------- Log Output ------------------------- *)
|
(* ------------------------- Log Output ------------------------- *)
|
||||||
|
|
@ -170,6 +175,7 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
|
||||||
| "M": opt := opt / {mainlinkstat}
|
| "M": opt := opt / {mainlinkstat}
|
||||||
| "f": opt := opt / {notcoloroutput}
|
| "f": opt := opt / {notcoloroutput}
|
||||||
| "F": opt := opt / {forcenewsym}
|
| "F": opt := opt / {forcenewsym}
|
||||||
|
| "V": opt := opt / {verbose}
|
||||||
ELSE LogWStr(" warning: option "); LogW(OptionChar); LogW(s[i]); LogWStr(" ignored"); LogWLn
|
ELSE LogWStr(" warning: option "); LogW(OptionChar); LogW(s[i]); LogWStr(" ignored"); LogWLn
|
||||||
END ;
|
END ;
|
||||||
INC(i)
|
INC(i)
|
||||||
|
|
@ -192,7 +198,7 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
|
||||||
Console.Ln;
|
Console.Ln;
|
||||||
Console.String(' command = "voc" options {file options}.'); Console.Ln;
|
Console.String(' command = "voc" options {file options}.'); Console.Ln;
|
||||||
Console.String(' options = ["-" {option} ].'); Console.Ln;
|
Console.String(' options = ["-" {option} ].'); Console.Ln;
|
||||||
Console.String(' option = "m" | "M" | "s" | "e" | "i" | "l" | "k" | "r" | "x" | "a" | "p" | "t" | "P" | "S" | "c" | "f" | "F" .'); Console.Ln;
|
Console.String(' option = "m" | "M" | "s" | "e" | "i" | "l" | "k" | "r" | "x" | "a" | "p" | "t" | "P" | "S" | "c" | "f" | "F" | "V" .'); Console.Ln;
|
||||||
Console.Ln;
|
Console.Ln;
|
||||||
Console.String(" m - generate code for main module"); Console.Ln;
|
Console.String(" m - generate code for main module"); Console.Ln;
|
||||||
Console.String(" M - generate code for main module and link object statically"); Console.Ln;
|
Console.String(" M - generate code for main module and link object statically"); Console.Ln;
|
||||||
|
|
@ -210,6 +216,7 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
|
||||||
Console.String(" c - don't call linker"); Console.Ln;
|
Console.String(" c - don't call linker"); Console.Ln;
|
||||||
Console.String(" f - don't use color output"); Console.Ln;
|
Console.String(" f - don't use color output"); Console.Ln;
|
||||||
Console.String(" F - force writing new symbol file"); Console.Ln;
|
Console.String(" F - force writing new symbol file"); Console.Ln;
|
||||||
|
Console.String(" V - verbose output"); Console.Ln;
|
||||||
Console.Ln;
|
Console.Ln;
|
||||||
ELSE
|
ELSE
|
||||||
glbopt := defopt; S := 1; s := "";
|
glbopt := defopt; S := 1; s := "";
|
||||||
|
|
@ -228,6 +235,7 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
|
||||||
IF mainlinkstat IN glbopt THEN INCL(glbopt, mainprog); mainLinkStat := TRUE ELSE mainLinkStat := FALSE END;
|
IF mainlinkstat IN glbopt THEN INCL(glbopt, mainprog); mainLinkStat := TRUE ELSE mainLinkStat := FALSE END;
|
||||||
IF notcoloroutput IN glbopt THEN notColorOutput := TRUE ELSE notColorOutput := FALSE END;
|
IF notcoloroutput IN glbopt THEN notColorOutput := TRUE ELSE notColorOutput := FALSE END;
|
||||||
IF forcenewsym IN glbopt THEN forceNewSym := TRUE ELSE forceNewSym := FALSE END;
|
IF forcenewsym IN glbopt THEN forceNewSym := TRUE ELSE forceNewSym := FALSE END;
|
||||||
|
IF verbose IN glbopt THEN Verbose := TRUE ELSE forceNewSym := FALSE END;
|
||||||
GetProperties; (* GetProperties moved here in order to call it after ScanOptions because we have an option whether to use par file or not, noch *)
|
GetProperties; (* GetProperties moved here in order to call it after ScanOptions because we have an option whether to use par file or not, noch *)
|
||||||
|
|
||||||
END;
|
END;
|
||||||
|
|
@ -248,6 +256,7 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
|
||||||
IF mainprog IN opt THEN mainProg := TRUE ELSE mainProg := FALSE END;
|
IF mainprog IN opt THEN mainProg := TRUE ELSE mainProg := FALSE END;
|
||||||
IF mainlinkstat IN opt THEN INCL(glbopt, mainprog); mainLinkStat := TRUE ELSE mainLinkStat := FALSE END;
|
IF mainlinkstat IN opt THEN INCL(glbopt, mainprog); mainLinkStat := TRUE ELSE mainLinkStat := FALSE END;
|
||||||
IF forcenewsym IN glbopt THEN forceNewSym := TRUE ELSE forceNewSym := FALSE END;
|
IF forcenewsym IN glbopt THEN forceNewSym := TRUE ELSE forceNewSym := FALSE END;
|
||||||
|
IF verbose IN glbopt THEN Verbose := TRUE ELSE forceNewSym := FALSE END;
|
||||||
END InitOptions;
|
END InitOptions;
|
||||||
|
|
||||||
PROCEDURE Init*(VAR done: BOOLEAN; VAR mname : ARRAY OF CHAR); (* get the source for one translation *)
|
PROCEDURE Init*(VAR done: BOOLEAN; VAR mname : ARRAY OF CHAR); (* get the source for one translation *)
|
||||||
|
|
@ -588,6 +597,41 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
|
||||||
RETURN p;
|
RETURN p;
|
||||||
END power0;
|
END power0;
|
||||||
|
|
||||||
|
PROCEDURE VerboseListSizes;
|
||||||
|
BEGIN
|
||||||
|
Console.String("Type Size Alignement"); Console.Ln;
|
||||||
|
Console.String("CHAR "); Console.Int(CharSize, 0); Console.Int(CharAlign, 5); Console.Ln;
|
||||||
|
Console.String("BOOLEAN "); Console.Int(BoolSize, 0); Console.Int(BoolAlign, 5); Console.Ln;
|
||||||
|
Console.String("SHORTINT "); Console.Int(SIntSize, 0); Console.Int(SIntAlign, 5); Console.Ln;
|
||||||
|
Console.String("INTEGER "); Console.Int(IntSize, 0); Console.Int(IntAlign, 5); Console.Ln;
|
||||||
|
Console.String("LONGINT "); Console.Int(LIntSize, 0); Console.Int(LIntAlign, 5); Console.Ln;
|
||||||
|
Console.String("SET "); Console.Int(SetSize, 0); Console.Int(SetAlign, 5); Console.Ln;
|
||||||
|
Console.String("REAL "); Console.Int(RealSize, 0); Console.Int(RealAlign, 5); Console.Ln;
|
||||||
|
Console.String("LONGREAL "); Console.Int(LRealSize, 0); Console.Int(LRealAlign, 5); Console.Ln;
|
||||||
|
Console.String("PTR "); Console.Int(PointerSize, 0); Console.Int(PointerAlign, 5); Console.Ln;
|
||||||
|
Console.String("PROC "); Console.Int(ProcSize, 0); Console.Int(ProcAlign, 5); Console.Ln;
|
||||||
|
Console.String("RECORD "); Console.Int(RecSize, 0); Console.Int(RecAlign, 5); Console.Ln;
|
||||||
|
Console.String("ENDIAN "); Console.Int(ByteOrder, 0); Console.Int(BitOrder, 5); Console.Ln;
|
||||||
|
Console.String("SYSTEM.INT8 "); Console.Int(Int8Size, 0); Console.Int(Int8Align, 5); Console.Ln;
|
||||||
|
Console.String("SYSTEM.INT16 "); Console.Int(Int16Size, 0); Console.Int(Int16Align, 5); Console.Ln;
|
||||||
|
Console.String("SYSTEM.INT32 "); Console.Int(Int32Size, 0); Console.Int(Int32Align, 5); Console.Ln;
|
||||||
|
Console.String("SYSTEM.INT64 "); Console.Int(Int64Size, 0); Console.Int(Int64Align, 5); Console.Ln;
|
||||||
|
Console.Ln;
|
||||||
|
Console.String("Min shortint "); Console.Int(MinSInt, 0); Console.Ln;
|
||||||
|
Console.String("Max shortint "); Console.Int(MaxSInt, 0); Console.Ln;
|
||||||
|
Console.String("Min integer "); Console.Int(MinInt, 0); Console.Ln;
|
||||||
|
Console.String("Max integer "); Console.Int(MaxInt, 0); Console.Ln;
|
||||||
|
Console.String("Min longint "); Console.Int(MinLInt, 0); Console.Ln;
|
||||||
|
Console.String("Max longint "); Console.Int(MaxLInt, 0); Console.Ln;
|
||||||
|
Console.String("Min int8 "); Console.Int(MinInt8, 0); Console.Ln;
|
||||||
|
Console.String("Max int8 "); Console.Int(MaxInt8, 0); Console.Ln;
|
||||||
|
Console.String("Min int16 "); Console.Int(MinInt16, 0); Console.Ln;
|
||||||
|
Console.String("Max int16 "); Console.Int(MaxInt16, 0); Console.Ln;
|
||||||
|
Console.String("Min int32 "); Console.Int(MinInt32, 0); Console.Ln;
|
||||||
|
Console.String("Max int32 "); Console.Int(MaxInt32, 0); Console.Ln;
|
||||||
|
|
||||||
|
|
||||||
|
END VerboseListSizes;
|
||||||
|
|
||||||
PROCEDURE GetProperties();
|
PROCEDURE GetProperties();
|
||||||
VAR T: Texts.Text; S: Texts.Scanner;
|
VAR T: Texts.Text; S: Texts.Scanner;
|
||||||
|
|
@ -601,6 +645,7 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
|
||||||
ByteSize := 1; CharSize := 1; BoolSize := 1; SIntSize := 1; IntSize := 4; LIntSize := 8;
|
ByteSize := 1; CharSize := 1; BoolSize := 1; SIntSize := 1; IntSize := 4; LIntSize := 8;
|
||||||
SetSize := 8; RealSize := 4; LRealSize := 8; ProcSize := 8; PointerSize := 8; RecSize := 1;
|
SetSize := 8; RealSize := 4; LRealSize := 8; ProcSize := 8; PointerSize := 8; RecSize := 1;
|
||||||
CharAlign := 1; BoolAlign := 1; SIntAlign := 1; IntAlign := 4; LIntAlign := 8;
|
CharAlign := 1; BoolAlign := 1; SIntAlign := 1; IntAlign := 4; LIntAlign := 8;
|
||||||
|
Int8Align := 1; Int16Align := 2; Int32Align := 4; Int64Align := 8;
|
||||||
SetAlign := 8; RealAlign := 4; LRealAlign := 8; ProcAlign := 8; PointerAlign := 8; RecAlign := 1;
|
SetAlign := 8; RealAlign := 4; LRealAlign := 8; ProcAlign := 8; PointerAlign := 8; RecAlign := 1;
|
||||||
(* not necessary, we will calculate values later
|
(* not necessary, we will calculate values later
|
||||||
MinSInt := -80H; MaxSInt := 7FH;
|
MinSInt := -80H; MaxSInt := 7FH;
|
||||||
|
|
@ -617,6 +662,7 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
|
||||||
ByteSize := 1; CharSize := 1; BoolSize := 1; SIntSize := 1; IntSize := 2; LIntSize := 4;
|
ByteSize := 1; CharSize := 1; BoolSize := 1; SIntSize := 1; IntSize := 2; LIntSize := 4;
|
||||||
SetSize := 4; RealSize := 4; LRealSize := 8; ProcSize := 4; PointerSize := 4; RecSize := 1;
|
SetSize := 4; RealSize := 4; LRealSize := 8; ProcSize := 4; PointerSize := 4; RecSize := 1;
|
||||||
CharAlign := 1; BoolAlign := 1; SIntAlign := 1; IntAlign := 2; LIntAlign := 4;
|
CharAlign := 1; BoolAlign := 1; SIntAlign := 1; IntAlign := 2; LIntAlign := 4;
|
||||||
|
Int8Align := 1; Int16Align := 2; Int32Align := 4; Int64Align := 4;
|
||||||
SetAlign := 4; RealAlign := 4; LRealAlign := 8; ProcAlign := 4; PointerAlign := 4; RecAlign := 1;
|
SetAlign := 4; RealAlign := 4; LRealAlign := 8; ProcAlign := 4; PointerAlign := 4; RecAlign := 1;
|
||||||
|
|
||||||
(* not necessary, we will calculate values later
|
(* not necessary, we will calculate values later
|
||||||
|
|
@ -630,6 +676,8 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
|
||||||
ByteSize := 1; CharSize := 1; BoolSize := 1; SIntSize := 1; IntSize := 2; LIntSize := 4;
|
ByteSize := 1; CharSize := 1; BoolSize := 1; SIntSize := 1; IntSize := 2; LIntSize := 4;
|
||||||
SetSize := 4; RealSize := 4; LRealSize := 8; ProcSize := 4; PointerSize := 4; RecSize := 1;
|
SetSize := 4; RealSize := 4; LRealSize := 8; ProcSize := 4; PointerSize := 4; RecSize := 1;
|
||||||
CharAlign := 1; BoolAlign := 1; SIntAlign := 1; IntAlign := 2; LIntAlign := 4;
|
CharAlign := 1; BoolAlign := 1; SIntAlign := 1; IntAlign := 2; LIntAlign := 4;
|
||||||
|
|
||||||
|
Int8Align := 1; Int16Align := 2; Int32Align := 4; Int64Align := 4;
|
||||||
SetAlign := 4; RealAlign := 4; LRealAlign := 8; ProcAlign := 4; PointerAlign := 4; RecAlign := 1;
|
SetAlign := 4; RealAlign := 4; LRealAlign := 8; ProcAlign := 4; PointerAlign := 4; RecAlign := 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -638,6 +686,8 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
|
||||||
ByteSize := 1; CharSize := 1; BoolSize := 1; SIntSize := 1; IntSize := 2; LIntSize := 4;
|
ByteSize := 1; CharSize := 1; BoolSize := 1; SIntSize := 1; IntSize := 2; LIntSize := 4;
|
||||||
SetSize := 4; RealSize := 4; LRealSize := 8; ProcSize := 4; PointerSize := 4; RecSize := 1;
|
SetSize := 4; RealSize := 4; LRealSize := 8; ProcSize := 4; PointerSize := 4; RecSize := 1;
|
||||||
CharAlign := 1; BoolAlign := 1; SIntAlign := 1; IntAlign := 2; LIntAlign := 4;
|
CharAlign := 1; BoolAlign := 1; SIntAlign := 1; IntAlign := 2; LIntAlign := 4;
|
||||||
|
|
||||||
|
Int8Align := 1; Int16Align := 2; Int32Align := 4; Int64Align := 4;
|
||||||
SetAlign := 4; RealAlign := 4; LRealAlign := 4; ProcAlign := 4; PointerAlign := 4; RecAlign := 1;
|
SetAlign := 4; RealAlign := 4; LRealAlign := 4; ProcAlign := 4; PointerAlign := 4; RecAlign := 1;
|
||||||
|
|
||||||
ELSE (* this should suite any gnu x86 system *)
|
ELSE (* this should suite any gnu x86 system *)
|
||||||
|
|
@ -645,6 +695,8 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
|
||||||
ByteSize := 1; CharSize := 1; BoolSize := 1; SIntSize := 1; IntSize := 2; LIntSize := 4;
|
ByteSize := 1; CharSize := 1; BoolSize := 1; SIntSize := 1; IntSize := 2; LIntSize := 4;
|
||||||
SetSize := 4; RealSize := 4; LRealSize := 8; ProcSize := 4; PointerSize := 4; RecSize := 1;
|
SetSize := 4; RealSize := 4; LRealSize := 8; ProcSize := 4; PointerSize := 4; RecSize := 1;
|
||||||
CharAlign := 1; BoolAlign := 1; SIntAlign := 1; IntAlign := 2; LIntAlign := 4;
|
CharAlign := 1; BoolAlign := 1; SIntAlign := 1; IntAlign := 2; LIntAlign := 4;
|
||||||
|
|
||||||
|
Int8Align := 1; Int16Align := 2; Int32Align := 4; Int64Align := 4;
|
||||||
SetAlign := 4; RealAlign := 4; LRealAlign := 4; ProcAlign := 4; PointerAlign := 4; RecAlign := 1;
|
SetAlign := 4; RealAlign := 4; LRealAlign := 4; ProcAlign := 4; PointerAlign := 4; RecAlign := 1;
|
||||||
(* LRealAlign should be checked and confirmed *)
|
(* LRealAlign should be checked and confirmed *)
|
||||||
(* not necessary, will be calculated later
|
(* not necessary, will be calculated later
|
||||||
|
|
@ -658,7 +710,7 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
|
||||||
(* read voc.par *)
|
(* read voc.par *)
|
||||||
|
|
||||||
IF useParFile THEN (* noch *)
|
IF useParFile THEN (* noch *)
|
||||||
Console.String ("loading type sizes from voc.par"); Console.Ln;
|
IF Verbose THEN Console.String ("loading type sizes from voc.par"); Console.Ln; END;
|
||||||
NEW(T); Texts.Open(T, "voc.par");
|
NEW(T); Texts.Open(T, "voc.par");
|
||||||
IF T.len # 0 THEN
|
IF T.len # 0 THEN
|
||||||
Texts.OpenScanner(S, T, 0); Texts.Scan(S);
|
Texts.OpenScanner(S, T, 0); Texts.Scan(S);
|
||||||
|
|
@ -677,13 +729,24 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
|
||||||
Size = 1; size and alignment follows from field types but at least RecAlign; e.g, SPARC, MIPS, PowerPC
|
Size = 1; size and alignment follows from field types but at least RecAlign; e.g, SPARC, MIPS, PowerPC
|
||||||
*)
|
*)
|
||||||
GetProperty(S, "ENDIAN", ByteOrder, BitOrder); (*currently not used*)
|
GetProperty(S, "ENDIAN", ByteOrder, BitOrder); (*currently not used*)
|
||||||
|
|
||||||
|
GetProperty(S, "SYSTEM.INT8", Int8Size, Int8Align);
|
||||||
|
GetProperty(S, "SYSTEM.INT16", Int16Size, Int16Align);
|
||||||
|
GetProperty(S, "SYSTEM.INT32", Int32Size, Int32Align);
|
||||||
|
GetProperty(S, "SYSTEM.INT64", Int64Size, Int64Align);
|
||||||
(* add here Max and Min sizes, noch *)
|
(* add here Max and Min sizes, noch *)
|
||||||
ByteSize := CharSize;
|
ByteSize := CharSize;
|
||||||
|
|
||||||
ELSE Mark(-156, -1)
|
ELSE Mark(-156, -1)
|
||||||
END ;
|
END ;
|
||||||
ELSE Console.String ("not using voc.par file"); Console.Ln;
|
ELSE
|
||||||
|
IF Verbose THEN
|
||||||
|
Console.String ("not using voc.par file"); Console.Ln
|
||||||
|
END
|
||||||
END; (* if useParFile , noch *)
|
END; (* if useParFile , noch *)
|
||||||
|
|
||||||
|
Int8Size := 1; Int16Size := 2; Int32Size := 4; Int64Size := 8;
|
||||||
|
|
||||||
(* commenting this by replacing with faster way; -- noch *
|
(* commenting this by replacing with faster way; -- noch *
|
||||||
MinSInt := power0(-2, (SIntSize*8-1)); (* -2^(SIntSize*8-1)*)
|
MinSInt := power0(-2, (SIntSize*8-1)); (* -2^(SIntSize*8-1)*)
|
||||||
(*MaxSInt := -(MinSint + 1);; may be optimized?*)
|
(*MaxSInt := -(MinSint + 1);; may be optimized?*)
|
||||||
|
|
@ -708,15 +771,11 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
|
||||||
MinLInt := ASH(base, LIntSize*8-2);
|
MinLInt := ASH(base, LIntSize*8-2);
|
||||||
MaxLInt := minus(MinLInt +1);
|
MaxLInt := minus(MinLInt +1);
|
||||||
|
|
||||||
(*
|
MinInt8 := -80H; MinInt16 := -8000H; MinInt32 := 80000000H; (*-2147483648*)
|
||||||
Console.Int(MinSInt, 0); Console.Ln;
|
MaxInt8 := 7FH; MaxInt16 := 7FFFH; MaxInt32 := 7FFFFFFFH; (*2147483647*)
|
||||||
Console.Int(MaxSInt, 0); Console.Ln;
|
|
||||||
Console.Int(MinInt, 0); Console.Ln;
|
|
||||||
Console.Int(MaxInt, 0); Console.Ln;
|
|
||||||
Console.Int(MinLInt, 0); Console.Ln;
|
|
||||||
Console.Int(MaxLInt, 0); Console.Ln;
|
|
||||||
*)
|
|
||||||
|
|
||||||
|
MinInt64 := ASH(base, Int64Size*8-2);
|
||||||
|
MaxInt64 := minus(ASH(base, Int64Size*8-2) + 1);
|
||||||
|
|
||||||
IF RealSize = 4 THEN MaxReal := 3.40282346D38
|
IF RealSize = 4 THEN MaxReal := 3.40282346D38
|
||||||
ELSIF RealSize = 8 THEN MaxReal := 1.7976931348623157D307 * 9.999999
|
ELSIF RealSize = 8 THEN MaxReal := 1.7976931348623157D307 * 9.999999
|
||||||
|
|
@ -733,6 +792,10 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
|
||||||
(*IF IntSize = 4 THEN MinLInt := MinInt; MaxLInt := MaxInt END ;*)
|
(*IF IntSize = 4 THEN MinLInt := MinInt; MaxLInt := MaxInt END ;*)
|
||||||
MaxSet := SetSize * 8 - 1;
|
MaxSet := SetSize * 8 - 1;
|
||||||
MaxIndex := MaxLInt; (* shouldn't it be like max(int)? so that for loop will be safe, noch *)
|
MaxIndex := MaxLInt; (* shouldn't it be like max(int)? so that for loop will be safe, noch *)
|
||||||
|
IF Verbose THEN
|
||||||
|
VerboseListSizes
|
||||||
|
END;
|
||||||
|
|
||||||
|
|
||||||
END GetProperties;
|
END GetProperties;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,14 @@ MODULE OPP; (* NW, RC 6.3.89 / 10.2.94 *) (* object model 4.12.93 *)
|
||||||
SProc = 8; CProc = 9; IProc = 10; Mod = 11; Head = 12; TProc = 13;
|
SProc = 8; CProc = 9; IProc = 10; Mod = 11; Head = 12; TProc = 13;
|
||||||
|
|
||||||
(* Structure forms *)
|
(* Structure forms *)
|
||||||
Undef = 0; Byte = 1; Bool = 2; Char = 3; SInt = 4; Int = 5; LInt = 6;
|
Undef = 0; Byte = 1; Bool = 2; Char = 3;
|
||||||
|
SInt = 4; Int = 5; LInt = 6;
|
||||||
Real = 7; LReal = 8; Set = 9; String = 10; NilTyp = 11; NoTyp = 12;
|
Real = 7; LReal = 8; Set = 9; String = 10; NilTyp = 11; NoTyp = 12;
|
||||||
Pointer = 13; ProcTyp = 14; Comp = 15;
|
Pointer = 13; ProcTyp = 14;
|
||||||
intSet = {SInt..LInt};
|
Int8 = 16; Int16 = 17; Int32 = 18; Int64 = 19;
|
||||||
|
Comp = (*15*)20;
|
||||||
|
|
||||||
|
intSet = {SInt..LInt, Int8..Int64};
|
||||||
|
|
||||||
(* composite structure forms *)
|
(* composite structure forms *)
|
||||||
Basic = 1; Array = 2; DynArr = 3; Record = 4;
|
Basic = 1; Array = 2; DynArr = 3; Record = 4;
|
||||||
|
|
@ -281,7 +285,7 @@ MODULE OPP; (* NW, RC 6.3.89 / 10.2.94 *) (* object model 4.12.93 *)
|
||||||
OPS.Get(sym); resTyp := OPT.undftyp;
|
OPS.Get(sym); resTyp := OPT.undftyp;
|
||||||
IF sym = ident THEN qualident(res);
|
IF sym = ident THEN qualident(res);
|
||||||
IF res^.mode = Typ THEN
|
IF res^.mode = Typ THEN
|
||||||
IF res^.typ^.form < Comp THEN resTyp := res^.typ
|
IF (res^.typ^.form < Comp) OR (res^.typ^.form >= Int8) & (res^.typ^.form <= Int64) THEN resTyp := res^.typ;
|
||||||
ELSE err(54)
|
ELSE err(54)
|
||||||
END
|
END
|
||||||
ELSE err(52)
|
ELSE err(52)
|
||||||
|
|
|
||||||
1116
src/voc/OPT.Mod
1116
src/voc/OPT.Mod
File diff suppressed because it is too large
Load diff
|
|
@ -22,8 +22,11 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96
|
||||||
adr = 24; cc = 25; bit = 26; lsh = 27; rot = 28; val = 29;
|
adr = 24; cc = 25; bit = 26; lsh = 27; rot = 28; val = 29;
|
||||||
|
|
||||||
(* structure forms *)
|
(* structure forms *)
|
||||||
Byte = 1; Bool = 2; Char = 3; SInt = 4; Int = 5; LInt = 6;
|
Byte = 1; Bool = 2; Char = 3;
|
||||||
Real = 7; LReal = 8; Set = 9; String = 10; NilTyp = 11; Pointer = 13; ProcTyp = 14; Comp = 15;
|
SInt = 4; Int = 5; LInt = 6;
|
||||||
|
Real = 7; LReal = 8; Set = 9; String = 10; NilTyp = 11; Pointer = 13; ProcTyp = 14;
|
||||||
|
Int8 = 16; Int16 = 17; Int32 = 18; Int64 = 19;
|
||||||
|
Comp = (*15*)20;
|
||||||
|
|
||||||
(* composite structure forms *)
|
(* composite structure forms *)
|
||||||
Array = 2; DynArr = 3; Record = 4;
|
Array = 2; DynArr = 3; Record = 4;
|
||||||
|
|
@ -249,6 +252,10 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96
|
||||||
OPT.sinttyp^.strobj^.linkadr := PredefinedType;
|
OPT.sinttyp^.strobj^.linkadr := PredefinedType;
|
||||||
OPT.booltyp^.strobj^.linkadr := PredefinedType;
|
OPT.booltyp^.strobj^.linkadr := PredefinedType;
|
||||||
OPT.bytetyp^.strobj^.linkadr := PredefinedType;
|
OPT.bytetyp^.strobj^.linkadr := PredefinedType;
|
||||||
|
OPT.int8typ^.strobj^.linkadr := PredefinedType;
|
||||||
|
OPT.int16typ^.strobj^.linkadr := PredefinedType;
|
||||||
|
OPT.int32typ^.strobj^.linkadr := PredefinedType;
|
||||||
|
OPT.int64typ^.strobj^.linkadr := PredefinedType;
|
||||||
OPT.sysptrtyp^.strobj^.linkadr := PredefinedType;
|
OPT.sysptrtyp^.strobj^.linkadr := PredefinedType;
|
||||||
END AdrAndSize;
|
END AdrAndSize;
|
||||||
|
|
||||||
|
|
@ -509,10 +516,12 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96
|
||||||
OPM.WriteString("(void*)") (* type extension *)
|
OPM.WriteString("(void*)") (* type extension *)
|
||||||
END
|
END
|
||||||
ELSE
|
ELSE
|
||||||
IF (form IN {Real, LReal}) & (n^.typ^.form IN {SInt, Int, LInt}) THEN (* real promotion *)
|
IF (form IN {Real, LReal}) & (n^.typ^.form IN {SInt, Int, LInt, Int8, Int16, Int32, Int64}) THEN (* real promotion *)
|
||||||
OPM.WriteString("(double)"); prec := 9
|
OPM.WriteString("(double)"); prec := 9
|
||||||
ELSIF (form = LInt) & (n^.typ^.form < LInt) THEN (* integral promotion *)
|
ELSIF (form = LInt) & (n^.typ^.form < LInt) THEN (* integral promotion *)
|
||||||
OPM.WriteString("(LONGINT)"); prec := 9
|
OPM.WriteString("(LONGINT)"); prec := 9
|
||||||
|
ELSIF (form = Int64) & (n^.typ^.form < Int64) THEN
|
||||||
|
OPM.WriteString("(SYSTEM_INT64)"); prec := 9;
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
ELSIF ansi THEN
|
ELSIF ansi THEN
|
||||||
|
|
@ -708,7 +717,7 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96
|
||||||
| slash:
|
| slash:
|
||||||
IF form = Set THEN OPM.WriteString(" ^ ")
|
IF form = Set THEN OPM.WriteString(" ^ ")
|
||||||
ELSE OPM.WriteString(" / ");
|
ELSE OPM.WriteString(" / ");
|
||||||
IF (r^.obj = NIL) OR (r^.obj^.typ^.form IN {SInt, Int, LInt}) THEN
|
IF (r^.obj = NIL) OR (r^.obj^.typ^.form IN {SInt, Int, LInt, Int8, Int16, Int32, Int64}) THEN
|
||||||
OPM.Write(OpenParen); OPC.Ident(n^.typ^.strobj); OPM.Write(CloseParen)
|
OPM.Write(OpenParen); OPC.Ident(n^.typ^.strobj); OPM.Write(CloseParen)
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,10 @@ VAR mname : ARRAY 256 OF CHAR; (* noch *)
|
||||||
modulesobj := "";
|
modulesobj := "";
|
||||||
OPM.OpenPar; (* gclock(); slightly faste rtranslation but may lead to opening "too many files" *)
|
OPM.OpenPar; (* gclock(); slightly faste rtranslation but may lead to opening "too many files" *)
|
||||||
OPT.bytetyp.size := OPM.ByteSize;
|
OPT.bytetyp.size := OPM.ByteSize;
|
||||||
|
OPT.int8typ.size := 1;
|
||||||
|
OPT.int16typ.size := 2;
|
||||||
|
OPT.int32typ.size := 4;
|
||||||
|
OPT.int64typ.size := 8;
|
||||||
OPT.sysptrtyp.size := OPM.PointerSize;
|
OPT.sysptrtyp.size := OPM.PointerSize;
|
||||||
OPT.chartyp.size := OPM.CharSize;
|
OPT.chartyp.size := OPM.CharSize;
|
||||||
OPT.settyp.size := OPM.SetSize;
|
OPT.settyp.size := OPM.SetSize;
|
||||||
|
|
|
||||||
BIN
voc
BIN
voc
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue