00001
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _CPELANG_H_
00031 #define _CPELANG_H_
00032
00033 #include <stdlib.h>
00034
00035 #include "cpeuri.h"
00036
00038 enum cpe_lang_oper_t {
00039 CPE_LANG_OPER_HALT = 0x00,
00040 CPE_LANG_OPER_AND = 0x01,
00041 CPE_LANG_OPER_OR = 0x02,
00042 CPE_LANG_OPER_MATCH = 0x03,
00043 CPE_LANG_OPER_MASK = 0xFF,
00044 CPE_LANG_OPER_NOT = 0x100,
00045
00046 CPE_LANG_OPER_NAND = CPE_LANG_OPER_AND | CPE_LANG_OPER_NOT,
00047 CPE_LANG_OPER_NOR = CPE_LANG_OPER_OR | CPE_LANG_OPER_NOT,
00048 };
00049
00051 typedef struct cpe_lang_expr {
00052 enum cpe_lang_oper_t oper;
00053 union {
00054 struct cpe_lang_expr *expr;
00055 cpe_t *cpe;
00056 } meta;
00057 } cpe_lang_expr_t;
00058
00062 typedef struct cpe_platform_spec {
00063 struct cpe_platform **platforms;
00064 size_t platforms_n;
00065 size_t alloc_;
00066 } cpe_platform_spec_t;
00067
00071 typedef struct cpe_platform {
00072 char *id;
00073 char *title;
00074 char *remark;
00075 struct cpe_lang_expr expr;
00076 } cpe_platform_t;
00077
00084 cpe_platform_spec_t *cpe_platformspec_new(const char *fname);
00085
00093 bool cpe_platformspec_add(cpe_platform_spec_t * platformspec,
00094 cpe_platform_t * platform);
00095
00100 void cpe_platformspec_delete(cpe_platform_spec_t * platformspec);
00101
00109 bool cpe_language_match_cpe(cpe_t ** cpe, size_t n,
00110 const cpe_platform_t * platform);
00111
00116 void cpe_platform_delete(cpe_platform_t * platform);
00117
00122 void cpe_langexpr_delete(cpe_lang_expr_t * expr);
00123
00124 #endif