hedgewars/pas2cSystem.pas
author Stepan777 <stepik-777@mail.ru>
Fri, 08 Jun 2012 02:52:35 +0400
changeset 7198 5debd5fe526e
parent 7151 ec15d9e1a7e3
child 7616 dcda1c2b77e4
permissions -rw-r--r--
1. Add IFDEFs for video recording 2. Options for video recording were hardcoded in engine, now they are hardcoded in frontend and passed to engine thru command line (later it will be possible to change them in frontend)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6512
0df7f6697939 "System" unit to help converter
unc0rr
parents:
diff changeset
     1
system;
0df7f6697939 "System" unit to help converter
unc0rr
parents:
diff changeset
     2
0df7f6697939 "System" unit to help converter
unc0rr
parents:
diff changeset
     3
type 
6635
c2fa29fe2a58 Some progress, still can't find the source of bad behavior
unc0rr
parents: 6552
diff changeset
     4
    Integer = integer;
6512
0df7f6697939 "System" unit to help converter
unc0rr
parents:
diff changeset
     5
    LongInt = integer;
0df7f6697939 "System" unit to help converter
unc0rr
parents:
diff changeset
     6
    LongWord = integer;
6516
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
     7
    Cardinal = integer;
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
     8
    PtrInt = integer;
6520
6fecdc5d182f Some more work on scopes
unc0rr
parents: 6516
diff changeset
     9
    Word = integer;
6fecdc5d182f Some more work on scopes
unc0rr
parents: 6516
diff changeset
    10
    Byte = integer;
6fecdc5d182f Some more work on scopes
unc0rr
parents: 6516
diff changeset
    11
    SmallInt = integer;
6fecdc5d182f Some more work on scopes
unc0rr
parents: 6516
diff changeset
    12
    ShortInt = integer;
6653
d45b6dbd2ad6 Move a bit further
unc0rr
parents: 6649
diff changeset
    13
    QWord = integer;
6891
ab9843957664 Improve rendering of function types, ranges, and more
unc0rr
parents: 6873
diff changeset
    14
    GLint = integer;
ab9843957664 Improve rendering of function types, ranges, and more
unc0rr
parents: 6873
diff changeset
    15
    GLuint = integer;
7044
46cb4e8cedfb Fix for Int type and sysutils in hwengine.pas
unc0rr
parents: 7041
diff changeset
    16
    int = integer;
7073
26f960656cc9 help pas2c
unc0rr
parents: 7069
diff changeset
    17
    size_t = integer;
6516
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    18
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    19
    pointer = pointer;
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    20
6649
7f78e8a6db69 Fix a bug with type declaration trying to resolve type being declared
unc0rr
parents: 6635
diff changeset
    21
    float = float;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    22
    single = float;
6516
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    23
    double = float;
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    24
    real = float;
6653
d45b6dbd2ad6 Move a bit further
unc0rr
parents: 6649
diff changeset
    25
    extended = float;
6891
ab9843957664 Improve rendering of function types, ranges, and more
unc0rr
parents: 6873
diff changeset
    26
    GLfloat = float;
6516
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    27
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    28
    boolean = boolean;
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    29
    LongBool = boolean;
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    30
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    31
    string = string;
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    32
    shortstring = string;
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    33
    ansistring = string;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    34
    widechar = string;
6516
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    35
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    36
    char = char;
6873
30840365af0a Eraser tool
unc0rr
parents: 6860
diff changeset
    37
    PChar = ^char;
6926
6e832f8f4d8e Make adler32 friendlier for pas2c - this should work the same (needs testing ofc)
nemo
parents: 6902
diff changeset
    38
    PPChar = ^Pchar;
6520
6fecdc5d182f Some more work on scopes
unc0rr
parents: 6516
diff changeset
    39
    
6fecdc5d182f Some more work on scopes
unc0rr
parents: 6516
diff changeset
    40
    PByte = ^Byte;
6fecdc5d182f Some more work on scopes
unc0rr
parents: 6516
diff changeset
    41
    PLongInt = ^LongInt;
6fecdc5d182f Some more work on scopes
unc0rr
parents: 6516
diff changeset
    42
    PLongWord = ^LongWord;
6fecdc5d182f Some more work on scopes
unc0rr
parents: 6516
diff changeset
    43
    PInteger = ^Integer;
6663
2c4151afad0c Workaround pointers to not yet defined types
unc0rr
parents: 6653
diff changeset
    44
    
2c4151afad0c Workaround pointers to not yet defined types
unc0rr
parents: 6653
diff changeset
    45
    Handle = integer;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    46
6893
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
    47
    png_structp = pointer;
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
    48
    png_size_t = integer;
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
    49
6512
0df7f6697939 "System" unit to help converter
unc0rr
parents:
diff changeset
    50
var 
0df7f6697939 "System" unit to help converter
unc0rr
parents:
diff changeset
    51
    false, true: boolean;
6855
807156c01475 Finish the toughest part of the converter. Now it knows types of everything, so could correctly recognize bitwise operators and type convertions.
unc0rr
parents: 6854
diff changeset
    52
    
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    53
    write, writeLn, read, readLn: procedure;
6855
807156c01475 Finish the toughest part of the converter. Now it knows types of everything, so could correctly recognize bitwise operators and type convertions.
unc0rr
parents: 6854
diff changeset
    54
    
6520
6fecdc5d182f Some more work on scopes
unc0rr
parents: 6516
diff changeset
    55
    StrLen, ord, Succ, Pred : function : integer;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    56
    inc, dec, Low, High, Lo, Hi : function : integer;
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    57
    odd, even : function : boolean;
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    58
6520
6fecdc5d182f Some more work on scopes
unc0rr
parents: 6516
diff changeset
    59
    Now : function : integer;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    60
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    61
    new, dispose, FillChar, Move : procedure;
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    62
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    63
    trunc, round : function : integer;
7041
76a9274f280f More definitions and mess with pascal code
unc0rr
parents: 7038
diff changeset
    64
    abs, sqr : function : integer;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    65
6967
1224c6fb36c3 Support recurrent function calls. The code is kinda hackish and ugly, but I really spent a few hours thinking on a good solution.
unc0rr
parents: 6926
diff changeset
    66
    StrPas, FormatDateTime, copy, delete, str, pos, trim, LowerCase : function : shortstring;
6856
a5b0afb60862 More external definitions for pas2c
unc0rr
parents: 6855
diff changeset
    67
    Length, StrToInt : function : integer;
a5b0afb60862 More external definitions for pas2c
unc0rr
parents: 6855
diff changeset
    68
    SetLength, val : procedure;
6898
344b0dbd9690 - Remove support for variables in command handlers
unc0rr
parents: 6894
diff changeset
    69
    _pchar : function : PChar;
7134
beb16926ae5c Some improvements to pas2c
unc0rr
parents: 7073
diff changeset
    70
    pchar2str : function : string;
7066
12cc2bd84b0b Make pas2c even more happier with uGears.c, allow assigning arrays in some cases
unc0rr
parents: 7065
diff changeset
    71
    memcpy : procedure;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    72
6855
807156c01475 Finish the toughest part of the converter. Now it knows types of everything, so could correctly recognize bitwise operators and type convertions.
unc0rr
parents: 6854
diff changeset
    73
    assign, rewrite, reset, flush, BlockWrite, BlockRead, close : procedure;
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
    74
    IOResult : integer;
6853
affeaba0af71 Fix withState' not returning lastType
unc0rr
parents: 6843
diff changeset
    75
    exit, break, halt, continue : procedure;
6843
59da15acb2f2 Finally fix the bug with pointer declarations polluting namespace with bad records
unc0rr
parents: 6838
diff changeset
    76
    TextFile, file : Handle;
6853
affeaba0af71 Fix withState' not returning lastType
unc0rr
parents: 6843
diff changeset
    77
    FileMode : integer;
6855
807156c01475 Finish the toughest part of the converter. Now it knows types of everything, so could correctly recognize bitwise operators and type convertions.
unc0rr
parents: 6854
diff changeset
    78
    FileExists, DirectoryExists, eof : function : boolean;
807156c01475 Finish the toughest part of the converter. Now it knows types of everything, so could correctly recognize bitwise operators and type convertions.
unc0rr
parents: 6854
diff changeset
    79
    ExtractFileName : function : string;
807156c01475 Finish the toughest part of the converter. Now it knows types of everything, so could correctly recognize bitwise operators and type convertions.
unc0rr
parents: 6854
diff changeset
    80
    exitcode : integer;
7151
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7134
diff changeset
    81
    stdout, stderr : Handle;
6853
affeaba0af71 Fix withState' not returning lastType
unc0rr
parents: 6843
diff changeset
    82
    
affeaba0af71 Fix withState' not returning lastType
unc0rr
parents: 6843
diff changeset
    83
    ParamCount : function : integer;
affeaba0af71 Fix withState' not returning lastType
unc0rr
parents: 6843
diff changeset
    84
    ParamStr : function : string;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    85
7062
7efe16575779 Recognize length on arrays as a separate function
unc0rr
parents: 7054
diff changeset
    86
    sqrt, arctan2, cos, sin, power : function : float;
7efe16575779 Recognize length on arrays as a separate function
unc0rr
parents: 7054
diff changeset
    87
    pi : float;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    88
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    89
    TypeInfo, GetEnumName : function : shortstring;
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    90
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    91
    UTF8ToUnicode, WrapText: function : shortstring;
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    92
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    93
    sizeof : function : integer;
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    94
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    95
    GetMem : function : pointer;
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    96
    FreeMem : procedure;
7064
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
    97
   
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
    98
    glGetString : function : pchar;
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
    99
 
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
   100
    glBegin, glBindTexture, glBlendFunc, glClear, glClearColor,
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
   101
    glColor4ub, glColorMask, glColorPointer, glDeleteTextures,
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
   102
    glDisable, glDisableClientState, glDrawArrays, glEnable,
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
   103
    glEnableClientState, glEnd, glGenTextures, glGetIntegerv,
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
   104
    glHint, glLineWidth, glLoadIdentity, glMatrixMode, glPopMatrix,
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
   105
    glPushMatrix, glReadPixels, glRotatef, glScalef, glTexCoord2f,
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
   106
    glTexCoordPointer, glTexImage2D, glTexParameterf,
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
   107
    glTexParameteri, glTranslatef, glVertex2d, glVertexPointer,
7065
e80e0d3273c5 Add missing identifiers
unc0rr
parents: 7064
diff changeset
   108
    glViewport, glext_LoadExtension, glDeleteRenderbuffersEXT,
e80e0d3273c5 Add missing identifiers
unc0rr
parents: 7064
diff changeset
   109
    glDeleteFramebuffersEXT, glGenFramebuffersEXT,
e80e0d3273c5 Add missing identifiers
unc0rr
parents: 7064
diff changeset
   110
    glGenRenderbuffersEXT, glBindFramebufferEXT, 
e80e0d3273c5 Add missing identifiers
unc0rr
parents: 7064
diff changeset
   111
    glBindRenderbufferEXT, glRenderbufferStorageEXT,
e80e0d3273c5 Add missing identifiers
unc0rr
parents: 7064
diff changeset
   112
    glFramebufferRenderbufferEXT, glFramebufferTexture2DEXT : procedure;
7064
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
   113
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
   114
    GL_BGRA, GL_BLEND, GL_CLAMP_TO_EDGE, GL_COLOR_ARRAY,
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
   115
    GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_DEPTH_COMPONENT,
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
   116
    GL_DITHER, GL_EXTENSIONS, GL_FALSE, GL_FASTEST, GL_LINEAR,
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
   117
    GL_LINE_LOOP, GL_LINES, GL_LINE_SMOOTH, GL_LINE_STRIP,
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
   118
    GL_MAX_TEXTURE_SIZE, GL_MODELVIEW, GL_ONE_MINUS_SRC_ALPHA,
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
   119
    GL_PERSPECTIVE_CORRECTION_HINT, GL_PROJECTION, GL_QUADS,
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
   120
    GL_RENDERER, GL_RGBA, GL_RGBA8, GL_SRC_ALPHA, GL_TEXTURE_2D,
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
   121
    GL_TEXTURE_COORD_ARRAY, GL_TEXTURE_MAG_FILTER,
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
   122
    GL_TEXTURE_MIN_FILTER, GL_TEXTURE_PRIORITY, GL_TEXTURE_WRAP_S,
0cf7cad767aa Fix casing and type for gl
nemo
parents: 7062
diff changeset
   123
    GL_TEXTURE_WRAP_T, GL_TRIANGLE_FAN, GL_TRUE, GL_VENDOR,
7065
e80e0d3273c5 Add missing identifiers
unc0rr
parents: 7064
diff changeset
   124
    GL_VERSION, GL_VERTEX_ARRAY, GLenum,  GL_FRAMEBUFFER_EXT,
e80e0d3273c5 Add missing identifiers
unc0rr
parents: 7064
diff changeset
   125
    GL_RENDERBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
7069
bcf9d8e64e92 pas2c stuff again
unc0rr
parents: 7066
diff changeset
   126
    GL_COLOR_ATTACHMENT0_EXT, GL_FLOAT, GL_UNSIGNED_BYTE : integer;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
   127
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
   128
    TThreadId : function : integer;
6854
873929cbd54b Normalize RecordFields before conversion. Helps with namespaces problem.
unc0rr
parents: 6853
diff changeset
   129
    BeginThread, ThreadSwitch : procedure;
873929cbd54b Normalize RecordFields before conversion. Helps with namespaces problem.
unc0rr
parents: 6853
diff changeset
   130
    InterlockedIncrement, InterlockedDecrement : procedure;
6853
affeaba0af71 Fix withState' not returning lastType
unc0rr
parents: 6843
diff changeset
   131
    
affeaba0af71 Fix withState' not returning lastType
unc0rr
parents: 6843
diff changeset
   132
    random : function : integer;
6855
807156c01475 Finish the toughest part of the converter. Now it knows types of everything, so could correctly recognize bitwise operators and type convertions.
unc0rr
parents: 6854
diff changeset
   133
    randomize : procedure;
6853
affeaba0af71 Fix withState' not returning lastType
unc0rr
parents: 6843
diff changeset
   134
    
affeaba0af71 Fix withState' not returning lastType
unc0rr
parents: 6843
diff changeset
   135
    Assigned : function : boolean;
6854
873929cbd54b Normalize RecordFields before conversion. Helps with namespaces problem.
unc0rr
parents: 6853
diff changeset
   136
    
7151
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7134
diff changeset
   137
    _strconcat, _strappend, _strprepend, _chrconcat : function : string;
7054
7e8fb07ef91c Function to compare string to char ftw
unc0rr
parents: 7044
diff changeset
   138
    _strcompare, _strncompare, _strcomparec : function : boolean;
6893
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
   139
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
   140
    png_structp, png_set_write_fn, png_get_io_ptr,
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
   141
    png_get_libpng_ver, png_create_write_struct,
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
   142
    png_create_info_struct, png_destroy_write_struct,
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
   143
    png_write_row, png_set_ihdr, png_write_info,
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
   144
    png_write_end : procedure;
6894
555a8d8db228 Some more progress with pas2c
unc0rr
parents: 6893
diff changeset
   145
555a8d8db228 Some more progress with pas2c
unc0rr
parents: 6893
diff changeset
   146
    EnumToStr : function : string;
7066
12cc2bd84b0b Make pas2c even more happier with uGears.c, allow assigning arrays in some cases
unc0rr
parents: 7065
diff changeset
   147