hedgewars/pas2cRedo.pas
author unC0Rr
Wed, 28 Aug 2024 13:41:51 +0200
changeset 16049 9be943326d9c
parent 15313 70d416a8f63f
permissions -rw-r--r--
Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
     1
redo;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
     2
{This file contains functions that are re-implemented}
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
     3
{pas2c will add prefix fpcrtl_ to all these functions}
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9966
diff changeset
     4
type
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
     5
    uinteger = uinteger;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
     6
    Integer = integer;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
     7
    LongInt = integer;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
     8
    LongWord = uinteger;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
     9
    Cardinal = uinteger;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    10
    PtrInt = integer;
12104
f61bd25b9f70 tweak landtex filling some more. cuz it's fun
sheepluva
parents: 11826
diff changeset
    11
    SizeInt = PtrInt;
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    12
    Word = uinteger;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    13
    Byte = integer;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    14
    SmallInt = integer;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    15
    ShortInt = integer;
8105
d088be5ecdcb ok at least pas2c now parses allnots.......
koda
parents: 8026
diff changeset
    16
    Int64 = integer;
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    17
    QWord = uinteger;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    18
    GLint = integer;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    19
    GLuint = integer;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    20
    int = integer;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    21
    size_t = integer;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    22
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    23
    pointer = pointer;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    24
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    25
    float = float;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    26
    single = float;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    27
    double = float;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    28
    real = float;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    29
    extended = float;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    30
    GLfloat = float;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    31
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    32
    boolean = boolean;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    33
    LongBool = boolean;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    34
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    35
    string = string;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    36
    shortstring = string;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    37
    ansistring = string;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    38
    widechar = string;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    39
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    40
    char = char;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    41
    PChar = ^char;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    42
    PPChar = ^Pchar;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9966
diff changeset
    43
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    44
    PByte = ^Byte;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    45
    PLongInt = ^LongInt;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    46
    PLongWord = ^LongWord;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    47
    PInteger = ^Integer;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9966
diff changeset
    48
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    49
    Handle = integer;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    50
14934
68e1783762bc Pas2C: Support FileSize and Delete; add dummy implementation of FormatDateTime
Wuzzy <Wuzzy2@mail.ru>
parents: 12104
diff changeset
    51
    TDateTime = double;
68e1783762bc Pas2C: Support FileSize and Delete; add dummy implementation of FormatDateTime
Wuzzy <Wuzzy2@mail.ru>
parents: 12104
diff changeset
    52
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    53
var
9966
01e198990211 pas2c engine now writes debug log
unc0rr
parents: 8856
diff changeset
    54
    write, writeLn, read, readLn, flush, CreateDir: procedure;
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    55
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    56
    halt:procedure;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    57
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    58
    GetEnumName:function:shortstring;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    59
    TypeInfo:function:Integer;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    60
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    61
    lo:function:Integer;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    62
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    63
    init:procedure;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    64
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    65
    StrLen:function : integer;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    66
    odd, even : function : boolean;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    67
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    68
    Length : function : integer;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    69
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    70
    Now : function : integer;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    71
10838
2abe883c9c21 teach pas2c how to insert() shortstrings
sheepluva
parents: 10564
diff changeset
    72
    new, dispose, FillChar, Insert, Delete, Move : procedure;
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    73
10909
594f59bd1751 Silly fixes for silly pas2c
unc0rr
parents: 10838
diff changeset
    74
    trunc, round, ceil : function : integer;
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    75
    abs, sqr : function : integer;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    76
11824
3f1f8f79fcdb implement Trim() in uUtils
sheepluva
parents: 11682
diff changeset
    77
    StrPas, FormatDateTime, copy, str, PosS, LowerCase : function : shortstring;
8856
af59e65586a7 Fix pos() return type
unc0rr
parents: 8105
diff changeset
    78
    pos : function : integer;
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    79
    StrToInt : function : integer;
10131
4b4a043111f4 - pas2c recognizes typecasts in initialization expressions
unc0rr
parents: 10120
diff changeset
    80
    SetLength, SetLengthA, val, StrDispose, StrCopy : procedure;
10120
b7f632c12784 Pas2C recognizes ansistrings
unc0rr
parents: 10080
diff changeset
    81
    _pchar, _pcharA, StrAlloc : function : PChar;
b7f632c12784 Pas2C recognizes ansistrings
unc0rr
parents: 10080
diff changeset
    82
    pchar2str, astr2str : function : string;
b7f632c12784 Pas2C recognizes ansistrings
unc0rr
parents: 10080
diff changeset
    83
    pchar2astr, str2astr : function : ansistring;
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    84
    memcpy : procedure;
10080
ac51bcb534ef Even more love to pas2c
unc0rr
parents: 10015
diff changeset
    85
    StrLength : function : integer;
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    86
8856
af59e65586a7 Fix pos() return type
unc0rr
parents: 8105
diff changeset
    87
     min, max:function:integer;
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    88
    assign, rewrite, rewrite_2, reset, reset_2, flush, BlockWrite, BlockRead, close : procedure;
14934
68e1783762bc Pas2C: Support FileSize and Delete; add dummy implementation of FormatDateTime
Wuzzy <Wuzzy2@mail.ru>
parents: 12104
diff changeset
    89
    FileSize : function: Int64;
68e1783762bc Pas2C: Support FileSize and Delete; add dummy implementation of FormatDateTime
Wuzzy <Wuzzy2@mail.ru>
parents: 12104
diff changeset
    90
    FileExists, DirectoryExists, eof, DeleteFile : function : boolean;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9966
diff changeset
    91
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    92
    ParamCount : function : integer;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    93
    ParamStr : function : string;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    94
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    95
    arctan2, power: function : float;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    96
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    97
    //TypeInfo, GetEnumName : function : shortstring;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    98
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
    99
    UTF8ToUnicode, WrapText: function : shortstring;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
   100
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
   101
    GetMem : function : pointer;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
   102
    FreeMem : procedure;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
   103
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
   104
    BeginThread, ThreadSwitch : procedure;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
   105
    InterlockedIncrement, InterlockedDecrement : procedure;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
   106
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
   107
    random : function : integer;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
   108
    randomize : procedure;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9966
diff changeset
   109
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
   110
    Assigned : function : boolean;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
   111
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
   112
    //EnumToStr : function : string;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
   113
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
   114
    initParams : procedure;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9966
diff changeset
   115
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
   116
    Load_GL_VERSION_2_0 : procedure;
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
   117
11682
2c21bc80c95d Implement GetCurrentDir in the c rtl
koda
parents: 10909
diff changeset
   118
    GetCurrentDir : function : PChar;
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
diff changeset
   119
15313
70d416a8f63f fix Bug 750: workaround GL2 function params const-iness issues with pas2c
sheepluva
parents: 14934
diff changeset
   120
    glShaderSource : procedure;