hedgewars/pas2cSystem.pas
author unc0rr
Thu, 19 Apr 2012 23:36:20 +0400
changeset 6893 69cc0166be8d
parent 6891 ab9843957664
child 6894 555a8d8db228
permissions -rw-r--r--
- Track array size to use for High function - Some fixes
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;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    16
    gl_unsigned_byte = 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
    17
    Int = 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;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    27
    gl_float = float;
6516
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    28
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    29
    boolean = boolean;
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    30
    LongBool = boolean;
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    31
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    32
    string = string;
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    33
    shortstring = string;
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    34
    ansistring = string;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    35
    widechar = string;
6516
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    36
addaeb1b9539 Further progress on dealing with namespaces
unc0rr
parents: 6512
diff changeset
    37
    char = char;
6873
30840365af0a Eraser tool
unc0rr
parents: 6860
diff changeset
    38
    PChar = ^char;
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;
2c4151afad0c Workaround pointers to not yet defined types
unc0rr
parents: 6653
diff changeset
    46
    stderr = Handle;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    47
6893
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
    48
    png_structp = pointer;
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
    49
    png_size_t = integer;
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
    50
6512
0df7f6697939 "System" unit to help converter
unc0rr
parents:
diff changeset
    51
var 
0df7f6697939 "System" unit to help converter
unc0rr
parents:
diff changeset
    52
    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
    53
    
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    54
    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
    55
    
6520
6fecdc5d182f Some more work on scopes
unc0rr
parents: 6516
diff changeset
    56
    StrLen, ord, Succ, Pred : function : integer;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    57
    inc, dec, Low, High, Lo, Hi : function : integer;
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    58
    odd, even : function : boolean;
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    59
6520
6fecdc5d182f Some more work on scopes
unc0rr
parents: 6516
diff changeset
    60
    Now : function : integer;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    61
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    62
    new, dispose, FillChar, Move : procedure;
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    63
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    64
    trunc, round : function : integer;
6837
a137733c5776 Much better types handling, work correctly with functions
unc0rr
parents: 6835
diff changeset
    65
    Abs, Sqr : function : integer;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    66
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
    67
    StrPas, FormatDateTime, copy, delete, str, pos, trim : function : shortstring;
6856
a5b0afb60862 More external definitions for pas2c
unc0rr
parents: 6855
diff changeset
    68
    Length, StrToInt : function : integer;
a5b0afb60862 More external definitions for pas2c
unc0rr
parents: 6855
diff changeset
    69
    SetLength, val : procedure;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    70
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
    71
    assign, rewrite, reset, flush, BlockWrite, BlockRead, close : procedure;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    72
    IOResult : function : integer;
6853
affeaba0af71 Fix withState' not returning lastType
unc0rr
parents: 6843
diff changeset
    73
    exit, break, halt, continue : procedure;
6843
59da15acb2f2 Finally fix the bug with pointer declarations polluting namespace with bad records
unc0rr
parents: 6838
diff changeset
    74
    TextFile, file : Handle;
6853
affeaba0af71 Fix withState' not returning lastType
unc0rr
parents: 6843
diff changeset
    75
    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
    76
    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
    77
    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
    78
    exitcode : integer;
6853
affeaba0af71 Fix withState' not returning lastType
unc0rr
parents: 6843
diff changeset
    79
    
affeaba0af71 Fix withState' not returning lastType
unc0rr
parents: 6843
diff changeset
    80
    ParamCount : function : integer;
affeaba0af71 Fix withState' not returning lastType
unc0rr
parents: 6843
diff changeset
    81
    ParamStr : function : string;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    82
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
    83
    sqrt, arctan2, pi, cos, sin, power : function : float;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    84
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    85
    TypeInfo, GetEnumName : function : shortstring;
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    86
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    87
    UTF8ToUnicode, WrapText: function : shortstring;
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    88
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    89
    sizeof : function : integer;
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    90
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    91
    GetMem : function : pointer;
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    92
    FreeMem : procedure;
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    93
    
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    94
    gl_texture_2d, glbindtexture, gltexparameterf, gl_rgba, 
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    95
    glteximage2d, glvertexpointer, gltexcoordpointer,
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    96
    gl_triangle_fan, gldrawarrays, glpushmatrix, glpopmatrix,
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    97
    gltranslatef, glscalef, glrotatef, gldisable, glenable,
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    98
    gl_line_smooth, gllinewidth, gl_lines, gl_line_loop,
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
    99
    glcolor4ub, gl_texture_wrap_s, gltexparameteri,
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
   100
    gl_texture_wrap_t, gl_texture_min_filter,
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
   101
    gl_linear, gl_texture_mag_filter, glgentextures,
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
   102
    gldeletetextures, glreadpixels, glclearcolor,
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
   103
    gl_line_strip, gldeleterenderbuffersext,
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
   104
    gldeleteframebuffersext, glext_loadextension,
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
   105
    gl_max_texture_size, glgetintegerv, gl_renderer,
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
   106
    glgetstring, gl_vendor, gl_version, glgenframebuffersext,
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
   107
    glbindframebufferext, glgenrenderbuffersext,
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
   108
    glbindrenderbufferext, glrenderbufferstorageext,
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
   109
    glframebufferrenderbufferext, glframebuffertexture2dext,
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
   110
    gl_framebuffer_ext, gl_depth_component, 
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
   111
    gl_depth_attachment_ext, gl_renderbuffer_ext, gl_rgba8,
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
   112
    gl_color_attachment0_ext, gl_modelview, gl_blend,
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
   113
    gl_src_alpha, gl_one_minus_src_alpha,  
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
   114
    gl_perspective_correction_hint, gl_fastest,
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
   115
    gl_dither, gl_vertex_array, gl_texture_coord_array,
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
   116
    glviewport, glloadidentity, glmatrixmode, glhint,
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
   117
    glblendfunc, glenableclientstate, gl_color_buffer_bit,
6856
a5b0afb60862 More external definitions for pas2c
unc0rr
parents: 6855
diff changeset
   118
    glclear, gldisableclientstate, gl_color_array,
a5b0afb60862 More external definitions for pas2c
unc0rr
parents: 6855
diff changeset
   119
    glcolorpointer, gl_depth_buffer_bit, gl_quads,
a5b0afb60862 More external definitions for pas2c
unc0rr
parents: 6855
diff changeset
   120
    glbegin, glend, gltexcoord2f, glvertex2d,
6893
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
   121
    gl_true, gl_false, glcolormask, gl_projection,
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
   122
    gl_texture_priority, glenum, gl_clamp_to_edge,
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
   123
    gl_extensions : procedure;
6838
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
   124
b1a0e7a52c04 More clean namespace, some fixes
unc0rr
parents: 6837
diff changeset
   125
    TThreadId : function : integer;
6854
873929cbd54b Normalize RecordFields before conversion. Helps with namespaces problem.
unc0rr
parents: 6853
diff changeset
   126
    BeginThread, ThreadSwitch : procedure;
873929cbd54b Normalize RecordFields before conversion. Helps with namespaces problem.
unc0rr
parents: 6853
diff changeset
   127
    InterlockedIncrement, InterlockedDecrement : procedure;
6853
affeaba0af71 Fix withState' not returning lastType
unc0rr
parents: 6843
diff changeset
   128
    
affeaba0af71 Fix withState' not returning lastType
unc0rr
parents: 6843
diff changeset
   129
    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
   130
    randomize : 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
    Assigned : function : boolean;
6854
873929cbd54b Normalize RecordFields before conversion. Helps with namespaces problem.
unc0rr
parents: 6853
diff changeset
   133
    
6860
f4238c683ec7 Convert some operators
unc0rr
parents: 6856
diff changeset
   134
    _strconcat : function : string;
f4238c683ec7 Convert some operators
unc0rr
parents: 6856
diff changeset
   135
    _strcompare, _strncompare : function : boolean;
6893
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
   136
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
   137
    png_structp, png_set_write_fn, png_get_io_ptr,
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
   138
    png_get_libpng_ver, png_create_write_struct,
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
   139
    png_create_info_struct, png_destroy_write_struct,
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
   140
    png_write_row, png_set_ihdr, png_write_info,
69cc0166be8d - Track array size to use for High function
unc0rr
parents: 6891
diff changeset
   141
    png_write_end : procedure;