project_files/hwc/rtl/tests/main.c
author Wuzzy <Wuzzy2@mail.ru>
Sat, 10 Feb 2018 18:03:12 +0100
changeset 12962 52c12029c7bd
parent 10015 4feced261c68
permissions -rw-r--r--
Increase opacity of Racer/TechRacer 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
#if 0
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 "fpcrtl.h"
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
     4
#include "fileio.h"
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
     5
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
     6
string255 t = STRINIT("test");
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
     7
string255 Pathz[1] = {STRINIT(".")};
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
     8
//int ptCurrTheme = 0;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
     9
string255 cThemeCFGFilename = STRINIT("theme.cfg");
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    10
const string255 __str79 = STRINIT("object");
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    11
string255 c1 = STRINIT("=");
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    12
string255 c2 = STRINIT("\x2c");
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    13
string255 c3 = STRINIT("\x2f");
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
typedef struct __TResourceList {
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    16
            Integer count;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    17
            string255 files[500 + 1];
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    18
} TResourceList;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    19
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    20
TResourceList readThemeCfg_0()
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
    TResourceList readthemecfg_result;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    23
    string255 s;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    24
    string255 key;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    25
    TextFile f;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    26
    Integer i;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    27
    TResourceList result;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    28
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    29
    int t = 0;
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
    s = _strconcat(_strappend(Pathz[ptCurrTheme], '\x2f'), cThemeCFGFilename);
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
    assign(&f, s);
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
    reset(&f);
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    36
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    37
    if (f.fp == NULL) {
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    38
      readthemecfg_result.count = 0;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    39
      return readthemecfg_result;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    40
    }
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    41
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    42
    result.count = 0;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    43
    while (!eof(&f)) {
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    44
        readLnS(&f, &s);
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    45
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    46
        if ((Length(s)) == (0)) {
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    47
            continue;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    48
        }
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    49
        if ((s.s[1]) == ('\x3b')) {
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    50
            continue;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    51
        }
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    52
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    53
        i = pos(c1, s);
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    54
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    55
        key = fpcrtl_trim(fpcrtl_copy(s, 1, i - 1));
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    56
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    57
        fpcrtl_delete(&s, 1, i);
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    58
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    59
        if (_strcompare(key, __str79)) {
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    60
            i = pos(c2, s);
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    61
            result.files[result.count] = _strconcat(_strappend(Pathz[ptCurrTheme], '\x2f'), trim(copy(s, 1, i - 1)));
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    62
            ++result.count;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    63
        }
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
    close(&f);
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    67
    readthemecfg_result = result;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    68
    return readthemecfg_result;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    69
}
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    70
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    71
int main(int argc, char** argv)
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    72
{
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    73
    int i;
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    74
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    75
    TResourceList result = readThemeCfg_0();
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    76
    for(i = 0; i < result.count; i++) {
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    77
        printf("%s\n", result.files[i].str);
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    78
    }
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    79
}
4feced261c68 partial merge of the webgl branch
koda
parents: 7983
diff changeset
    80
#endif