hedgewars/pas2c.h
author unc0rr
Sun, 22 Apr 2012 21:23:32 +0400
changeset 6912 831416764d2d
parent 6902 7d4e5ce73b98
child 6922 93bdd3d251fe
permissions -rw-r--r--
Allow LIST command while in room to not annoy old frontends (0.9.17 or less) with warnings
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6875
6528171ce36d First try to compile with clang: improve renderer a bit. The result of pas2c is still far from normal C source.
unc0rr
parents:
diff changeset
     1
#pragma once
6528171ce36d First try to compile with clang: improve renderer a bit. The result of pas2c is still far from normal C source.
unc0rr
parents:
diff changeset
     2
6878
0af34406b83d Improve rendering of function types, arrays, and more
unc0rr
parents: 6875
diff changeset
     3
#include <stdbool.h>
0af34406b83d Improve rendering of function types, arrays, and more
unc0rr
parents: 6875
diff changeset
     4
6896
23b38e530967 Move all strings into constants to make them of string255 type
unc0rr
parents: 6895
diff changeset
     5
typedef union string255_
6883
70aec33185e2 Support string constants
unc0rr
parents: 6878
diff changeset
     6
    {
6896
23b38e530967 Move all strings into constants to make them of string255 type
unc0rr
parents: 6895
diff changeset
     7
        struct {
23b38e530967 Move all strings into constants to make them of string255 type
unc0rr
parents: 6895
diff changeset
     8
            char s[256];
23b38e530967 Move all strings into constants to make them of string255 type
unc0rr
parents: 6895
diff changeset
     9
        };
23b38e530967 Move all strings into constants to make them of string255 type
unc0rr
parents: 6895
diff changeset
    10
        struct {
23b38e530967 Move all strings into constants to make them of string255 type
unc0rr
parents: 6895
diff changeset
    11
            char len;
23b38e530967 Move all strings into constants to make them of string255 type
unc0rr
parents: 6895
diff changeset
    12
            char str[255];
23b38e530967 Move all strings into constants to make them of string255 type
unc0rr
parents: 6895
diff changeset
    13
        };
6883
70aec33185e2 Support string constants
unc0rr
parents: 6878
diff changeset
    14
    } string255;
6889
149638c9cbc4 More string types
unc0rr
parents: 6886
diff changeset
    15
typedef struct string192_
149638c9cbc4 More string types
unc0rr
parents: 6886
diff changeset
    16
    {
149638c9cbc4 More string types
unc0rr
parents: 6886
diff changeset
    17
        char s[193];
149638c9cbc4 More string types
unc0rr
parents: 6886
diff changeset
    18
    } string192;
149638c9cbc4 More string types
unc0rr
parents: 6886
diff changeset
    19
typedef struct string31_
149638c9cbc4 More string types
unc0rr
parents: 6886
diff changeset
    20
    {
149638c9cbc4 More string types
unc0rr
parents: 6886
diff changeset
    21
        char s[32];
149638c9cbc4 More string types
unc0rr
parents: 6886
diff changeset
    22
    } string31;
6891
ab9843957664 Improve rendering of function types, ranges, and more
unc0rr
parents: 6889
diff changeset
    23
typedef struct string15_
ab9843957664 Improve rendering of function types, ranges, and more
unc0rr
parents: 6889
diff changeset
    24
    {
ab9843957664 Improve rendering of function types, ranges, and more
unc0rr
parents: 6889
diff changeset
    25
        char s[16];
ab9843957664 Improve rendering of function types, ranges, and more
unc0rr
parents: 6889
diff changeset
    26
    } string15;
6875
6528171ce36d First try to compile with clang: improve renderer a bit. The result of pas2c is still far from normal C source.
unc0rr
parents:
diff changeset
    27
6528171ce36d First try to compile with clang: improve renderer a bit. The result of pas2c is still far from normal C source.
unc0rr
parents:
diff changeset
    28
typedef int SmallInt;
6528171ce36d First try to compile with clang: improve renderer a bit. The result of pas2c is still far from normal C source.
unc0rr
parents:
diff changeset
    29
typedef int Word;
6528171ce36d First try to compile with clang: improve renderer a bit. The result of pas2c is still far from normal C source.
unc0rr
parents:
diff changeset
    30
typedef int LongInt;
6528171ce36d First try to compile with clang: improve renderer a bit. The result of pas2c is still far from normal C source.
unc0rr
parents:
diff changeset
    31
typedef int LongWord;
6528171ce36d First try to compile with clang: improve renderer a bit. The result of pas2c is still far from normal C source.
unc0rr
parents:
diff changeset
    32
typedef int Byte;
6878
0af34406b83d Improve rendering of function types, arrays, and more
unc0rr
parents: 6875
diff changeset
    33
typedef int Integer;
6886
4463ee51c9ec Render unions
unc0rr
parents: 6883
diff changeset
    34
typedef long long int QWord;
6878
0af34406b83d Improve rendering of function types, arrays, and more
unc0rr
parents: 6875
diff changeset
    35
0af34406b83d Improve rendering of function types, arrays, and more
unc0rr
parents: 6875
diff changeset
    36
typedef float extended;
0af34406b83d Improve rendering of function types, arrays, and more
unc0rr
parents: 6875
diff changeset
    37
typedef float real;
0af34406b83d Improve rendering of function types, arrays, and more
unc0rr
parents: 6875
diff changeset
    38
0af34406b83d Improve rendering of function types, arrays, and more
unc0rr
parents: 6875
diff changeset
    39
typedef bool boolean;
6875
6528171ce36d First try to compile with clang: improve renderer a bit. The result of pas2c is still far from normal C source.
unc0rr
parents:
diff changeset
    40
6528171ce36d First try to compile with clang: improve renderer a bit. The result of pas2c is still far from normal C source.
unc0rr
parents:
diff changeset
    41
typedef void * pointer;
6878
0af34406b83d Improve rendering of function types, arrays, and more
unc0rr
parents: 6875
diff changeset
    42
typedef Byte * PByte;
0af34406b83d Improve rendering of function types, arrays, and more
unc0rr
parents: 6875
diff changeset
    43
typedef char * PChar;
0af34406b83d Improve rendering of function types, arrays, and more
unc0rr
parents: 6875
diff changeset
    44
typedef LongInt * PLongInt;
0af34406b83d Improve rendering of function types, arrays, and more
unc0rr
parents: 6875
diff changeset
    45
typedef Integer * PInteger;
6875
6528171ce36d First try to compile with clang: improve renderer a bit. The result of pas2c is still far from normal C source.
unc0rr
parents:
diff changeset
    46
6902
7d4e5ce73b98 Make pas2c even smarter. Now uIO.c compiles fine, and only 1 warning when compiled with -Wall (clang).
unc0rr
parents: 6898
diff changeset
    47
#define new(a) __new(&a, sizeof(*(a)))
7d4e5ce73b98 Make pas2c even smarter. Now uIO.c compiles fine, and only 1 warning when compiled with -Wall (clang).
unc0rr
parents: 6898
diff changeset
    48
void __new(pointer * p, int size);
6895
31def088a870 Many small improvements to pas2c
unc0rr
parents: 6894
diff changeset
    49
31def088a870 Many small improvements to pas2c
unc0rr
parents: 6894
diff changeset
    50
#define dispose(a) __dispose(a, sizeof(*(a)))
31def088a870 Many small improvements to pas2c
unc0rr
parents: 6894
diff changeset
    51
void __dispose(pointer p, int size);
6894
555a8d8db228 Some more progress with pas2c
unc0rr
parents: 6891
diff changeset
    52
555a8d8db228 Some more progress with pas2c
unc0rr
parents: 6891
diff changeset
    53
#define FillChar(a, b, c) __FillChar(&(a), b, c)
555a8d8db228 Some more progress with pas2c
unc0rr
parents: 6891
diff changeset
    54
555a8d8db228 Some more progress with pas2c
unc0rr
parents: 6891
diff changeset
    55
void __FillChar(pointer p, int size, char fill);
555a8d8db228 Some more progress with pas2c
unc0rr
parents: 6891
diff changeset
    56
string255 _strconcat(string255 a, string255 b);
6898
344b0dbd9690 - Remove support for variables in command handlers
unc0rr
parents: 6896
diff changeset
    57
string255 _strappend(string255 s, char c);
344b0dbd9690 - Remove support for variables in command handlers
unc0rr
parents: 6896
diff changeset
    58
string255 _strprepend(char c, string255 s);
344b0dbd9690 - Remove support for variables in command handlers
unc0rr
parents: 6896
diff changeset
    59
char * _pchar(string255 s);
6894
555a8d8db228 Some more progress with pas2c
unc0rr
parents: 6891
diff changeset
    60
6895
31def088a870 Many small improvements to pas2c
unc0rr
parents: 6894
diff changeset
    61
int Length(string255 a);
31def088a870 Many small improvements to pas2c
unc0rr
parents: 6894
diff changeset
    62
string255 copy(string255 a, int s, int l);
31def088a870 Many small improvements to pas2c
unc0rr
parents: 6894
diff changeset
    63
string255 delete(string255 a, int s, int l);
31def088a870 Many small improvements to pas2c
unc0rr
parents: 6894
diff changeset
    64
6896
23b38e530967 Move all strings into constants to make them of string255 type
unc0rr
parents: 6895
diff changeset
    65
#define STRCONSTDECL(a, b) const string255 a = {.len = sizeof(b), .str = b}
6898
344b0dbd9690 - Remove support for variables in command handlers
unc0rr
parents: 6896
diff changeset
    66
344b0dbd9690 - Remove support for variables in command handlers
unc0rr
parents: 6896
diff changeset
    67
typedef int file;
344b0dbd9690 - Remove support for variables in command handlers
unc0rr
parents: 6896
diff changeset
    68
extern int FileMode;
344b0dbd9690 - Remove support for variables in command handlers
unc0rr
parents: 6896
diff changeset
    69
extern int IOResult;
344b0dbd9690 - Remove support for variables in command handlers
unc0rr
parents: 6896
diff changeset
    70
6902
7d4e5ce73b98 Make pas2c even smarter. Now uIO.c compiles fine, and only 1 warning when compiled with -Wall (clang).
unc0rr
parents: 6898
diff changeset
    71
#define assign(a, b) assign_(&(a), b)
7d4e5ce73b98 Make pas2c even smarter. Now uIO.c compiles fine, and only 1 warning when compiled with -Wall (clang).
unc0rr
parents: 6898
diff changeset
    72
void assign_(int * f, string255 fileName);
6898
344b0dbd9690 - Remove support for variables in command handlers
unc0rr
parents: 6896
diff changeset
    73
void reset(int f, int size);
344b0dbd9690 - Remove support for variables in command handlers
unc0rr
parents: 6896
diff changeset
    74
#define BlockRead(a, b, c, d) BlockRead_(a, &(b), c, &(d))
344b0dbd9690 - Remove support for variables in command handlers
unc0rr
parents: 6896
diff changeset
    75
void BlockRead_(int f, void * p, int size, int * sizeRead);
344b0dbd9690 - Remove support for variables in command handlers
unc0rr
parents: 6896
diff changeset
    76
void close(int f);