Stick <info> element into PXML.xml .. parser, disco-t, pxml-t
authorskeezix <skeezix@flotsam-vm.(none)>
Thu, 11 Mar 2010 15:39:10 +0000 (10:39 -0500)
committerskeezix <skeezix@flotsam-vm.(none)>
Thu, 11 Mar 2010 15:39:10 +0000 (10:39 -0500)
include/pnd_discovery.h
include/pnd_pxml.h
include/pnd_pxml_names.h
lib/pnd_discovery.c
lib/pnd_pxml.c
lib/pnd_tinyxml.cpp

index f8123d7..3e8138d 100644 (file)
@@ -69,6 +69,9 @@ typedef struct {
   char *preview_pic1;
   char *preview_pic2;
   char *mkdir_sp;
+  char *info_name;      // should be a struct..
+  char *info_filename;
+  char *info_type;
 } pnd_disco_t;
 
 void pnd_disco_destroy ( pnd_disco_t *p ); // a function name that simply could not be avoided
index 623d527..7ed5a24 100644 (file)
@@ -87,6 +87,9 @@ char *pnd_pxml_get_clockspeed ( pnd_pxml_handle h );
 char *pnd_pxml_get_background ( pnd_pxml_handle h );
 char *pnd_pxml_get_startdir ( pnd_pxml_handle h );
 char *pnd_pxml_get_mkdir ( pnd_pxml_handle h );
+char *pnd_pxml_get_info_name ( pnd_pxml_handle h );
+char *pnd_pxml_get_info_type ( pnd_pxml_handle h );
+char *pnd_pxml_get_info_src ( pnd_pxml_handle h );
 
 // for 'set' functions, pass NULL value to delete existing value without setting new one
 void pnd_pxml_set_app_name ( pnd_pxml_handle h, char *v );
@@ -158,6 +161,10 @@ typedef struct
        char *package_release_date;
         char *mkdir_sp; // a colon separated list of paths to be mkdir'd (silently fail) when pnd is autodiscovered. path is always relative to the root of the hosting device.
 
+        char *info_name;      // should be a struct..
+        char *info_filename;
+        char *info_type;
+
 }  pnd_pxml_t;
 
 #ifdef __cplusplus
index edf7a53..4cd1e65 100644 (file)
@@ -99,6 +99,13 @@ extern "C" {
 #define PND_PXML_ENAME_MKDIR "dir"
 #define PND_PXML_ATTRNAME_MKDIRPATH "path"
 
+/* <info name="AwesomeGame Setup" type="txt/html" src="index.html"/>
+ */
+#define PND_PXML_ENAME_INFO "info"
+#define PND_PXML_ATTRNAME_INFONAME "name"
+#define PND_PXML_ATTRNAME_INFOSRC "src"
+#define PND_PXML_ATTRNAME_INFOTYPE "type"
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index a15ef27..eeee25e 100644 (file)
@@ -39,6 +39,9 @@ void pnd_disco_destroy ( pnd_disco_t *p ) {
   if ( p -> alt_category1 ) {  free ( p -> alt_category1 );  }
   if ( p -> alt_category2 ) {  free ( p -> alt_category2 );  }
   if ( p -> mkdir_sp )      {  free ( p -> mkdir_sp );       }
+  if ( p -> info_name )     {  free ( p -> info_name );       }
+  if ( p -> info_type )     {  free ( p -> info_type );       }
+  if ( p -> info_filename ) {  free ( p -> info_filename );       }
 
   return;
 }
@@ -267,6 +270,16 @@ static int pnd_disco_callback ( const char *fpath, const struct stat *sb,
       if ( pnd_pxml_get_mkdir ( pxmlh ) ) {
        p -> mkdir_sp = strdup ( pnd_pxml_get_mkdir ( pxmlh ) );
       }
+      // info
+      if ( pnd_pxml_get_info_src ( pxmlh ) ) {
+       p -> info_filename = strdup ( pnd_pxml_get_info_src ( pxmlh ) );
+      }
+      if ( pnd_pxml_get_info_name ( pxmlh ) ) {
+       p -> info_name = strdup ( pnd_pxml_get_info_name ( pxmlh ) );
+      }
+      if ( pnd_pxml_get_info_type ( pxmlh ) ) {
+       p -> info_type = strdup ( pnd_pxml_get_info_type ( pxmlh ) );
+      }
 
     } else {
       //printf ( "Invalid PXML; skipping.\n" );
index 0e06987..7632c05 100644 (file)
@@ -569,3 +569,18 @@ pnd_pxml_x11_req_e pnd_pxml_get_x11 ( char *pxmlvalue ) {
 
   return ( pnd_pxml_x11_ignored ); // default
 }
+
+char *pnd_pxml_get_info_name ( pnd_pxml_handle h ) {
+  pnd_pxml_t *p = (pnd_pxml_t*) h;
+  return ( p -> info_name );
+}
+
+char *pnd_pxml_get_info_type ( pnd_pxml_handle h ) {
+  pnd_pxml_t *p = (pnd_pxml_t*) h;
+  return ( p -> info_type );
+}
+
+char *pnd_pxml_get_info_src ( pnd_pxml_handle h ) {
+  pnd_pxml_t *p = (pnd_pxml_t*) h;
+  return ( p -> info_filename );
+}
index da4f13a..6159562 100644 (file)
@@ -185,6 +185,14 @@ unsigned char pnd_pxml_parse ( const char *pFilename, char *buffer, unsigned int
       app->icon       = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_ICONSRC);
     }
 
+    // <info>
+    if ( (pElem = hRoot.FirstChild(PND_PXML_ENAME_INFO).Element()) )
+     {
+       app-> info_name = pnd_pxml_get_attribute ( pElem, PND_PXML_ATTRNAME_INFONAME );
+       app-> info_filename = pnd_pxml_get_attribute ( pElem, PND_PXML_ATTRNAME_INFOSRC );
+       app-> info_type = pnd_pxml_get_attribute ( pElem, PND_PXML_ATTRNAME_INFOTYPE );
+     }
+
     //The preview pics:
     if ( (pElem = hRoot.FirstChild(PND_PXML_NODENAME_PREVPICS).Element()) )
     {