project_files/hwc/rtl/misc.c
author unc0rr
Fri, 25 Apr 2014 14:22:59 +0400
changeset 10227 0b848d595f22
parent 10137 a4537aab4117
child 10241 2dc9ff47c5b9
permissions -rw-r--r--
- Fix bug with infinite rounds in racer when a team quits mid-game - Don't allow placing waypoint right on top of previous one, prevents accidental double waypoints - Don't limit maps on number of embedded waypoints
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
     1
#include "misc.h"
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
     2
#include <stdio.h>
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
     3
#include <stdarg.h>
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
     4
#include <string.h>
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
     5
#include <assert.h>
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
     6
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
     7
char strbuf[512];
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
     8
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
     9
void fpcrtl_assert(int i)
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    10
{
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    11
    if(!i){
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    12
        assert(0);
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    13
    }
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    14
}
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    15
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    16
// EFFECTS: return the nearest integer of the given number
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    17
int fpcrtl_round(double number)
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    18
{
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    19
    return (number >= 0) ? (int)(number + 0.5) : (int)(number - 0.5);
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    20
}
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    21
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    22
void fpcrtl_printf(const char* format, ...)
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    23
{
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    24
#ifdef FPCRTL_DEBUG
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    25
    va_list args;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    26
    va_start (args, format);
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    27
    vprintf (format, args);
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    28
    va_end (args);
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    29
#endif
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    30
}
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    31
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    32
//
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    33
//void fpcrtl_check_string(string255 str)
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    34
//{
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    35
//#ifdef FPCRTL_DEBUG
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    36
//    int len = strlen(str.str);
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    37
//    if(len != str.len){
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    38
//        printf("String %s internal inconsistency error. Length should be %d but actually is %d.\n", str.str, len, str.len);
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    39
//    }
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    40
//    //assert(len == str.len);
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    41
//#endif
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    42
//}
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    43
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    44
string255 fpcrtl_strconcat(string255 str1, string255 str2)
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    45
{
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    46
    int newlen = str1.len + str2.len;
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    47
    if(newlen > 255) newlen = 255;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    48
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    49
    memcpy(&(str1.str[str1.len]), str2.str, newlen - str1.len);
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    50
    str1.len = newlen;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    51
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    52
    return str1;
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    53
}
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    54
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    55
astring fpcrtl_strconcatA(astring str1, astring str2)
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    56
{
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    57
    int newlen = str1.len + str2.len;
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    58
    if(newlen > MAX_ANSISTRING_LENGTH) newlen = MAX_ANSISTRING_LENGTH;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    59
10129
cd2a64a1f4aa - Pas2C: make use of 'external' function decorator
unc0rr
parents: 10128
diff changeset
    60
    memcpy(&(str1.s[str1.len + 1]), &str2.s[1], newlen - str1.len);
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    61
    str1.len = newlen;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    62
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    63
    return str1;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    64
}
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    65
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    66
string255 fpcrtl_strappend(string255 s, char c)
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    67
{
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    68
    if(s.len < 255)
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    69
    {
10129
cd2a64a1f4aa - Pas2C: make use of 'external' function decorator
unc0rr
parents: 10128
diff changeset
    70
        ++s.len;
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    71
        s.s[s.len] = c;
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    72
    }
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    73
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    74
    return s;
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    75
}
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    76
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    77
astring fpcrtl_strappendA(astring s, char c)
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    78
{
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    79
    if(s.len < MAX_ANSISTRING_LENGTH)
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    80
    {
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    81
        s.s[s.len] = c;
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    82
        ++s.len;
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    83
    }
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    84
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    85
    return s;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    86
}
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    87
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    88
string255 fpcrtl_strprepend(char c, string255 s)
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    89
{
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    90
    uint8_t newlen = s.len < 255 ? s.len + 1 : 255;
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    91
    memmove(s.str + 1, s.str, newlen); // also move '/0'
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    92
    s.str[0] = c;
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
    93
    s.len = newlen;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    94
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    95
    return s;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    96
}
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    97
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    98
string255 fpcrtl_chrconcat(char a, char b)
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    99
{
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   100
    string255 result;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   101
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   102
    result.len = 2;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   103
    result.str[0] = a;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   104
    result.str[1] = b;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   105
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   106
    return result;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   107
}
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   108
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   109
bool fpcrtl_strcompare(string255 str1, string255 str2)
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   110
{
10132
701844ed50d3 Fix binds loading
unc0rr
parents: 10131
diff changeset
   111
    FIX_STRING(str1);
701844ed50d3 Fix binds loading
unc0rr
parents: 10131
diff changeset
   112
    FIX_STRING(str2);
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   113
    if(strncmp(str1.str, str2.str, 256) == 0){
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   114
        return true;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   115
    }
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   116
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   117
    return false;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   118
}
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   119
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   120
bool fpcrtl_strcomparec(string255 a, char b)
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   121
{
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   122
    if(a.len == 1 && a.str[0] == b){
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   123
        return true;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   124
    }
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   125
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   126
    return false;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   127
}
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   128
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   129
bool fpcrtl_strncompare(string255 a, string255 b)
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   130
{
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   131
    return !fpcrtl_strcompare(a, b);
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   132
}
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   133
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   134
bool fpcrtl_strncompareA(astring a, astring b)
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   135
{
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   136
    return (a.len == b.len) && (strncmp(a.s, b.s, MAX_ANSISTRING_LENGTH) == 0);
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   137
}
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   138
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   139
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   140
string255 fpcrtl_pchar2str(const char *s)
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   141
{
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   142
    string255 result;
10137
a4537aab4117 NULL PChar is okay
unc0rr
parents: 10132
diff changeset
   143
    
a4537aab4117 NULL PChar is okay
unc0rr
parents: 10132
diff changeset
   144
    if(!s)
a4537aab4117 NULL PChar is okay
unc0rr
parents: 10132
diff changeset
   145
    {
a4537aab4117 NULL PChar is okay
unc0rr
parents: 10132
diff changeset
   146
        result.len = 0;
a4537aab4117 NULL PChar is okay
unc0rr
parents: 10132
diff changeset
   147
    } else
a4537aab4117 NULL PChar is okay
unc0rr
parents: 10132
diff changeset
   148
    {
a4537aab4117 NULL PChar is okay
unc0rr
parents: 10132
diff changeset
   149
        int rlen = strlen(s);
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   150
10137
a4537aab4117 NULL PChar is okay
unc0rr
parents: 10132
diff changeset
   151
        if(rlen > 255){
a4537aab4117 NULL PChar is okay
unc0rr
parents: 10132
diff changeset
   152
            rlen = 255;
a4537aab4117 NULL PChar is okay
unc0rr
parents: 10132
diff changeset
   153
        }
a4537aab4117 NULL PChar is okay
unc0rr
parents: 10132
diff changeset
   154
a4537aab4117 NULL PChar is okay
unc0rr
parents: 10132
diff changeset
   155
        result.len = rlen;
a4537aab4117 NULL PChar is okay
unc0rr
parents: 10132
diff changeset
   156
        memcpy(result.str, s, rlen);
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   157
    }
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   158
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   159
    return result;
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   160
}
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   161
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   162
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   163
string255 fpcrtl_make_string(const char* s) {
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   164
    return fpcrtl_pchar2str(s);
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   165
}
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   166
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   167
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   168
astring fpcrtl_pchar2astr(const char *s)
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   169
{
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   170
    astring result;
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   171
    int rlen = strlen(s);
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   172
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   173
    if(rlen > MAX_ANSISTRING_LENGTH){
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   174
        rlen = MAX_ANSISTRING_LENGTH;
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   175
    }
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   176
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   177
    result.len = rlen;
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   178
    memcpy(result.s + 1, s, rlen);
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   179
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   180
    return result;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   181
}
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   182
10131
4b4a043111f4 - pas2c recognizes typecasts in initialization expressions
unc0rr
parents: 10130
diff changeset
   183
astring fpcrtl_str2astr(const string255 s)
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   184
{
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   185
    astring result;
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   186
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   187
    result.str255 = s;
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   188
    result.len = s.len;
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   189
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   190
    return result;
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   191
}
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   192
10131
4b4a043111f4 - pas2c recognizes typecasts in initialization expressions
unc0rr
parents: 10130
diff changeset
   193
string255 fpcrtl_astr2str(const astring s)
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   194
{
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   195
    string255 result;
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   196
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   197
    result = s.str255;
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   198
    result.len = s.len > 255 ? 255 : s.len;
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   199
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   200
    return result;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   201
}
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   202
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   203
char __pcharBuf[256];
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   204
10131
4b4a043111f4 - pas2c recognizes typecasts in initialization expressions
unc0rr
parents: 10130
diff changeset
   205
char* fpcrtl__pchar__vars(const string255 * s)
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   206
{
10129
cd2a64a1f4aa - Pas2C: make use of 'external' function decorator
unc0rr
parents: 10128
diff changeset
   207
    memcpy(__pcharBuf, &s->s[1], s->len);
cd2a64a1f4aa - Pas2C: make use of 'external' function decorator
unc0rr
parents: 10128
diff changeset
   208
    __pcharBuf[s->len] = 0;
cd2a64a1f4aa - Pas2C: make use of 'external' function decorator
unc0rr
parents: 10128
diff changeset
   209
    return __pcharBuf;
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   210
}
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   211
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   212
char* fpcrtl__pcharA__vars(astring * s)
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   213
{
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   214
    if(s->len == MAX_ANSISTRING_LENGTH)
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   215
        --s->len;
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   216
10130
a9d509848390 Small fix which makes pas2c engine successfully replay demos
unc0rr
parents: 10129
diff changeset
   217
    s->s[s->len + 1] = 0;
10128
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   218
    return &s->s[1];
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   219
}
0f6878b5395a Implement needed rtl functions
unc0rr
parents: 10015
diff changeset
   220
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   221
#ifdef EMSCRIPTEN
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   222
GLenum glewInit()
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   223
{
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   224
    return GLEW_OK;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   225
}
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
   226
#endif