00001
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef _CPELANG_H_
00036 #define _CPELANG_H_
00037
00038 #include <stdlib.h>
00039
00040 #include "cpeuri.h"
00041
00043 enum cpe_lang_oper_t {
00044 CPE_LANG_OPER_HALT = 0x00,
00045 CPE_LANG_OPER_AND = 0x01,
00046 CPE_LANG_OPER_OR = 0x02,
00047 CPE_LANG_OPER_MATCH = 0x03,
00048 CPE_LANG_OPER_MASK = 0xFF,
00049 CPE_LANG_OPER_NOT = 0x100,
00050
00051 CPE_LANG_OPER_NAND = CPE_LANG_OPER_AND | CPE_LANG_OPER_NOT,
00052 CPE_LANG_OPER_NOR = CPE_LANG_OPER_OR | CPE_LANG_OPER_NOT,
00053 };
00054
00056 typedef struct cpe_lang_expr {
00057 enum cpe_lang_oper_t oper;
00058 union {
00059 struct cpe_lang_expr *expr;
00060 cpe_t *cpe;
00061 } meta;
00062 } cpe_lang_expr_t;
00063
00067 typedef struct cpe_platform_spec {
00068 struct cpe_platform **platforms;
00069 size_t platforms_n;
00070 size_t alloc_;
00071 } cpe_platform_spec_t;
00072
00076 typedef struct cpe_platform {
00077 char *id;
00078 char *title;
00079 char *remark;
00080 struct cpe_lang_expr expr;
00081 } cpe_platform_t;
00082
00089 cpe_platform_spec_t *cpe_platformspec_new(const char *fname);
00090
00098 bool cpe_platformspec_add(cpe_platform_spec_t * platformspec,
00099 cpe_platform_t * platform);
00100
00105 void cpe_platformspec_delete(cpe_platform_spec_t * platformspec);
00106
00114 bool cpe_language_match_cpe(cpe_t ** cpe, size_t n,
00115 const cpe_platform_t * platform);
00116
00121 void cpe_platform_delete(cpe_platform_t * platform);
00122
00127 void cpe_langexpr_delete(cpe_lang_expr_t * expr);
00128
00129 #endif