|
1 #if 0 |
|
2 #include <stdio.h> |
|
3 #include "fpcrtl.h" |
|
4 #include "fileio.h" |
|
5 |
|
6 string255 t = STRINIT("test"); |
|
7 string255 Pathz[1] = {STRINIT(".")}; |
|
8 //int ptCurrTheme = 0; |
|
9 string255 cThemeCFGFilename = STRINIT("theme.cfg"); |
|
10 const string255 __str79 = STRINIT("object"); |
|
11 string255 c1 = STRINIT("="); |
|
12 string255 c2 = STRINIT("\x2c"); |
|
13 string255 c3 = STRINIT("\x2f"); |
|
14 |
|
15 typedef struct __TResourceList { |
|
16 Integer count; |
|
17 string255 files[500 + 1]; |
|
18 } TResourceList; |
|
19 |
|
20 TResourceList readThemeCfg_0() |
|
21 { |
|
22 TResourceList readthemecfg_result; |
|
23 string255 s; |
|
24 string255 key; |
|
25 TextFile f; |
|
26 Integer i; |
|
27 TResourceList result; |
|
28 |
|
29 int t = 0; |
|
30 |
|
31 s = _strconcat(_strappend(Pathz[ptCurrTheme], '\x2f'), cThemeCFGFilename); |
|
32 |
|
33 assign(&f, s); |
|
34 |
|
35 reset(&f); |
|
36 |
|
37 if (f.fp == NULL) { |
|
38 readthemecfg_result.count = 0; |
|
39 return readthemecfg_result; |
|
40 } |
|
41 |
|
42 result.count = 0; |
|
43 while (!eof(&f)) { |
|
44 readLnS(&f, &s); |
|
45 |
|
46 if ((Length(s)) == (0)) { |
|
47 continue; |
|
48 } |
|
49 if ((s.s[1]) == ('\x3b')) { |
|
50 continue; |
|
51 } |
|
52 |
|
53 i = pos(c1, s); |
|
54 |
|
55 key = fpcrtl_trim(fpcrtl_copy(s, 1, i - 1)); |
|
56 |
|
57 fpcrtl_delete(&s, 1, i); |
|
58 |
|
59 if (_strcompare(key, __str79)) { |
|
60 i = pos(c2, s); |
|
61 result.files[result.count] = _strconcat(_strappend(Pathz[ptCurrTheme], '\x2f'), trim(copy(s, 1, i - 1))); |
|
62 ++result.count; |
|
63 } |
|
64 } |
|
65 |
|
66 close(&f); |
|
67 readthemecfg_result = result; |
|
68 return readthemecfg_result; |
|
69 } |
|
70 |
|
71 int main(int argc, char** argv) |
|
72 { |
|
73 int i; |
|
74 |
|
75 TResourceList result = readThemeCfg_0(); |
|
76 for(i = 0; i < result.count; i++) { |
|
77 printf("%s\n", result.files[i].str); |
|
78 } |
|
79 } |
|
80 #endif |