+//
+// Handle the creation of labels
+//
+int HandleLabel(char * label, int labelType)
+{
+ // Check for dot in front of label; means this is a local label if present
+ int j = (*label == '.' ? curenv : 0);
+ SYM * sy = lookup(label, LABEL, j);
+
+ if (sy == NULL)
+ {
+ sy = NewSymbol(label, LABEL, j);
+ sy->sattr = 0;
+ sy->sattre = RISCSYM;
+ }
+ else if (sy->sattr & DEFINED)
+ return errors("multiply-defined label '%s'", label);
+
+ // Put symbol in "order of definition" list
+ if (!(sy->sattr & SDECLLIST))
+ sym_decl(sy);
+
+ if (orgactive)
+ {
+ sy->svalue = orgaddr;
+ sy->sattr |= ABS | DEFINED | EQUATED;
+ }
+ else
+ {
+ sy->svalue = sloc;
+ sy->sattr |= DEFINED | cursect;
+ }
+
+ lab_sym = sy;
+
+ if (!j)
+ curenv++;
+
+ // Make label global if it has a double colon
+ if (labelType == DCOLON)
+ {
+ if (j)
+ return error(locgl_error);
+
+ sy->sattr |= GLOBAL;
+ }
+
+ return 0;
+}
+
+