pcb 4.1.1
An interactive printed circuit board layout editor.

resource.h

Go to the documentation of this file.
00001 #ifndef PCB_RESOURCE_H
00002 #define PCB_RESOURCE_H
00003 
00004 #include <stdio.h>
00005 
00006 #ifdef __cplusplus
00007 extern "C"
00008 {
00009 #endif
00010 
00011   struct Resource;
00012 
00013   typedef struct ResourceVal
00014   {
00015     char *name;
00016     char *value;
00017     struct Resource *subres;
00018   } ResourceVal;
00019 
00020 #define FLAG_V  1
00021 #define FLAG_NV 2
00022 #define FLAG_S  4
00023 #define FLAG_NS 8
00024 
00025   typedef struct Resource
00026   {
00027     struct Resource *parent;
00028     void *user_ptr;
00029     int flags;
00030     int c;                      /* number of v[i] */
00031     ResourceVal *v;
00032   } Resource;
00033 
00034 #define resource_type(resval) (((resval).name?100:0)+((resval).value?10:0)+((resval).subres?1:0))
00035 
00036 /* res_parse.y */
00037 
00038 /* Pass either filename OR stringtab.  */
00039   Resource *resource_parse (const char *filename, const char **stringtab);
00040   char *resource_value (const Resource * res, char *name);
00041   Resource *resource_subres (const Resource * res, const char *name);
00042 
00043   Resource *resource_create (Resource * parent);
00044   void resource_add_val (Resource * n, char *name, char *value,
00045                          Resource * subres);
00046 
00047   void resource_dump (Resource * res);
00048 
00049 #ifdef __cplusplus
00050 }
00051 #endif
00052 
00053 #endif