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