! ----- DEC_TO_OCT.FUN ----- ! ! ----- FUNCTION TO CONVERT THE DECIMAL REPRESENTATION OF A ----- ! ----- UIC INTO ITS OCTAL DIGITS (EXPRESSED AS A DECIMAL VALUE) ----- ! ! ----- Last Change 07/02/93 by Brian Lomasky ----- ! FUNCTION LONG DEC_TO_OCT(LONG DEC_UIC) %INCLUDE "NUSER.INC" DECLARE LONG DEC_DIV ! FOR DEC_TO_OCT FUNCTION DECLARE LONG DEC_INPUT ! FOR DEC_TO_OCT FUNCTION DECLARE LONG OCT_OUTPUT ! FOR DEC_TO_OCT FUNCTION DECLARE WORD TEMP ! TEMPORARY WORD VARIABLE ! ----- ENSURE UIC IS POSITIVE ----- IF DEC_UIC >= 0% THEN DEC_INPUT = DEC_UIC ELSE DEC_INPUT = DEC_UIC + 65536% END IF OCT_OUTPUT = 0% FOR TEMP = 7% TO 0% STEP -1% DEC_DIV = INT(DEC_INPUT / 8%^TEMP) IF DEC_DIV > 0% THEN OCT_OUTPUT = OCT_OUTPUT + 10%^TEMP * DEC_DIV DEC_INPUT = DEC_INPUT - 8%^TEMP * DEC_DIV END IF NEXT TEMP DEC_TO_OCT = OCT_OUTPUT END FUNCTION