comparison lwasm/symbol.c @ 389:fbb7bfed8076

Added in structure support and fixed up some warts in the listing code (by adding more warts)
author lost@l-w.ca
date Wed, 14 Jul 2010 22:33:55 -0600
parents d99322ef6f21
children 027d7fbcdcfc
comparison
equal deleted inserted replaced
388:8991eb507d2d 389:fbb7bfed8076
36 int islocal = 0; 36 int islocal = 0;
37 int context = -1; 37 int context = -1;
38 int version = -1; 38 int version = -1;
39 char *cp; 39 char *cp;
40 40
41 if (*sym < 0x80 && !strchr(SSYMCHARS, *sym)) 41 if (!(flags & symbol_flag_nocheck))
42 { 42 {
43 lwasm_register_error(as, cl, "Bad symbol (%s)", sym); 43 if (*sym < 0x80 && !strchr(SSYMCHARS, *sym))
44 return NULL; 44 {
45 } 45 lwasm_register_error(as, cl, "Bad symbol (%s)", sym);
46 return NULL;
47 }
46 48
47 if ((*sym == '$' || *sym == '@') && (sym[1] >= '0' && sym[1] <= '9')) 49 if ((*sym == '$' || *sym == '@') && (sym[1] >= '0' && sym[1] <= '9'))
48 { 50 {
49 lwasm_register_error(as, cl, "Bad symbol (%s)", sym); 51 lwasm_register_error(as, cl, "Bad symbol (%s)", sym);
50 return NULL; 52 return NULL;
53 }
51 } 54 }
52 55
53 for (cp = sym; *cp; cp++) 56 for (cp = sym; *cp; cp++)
54 { 57 {
55 if (*cp == '@' || *cp == '?') 58 if (*cp == '@' || *cp == '?')
56 islocal = 1; 59 islocal = 1;
57 if (*cp == '$' && !(CURPRAGMA(cl, PRAGMA_DOLLARNOTLOCAL))) 60 if (*cp == '$' && !(CURPRAGMA(cl, PRAGMA_DOLLARNOTLOCAL)))
58 islocal = 1; 61 islocal = 1;
59 62
60 // bad symbol 63 // bad symbol
61 if (*cp < 0x80 && !strchr(SYMCHARS, *cp)) 64 if (!(flags & symbol_flag_nocheck) && *cp < 0x80 && !strchr(SYMCHARS, *cp))
62 { 65 {
63 lwasm_register_error(as, cl, "Bad symbol (%s)", sym); 66 lwasm_register_error(as, cl, "Bad symbol (%s)", sym);
64 return NULL; 67 return NULL;
65 } 68 }
66 } 69 }
82 continue; 85 continue;
83 } 86 }
84 break; 87 break;
85 } 88 }
86 } 89 }
90
87 if (se) 91 if (se)
88 { 92 {
89 // multiply defined symbol 93 // multiply defined symbol
90 lwasm_register_error(as, cl, "Multiply defined symbol (%s)", sym); 94 lwasm_register_error(as, cl, "Multiply defined symbol (%s)", sym);
91 return NULL; 95 return NULL;