project_files/hwc/rtl/pas2c.h
author sheepluva
Tue, 06 Dec 2016 01:05:46 +0100
changeset 12103 22bd1099d51f
parent 10660 79fa79c77c38
child 13880 5f819b90d479
permissions -rw-r--r--
fix pas2c definition of SizeInt
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7989
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
     1
#pragma once
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
     2
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
     3
#include <stddef.h>
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
     4
#include <stdint.h>
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
     5
#include <stdbool.h>
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
     6
#include <wchar.h>
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
     7
#include <math.h>
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
     8
8006
7ca007615b88 no globs, sources not yet generated
koda
parents: 7989
diff changeset
     9
#define MAX_PARAMS 64
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10127
diff changeset
    10
#define MAX_ANSISTRING_LENGTH 16383
7989
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    11
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    12
typedef union string255_
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    13
    {
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    14
        struct {
10121
8b65699beb56 Implement a bit of astring
unc0rr
parents: 9962
diff changeset
    15
            unsigned char s[256];
7989
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    16
        };
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    17
        struct {
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    18
            unsigned char len;
10121
8b65699beb56 Implement a bit of astring
unc0rr
parents: 9962
diff changeset
    19
            unsigned char str[255];
7989
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    20
        };
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    21
    } string255;
10121
8b65699beb56 Implement a bit of astring
unc0rr
parents: 9962
diff changeset
    22
8b65699beb56 Implement a bit of astring
unc0rr
parents: 9962
diff changeset
    23
typedef union astring_
7989
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    24
    {
10121
8b65699beb56 Implement a bit of astring
unc0rr
parents: 9962
diff changeset
    25
        struct {
10131
4b4a043111f4 - pas2c recognizes typecasts in initialization expressions
unc0rr
parents: 10128
diff changeset
    26
            uint16_t len;
10121
8b65699beb56 Implement a bit of astring
unc0rr
parents: 9962
diff changeset
    27
        };
8b65699beb56 Implement a bit of astring
unc0rr
parents: 9962
diff changeset
    28
        struct {
8b65699beb56 Implement a bit of astring
unc0rr
parents: 9962
diff changeset
    29
            unsigned char _dummy2;
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10127
diff changeset
    30
            unsigned char s[MAX_ANSISTRING_LENGTH + 1];
10121
8b65699beb56 Implement a bit of astring
unc0rr
parents: 9962
diff changeset
    31
        };
8b65699beb56 Implement a bit of astring
unc0rr
parents: 9962
diff changeset
    32
        struct {
10131
4b4a043111f4 - pas2c recognizes typecasts in initialization expressions
unc0rr
parents: 10128
diff changeset
    33
            unsigned char _dummy1;
4b4a043111f4 - pas2c recognizes typecasts in initialization expressions
unc0rr
parents: 10128
diff changeset
    34
            string255 str255;
10121
8b65699beb56 Implement a bit of astring
unc0rr
parents: 9962
diff changeset
    35
        };
8b65699beb56 Implement a bit of astring
unc0rr
parents: 9962
diff changeset
    36
    } astring;
7989
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    37
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    38
typedef string255 shortstring;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    39
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    40
typedef uint8_t Byte;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    41
typedef int8_t ShortInt;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    42
typedef uint16_t Word;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    43
typedef int16_t SmallInt;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    44
typedef uint32_t LongWord;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    45
typedef int32_t LongInt;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    46
typedef uint64_t QWord;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    47
typedef int64_t Int64;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    48
typedef LongWord Cardinal;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    49
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    50
typedef LongInt Integer;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    51
typedef float extended;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    52
typedef float real;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    53
typedef float single;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    54
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    55
typedef bool boolean;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    56
typedef int LongBool;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    57
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    58
typedef void * pointer;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    59
typedef Byte * PByte;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    60
typedef char * PChar;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    61
typedef LongInt * PLongInt;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    62
typedef LongWord * PLongWord;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    63
typedef Integer * PInteger;
10660
79fa79c77c38 fix size of PtrInt. enable tests for pas2c (all passing now)
sheepluva
parents: 10142
diff changeset
    64
typedef ptrdiff_t PtrInt;
7989
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    65
typedef wchar_t widechar;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    66
typedef wchar_t* PWideChar;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    67
typedef char Char;
12103
22bd1099d51f fix pas2c definition of SizeInt
sheepluva
parents: 10660
diff changeset
    68
typedef PtrInt SizeInt;
7989
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    69
typedef char ** PPChar;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    70
typedef Word* PWord;
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    71
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    72
string255 _strconcat(string255 a, string255 b);
9962
97ed501accc5 oh those signed chars
unc0rr
parents: 8006
diff changeset
    73
string255 _strappend(string255 s, unsigned char c);
97ed501accc5 oh those signed chars
unc0rr
parents: 8006
diff changeset
    74
string255 _strprepend(unsigned char c, string255 s);
97ed501accc5 oh those signed chars
unc0rr
parents: 8006
diff changeset
    75
string255 _chrconcat(unsigned char a, unsigned char b);
7989
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    76
bool _strcompare(string255 a, string255 b);
9962
97ed501accc5 oh those signed chars
unc0rr
parents: 8006
diff changeset
    77
bool _strcomparec(string255 a, unsigned char b);
7989
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    78
bool _strncompare(string255 a, string255 b);
10127
7f29a65aa1e4 It compiles \o/
unc0rr
parents: 10121
diff changeset
    79
bool _strncompareA(astring a, astring b);
7989
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    80
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    81
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    82
#define STRINIT(a) {.len = sizeof(a) - 1, .str = a}
10142
adb804cb2638 Reduce number of warnings in pas2c-generated code
unc0rr
parents: 10131
diff changeset
    83
#define UNUSED(x) (void)(x)
7989
7ef4ace6335f add xymeng's pas2c header
koda
parents:
diff changeset
    84