11 void lexerror(lex_file *lex, const char *fmt, ...)
17 con_vprintmsg(LVL_ERROR, lex->name, lex->sline, "parse error", fmt, ap);
19 con_vprintmsg(LVL_ERROR, "", 0, "parse error", fmt, ap);
23 bool lexwarn(lex_file *lex, int warntype, const char *fmt, ...)
26 int lvl = LVL_WARNING;
28 if (!OPTS_WARN(warntype))
35 con_vprintmsg(lvl, lex->name, lex->sline, "warning", fmt, ap);
45 token *tok = (token*)mem_a(sizeof(token));
48 memset(tok, 0, sizeof(*tok));
52 void token_delete(token *self)
54 if (self->next && self->next->prev == self)
55 self->next->prev = self->prev;
56 if (self->prev && self->prev->next == self)
57 self->prev->next = self->next;
58 MEM_VECTOR_CLEAR(self, value);
62 token* token_copy(const token *cp)
64 token* self = token_new();
68 self->value_alloc = cp->value_count + 1;
69 self->value_count = cp->value_count;
70 self->value = (char*)mem_a(self->value_alloc);
75 memcpy(self->value, cp->value, cp->value_count);
76 self->value[self->value_alloc-1] = 0;
80 self->ttype = cp->ttype;
81 memcpy(&self->constval, &cp->constval, sizeof(self->constval));
85 void token_delete_all(token *t)
96 token* token_copy_all(const token *cp)
101 out = cur = token_copy(cp);
107 cur->next = token_copy(cp);
109 token_delete_all(out);
112 cur->next->prev = cur;
119 static void lex_token_new(lex_file *lex)
123 token_delete(lex->tok);
124 lex->tok = token_new();
127 vec_shrinkto(lex->tok.value, 0);
128 lex->tok.constval.t = 0;
129 lex->tok.ctx.line = lex->sline;
130 lex->tok.ctx.file = lex->name;
135 lex_file* lex_open(const char *file)
138 FILE *in = util_fopen(file, "rb");
141 lexerror(NULL, "open failed: '%s'\n", file);
145 lex = (lex_file*)mem_a(sizeof(*lex));
148 lexerror(NULL, "out of memory\n");
152 memset(lex, 0, sizeof(*lex));
155 lex->name = util_strdup(file);
156 lex->line = 1; /* we start counting at 1 */
161 vec_push(lex_filenames, lex->name);
165 lex_file* lex_open_string(const char *str, size_t len, const char *name)
169 lex = (lex_file*)mem_a(sizeof(*lex));
171 lexerror(NULL, "out of memory\n");
175 memset(lex, 0, sizeof(*lex));
178 lex->open_string = str;
179 lex->open_string_length = len;
180 lex->open_string_pos = 0;
182 lex->name = util_strdup(name ? name : "<string-source>");
183 lex->line = 1; /* we start counting at 1 */
188 vec_push(lex_filenames, lex->name);
193 void lex_cleanup(void)
196 for (i = 0; i < vec_size(lex_filenames); ++i)
197 mem_d(lex_filenames[i]);
198 vec_free(lex_filenames);
201 void lex_close(lex_file *lex)
204 for (i = 0; i < vec_size(lex->frames); ++i)
205 mem_d(lex->frames[i].name);
206 vec_free(lex->frames);
209 vec_free(lex->modelname);
215 token_delete(lex->tok);
217 vec_free(lex->tok.value);
219 /* mem_d(lex->name); collected in lex_filenames */
223 static int lex_fgetc(lex_file *lex)
226 return fgetc(lex->file);
227 if (lex->open_string) {
228 if (lex->open_string_pos >= lex->open_string_length)
230 return lex->open_string[lex->open_string_pos++];
235 /* Get or put-back data
236 * The following to functions do NOT understand what kind of data they
238 * The are merely wrapping get/put in order to count line numbers.
240 static void lex_ungetch(lex_file *lex, int ch);
241 static int lex_try_trigraph(lex_file *lex, int old)
246 lex_ungetch(lex, c2);
252 case '=': return '#';
253 case '/': return '\\';
254 case '\'': return '^';
255 case '(': return '[';
256 case ')': return ']';
257 case '!': return '|';
258 case '<': return '{';
259 case '>': return '}';
260 case '-': return '~';
262 lex_ungetch(lex, c3);
263 lex_ungetch(lex, c2);
268 static int lex_try_digraph(lex_file *lex, int ch)
272 if (ch == '<' && c2 == ':')
274 else if (ch == ':' && c2 == '>')
276 else if (ch == '<' && c2 == '%')
278 else if (ch == '%' && c2 == '>')
280 else if (ch == '%' && c2 == ':')
282 lex_ungetch(lex, c2);
286 static int lex_getch(lex_file *lex)
292 if (!lex->push_line && lex->peek[lex->peekpos] == '\n')
294 return lex->peek[lex->peekpos];
298 if (!lex->push_line && ch == '\n')
301 return lex_try_trigraph(lex, ch);
302 else if (!lex->flags.nodigraphs && (ch == '<' || ch == ':' || ch == '%'))
303 return lex_try_digraph(lex, ch);
307 static void lex_ungetch(lex_file *lex, int ch)
309 lex->peek[lex->peekpos++] = ch;
310 if (!lex->push_line && ch == '\n')
314 /* classify characters
315 * some additions to the is*() functions of ctype.h
318 /* Idents are alphanumberic, but they start with alpha or _ */
319 static bool isident_start(int ch)
321 return isalpha(ch) || ch == '_';
324 static bool isident(int ch)
326 return isident_start(ch) || isdigit(ch);
329 /* isxdigit_only is used when we already know it's not a digit
330 * and want to see if it's a hex digit anyway.
332 static bool isxdigit_only(int ch)
334 return (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F');
337 /* Append a character to the token buffer */
338 static void lex_tokench(lex_file *lex, int ch)
340 vec_push(lex->tok.value, ch);
343 /* Append a trailing null-byte */
344 static void lex_endtoken(lex_file *lex)
346 vec_push(lex->tok.value, 0);
347 vec_shrinkby(lex->tok.value, 1);
350 static bool lex_try_pragma(lex_file *lex)
354 char *command = NULL;
358 if (lex->flags.preprocessing)
365 lex_ungetch(lex, ch);
369 for (ch = lex_getch(lex); vec_size(pragma) < 8 && ch >= 'a' && ch <= 'z'; ch = lex_getch(lex))
370 vec_push(pragma, ch);
373 if (ch != ' ' || strcmp(pragma, "pragma")) {
374 lex_ungetch(lex, ch);
378 for (ch = lex_getch(lex); vec_size(command) < 32 && ch >= 'a' && ch <= 'z'; ch = lex_getch(lex))
379 vec_push(command, ch);
380 vec_push(command, 0);
383 lex_ungetch(lex, ch);
387 for (ch = lex_getch(lex); vec_size(param) < 32 && ch != ')' && ch != '\n'; ch = lex_getch(lex))
392 lex_ungetch(lex, ch);
396 if (!strcmp(command, "push")) {
397 if (!strcmp(param, "line")) {
404 else if (!strcmp(command, "pop")) {
405 if (!strcmp(param, "line")) {
423 while (vec_size(command)) {
424 lex_ungetch(lex, vec_last(command));
431 while (vec_size(command)) {
432 lex_ungetch(lex, vec_last(command));
439 while (vec_size(pragma)) {
440 lex_ungetch(lex, vec_last(pragma));
445 lex_ungetch(lex, '#');
451 /* Skip whitespace and comments and return the first
452 * non-white character.
453 * As this makes use of the above getch() ungetch() functions,
454 * we don't need to care at all about line numbering anymore.
456 * In theory, this function should only be used at the beginning
457 * of lexing, or when we *know* the next character is part of the token.
458 * Otherwise, if the parser throws an error, the linenumber may not be
459 * the line of the error, but the line of the next token AFTER the error.
461 * This is currently only problematic when using c-like string-continuation,
462 * since comments and whitespaces are allowed between 2 such strings.
466 "A continuation of the previous string"
467 // This line is skipped
470 * In this case, if the parse decides it didn't actually want a string,
471 * and uses lex->line to print an error, it will show the ', foo);' line's
474 * On the other hand, the parser is supposed to remember the line of the next
475 * token's beginning. In this case we would want skipwhite() to be called
476 * AFTER reading a token, so that the parser, before reading the NEXT token,
477 * doesn't store teh *comment's* linenumber, but the actual token's linenumber.
480 * here is to store the line of the first character after skipping
481 * the initial whitespace in lex->sline, this happens in lex_do.
483 static int lex_skipwhite(lex_file *lex)
486 bool haswhite = false;
491 while (ch != EOF && isspace(ch)) {
493 if (lex_try_pragma(lex)) {
498 if (lex->flags.preprocessing) {
501 /* see if there was whitespace first */
502 if (haswhite) { /* (vec_size(lex->tok.value)) { */
503 lex_ungetch(lex, ch);
507 /* otherwise return EOL */
511 lex_tokench(lex, ch);
520 /* one line comment */
523 if (lex->flags.preprocessing) {
526 lex_tokench(lex, '/');
527 lex_tokench(lex, '/');
529 lex_tokench(lex, ' ');
530 lex_tokench(lex, ' ');
533 while (ch != EOF && ch != '\n') {
534 if (lex->flags.preprocessing)
535 lex_tokench(lex, ' '); /* ch); */
538 if (lex->flags.preprocessing) {
539 lex_ungetch(lex, '\n');
547 /* multiline comment */
548 if (lex->flags.preprocessing) {
551 lex_tokench(lex, '/');
552 lex_tokench(lex, '*');
554 lex_tokench(lex, ' ');
555 lex_tokench(lex, ' ');
564 if (lex->flags.preprocessing) {
566 lex_tokench(lex, '*');
567 lex_tokench(lex, '/');
569 lex_tokench(lex, ' ');
570 lex_tokench(lex, ' ');
575 if (lex->flags.preprocessing) {
576 lex_tokench(lex, ' '); /* ch); */
579 ch = ' '; /* cause TRUE in the isspace check */
582 /* Otherwise roll back to the slash and break out of the loop */
583 lex_ungetch(lex, ch);
587 } while (ch != EOF && isspace(ch));
591 lex_ungetch(lex, ch);
598 static bool GMQCC_WARN lex_finish_ident(lex_file *lex)
603 while (ch != EOF && isident(ch))
605 lex_tokench(lex, ch);
609 /* last ch was not an ident ch: */
610 lex_ungetch(lex, ch);
615 /* read one ident for the frame list */
616 static int lex_parse_frame(lex_file *lex)
623 while (ch != EOF && ch != '\n' && isspace(ch))
629 if (!isident_start(ch)) {
630 lexerror(lex, "invalid framename, must start with one of a-z or _, got %c", ch);
634 lex_tokench(lex, ch);
635 if (!lex_finish_ident(lex))
641 /* read a list of $frames */
642 static bool lex_finish_frames(lex_file *lex)
649 rc = lex_parse_frame(lex);
650 if (rc > 0) /* end of line */
652 if (rc < 0) /* error */
655 for (i = 0; i < vec_size(lex->frames); ++i) {
656 if (!strcmp(lex->tok.value, lex->frames[i].name)) {
657 lex->frames[i].value = lex->framevalue++;
658 if (lexwarn(lex, WARN_FRAME_MACROS, "duplicate frame macro defined: `%s`", lex->tok.value))
663 if (i < vec_size(lex->frames))
666 m.value = lex->framevalue++;
667 m.name = util_strdup(lex->tok.value);
668 vec_shrinkto(lex->tok.value, 0);
669 vec_push(lex->frames, m);
673 static int GMQCC_WARN lex_finish_string(lex_file *lex, int quote)
681 return TOKEN_STRINGCONST;
683 if (lex->flags.preprocessing && ch == '\\') {
684 lex_tokench(lex, ch);
687 lexerror(lex, "unexpected end of file");
688 lex_ungetch(lex, EOF); /* next token to be TOKEN_EOF */
689 return (lex->tok.ttype = TOKEN_ERROR);
691 lex_tokench(lex, ch);
693 else if (ch == '\\') {
696 lexerror(lex, "unexpected end of file");
697 lex_ungetch(lex, EOF); /* next token to be TOKEN_EOF */
698 return (lex->tok.ttype = TOKEN_ERROR);
705 case 'a': ch = '\a'; break;
706 case 'b': ch = '\b'; break;
707 case 'r': ch = '\r'; break;
708 case 'n': ch = '\n'; break;
709 case 't': ch = '\t'; break;
710 case 'f': ch = '\f'; break;
711 case 'v': ch = '\v'; break;
713 lexwarn(lex, WARN_UNKNOWN_CONTROL_SEQUENCE, "unrecognized control sequence: \\%c", ch);
714 /* so we just add the character plus backslash no matter what it actually is */
715 lex_tokench(lex, '\\');
717 /* add the character finally */
718 lex_tokench(lex, ch);
721 lex_tokench(lex, ch);
723 lexerror(lex, "unexpected end of file within string constant");
724 lex_ungetch(lex, EOF); /* next token to be TOKEN_EOF */
725 return (lex->tok.ttype = TOKEN_ERROR);
728 static int GMQCC_WARN lex_finish_digit(lex_file *lex, int lastch)
734 /* parse a number... */
735 lex->tok.ttype = TOKEN_INTCONST;
737 lex_tokench(lex, ch);
740 if (ch != '.' && !isdigit(ch))
742 if (lastch != '0' || ch != 'x')
744 /* end of the number or EOF */
745 lex_ungetch(lex, ch);
748 lex->tok.constval.i = lastch - '0';
749 return lex->tok.ttype;
755 /* EOF would have been caught above */
759 lex_tokench(lex, ch);
761 while (isdigit(ch) || (ishex && isxdigit_only(ch)))
763 lex_tokench(lex, ch);
767 /* NOT else, '.' can come from above as well */
768 if (ch == '.' && !ishex)
770 /* Allow floating comma in non-hex mode */
771 lex->tok.ttype = TOKEN_FLOATCONST;
772 lex_tokench(lex, ch);
774 /* continue digits-only */
778 lex_tokench(lex, ch);
782 /* put back the last character */
783 /* but do not put back the trailing 'f' or a float */
784 if (lex->tok.ttype == TOKEN_FLOATCONST && ch == 'f')
787 /* generally we don't want words to follow numbers: */
789 lexerror(lex, "unexpected trailing characters after number");
790 return (lex->tok.ttype = TOKEN_ERROR);
792 lex_ungetch(lex, ch);
795 if (lex->tok.ttype == TOKEN_FLOATCONST)
796 lex->tok.constval.f = strtod(lex->tok.value, NULL);
798 lex->tok.constval.i = strtol(lex->tok.value, NULL, 0);
799 return lex->tok.ttype;
802 int lex_do(lex_file *lex)
813 ch = lex_skipwhite(lex);
814 if (!lex->flags.mergelines || ch != '\\')
818 lex_ungetch(lex, ch);
822 /* we reached a linemerge */
823 lex_tokench(lex, '\n');
827 lex->sline = lex->line;
828 lex->tok.ctx.line = lex->sline;
829 lex->tok.ctx.file = lex->name;
831 if (lex->flags.preprocessing && (ch == TOKEN_WHITE || ch == TOKEN_EOL || ch == TOKEN_FATAL)) {
832 return (lex->tok.ttype = ch);
836 return (lex->tok.ttype = TOKEN_FATAL);
840 return (lex->tok.ttype = TOKEN_EOF);
843 /* modelgen / spiritgen commands */
849 if (!isident_start(ch)) {
850 lexerror(lex, "hanging '$' modelgen/spritegen command line");
853 lex_tokench(lex, ch);
854 if (!lex_finish_ident(lex))
855 return (lex->tok.ttype = TOKEN_ERROR);
857 /* skip the known commands */
860 if (!strcmp(v, "frame") || !strcmp(v, "framesave"))
862 /* frame/framesave command works like an enum
863 * similar to fteqcc we handle this in the lexer.
864 * The reason for this is that it is sensitive to newlines,
865 * which the parser is unaware of
867 if (!lex_finish_frames(lex))
868 return (lex->tok.ttype = TOKEN_ERROR);
872 if (!strcmp(v, "framevalue"))
875 while (ch != EOF && isspace(ch) && ch != '\n')
879 lexerror(lex, "$framevalue requires an integer parameter");
884 lex->tok.ttype = lex_finish_digit(lex, ch);
886 if (lex->tok.ttype != TOKEN_INTCONST) {
887 lexerror(lex, "$framevalue requires an integer parameter");
890 lex->framevalue = lex->tok.constval.i;
894 if (!strcmp(v, "framerestore"))
900 rc = lex_parse_frame(lex);
903 lexerror(lex, "$framerestore requires a framename parameter");
907 return (lex->tok.ttype = TOKEN_FATAL);
910 for (frame = 0; frame < vec_size(lex->frames); ++frame) {
911 if (!strcmp(v, lex->frames[frame].name)) {
912 lex->framevalue = lex->frames[frame].value;
916 lexerror(lex, "unknown framename `%s`", v);
920 if (!strcmp(v, "modelname"))
926 rc = lex_parse_frame(lex);
929 lexerror(lex, "$modelname requires a parameter");
933 return (lex->tok.ttype = TOKEN_FATAL);
936 if (lex->modelname) {
938 m.value = lex->framevalue;
939 m.name = lex->modelname;
940 lex->modelname = NULL;
941 vec_push(lex->frames, m);
943 lex->modelname = lex->tok.value;
944 lex->tok.value = NULL;
948 if (!strcmp(v, "flush"))
951 for (frame = 0; frame < vec_size(lex->frames); ++frame)
952 mem_d(lex->frames[frame].name);
953 vec_free(lex->frames);
954 /* skip line (fteqcc does it too) */
956 while (ch != EOF && ch != '\n')
961 if (!strcmp(v, "cd") ||
962 !strcmp(v, "origin") ||
963 !strcmp(v, "base") ||
964 !strcmp(v, "flags") ||
965 !strcmp(v, "scale") ||
970 while (ch != EOF && ch != '\n')
975 for (frame = 0; frame < vec_size(lex->frames); ++frame) {
976 if (!strcmp(v, lex->frames[frame].name)) {
977 lex->tok.constval.i = lex->frames[frame].value;
978 return (lex->tok.ttype = TOKEN_INTCONST);
982 lexerror(lex, "invalid frame macro");
986 /* single-character tokens */
991 lex_tokench(lex, ch);
993 if (lex->flags.noops)
994 return (lex->tok.ttype = ch);
996 return (lex->tok.ttype = TOKEN_OPERATOR);
1005 lex_tokench(lex, ch);
1007 return (lex->tok.ttype = ch);
1012 if (lex->flags.noops)
1014 /* Detect characters early which are normally
1015 * operators OR PART of an operator.
1032 lex_tokench(lex, ch);
1034 return (lex->tok.ttype = ch);
1041 lex_tokench(lex, ch);
1042 /* peak ahead once */
1043 nextch = lex_getch(lex);
1044 if (nextch != '.') {
1045 lex_ungetch(lex, nextch);
1047 return (lex->tok.ttype = ch);
1049 /* peak ahead again */
1050 nextch = lex_getch(lex);
1051 if (nextch != '.') {
1052 lex_ungetch(lex, nextch);
1053 lex_ungetch(lex, nextch);
1055 return (lex->tok.ttype = ch);
1057 /* fill the token to be "..." */
1058 lex_tokench(lex, ch);
1059 lex_tokench(lex, ch);
1061 return (lex->tok.ttype = TOKEN_DOTS);
1065 if (ch == ',' || ch == '.') {
1066 lex_tokench(lex, ch);
1068 return (lex->tok.ttype = TOKEN_OPERATOR);
1071 if (ch == '+' || ch == '-' || /* ++, --, +=, -= and -> as well! */
1072 ch == '>' || ch == '<' || /* <<, >>, <=, >= */
1073 ch == '=' || ch == '!' || /* ==, != */
1074 ch == '&' || ch == '|') /* &&, ||, &=, |= */
1076 lex_tokench(lex, ch);
1078 nextch = lex_getch(lex);
1079 if (nextch == ch || nextch == '=') {
1080 lex_tokench(lex, nextch);
1081 } else if (ch == '-' && nextch == '>') {
1082 lex_tokench(lex, nextch);
1084 lex_ungetch(lex, nextch);
1087 return (lex->tok.ttype = TOKEN_OPERATOR);
1091 if (ch == '^' || ch == '~' || ch == '!')
1093 lex_tokench(lex, ch);
1095 return (lex->tok.ttype = TOKEN_OPERATOR);
1099 if (ch == '*' || ch == '/') /* *=, /= */
1101 lex_tokench(lex, ch);
1103 nextch = lex_getch(lex);
1104 if (nextch == '=') {
1105 lex_tokench(lex, nextch);
1107 lex_ungetch(lex, nextch);
1110 return (lex->tok.ttype = TOKEN_OPERATOR);
1113 if (isident_start(ch))
1117 lex_tokench(lex, ch);
1118 if (!lex_finish_ident(lex)) {
1120 return (lex->tok.ttype = TOKEN_ERROR);
1123 lex->tok.ttype = TOKEN_IDENT;
1126 if (!strcmp(v, "void")) {
1127 lex->tok.ttype = TOKEN_TYPENAME;
1128 lex->tok.constval.t = TYPE_VOID;
1129 } else if (!strcmp(v, "int")) {
1130 lex->tok.ttype = TOKEN_TYPENAME;
1131 lex->tok.constval.t = TYPE_INTEGER;
1132 } else if (!strcmp(v, "float")) {
1133 lex->tok.ttype = TOKEN_TYPENAME;
1134 lex->tok.constval.t = TYPE_FLOAT;
1135 } else if (!strcmp(v, "string")) {
1136 lex->tok.ttype = TOKEN_TYPENAME;
1137 lex->tok.constval.t = TYPE_STRING;
1138 } else if (!strcmp(v, "entity")) {
1139 lex->tok.ttype = TOKEN_TYPENAME;
1140 lex->tok.constval.t = TYPE_ENTITY;
1141 } else if (!strcmp(v, "vector")) {
1142 lex->tok.ttype = TOKEN_TYPENAME;
1143 lex->tok.constval.t = TYPE_VECTOR;
1144 } else if (!strcmp(v, "for") ||
1145 !strcmp(v, "while") ||
1148 !strcmp(v, "else") ||
1149 !strcmp(v, "local") ||
1150 !strcmp(v, "return") ||
1151 !strcmp(v, "not") ||
1152 !strcmp(v, "const"))
1154 lex->tok.ttype = TOKEN_KEYWORD;
1156 else if (opts_standard != COMPILER_QCC)
1158 /* other standards reserve these keywords */
1159 if (!strcmp(v, "switch") ||
1160 !strcmp(v, "struct") ||
1161 !strcmp(v, "union") ||
1162 !strcmp(v, "break") ||
1163 !strcmp(v, "continue") ||
1166 lex->tok.ttype = TOKEN_KEYWORD;
1170 return lex->tok.ttype;
1175 lex->flags.nodigraphs = true;
1176 if (lex->flags.preprocessing)
1177 lex_tokench(lex, ch);
1178 lex->tok.ttype = lex_finish_string(lex, '"');
1179 if (lex->flags.preprocessing)
1180 lex_tokench(lex, ch);
1181 while (!lex->flags.preprocessing && lex->tok.ttype == TOKEN_STRINGCONST)
1183 /* Allow c style "string" "continuation" */
1184 ch = lex_skipwhite(lex);
1186 lex_ungetch(lex, ch);
1190 lex->tok.ttype = lex_finish_string(lex, '"');
1192 lex->flags.nodigraphs = false;
1194 return lex->tok.ttype;
1199 /* we parse character constants like string,
1200 * but return TOKEN_CHARCONST, or a vector type if it fits...
1201 * Likewise actual unescaping has to be done by the parser.
1202 * The difference is we don't allow 'char' 'continuation'.
1204 if (lex->flags.preprocessing)
1205 lex_tokench(lex, ch);
1206 lex->tok.ttype = lex_finish_string(lex, '\'');
1207 if (lex->flags.preprocessing)
1208 lex_tokench(lex, ch);
1211 /* It's a vector if we can successfully scan 3 floats */
1213 if (sscanf_s(lex->tok.value, " %f %f %f ",
1214 &lex->tok.constval.v.x, &lex->tok.constval.v.y, &lex->tok.constval.v.z) == 3)
1216 if (sscanf(lex->tok.value, " %f %f %f ",
1217 &lex->tok.constval.v.x, &lex->tok.constval.v.y, &lex->tok.constval.v.z) == 3)
1221 lex->tok.ttype = TOKEN_VECTORCONST;
1224 return lex->tok.ttype;
1229 lex->tok.ttype = lex_finish_digit(lex, ch);
1231 return lex->tok.ttype;
1234 lexerror(lex, "unknown token");
1235 return (lex->tok.ttype = TOKEN_ERROR);