*/
#include <stdio.h>
-#include <ctype.h>
-
+#include "safe-ctype.h"
#include "as.h"
#include "opcode/tic4x.h"
#include "subsegs.h"
symbol_table_insert (symbol_new (regname, reg_section, (valueT) regnum,
&zero_address_frag));
for (i = 0; regname[i]; i++)
- buf[i] = islower (regname[i]) ? toupper (regname[i]) : regname[i];
+ buf[i] = islower (regname[i]) ? TOUPPER (regname[i]) : regname[i];
buf[i] = '\0';
symbol_table_insert (symbol_new (buf, reg_section, (valueT) regnum,
if (*s == '%')
s++;
#endif
- while (isalnum (*s))
+ while (ISALNUM (*s))
*b++ = *s++;
*b++ = '\0';
if (!(symbolP = symbol_find (name)))
break;
default:
- if (tolower (*s) != *n)
+ if (TOLOWER (*s) != *n)
return 0;
s++;
}
tic4x_inst_t *inst; /* Instruction template. */
tic4x_inst_t *first_inst;
+ /* Scan for parallel operators */
+ if (str)
+ {
+ s = str;
+ while (*s && *s != '|')
+ s++;
+
+ if (*s && s[1]=='|')
+ {
+ if(insn->parallel)
+ {
+ as_bad ("Parallel opcode cannot contain more than two instructions");
+ insn->parallel = 0;
+ insn->in_use = 0;
+ return;
+ }
+
+ /* Lets take care of the first part of the parallel insn */
+ *s++ = 0;
+ md_assemble(str);
+ insn->parallel = 1;
+ str = ++s;
+ /* .. and let the second run though here */
+ }
+ }
+
if (str && insn->parallel)
{
- int star;
-
/* Find mnemonic (second part of parallel instruction). */
s = str;
/* Skip past instruction mnemonic. */
- while (*s && *s != ' ' && *s != '*')
+ while (*s && *s != ' ')
s++;
- star = *s == '*';
if (*s) /* Null terminate for hash_find. */
*s++ = '\0'; /* and skip past null. */
strcat (insn->name, "_");
strncat (insn->name, str, TIC4X_NAME_MAX - strlen (insn->name));
- /* Kludge to overcome problems with scrubber removing
- space between mnemonic and indirect operand (starting with *)
- on second line of parallel instruction. */
- if (star)
- *--s = '*';
-
insn->operands[insn->num_operands++].mode = M_PARALLEL;
if ((i = tic4x_operands_parse
switch (c)
{
case OPTION_CPU: /* cpu brand */
- if (tolower (*arg) == 'c')
+ if (TOLOWER (*arg) == 'c')
arg++;
tic4x_cpu = atoi (arg);
if (!IS_CPU_TIC3X (tic4x_cpu) && !IS_CPU_TIC4X (tic4x_cpu))
int lab;
char *s;
- if (c != '$' || !isdigit (input_line_pointer[0]))
+ if (c != '$' || ! ISDIGIT (input_line_pointer[0]))
return 0;
s = input_line_pointer;
/* Let's allow multiple digit local labels. */
lab = 0;
- while (isdigit (*s))
+ while (ISDIGIT (*s))
{
lab = lab * 10 + *s - '0';
s++;
char *name;
{
/* Look for local labels of the form $n. */
- if (name[0] == '$' && isdigit (name[1]))
+ if (name[0] == '$' && ISDIGIT (name[1]))
{
symbolS *symbolP;
char *s = name + 1;
int lab = 0;
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT ((unsigned char) *s))
{
lab = lab * 10 + *s - '0';
s++;
if (insn->in_use)
{
insn->parallel = 1;
- input_line_pointer += 2;
+ input_line_pointer ++;
+ *input_line_pointer = ' ';
/* So line counters get bumped. */
input_line_pointer[-1] = '\n';
}
}
else
{
+ /* Write out the previous insn here */
if (insn->in_use)
md_assemble (NULL);
input_line_pointer = s;