comparison sidinfo.c @ 112:55d99dc7c35c

Prepare for some possible future enhancements by specifying a type for each data field.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 15 Feb 2016 11:08:21 +0200
parents c7ecf56d23e7
children cd97e7517e21
comparison
equal deleted inserted replaced
111:c7ecf56d23e7 112:55d99dc7c35c
10 10
11 11
12 // Some constants 12 // Some constants
13 #define SET_SLDB_FILENAME "Songlengths.txt" 13 #define SET_SLDB_FILENAME "Songlengths.txt"
14 14
15 enum
16 {
17 OTYPE_OTHER = 0,
18 OTYPE_STR = 1,
19 OTYPE_INT = 2,
20 };
21
15 22
16 typedef struct 23 typedef struct
17 { 24 {
18 int cmd; 25 int cmd;
19 char *str; 26 char *str;
31 38
32 typedef struct 39 typedef struct
33 { 40 {
34 char *name; 41 char *name;
35 char *lname; 42 char *lname;
43 int type;
36 } PSFOption; 44 } PSFOption;
37 45
38 46
39 static const PSFOption optPSOptions[] = 47 static const PSFOption optPSOptions[] =
40 { 48 {
41 { "Filename" , NULL }, 49 { "Filename" , NULL , OTYPE_STR },
42 { "Type" , NULL }, 50 { "Type" , NULL , OTYPE_STR },
43 { "Version" , NULL }, 51 { "Version" , NULL , OTYPE_STR },
44 { "PlayerType" , "Player type" }, 52 { "PlayerType" , "Player type" , OTYPE_STR },
45 { "PlayerCompat" , "Player compatibility" }, 53 { "PlayerCompat" , "Player compatibility" , OTYPE_STR },
46 { "VideoClock" , "Video clock speed" }, 54 { "VideoClock" , "Video clock speed" , OTYPE_STR },
47 { "SIDModel" , "SID model" }, 55 { "SIDModel" , "SID model" , OTYPE_STR },
48 56
49 { "DataOffs" , "Data offset" }, 57 { "DataOffs" , "Data offset" , OTYPE_INT },
50 { "DataSize" , "Data size" }, 58 { "DataSize" , "Data size" , OTYPE_INT },
51 { "LoadAddr" , "Load address" }, 59 { "LoadAddr" , "Load address" , OTYPE_INT },
52 { "InitAddr" , "Init address" }, 60 { "InitAddr" , "Init address" , OTYPE_INT },
53 { "PlayAddr" , "Play address" }, 61 { "PlayAddr" , "Play address" , OTYPE_INT },
54 { "Songs" , "Songs" }, 62 { "Songs" , "Songs" , OTYPE_INT },
55 { "StartSong" , "Start song" }, 63 { "StartSong" , "Start song" , OTYPE_INT },
56 { "Name" , NULL }, 64
57 { "Author" , NULL }, 65 { "Name" , NULL , OTYPE_STR },
58 { "Copyright" , NULL }, 66 { "Author" , NULL , OTYPE_STR },
59 { "Hash" , NULL }, 67 { "Copyright" , NULL , OTYPE_STR },
60 68 { "Hash" , NULL , OTYPE_OTHER },
61 { "Songlengths" , "Song lengths" }, 69
70 { "Songlengths" , "Song lengths" , OTYPE_OTHER },
62 }; 71 };
63 72
64 static const int noptPSOptions = sizeof(optPSOptions) / sizeof(optPSOptions[0]); 73 static const int noptPSOptions = sizeof(optPSOptions) / sizeof(optPSOptions[0]);
65 74
66 75