00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <stdio.h>
00025 #include <glib.h>
00026 #include "cr-utils.h"
00027 #include "cr-rgb.h"
00028 #include "cr-num.h"
00029 #include "cr-string.h"
00030
00031 #ifndef __CR_TERM_H__
00032 #define __CR_TERM_H__
00033
00034 G_BEGIN_DECLS
00035
00036
00037
00038
00039
00040
00041 enum CRTermType
00042 {
00043 TERM_NO_TYPE = 0,
00044 TERM_NUMBER,
00045 TERM_FUNCTION,
00046 TERM_STRING,
00047 TERM_IDENT,
00048 TERM_URI,
00049 TERM_RGB,
00050 TERM_UNICODERANGE,
00051 TERM_HASH
00052 } ;
00053
00054
00055 enum UnaryOperator
00056 {
00057 NO_UNARY_UOP = 0,
00058 PLUS_UOP,
00059 MINUS_UOP,
00060 EMPTY_UNARY_UOP
00061 } ;
00062
00063 enum Operator
00064 {
00065 NO_OP = 0,
00066 DIVIDE,
00067 COMMA
00068 } ;
00069
00070 struct _CRTerm ;
00071 typedef struct _CRTerm CRTerm ;
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082 struct _CRTerm
00083 {
00084
00085
00086
00087 enum CRTermType type ;
00088
00089
00090
00091
00092
00093 enum UnaryOperator unary_op ;
00094
00095
00096
00097
00098 enum Operator the_operator ;
00099
00100
00101
00102
00103
00104
00105
00106 union
00107 {
00108 CRNum *num ;
00109 CRString * str ;
00110 CRRgb * rgb ;
00111 } content ;
00112
00113
00114
00115
00116
00117
00118
00119
00120 union
00121 {
00122 CRTerm *func_param ;
00123 } ext_content ;
00124
00125
00126
00127
00128
00129 gpointer app_data ;
00130
00131 glong ref_count ;
00132
00133
00134
00135
00136
00137
00138 CRTerm *next ;
00139
00140
00141
00142
00143
00144 CRTerm *prev ;
00145 CRParsingLocation location ;
00146 } ;
00147
00148 CRTerm * cr_term_parse_expression_from_buf (const guchar *a_buf,
00149 enum CREncoding a_encoding) ;
00150 CRTerm * cr_term_new (void) ;
00151
00152 enum CRStatus cr_term_set_number (CRTerm *a_this, CRNum *a_num) ;
00153
00154 enum CRStatus cr_term_set_function (CRTerm *a_this,
00155 CRString *a_func_name,
00156 CRTerm *a_func_param) ;
00157
00158 enum CRStatus cr_term_set_string (CRTerm *a_this, CRString *a_str) ;
00159
00160 enum CRStatus cr_term_set_ident (CRTerm *a_this, CRString *a_str) ;
00161
00162 enum CRStatus cr_term_set_uri (CRTerm *a_this, CRString *a_str) ;
00163
00164 enum CRStatus cr_term_set_rgb (CRTerm *a_this, CRRgb *a_rgb) ;
00165
00166 enum CRStatus cr_term_set_hash (CRTerm *a_this, CRString *a_str) ;
00167
00168 CRTerm * cr_term_append_term (CRTerm *a_this, CRTerm *a_new_term) ;
00169
00170 CRTerm * cr_term_prepend_term (CRTerm *a_this, CRTerm *a_new_term) ;
00171
00172 guchar * cr_term_to_string (CRTerm *a_this) ;
00173
00174 guchar * cr_term_one_to_string (CRTerm * a_this) ;
00175
00176 void cr_term_dump (CRTerm *a_this, FILE *a_fp) ;
00177
00178 int cr_term_nr_values (CRTerm *a_this) ;
00179
00180 CRTerm * cr_term_get_from_list (CRTerm *a_this, int itemnr) ;
00181
00182 void cr_term_ref (CRTerm *a_this) ;
00183
00184 gboolean cr_term_unref (CRTerm *a_this) ;
00185
00186 void cr_term_destroy (CRTerm * a_term) ;
00187
00188 G_END_DECLS
00189
00190 #endif