2 * IDOS Timetable Extractor
4 * (c) 2013 Tomas Pokorny <jethro@kam.mff.cuni.cz>
6 * This software can be freely distributed and used according
7 * to the terms of the GNU General Public License.
21 void print_strings(uint32_t offset
)
23 fseek(in
,offset
,SEEK_SET
);
26 fread(&count
,1,sizeof(count
),in
);
27 printf("Will read %d strings\n",count
);
30 indexes
= malloc(sizeof(int32_t)*(count
+1));
33 for (int i
=0;i
<=count
;i
++){
34 fread(indexes
+i
,1,sizeof(int32_t),in
);
39 for (int i
=0;i
<count
;i
++){
40 fread(buf
,indexes
[i
+1]-indexes
[i
],1,in
);
41 for (int j
=0; j
<indexes
[i
+1]-indexes
[i
];j
++)
48 int main(int argc
, char * argv
[])
50 in
= fopen(argv
[1], "r");
71 /* fclose(fopen("data/strings.dat","w"));
72 fclose(fopen("data/stations.dat","w"));*/
76 fseek(in
,next
,SEEK_SET
);
77 // printf("Chunk %d\n",chunk_id);
78 // printf("Reading header\n");
81 fread(&len
,1,sizeof(len
),in
);
84 fread(&blocks
,1,sizeof(blocks
),in
);
85 //int_count = malloc(blocks);
86 printf("Chunk: %d, Len: %d, blocks: %d, nulls:%d\n",chunk_id
,len
,blocks
,nulls
);
87 if (!(len
%blocks
==0)){
88 printf("Skipping, individable\n");
90 fseek(in
,next
+0x15,SEEK_SET
);
91 fread(&len
,1,sizeof(len
),in
);
92 fread(&blocks
,1,sizeof(blocks
),in
);
104 for (int i
=0;i
<len
;i
++)
113 int32_t buf[rec_len];
114 for (int i=blocks;i>0;i--){
115 fread(buf,1,rec_len,in);
116 for (int j=0;j<rec_len;j++)
117 printf("%x ",buf[j]);
122 if ((next
==0x1F3)||(next
==0x3975b3))
126 if ((next
==0x71806)||(next
==0x7a374)||(next
==0x7a46e)||(next
==0x7d046)||(next
==0xbf32e)||(next
==0xe4efc))
132 if ((next
==0xe4fd2)||(next
==0x1ca76a)||(next
==0x20c02e)||(next
==0x39c94f))
149 // if ((next==0x55193)||(next==0x613ce)||(next==0x61a5c)||(next==0x63129))
151 /* if (next==0x28925)
154 printf("At: %x, next: %x\n",ftell(in
),next
);
155 if (chunk_id
>630) scanf("%c",&key
);
158 /* print_strings(next);
163 printf("At: %x\n",ftell(in));
168 printf("At: %x\n",ftell(in));
173 printf("At: %x\n",ftell(in));
175 //Bezbariérové stanice
178 printf("At: %x\n",ftell(in));
183 printf("At: %x\n",ftell(in));
188 printf("At: %x\n",ftell(in));
193 printf("At: %x\n",ftell(in));*/