project_files/hwc/rtl/tests/fileio_test.c
changeset 10015 4feced261c68
parent 7983 02f36c3e7f6c
equal deleted inserted replaced
10014:56d2f2d5aad8 10015:4feced261c68
       
     1 
       
     2 #include "pas2c.h"
       
     3 
       
     4 #include "fpcrtl.h"
       
     5 
       
     6 char Pathz[1][128] = {"./"};
       
     7 int ptCurrTheme = 0;
       
     8 cThemeCFGFilename = "theme.cfg";
       
     9 const string255 __str79 = STRINIT("object");
       
    10 
       
    11 typedef struct __TResourceList {
       
    12             Integer count;
       
    13             string255 files[500 + 1];
       
    14 } TResourceList;
       
    15 
       
    16 TResourceList readThemeCfg_0()
       
    17 {
       
    18     TResourceList readthemecfg_result;
       
    19     string255 s;
       
    20     string255 key;
       
    21     TextFile f;
       
    22     Integer i;
       
    23     TResourceList result;
       
    24     s = _strconcat(_strappend(Pathz[ptCurrTheme], '\x2f'), cThemeCFGFilename);
       
    25 
       
    26     assign(f, s);
       
    27     FileMode = 0;
       
    28     reset(f);
       
    29     result.count = 0;
       
    30     while(!eof(f))
       
    31     {
       
    32         readLnS(f, s);
       
    33         if((Length(s)) == (0))
       
    34         {
       
    35             continue;
       
    36         }
       
    37         if((s.s[1]) == ('\x3b'))
       
    38         {
       
    39             continue;
       
    40         }
       
    41         i = pos('\x3d', s);
       
    42         key = trim(copy(s, 1, i - 1));
       
    43         delete(s, 1, i);
       
    44         if(_strcompare(key, __str79))
       
    45         {
       
    46             i = pos('\x2c', s);
       
    47             result.files[result.count] = _strconcat(_strappend(Pathz[ptCurrTheme], '\x2f'), trim(copy(s, 1, i - 1)));
       
    48             ++result.count;
       
    49         }
       
    50     }
       
    51     close(f);
       
    52     readthemecfg_result = result;
       
    53     return readthemecfg_result;
       
    54 };
       
    55 
       
    56 int main(int argc, char** argv)
       
    57 {
       
    58     readThemeCfg_0();
       
    59 }