INTEGER FUNCTION CTOI(IN, I) C C **************************************************************** C C KERMIT for the MODCOMP MAXIV operating system C C Compliments of: C C SETPOINT, Inc. C 10245 Brecksville Rd. C Brecksville, Ohio 44141 C C C KERMIT is a copyrighted protocol of Columbia Univ. The authors C of this version hereby grant permission to copy this software C provided that it is not used for an explicitly commercial C purpose and that proper credit be given. SETPOINT, Inc. makes C no warranty whatsoever regarding the accuracy of this package C and will assume no liability resulting from it's use. C C **************************************************************** C C Abstract: CONVERT ASCII TO BINARY INTEGER C C MODIFICATION HISTORY C C BY DATE REASON PROGRAMS AFFECTED C C **************************************************************** C C Author: BOB BORGESON Version: A.0 Date: Oct-86 C C Calling Parameters: C C R IN - INPUT ASCII STRING C R I - POSITION IN STRING TO START CONVERSION C C **************************************************************** C C Messages generated by this module : None C C **************************************************************** C C Subroutines called directly : None C C **************************************************************** C C Files referenced : None C C **************************************************************** C C Local variable definitions : C C S - Sign flag indicator C C **************************************************************** C C Commons referenced : KERPAR local common C C **************************************************************** C C (*$END.DOCUMENT*) C C **************************************************************** C * * C * D I M E N S I O N S T A T E M E N T S * C * * C **************************************************************** C IMPLICIT INTEGER (A-Z) INTEGER*2 IN(1) C C **************************************************************** C * * C * T Y P E S T A T E M E N T S * C * * C **************************************************************** C C C **************************************************************** C * * C * C O M M O N S T A T E M E N T S * C * * C **************************************************************** C INCLUDE USL/KERPMC C C **************************************************************** C * * C * E Q U I V A L E N C E S T A T E M E N T S * C * * C **************************************************************** C C C **************************************************************** C * * C * D A T A S T A T E M E N T S * C * * C **************************************************************** C C C **************************************************************** C C Code starts here : C 23000 IF(.NOT.(IN(I) .EQ. 32 .OR. IN(I) .EQ. 9))GOTO 23001 I = I + 1 GOTO 23000 23001 CONTINUE IF(.NOT.(IN(I) .EQ. 45 .OR. IN(I) .EQ. 43))GOTO 23002 S = IN(I) I = I + 1 GOTO 23003 23002 CONTINUE S = 0 23003 CONTINUE CTOI = 0 23004 IF(.NOT.(IN(I) .NE. 10002))GOTO 23006 IF(.NOT.(IN(I) .LT. 48 .OR. IN(I) .GT. 57))GOTO 23007 GOTO 23006 23007 CONTINUE CTOI = 10 * CTOI + IN(I) - 48 23005 I = I + 1 GOTO 23004 23006 CONTINUE IF(.NOT.(S .EQ. 45))GOTO 23009 CTOI = -CTOI 23009 CONTINUE RETURN END