/************************************************************************ * labels -- creates a label upon command * * * * useage call labels * * note This routine will allow the programmer to create * * a label within the program by declaring: * * label labelname * * * * coded by G Beckmann, 5-Aug-79 * ************************************************************************/ subroutine labels include ratfor.def character name(MAXTOKEN),num(MAXTOKEN) integer gettok,labgen,scan integer lab logical instal,check repeat { if (scan(name) ^= LEXIDENT) { call synerr(S_ILL_LABEL) break } lab = labgen(1) #get a label from label generator call ita(lab,num) #convert it to ascii if (^(instal(name,num))) { #define it for programs use if (^(check(name))) { call synerr(F_LAB_LOST) call ratout } } i = scan(name) if(name(1) ^= COMMA) break } call pbstr(name) return end /************************************************************************ * check -- checks that string is numeric * * * * useage: if(check(name))... * * where: name is the string to check * * note: * * There is some funnieness on the line marked "###". * * This is done since numbers defined by DEFGEN produce spaces * * after them while numbers produced by LABELS do not. It is * * likely that this will never be changed. * ************************************************************************/ logical function check(name) character name(MAXTOKEN),def(MAXTOKEN) logical find if(find(name,def)) { j = length(def) if(def(j) == SPACE) [ def(j) = EOS ### J = J - 1 ] if(j <= 5) { for(i = 1;def(i) <> EOS;i = i + 1) if(def(i) < DIG_0 | def(i) > DIG_9){ break } if(i <> j+1) check = .false. else check = .true. } else check = .false. } else check = .false. return end