home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / modcomp / ctoi. < prev    next >
Text File  |  2020-01-01  |  5KB  |  131 lines

  1.       INTEGER FUNCTION CTOI(IN, I)
  2. C
  3. C     ****************************************************************
  4. C
  5. C              KERMIT for the MODCOMP MAXIV operating system
  6. C
  7. C        Compliments of:
  8. C
  9. C                         SETPOINT, Inc.
  10. C                      10245 Brecksville Rd.
  11. C                      Brecksville, Ohio 44141
  12. C
  13. C
  14. C      KERMIT is a copyrighted protocol of Columbia Univ. The authors
  15. C      of this version hereby grant permission to copy this software
  16. C      provided that it is not used for an explicitly commercial
  17. C      purpose and that proper credit be given. SETPOINT, Inc. makes
  18. C      no warranty whatsoever regarding the accuracy of this package
  19. C      and will assume no liability resulting from it's use.
  20. C
  21. C     ****************************************************************
  22. C
  23. C     Abstract: CONVERT ASCII TO BINARY INTEGER
  24. C
  25. C     MODIFICATION HISTORY
  26. C
  27. C     BY            DATE     REASON            PROGRAMS AFFECTED
  28. C
  29. C     ****************************************************************
  30. C
  31. C     Author: BOB BORGESON          Version: A.0    Date: Oct-86
  32. C
  33. C     Calling Parameters:
  34. C
  35. C     R    IN      - INPUT ASCII STRING
  36. C     R    I       - POSITION IN STRING TO START CONVERSION
  37. C
  38. C     ****************************************************************
  39. C
  40. C     Messages generated by this module :  None
  41. C
  42. C     ****************************************************************
  43. C
  44. C     Subroutines called directly :  None
  45. C
  46. C     ****************************************************************
  47. C
  48. C     Files referenced :  None
  49. C
  50. C     ****************************************************************
  51. C
  52. C     Local variable definitions :
  53. C
  54. C     S            - Sign flag indicator
  55. C
  56. C     ****************************************************************
  57. C
  58. C     Commons referenced :  KERPAR local common
  59. C
  60. C     ****************************************************************
  61. C
  62. C     (*$END.DOCUMENT*)
  63. C
  64. C     ****************************************************************
  65. C     *                                                              *
  66. C     *         D I M E N S I O N   S T A T E M E N T S              *
  67. C     *                                                              *
  68. C     ****************************************************************
  69. C
  70.       IMPLICIT INTEGER (A-Z)
  71.       INTEGER*2   IN(1)
  72. C
  73. C     ****************************************************************
  74. C     *                                                              *
  75. C     *         T Y P E   S T A T E M E N T S                        *
  76. C     *                                                              *
  77. C     ****************************************************************
  78. C
  79. C
  80. C     ****************************************************************
  81. C     *                                                              *
  82. C     *         C O M M O N   S T A T E M E N T S                    *
  83. C     *                                                              *
  84. C     ****************************************************************
  85. C
  86.       INCLUDE USL/KERPMC
  87. C
  88. C     ****************************************************************
  89. C     *                                                              *
  90. C     *         E Q U I V A L E N C E   S T A T E M E N T S          *
  91. C     *                                                              *
  92. C     ****************************************************************
  93. C
  94. C
  95. C     ****************************************************************
  96. C     *                                                              *
  97. C     *         D A T A   S T A T E M E N T S                        *
  98. C     *                                                              *
  99. C     ****************************************************************
  100. C
  101. C
  102. C     ****************************************************************
  103. C
  104. C     Code starts here :
  105. C
  106. 23000 IF(.NOT.(IN(I) .EQ. 32 .OR. IN(I) .EQ. 9))GOTO 23001
  107.       I = I + 1
  108.       GOTO 23000
  109. 23001 CONTINUE
  110.       IF(.NOT.(IN(I) .EQ. 45 .OR. IN(I) .EQ. 43))GOTO 23002
  111.       S = IN(I)
  112.       I = I + 1
  113.       GOTO 23003
  114. 23002 CONTINUE
  115.       S = 0
  116. 23003 CONTINUE
  117.       CTOI = 0
  118. 23004 IF(.NOT.(IN(I) .NE. 10002))GOTO 23006
  119.       IF(.NOT.(IN(I) .LT. 48 .OR. IN(I) .GT. 57))GOTO 23007
  120.       GOTO 23006
  121. 23007 CONTINUE
  122.       CTOI = 10 * CTOI + IN(I) - 48
  123. 23005 I = I + 1
  124.       GOTO 23004
  125. 23006 CONTINUE
  126.       IF(.NOT.(S .EQ. 45))GOTO 23009
  127.       CTOI = -CTOI
  128. 23009 CONTINUE
  129.       RETURN
  130.       END
  131.