/* * Add the offset corresponding to the specified user label name to the * opcode table for a function. If the label is not yet defined, then a * chain of undefined offsets is built using the offset value, and it * will be fixed up when the label is defined. * * given: * name user symbol name */ void addlabel(char *name) { register LABEL *lp; /* current label */ long i; /* counter */ for (i = labelcount, lp = labels; --i >= 0; lp++) { if (strcmp(name, lp->l_name)) continue; uselabel(lp); return; } if (labelcount >= MAXLABELS) { scanerror(T_NULL, "Too many labels in use"); return; } lp = &labels[labelcount++]; lp->l_offset = -1L; lp->l_chain = -1L; lp->l_name = addstr(&labelnames, name); uselabel(lp); }
/* * Add a jump-type opcode and a label to the function being compiled. * * given: * label label to be added */ void addoplabel(long op, LABEL *label) { addop(op); uselabel(label); }