Mercurial > hg-old > index.cgi
comparison src/pragma.c @ 73:4b37f17624a7
Added pragma directives
author | lost |
---|---|
date | Thu, 08 Jan 2009 01:18:09 +0000 |
parents | 34568fab6058 |
children | 0ee5f65bccf9 |
comparison
equal
deleted
inserted
replaced
72:9fa4f77dd119 | 73:4b37f17624a7 |
---|---|
23 | 23 |
24 #include <ctype.h> | 24 #include <ctype.h> |
25 #include <stdlib.h> | 25 #include <stdlib.h> |
26 #include <string.h> | 26 #include <string.h> |
27 #include "lwasm.h" | 27 #include "lwasm.h" |
28 #include "instab.h" | |
28 | 29 |
29 /* | 30 /* |
30 A pragma is a means of controlling code generation. | 31 A pragma is a means of controlling code generation. |
31 | 32 |
32 The pseudo op "*pragma" which will be treated as a comment by an assembler | 33 The pseudo op "*pragma" which will be treated as a comment by an assembler |
53 This particular optimization will save a cycle for a direct operation. For | 54 This particular optimization will save a cycle for a direct operation. For |
54 an indirect operation, however, it will save several cycles and a program byte | 55 an indirect operation, however, it will save several cycles and a program byte |
55 which may be very useful. | 56 which may be very useful. |
56 */ | 57 */ |
57 | 58 |
58 void pseudo_pragma_real(asmstate_t *as, sourceline_t *cl, char **optr, int error) | 59 void pseudo_pragma_real(asmstate_t *as, lwasm_line_t *cl, char **optr, int error) |
59 { | 60 { |
60 char pragma[128]; | 61 char pragma[128]; |
61 int c = 0; | 62 int c = 0; |
62 | 63 |
63 while (isspace(**optr)) | 64 while (isspace(**optr)) |
70 } | 71 } |
71 | 72 |
72 if (c == 0 || (**optr && !isspace(**optr))) | 73 if (c == 0 || (**optr && !isspace(**optr))) |
73 { | 74 { |
74 if (error) | 75 if (error) |
75 errorp1(ERR_PRAGMA); | 76 { |
77 register_error(as, cl, 1, "Unrecognized pragma"); | |
78 } | |
76 return; | 79 return; |
77 } | 80 } |
78 pragma[c] = 0; | 81 pragma[c] = 0; |
79 if (!strcmp(pragma, "noindex0tonone")) | 82 if (!strcmp(pragma, "noindex0tonone")) |
80 { | 83 { |
85 as -> pragmas &= ~PRAGMA_NOINDEX0TONONE; | 88 as -> pragmas &= ~PRAGMA_NOINDEX0TONONE; |
86 } | 89 } |
87 else | 90 else |
88 { | 91 { |
89 if (error) | 92 if (error) |
90 errorp1(ERR_PRAGMA); | 93 { |
94 register_error(as, cl, 1, "Unrecognized pragma"); | |
95 } | |
91 } | 96 } |
92 } | 97 } |
93 | 98 |
94 void pseudo_pragma(asmstate_t *as, sourceline_t *cl, char **optr) | 99 OPFUNC(pseudo_pragma) |
95 { | 100 { |
96 pseudo_pragma_real(as, cl, optr, 1); | 101 pseudo_pragma_real(as, l, p, 1); |
97 } | 102 } |
98 | 103 |
99 void pseudo_starpragma(asmstate_t *as, sourceline_t *cl, char **optr) | 104 OPFUNC(pseudo_starpragma) |
100 { | 105 { |
101 pseudo_pragma_real(as, cl, optr, 0); | 106 pseudo_pragma_real(as, l, p, 0); |
102 } | 107 } |