[718ad924] | 1 | |
---|
| 2 | /* bison grammar rules for process new rt1 statements */ |
---|
| 3 | /* |
---|
[da5afdf] | 4 | [keyid:A].oset:r <- [urn:'file://dir/filename'] |
---|
[718ad924] | 5 | */ |
---|
| 6 | |
---|
| 7 | %{ |
---|
| 8 | // include the GNU extension of asprintf |
---|
| 9 | #define _GNU_SOURCE |
---|
| 10 | |
---|
| 11 | /* C declarations */ |
---|
| 12 | #include <stdio.h> |
---|
| 13 | #include <string.h> |
---|
| 14 | |
---|
| 15 | #include "abac_pl_yy.h" |
---|
| 16 | |
---|
[da5afdf] | 17 | /* lex tie-ins flag */ |
---|
[718ad924] | 18 | int yyerror (char *s); |
---|
| 19 | |
---|
| 20 | FILE *abac_yyin = NULL; |
---|
| 21 | FILE *abac_yyout = NULL; |
---|
| 22 | char *abac_yyfptr = NULL; |
---|
[da5afdf] | 23 | char *abac_yyfptr_encoded = NULL; |
---|
[718ad924] | 24 | |
---|
| 25 | static int sz_overhead = 0; |
---|
| 26 | static int abac_yy_error_code = 0; /* keeping last error code */ |
---|
| 27 | |
---|
| 28 | void panic(char *msg); |
---|
| 29 | |
---|
[da5afdf] | 30 | /* lex tie-ins functions*/ |
---|
[718ad924] | 31 | extern void set_yap_clauses(abac_list_t *); |
---|
[da5afdf] | 32 | extern abac_list_t *make_role_statement(abac_yy_expression_t *, |
---|
| 33 | abac_yy_expression_t *); |
---|
| 34 | extern abac_list_t *make_oset_statement(abac_yy_expression_t *, |
---|
| 35 | abac_yy_expression_t *); |
---|
| 36 | extern abac_yy_expression_t *make_yy_expression(int, |
---|
| 37 | void *, void *, abac_yy_role_t *); |
---|
[718ad924] | 38 | extern abac_yy_principal_t *make_yy_principal(char *, char *, int); |
---|
[da5afdf] | 39 | extern abac_yy_role_t *make_yy_role(char *, abac_yy_term_t *); |
---|
| 40 | extern abac_yy_term_data_t *make_yy_term_data(char*); |
---|
| 41 | extern abac_yy_term_principal_t *make_yy_term_principal(char*); |
---|
| 42 | extern abac_yy_term_t *make_yy_term_dterm_anonymous(); |
---|
| 43 | extern abac_yy_term_t *make_yy_term_dterm_principal(abac_yy_term_principal_t *); |
---|
| 44 | extern abac_yy_term_t *make_yy_term_dterm_named(abac_yy_principal_t *); |
---|
| 45 | extern abac_yy_term_t *make_yy_term_dterm_data(abac_yy_term_data_t *); |
---|
[718ad924] | 46 | extern char *abac_cn_with_sha(char*); |
---|
[da5afdf] | 47 | extern abac_yy_term_t *add_yy_term(abac_yy_term_t *, abac_yy_term_t *); |
---|
| 48 | extern abac_yy_expression_t *add_yy_expression( |
---|
| 49 | abac_yy_expression_t *, abac_yy_expression_t *); |
---|
| 50 | extern void set_yy_term_data_is_variable(abac_yy_term_data_t *); |
---|
| 51 | extern void set_yy_term_data_type(abac_yy_term_data_t *,char*); |
---|
[718ad924] | 52 | extern void abac_init_yy_id_certs(); |
---|
[da5afdf] | 53 | extern void abac_init_yy_constraints(); |
---|
| 54 | extern void make_yy_range_constraint(abac_yy_term_data_t *ptr, char*); |
---|
| 55 | extern char *make_yy_oset_constraint(abac_yy_term_data_t *ptr, char*); |
---|
| 56 | extern char *make_yy_role_constraint(abac_yy_term_principal_t *ptr, char*); |
---|
| 57 | |
---|
| 58 | |
---|
[718ad924] | 59 | |
---|
| 60 | %} |
---|
| 61 | /* Bison declarations */ |
---|
| 62 | %union { |
---|
| 63 | struct _abac_yy_principal_t *pstruct; |
---|
[da5afdf] | 64 | struct _abac_yy_term_principal_t *ppstruct; |
---|
| 65 | struct _abac_yy_term_data_t *pdstruct; |
---|
[718ad924] | 66 | struct _abac_yy_role_t *rstruct; |
---|
[da5afdf] | 67 | struct _abac_yy_oset_t *ostruct; |
---|
| 68 | struct _abac_yy_term_t *dstruct; |
---|
| 69 | struct _abac_yy_expression_t *estruct; |
---|
[718ad924] | 70 | struct abac_list_t *lstruct; |
---|
| 71 | char *string; /* For returning char strings */ |
---|
[da5afdf] | 72 | int intval; /* for returning some value */ |
---|
[718ad924] | 73 | } |
---|
[da5afdf] | 74 | |
---|
| 75 | %start input |
---|
| 76 | |
---|
[718ad924] | 77 | %type <lstruct> stmt |
---|
| 78 | %type <rstruct> rolepart |
---|
[da5afdf] | 79 | %type <estruct> roleleft |
---|
| 80 | %type <estruct> roleright |
---|
[718ad924] | 81 | %type <estruct> roleterm |
---|
[da5afdf] | 82 | %type <ostruct> osetpart |
---|
| 83 | %type <estruct> osetleft |
---|
| 84 | %type <estruct> osetright |
---|
| 85 | %type <estruct> osetterm |
---|
[718ad924] | 86 | %type <pstruct> keypart |
---|
[da5afdf] | 87 | %type <dstruct> terms |
---|
| 88 | %type <dstruct> term |
---|
[718ad924] | 89 | %type <pdstruct> typedpart |
---|
[da5afdf] | 90 | %type <pdstruct> otypetail |
---|
[718ad924] | 91 | %type <ppstruct> principalpart |
---|
[da5afdf] | 92 | %type <lstruct> rangetype |
---|
| 93 | %type <lstruct> values |
---|
[718ad924] | 94 | |
---|
[da5afdf] | 95 | %token <string> IDEN /* keyname or rolename */ |
---|
| 96 | %token <string> CAPIDEN /* variable name */ |
---|
| 97 | %token <string> ROLE /* the word, role */ |
---|
| 98 | %token <string> OSET /* the word, oset */ |
---|
| 99 | %token <string> PRINCIPAL /* the word, principal */ |
---|
| 100 | %token <string> OTYPE /* integer,boolean,urn,time,string,float */ |
---|
| 101 | %token <string> OTYPE_CONSTANT |
---|
| 102 | %token <string> VARIABLE_CONSTANT /* constant for ?AAA */ |
---|
| 103 | %token <string> KEYTYPE /* keyid | or something else */ |
---|
| 104 | %token <string> KEYID_CONSTANT /* keyid | or something else */ |
---|
| 105 | %token <string> VALUE /* range value in static constraint */ |
---|
[718ad924] | 106 | |
---|
| 107 | %token <operator> DERIVE "<-" |
---|
| 108 | %token <operator> DOT "." |
---|
| 109 | %token <operator> AND "&" |
---|
| 110 | %token <operator> LPAREN "(" |
---|
| 111 | %token <operator> RPAREN ")" |
---|
| 112 | %token <operator> LSQUARE "[" |
---|
| 113 | %token <operator> RSQUARE "]" |
---|
[da5afdf] | 114 | %token <operator> LWIGGLE "{" |
---|
| 115 | %token <operator> RWIGGLE "}" |
---|
[718ad924] | 116 | %token <operator> LANGLE "<" |
---|
| 117 | %token <operator> RANGLE ">" |
---|
| 118 | %token <operator> COLON ":" |
---|
| 119 | %token <operator> COMMA "," |
---|
| 120 | %token <operator> QMARK "?" |
---|
[da5afdf] | 121 | %token <operator> DOTDOT ".." |
---|
[718ad924] | 122 | |
---|
| 123 | %% |
---|
| 124 | /* Grammar rules */ |
---|
| 125 | |
---|
| 126 | input: /* empty */ |
---|
| 127 | { } |
---|
[da5afdf] | 128 | | stmt |
---|
[718ad924] | 129 | { |
---|
| 130 | set_yap_clauses($1); |
---|
| 131 | } |
---|
[da5afdf] | 132 | ; |
---|
[718ad924] | 133 | |
---|
| 134 | /* generate/concate prolog credentials clauses */ |
---|
[da5afdf] | 135 | stmt : roleleft DERIVE roleright |
---|
| 136 | { |
---|
| 137 | abac_yy_expression_t *headexpr=$1; |
---|
| 138 | abac_yy_expression_t *tailexpr=$3; |
---|
| 139 | abac_list_t *ret=make_role_statement(headexpr, tailexpr); |
---|
| 140 | if(ret == NULL) { |
---|
| 141 | panic("unable to parse the role rule statment"); |
---|
| 142 | YYERROR; |
---|
| 143 | } else { |
---|
| 144 | $$=ret; |
---|
| 145 | } |
---|
| 146 | } |
---|
| 147 | | osetleft DERIVE osetright |
---|
[718ad924] | 148 | { |
---|
[da5afdf] | 149 | abac_yy_expression_t *headexpr=$1; |
---|
| 150 | abac_yy_expression_t *tailexpr=$3; |
---|
| 151 | abac_list_t *ret=make_oset_statement(headexpr, tailexpr); |
---|
[718ad924] | 152 | if(ret == NULL) { |
---|
[da5afdf] | 153 | panic("unable to parse the oset rule statment"); |
---|
[718ad924] | 154 | YYERROR; |
---|
| 155 | } else { |
---|
| 156 | $$=ret; |
---|
| 157 | } |
---|
| 158 | } |
---|
[da5afdf] | 159 | ; |
---|
[718ad924] | 160 | /* |
---|
| 161 | [keyid:isi].role:modifyBy([keyid:mike]) |
---|
| 162 | [keyid:acme].role:preferred |
---|
| 163 | */ |
---|
[da5afdf] | 164 | roleleft : keypart DOT rolepart |
---|
[718ad924] | 165 | { |
---|
| 166 | abac_yy_principal_t *keypart=$1; |
---|
| 167 | abac_yy_role_t *rolepart=$3; |
---|
[da5afdf] | 168 | abac_yy_expression_t *expr= |
---|
| 169 | make_yy_expression(e_yy_EXPR_ROLE,keypart,rolepart,NULL); |
---|
[718ad924] | 170 | $$=expr; |
---|
| 171 | } |
---|
[da5afdf] | 172 | ; |
---|
[718ad924] | 173 | |
---|
| 174 | /* [keyid:mike] */ |
---|
[da5afdf] | 175 | keypart : LSQUARE KEYTYPE COLON |
---|
| 176 | { abac_yy_push_keyid_state(); } |
---|
| 177 | KEYID_CONSTANT |
---|
| 178 | { abac_yy_pop_state(); } |
---|
| 179 | RSQUARE |
---|
[718ad924] | 180 | { |
---|
[da5afdf] | 181 | char *cn=abac_cn_with_sha($5); |
---|
[718ad924] | 182 | int idtype=abac_verify_keyid_type($2); |
---|
| 183 | if(cn && idtype) { |
---|
[da5afdf] | 184 | $$=make_yy_principal($5, cn, idtype); |
---|
[718ad924] | 185 | } else { |
---|
| 186 | panic("encountered an invalid SHA id"); |
---|
| 187 | YYERROR; |
---|
| 188 | } |
---|
| 189 | } |
---|
[da5afdf] | 190 | ; |
---|
[718ad924] | 191 | /* |
---|
| 192 | role:modifyBy([keyid:mike],[keyid:ted]) |
---|
| 193 | role:modifyBy([keyid:mike]) |
---|
| 194 | role:preferred |
---|
| 195 | */ |
---|
[da5afdf] | 196 | rolepart : ROLE COLON IDEN LPAREN terms RPAREN |
---|
[718ad924] | 197 | { |
---|
| 198 | $$=make_yy_role($3,$5); |
---|
| 199 | } |
---|
[da5afdf] | 200 | | ROLE COLON IDEN |
---|
[718ad924] | 201 | { |
---|
| 202 | $$=make_yy_role($3,NULL); |
---|
| 203 | } |
---|
[da5afdf] | 204 | ; |
---|
[718ad924] | 205 | |
---|
| 206 | /* |
---|
| 207 | [keyid:mike],[keyid:ted] |
---|
| 208 | [keyid:mike] |
---|
| 209 | [principal:?Z] |
---|
| 210 | ?? [principal:?this] |
---|
| 211 | [int:99] |
---|
| 212 | [int:?Z] |
---|
| 213 | [?] |
---|
| 214 | */ |
---|
[da5afdf] | 215 | terms : term COMMA terms |
---|
[718ad924] | 216 | { |
---|
[da5afdf] | 217 | abac_yy_term_t *nterm=$1; |
---|
| 218 | abac_yy_term_t *terms=$3; |
---|
| 219 | $$=add_yy_term(nterm, terms); |
---|
[718ad924] | 220 | } |
---|
[da5afdf] | 221 | | term |
---|
[718ad924] | 222 | { |
---|
| 223 | $$=$1; |
---|
| 224 | } |
---|
[da5afdf] | 225 | ; |
---|
[718ad924] | 226 | |
---|
[da5afdf] | 227 | term : LSQUARE QMARK RSQUARE |
---|
| 228 | { $$= make_yy_term_dterm_anonymous(); } |
---|
| 229 | | keypart |
---|
| 230 | { $$= make_yy_term_dterm_named($1); } |
---|
| 231 | | principalpart |
---|
| 232 | { $$= make_yy_term_dterm_principal($1); } |
---|
| 233 | | typedpart |
---|
| 234 | { $$= make_yy_term_dterm_data($1); } |
---|
| 235 | ; |
---|
| 236 | |
---|
| 237 | values : VALUE COMMA values |
---|
| 238 | { $$=addto_yy_val_range($3, $1); } |
---|
| 239 | | VALUE |
---|
| 240 | { $$=make_yy_val_range($1); } |
---|
| 241 | ; |
---|
| 242 | |
---|
| 243 | |
---|
| 244 | rangetype : LSQUARE VALUE DOTDOT VALUE RSQUARE |
---|
| 245 | { $$=make_yy_minmax_range($2,$4); } |
---|
| 246 | | LSQUARE DOTDOT VALUE RSQUARE |
---|
| 247 | { $$=make_yy_max_range($3); } |
---|
| 248 | | LSQUARE VALUE DOTDOT RSQUARE |
---|
| 249 | { $$=make_yy_min_range($2); } |
---|
| 250 | | LSQUARE values RSQUARE |
---|
| 251 | { $$=$2; } |
---|
| 252 | ; |
---|
| 253 | |
---|
| 254 | /* [otype:?Z:{oset-constraint}] */ |
---|
| 255 | /* [int:?I:[10 .. 20] */ |
---|
| 256 | otypetail : | VARIABLE_CONSTANT COLON |
---|
| 257 | { |
---|
| 258 | abac_yy_pop_state(); |
---|
| 259 | abac_yy_push_range_state(); |
---|
[718ad924] | 260 | } |
---|
[da5afdf] | 261 | rangetype |
---|
| 262 | { |
---|
| 263 | abac_yy_pop_state(); |
---|
| 264 | abac_yy_term_data_t *ptr=make_yy_term_data($1); |
---|
| 265 | set_yy_term_data_is_variable(ptr); |
---|
| 266 | set_yy_term_data_cond_range(ptr,$4); |
---|
| 267 | $$=ptr; |
---|
| 268 | } |
---|
| 269 | | VARIABLE_CONSTANT |
---|
| 270 | { abac_yy_pop_state(); } |
---|
| 271 | osetleft |
---|
| 272 | { |
---|
| 273 | abac_yy_term_data_t *ptr=make_yy_term_data($1); |
---|
| 274 | set_yy_term_data_cond_head_expr(ptr,$3); |
---|
| 275 | set_yy_term_data_is_variable(ptr); |
---|
| 276 | $$=ptr; |
---|
| 277 | } |
---|
| 278 | | VARIABLE_CONSTANT |
---|
| 279 | { |
---|
| 280 | abac_yy_pop_state(); |
---|
| 281 | abac_yy_term_data_t *ptr=make_yy_term_data($1); |
---|
| 282 | set_yy_term_data_is_variable(ptr); |
---|
| 283 | $$=ptr; |
---|
| 284 | } |
---|
| 285 | | OTYPE_CONSTANT |
---|
| 286 | { |
---|
| 287 | abac_yy_pop_state(); |
---|
| 288 | abac_yy_term_data_t *ptr=make_yy_term_data($1); |
---|
| 289 | $$=ptr; |
---|
| 290 | } |
---|
| 291 | ; |
---|
| 292 | |
---|
| 293 | typedpart : LSQUARE OTYPE COLON |
---|
| 294 | { abac_yy_push_state($2); } |
---|
| 295 | otypetail RSQUARE |
---|
| 296 | { |
---|
| 297 | abac_yy_term_data_t *ptr=$5; |
---|
| 298 | char *tail_string=get_yy_term_data_name(ptr); |
---|
| 299 | set_yy_term_data_type(ptr,$2); |
---|
| 300 | if(is_yy_term_data_has_constraint(ptr)) { |
---|
| 301 | make_yy_oset_constraint(ptr,tail_string); |
---|
| 302 | make_yy_range_constraint(ptr,tail_string); |
---|
[718ad924] | 303 | } |
---|
[da5afdf] | 304 | $$=$5; |
---|
[718ad924] | 305 | } |
---|
[da5afdf] | 306 | ; |
---|
| 307 | |
---|
[718ad924] | 308 | |
---|
| 309 | /* [principal:?Z] */ |
---|
[da5afdf] | 310 | /* [principal:?Z{role-constraint}] */ |
---|
| 311 | principalpart : LSQUARE PRINCIPAL COLON QMARK IDEN roleleft RSQUARE |
---|
| 312 | { |
---|
| 313 | abac_yy_expression_t *expr=$6; |
---|
| 314 | char *tail_string=$5; |
---|
| 315 | abac_yy_term_principal_t *ptr=make_yy_term_principal(tail_string); |
---|
| 316 | set_yy_term_principal_cond_head_expr(ptr,expr); |
---|
| 317 | char *string=make_yy_role_constraint(ptr,tail_string); |
---|
| 318 | $$=ptr; |
---|
| 319 | } |
---|
| 320 | | LSQUARE PRINCIPAL COLON QMARK IDEN RSQUARE |
---|
| 321 | { $$ = make_yy_term_principal($5); } |
---|
| 322 | ; |
---|
[718ad924] | 323 | |
---|
[da5afdf] | 324 | roleright : roleterm AND roleright |
---|
[718ad924] | 325 | { |
---|
[da5afdf] | 326 | abac_yy_expression_t *nexpr=$1; |
---|
| 327 | abac_yy_expression_t *exprs=$3; |
---|
| 328 | $$=add_yy_expression(nexpr,exprs); |
---|
[718ad924] | 329 | } |
---|
[da5afdf] | 330 | | roleterm |
---|
[718ad924] | 331 | { $$=$1; } |
---|
[da5afdf] | 332 | ; |
---|
[718ad924] | 333 | |
---|
| 334 | /* role at tail/right side |
---|
| 335 | [keyid:usc].role:employee.role:friend |
---|
| 336 | [keyid:usc].role:worker |
---|
| 337 | [keyid:mike] |
---|
| 338 | */ |
---|
| 339 | roleterm : keypart DOT rolepart DOT rolepart |
---|
| 340 | { |
---|
| 341 | abac_yy_principal_t *keypart=$1; |
---|
| 342 | abac_yy_role_t *linked_rolepart=$3; |
---|
| 343 | abac_yy_role_t *rolepart=$5; |
---|
[da5afdf] | 344 | abac_yy_expression_t *expr= |
---|
| 345 | make_yy_expression(e_yy_EXPR_LINKED,keypart,rolepart,linked_rolepart); |
---|
[718ad924] | 346 | $$=expr; |
---|
| 347 | } |
---|
[da5afdf] | 348 | | keypart DOT rolepart |
---|
[718ad924] | 349 | { |
---|
| 350 | abac_yy_principal_t *keypart=$1; |
---|
| 351 | abac_yy_role_t *rolepart=$3; |
---|
[da5afdf] | 352 | abac_yy_expression_t *expr= |
---|
| 353 | make_yy_expression(e_yy_EXPR_ROLE,keypart,rolepart,NULL); |
---|
[718ad924] | 354 | $$=expr; |
---|
| 355 | } |
---|
[da5afdf] | 356 | | keypart |
---|
[718ad924] | 357 | { |
---|
| 358 | abac_yy_principal_t *keypart=$1; |
---|
[da5afdf] | 359 | abac_yy_expression_t *expr= |
---|
| 360 | make_yy_expression(e_yy_EXPR_NAMED,keypart,NULL,NULL); |
---|
[718ad924] | 361 | $$=expr; |
---|
| 362 | } |
---|
[da5afdf] | 363 | ; |
---|
| 364 | |
---|
| 365 | osetterm : keypart DOT rolepart DOT osetpart |
---|
| 366 | { |
---|
| 367 | abac_yy_principal_t *keypart=$1; |
---|
| 368 | abac_yy_role_t *linked_rolepart=$3; |
---|
| 369 | abac_yy_oset_t *osetpart=$5; |
---|
| 370 | abac_yy_expression_t *expr= |
---|
| 371 | make_yy_expression(e_yy_EXPR_LINKED,keypart,osetpart,linked_rolepart); |
---|
| 372 | $$=expr; |
---|
| 373 | } |
---|
| 374 | | keypart DOT osetpart |
---|
| 375 | { |
---|
| 376 | abac_yy_principal_t *keypart=$1; |
---|
| 377 | abac_yy_oset_t *osetpart=$3; |
---|
| 378 | abac_yy_expression_t *expr= |
---|
| 379 | make_yy_expression(e_yy_EXPR_OSET,keypart,osetpart,NULL); |
---|
| 380 | $$=expr; |
---|
| 381 | } |
---|
| 382 | | keypart |
---|
| 383 | { |
---|
| 384 | abac_yy_principal_t *keypart=$1; |
---|
| 385 | abac_yy_expression_t *expr= |
---|
| 386 | make_yy_expression(e_yy_EXPR_NAMED,keypart,NULL,NULL); |
---|
| 387 | $$=expr; |
---|
| 388 | } |
---|
| 389 | | typedpart |
---|
| 390 | { |
---|
| 391 | abac_yy_term_data_t *objpart=$1; |
---|
| 392 | abac_yy_expression_t *expr= |
---|
| 393 | make_yy_expression(e_yy_EXPR_OBJECT,objpart,NULL,NULL); |
---|
| 394 | $$=expr; |
---|
| 395 | } |
---|
| 396 | ; |
---|
| 397 | |
---|
| 398 | /* |
---|
| 399 | oset:access([urn:'fileA']) |
---|
| 400 | */ |
---|
| 401 | osetpart : OSET COLON IDEN LPAREN terms RPAREN |
---|
| 402 | { |
---|
| 403 | $$=make_yy_oset($3,$5); |
---|
| 404 | } |
---|
| 405 | | OSET COLON IDEN |
---|
| 406 | { |
---|
| 407 | $$=make_yy_oset($3,NULL); |
---|
| 408 | } |
---|
| 409 | ; |
---|
| 410 | |
---|
| 411 | |
---|
| 412 | osetleft : keypart DOT osetpart |
---|
| 413 | { |
---|
| 414 | abac_yy_principal_t *keypart=$1; |
---|
| 415 | abac_yy_oset_t *osetpart=$3; |
---|
| 416 | abac_yy_expression_t *expr= |
---|
| 417 | make_yy_expression(e_yy_EXPR_OSET,keypart,osetpart,NULL); |
---|
| 418 | $$=expr; |
---|
| 419 | } |
---|
| 420 | ; |
---|
| 421 | |
---|
| 422 | osetright : osetterm AND osetright |
---|
| 423 | { |
---|
| 424 | abac_yy_expression_t *nexpr=$1; |
---|
| 425 | abac_yy_expression_t *exprs=$3; |
---|
| 426 | $$=add_yy_expression(nexpr,exprs); |
---|
| 427 | } |
---|
| 428 | | osetterm |
---|
| 429 | { $$=$1; } |
---|
| 430 | ; |
---|
[718ad924] | 431 | %% |
---|
| 432 | |
---|
[da5afdf] | 433 | |
---|
[718ad924] | 434 | /* Additional C code */ |
---|
| 435 | int yywrap() |
---|
| 436 | { |
---|
| 437 | /* exit when done lexing the current input */ |
---|
| 438 | return 1; |
---|
| 439 | } |
---|
| 440 | |
---|
| 441 | int yyerror (char *s) |
---|
| 442 | { |
---|
| 443 | fprintf (abac_yyout,"yyerror: %s\n", s); |
---|
| 444 | } |
---|
| 445 | |
---|
| 446 | /* setting defaults */ |
---|
| 447 | void abac_yyinit() |
---|
| 448 | { |
---|
| 449 | abac_yyin=abac_get_yyin(); |
---|
| 450 | abac_yyout=abac_get_yyout(); |
---|
| 451 | abac_yyfptr = abac_get_yyfptr(); |
---|
[da5afdf] | 452 | abac_yyfptr_encoded = abac_get_yyfptr_encoded(); |
---|
[718ad924] | 453 | sz_overhead = strlen(abac_yyfptr)+2000; |
---|
| 454 | abac_init_yap_id_clauses(); |
---|
| 455 | abac_init_yy_id_certs(); |
---|
[da5afdf] | 456 | abac_init_yy_constraints(); |
---|
[718ad924] | 457 | } |
---|
| 458 | |
---|
| 459 | void panic(char *msg) |
---|
| 460 | { |
---|
| 461 | yyerror(msg); |
---|
| 462 | } |
---|
| 463 | |
---|
| 464 | void set_error_code(int v) |
---|
| 465 | { |
---|
| 466 | abac_yy_error_code=v; |
---|
| 467 | } |
---|
| 468 | |
---|
| 469 | static int get_error_code() |
---|
| 470 | { |
---|
| 471 | return abac_yy_error_code; |
---|
| 472 | } |
---|
| 473 | |
---|