changeset 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
files sidinfo.c
diffstat 1 files changed, 28 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/sidinfo.c	Mon Feb 15 10:36:26 2016 +0200
+++ b/sidinfo.c	Mon Feb 15 11:08:21 2016 +0200
@@ -12,6 +12,13 @@
 // Some constants
 #define SET_SLDB_FILENAME "Songlengths.txt"
 
+enum
+{
+    OTYPE_OTHER    = 0,
+    OTYPE_STR      = 1,
+    OTYPE_INT      = 2,
+};
+
 
 typedef struct
 {
@@ -33,32 +40,34 @@
 {
     char *name;
     char *lname;
+    int type;
 } PSFOption;
 
 
 static const PSFOption optPSOptions[] =
 {
-    { "Filename"     , NULL },
-    { "Type"         , NULL },
-    { "Version"      , NULL },
-    { "PlayerType"   , "Player type" },
-    { "PlayerCompat" , "Player compatibility" },
-    { "VideoClock"   , "Video clock speed" },
-    { "SIDModel"     , "SID model" },
+    { "Filename"     , NULL                   , OTYPE_STR },
+    { "Type"         , NULL                   , OTYPE_STR },
+    { "Version"      , NULL                   , OTYPE_STR },
+    { "PlayerType"   , "Player type"          , OTYPE_STR },
+    { "PlayerCompat" , "Player compatibility" , OTYPE_STR },
+    { "VideoClock"   , "Video clock speed"    , OTYPE_STR },
+    { "SIDModel"     , "SID model"            , OTYPE_STR },
 
-    { "DataOffs"     , "Data offset" },
-    { "DataSize"     , "Data size" },
-    { "LoadAddr"     , "Load address" },
-    { "InitAddr"     , "Init address" },
-    { "PlayAddr"     , "Play address" },
-    { "Songs"        , "Songs" },
-    { "StartSong"    , "Start song" },
-    { "Name"         , NULL },
-    { "Author"       , NULL },
-    { "Copyright"    , NULL },
-    { "Hash"         , NULL },
+    { "DataOffs"     , "Data offset"          , OTYPE_INT },
+    { "DataSize"     , "Data size"            , OTYPE_INT },
+    { "LoadAddr"     , "Load address"         , OTYPE_INT },
+    { "InitAddr"     , "Init address"         , OTYPE_INT },
+    { "PlayAddr"     , "Play address"         , OTYPE_INT },
+    { "Songs"        , "Songs"                , OTYPE_INT },
+    { "StartSong"    , "Start song"           , OTYPE_INT },
 
-    { "Songlengths"  , "Song lengths" },
+    { "Name"         , NULL                   , OTYPE_STR },
+    { "Author"       , NULL                   , OTYPE_STR },
+    { "Copyright"    , NULL                   , OTYPE_STR },
+    { "Hash"         , NULL                   , OTYPE_OTHER },
+
+    { "Songlengths"  , "Song lengths"         , OTYPE_OTHER },
 };
 
 static const int noptPSOptions = sizeof(optPSOptions) / sizeof(optPSOptions[0]);