comparison lwasm/pseudo.c @ 381:e3f4aaa2a4e8

Allow FCB-like syntax after constant in FCC under m80ext This is an abomination (say what you really mean!) but for compatibilty with Macro-80C, allow handling of FCB style syntax after a string constant specified for FCC. Mostly, there are better ways to do this in new code so it is only accepted under the m80ext pragma. Thanks to Erik G <erik@6809.org> for the patch.
author William Astle <lost@l-w.ca>
date Mon, 13 Jul 2015 21:11:12 -0600
parents d791d47afc48
children 80d615a6642c
comparison
equal deleted inserted replaced
380:17fcd0c3ee45 381:e3f4aaa2a4e8
434 } 434 }
435 435
436 delim = **p; 436 delim = **p;
437 (*p)++; 437 (*p)++;
438 438
439
440 i = cstringlen(as, l, p, delim); 439 i = cstringlen(as, l, p, delim);
441 440
442 if (**p != delim) 441 if (**p != delim)
443 { 442 {
444 lwasm_register_error(as, l, E_OPERAND_BAD); 443 lwasm_register_error(as, l, E_OPERAND_BAD);
445 return; 444 return;
446 } 445 }
447 (*p)++; 446 (*p)++;
448 l -> len = i; 447 l -> len = i;
448
449 /* handle additional expressions, like FCC "Hello",13,0 */
450 if (CURPRAGMA(l, PRAGMA_M80EXT))
451 {
452 if (**p == ',')
453 {
454 (*p)++;
455 pseudo_parse_fcb(as, l, p);
456 l -> fcc_extras = l -> len;
457 l -> len = i + l -> fcc_extras;
458 }
459 }
449 } 460 }
450 461
451 EMITFUNC(pseudo_emit_fcc) 462 EMITFUNC(pseudo_emit_fcc)
452 { 463 {
453 int i; 464 int i;
454 465 lw_expr_t e;
455 for (i = 0; i < l -> len; i++) 466
467 for (i = 0; i < l -> len - l -> fcc_extras; i++)
456 lwasm_emit(l, l -> lstr[i]); 468 lwasm_emit(l, l -> lstr[i]);
469
470 /* PRAGMA_M80EXT */
471 for (i = 0; i < l -> fcc_extras; i++)
472 {
473 e = lwasm_fetch_expr(l, i);
474 lwasm_emitexpr(l, e, 1);
475 }
457 } 476 }
458 477
459 PARSEFUNC(pseudo_parse_fcs) 478 PARSEFUNC(pseudo_parse_fcs)
460 { 479 {
461 char delim; 480 char delim;