author | sheepluva |
Tue, 22 Jun 2021 22:13:55 +0200 | |
changeset 15802 | d5c37e78ab83 |
parent 14249 | 06f2dc4deab2 |
permissions | -rw-r--r-- |
7989 | 1 |
#pragma once |
2 |
||
3 |
#include <stddef.h> |
|
4 |
#include <stdint.h> |
|
5 |
#include <stdbool.h> |
|
6 |
#include <wchar.h> |
|
7 |
#include <math.h> |
|
8 |
||
8006 | 9 |
#define MAX_PARAMS 64 |
14249
06f2dc4deab2
Remove erroneous code duplicating FIX_STRING functionality, adjust ansistring array size
unc0rr
parents:
14185
diff
changeset
|
10 |
#define MAX_ANSISTRING_LENGTH 16382 |
7989 | 11 |
|
12 |
typedef union string255_ |
|
13 |
{ |
|
14 |
struct { |
|
10121 | 15 |
unsigned char s[256]; |
7989 | 16 |
}; |
17 |
struct { |
|
18 |
unsigned char len; |
|
10121 | 19 |
unsigned char str[255]; |
7989 | 20 |
}; |
21 |
} string255; |
|
10121 | 22 |
|
23 |
typedef union astring_ |
|
7989 | 24 |
{ |
10121 | 25 |
struct { |
10131
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
26 |
uint16_t len; |
13880 | 27 |
unsigned char str[MAX_ANSISTRING_LENGTH]; |
10121 | 28 |
}; |
29 |
struct { |
|
30 |
unsigned char _dummy2; |
|
10128 | 31 |
unsigned char s[MAX_ANSISTRING_LENGTH + 1]; |
10121 | 32 |
}; |
33 |
struct { |
|
10131
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
34 |
unsigned char _dummy1; |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
35 |
string255 str255; |
10121 | 36 |
}; |
37 |
} astring; |
|
7989 | 38 |
|
39 |
typedef string255 shortstring; |
|
40 |
||
41 |
typedef uint8_t Byte; |
|
42 |
typedef int8_t ShortInt; |
|
43 |
typedef uint16_t Word; |
|
44 |
typedef int16_t SmallInt; |
|
45 |
typedef uint32_t LongWord; |
|
46 |
typedef int32_t LongInt; |
|
47 |
typedef uint64_t QWord; |
|
48 |
typedef int64_t Int64; |
|
49 |
typedef LongWord Cardinal; |
|
50 |
||
51 |
typedef LongInt Integer; |
|
14185
801dc57371c3
Pas2C: Fix bad C typedefs for Pascal data types Extended and Real
Wuzzy <Wuzzy2@mail.ru>
parents:
13880
diff
changeset
|
52 |
typedef long double extended; |
801dc57371c3
Pas2C: Fix bad C typedefs for Pascal data types Extended and Real
Wuzzy <Wuzzy2@mail.ru>
parents:
13880
diff
changeset
|
53 |
typedef double real; |
7989 | 54 |
typedef float single; |
55 |
||
56 |
typedef bool boolean; |
|
57 |
typedef int LongBool; |
|
58 |
||
59 |
typedef void * pointer; |
|
60 |
typedef Byte * PByte; |
|
61 |
typedef char * PChar; |
|
62 |
typedef LongInt * PLongInt; |
|
63 |
typedef LongWord * PLongWord; |
|
64 |
typedef Integer * PInteger; |
|
10660
79fa79c77c38
fix size of PtrInt. enable tests for pas2c (all passing now)
sheepluva
parents:
10142
diff
changeset
|
65 |
typedef ptrdiff_t PtrInt; |
7989 | 66 |
typedef wchar_t widechar; |
67 |
typedef wchar_t* PWideChar; |
|
68 |
typedef char Char; |
|
12103 | 69 |
typedef PtrInt SizeInt; |
7989 | 70 |
typedef char ** PPChar; |
71 |
typedef Word* PWord; |
|
72 |
||
73 |
string255 _strconcat(string255 a, string255 b); |
|
9962 | 74 |
string255 _strappend(string255 s, unsigned char c); |
75 |
string255 _strprepend(unsigned char c, string255 s); |
|
76 |
string255 _chrconcat(unsigned char a, unsigned char b); |
|
7989 | 77 |
bool _strcompare(string255 a, string255 b); |
9962 | 78 |
bool _strcomparec(string255 a, unsigned char b); |
7989 | 79 |
bool _strncompare(string255 a, string255 b); |
10127 | 80 |
bool _strncompareA(astring a, astring b); |
7989 | 81 |
|
82 |
||
83 |
#define STRINIT(a) {.len = sizeof(a) - 1, .str = a} |
|
10142 | 84 |
#define UNUSED(x) (void)(x) |
7989 | 85 |