blob: a00eac9c717934f715d7ad63aa80f53927f26125 [file] [log] [blame]
vlmfa67ddc2004-06-03 03:38:44 +00001#include "asn1fix_internal.h"
2
3/*
4 * Dereference DefinedValues:
5 */
6int
7asn1f_fix_dereference_values(arg_t *arg) {
8 asn1p_expr_t *expr = arg->expr;
9 int r_value = 0;
10
11 if(expr->meta_type != AMT_VALUE)
12 return 0; /* Just ignore it */
13
14 if(expr->value == NULL)
15 return 0; /* Just ignore it */
16
17 if(expr->value && expr->value->type != ATV_REFERENCED)
18 return 0; /* Not a reference */
19
20 DEBUG("%s(%s %x ::= %s) for line %d", __func__,
21 expr->Identifier, expr->expr_type,
22 asn1f_printable_value(expr->value), expr->_lineno);
23
24 /*
25 * If this integer has a value, check that this value
26 * is an integer. If it is a reference, resolve it.
27 */
28 if(expr->value) {
29
30 if(asn1f_value_resolve(arg, expr)) {
31 /* This function will emit messages */
32 r_value = -1;
33 }
34
vlm59f89da2004-09-06 08:06:37 +000035 if(0 && expr->value->type != ATV_INTEGER) {
vlmfa67ddc2004-06-03 03:38:44 +000036 FATAL(
37 "INTEGER value %s at line %d: "
38 "Incompatible value specified: %s",
39 expr->Identifier,
40 expr->_lineno,
41 asn1f_printable_value(expr->value)
42 );
43 r_value = -1;
44 }
45 } else {
46 FATAL("Value of \"%s\" at line %d: "
47 "Incompatible value specified",
48 expr->Identifier,
49 expr->_lineno
50 );
51 r_value = -1;
52 }
53
54 return r_value;
55}
56