CHRSUB          - CHARACTER MANIPULATION SUBROUTINES             22-AUG-1978 00:32:05   VAX-11 MACRO X0.3-11               Page   0

TABLE OF CONTENTS   



   (2)      39  DECLARATIONS

   (3)      89  TEST A CHARACTER FOR CLASS

   (5)     180  GET TOKEN

   (6)     237  SET NONE BLANK

CHRSUB          - CHARACTER MANIPULATION SUBROUTINES             22-AUG-1978 00:32:05   VAX-11 MACRO X0.3-11               Page   1

01                                                                                                                               (1)



                                     0000     1 	.TITLE	CHRSUB - CHARACTER MANIPULATION SUBROUTINES

                                     0000     2 	.IDENT	/01/

                                     0000     3 

                                     0000     4 ;

                                     0000     5 ; COPYRIGHT (C) 1977

                                     0000     6 ; DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS 01754

                                     0000     7 ;

                                     0000     8 ; THIS SOFTWARE IS FURNISHED  UNDER A LICENSE FOR USE ONLY ON A SINGLE

                                     0000     9 ; COMPUTER  SYSTEM AND  MAY BE  COPIED ONLY WITH  THE INCLUSION OF THE

                                     0000    10 ; ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE, OR ANY OTHER COPIES THEREOF,

                                     0000    11 ; MAY NOT BE PROVIDED OR  OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON

                                     0000    12 ; EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO THESE LICENSE

                                     0000    13 ; TERMS.  TITLE TO AND  OWNERSHIP OF THE  SOFTWARE  SHALL AT ALL TIMES

                                     0000    14 ; REMAIN IN DEC.

                                     0000    15 ;

                                     0000    16 ; THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE

                                     0000    17 ; AND SHOULD  NOT BE CONSTRUED  AS A COMMITMENT  BY DIGITAL  EQUIPMENT

                                     0000    18 ; CORPORATION.

                                     0000    19 ;

                                     0000    20 ; DEC ASSUMES  NO  RESPONSIBILITY  FOR  THE USE OR  RELIABILITY OF ITS

                                     0000    21 ; SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.

                                     0000    22 ;

                                     0000    23 

                                     0000    24 ;++

                                     0000    25 ; FACILITY:	UTILITY SUBROUTINES

                                     0000    26 ;

                                     0000    27 ; ABSTRACT:	CHARACTER MANIPUATION SUBROUTINES

                                     0000    28 ;

                                     0000    29 ; ENVIRONMENT:	NATIVE/USER MODE CODE

                                     0000    30 ;

                                     0000    31 ; AUTHOR:	W.H.BROWN, CREATION DATE:	19-MAY-1977

                                     0000    32 ;

                                     0000    33 ; MODIFIED BY:

                                     0000    34 ;

                                     0000    35 ;	, : VERSION

                                     0000    36 ; 01	- 

                                     0000    37 ;--

CHRSUB          - CHARACTER MANIPULATION SUBROUTINES             22-AUG-1978 00:32:05   VAX-11 MACRO X0.3-11               Page   2

01              DECLARATIONS                                                                                                     (2)



                                     0000    39 	.SBTTL	DECLARATIONS

                                     0000    40 ;

                                     0000    41 ; INCLUDE FILES:

                                     0000    42 ;

                                     0000    43 

                                     0000    44 ;

                                     0000    45 ; MACROS:

                                     0000    46 ;

                                     0000    47 ; MACRO TO GENERATE AN ENTRY IN THE CHARACTER CLASSIFICATION TABLE

                                     0000    48 ;

                                     0000    49 ; CALL:

                                     0000    50 ;	CHAR	NAME,CHR

                                     0000    51 ; WHERE:

                                     0000    52 ;	NAME IS THE SYMBOLIC NAME SUFFIX TO "CHR_K_" FOR THE CHAR

                                     0000    53 ;	CHR IS THE ASCII CHAR.

                                     0000    54 ;

                                     0000    55 	.MACRO	CHAR	NAME,CHR,N

                                     0000    56 	CHR_K_'NAME == N

                                     0000    57 	.BYTE	^A\CHR\

                                     0000    58 	.ENDM

                                     0000    59 

                                     0000    60 ;

                                     0000    61 ; EQUATED SYMBOLS:

                                     0000    62 ;

                                     0000    63 ; DEFINE SPECIAL SYMBOLS FOR ALPHA/NUMERIC SETS

                                     0000    64 ;

                           00000001  0000    65 	CHR_K_ALPHA == 1

                           00000002  0000    66 	CHR_K_NUMERIC == 2

                                     0000    67 

                                     0000    68 ;

                                     0000    69 ; OWN STORAGE:

                                     0000    70 ;

                                 00000000    71 	.PSECT	_LIB$CODE	RD,NOWRT,BYTE,EXE

                                     0000    72  

                                     0000    73 CHR_TBL:

                                     0000    74 	CHAR	SLASH	</>	12

                                     0001    75 	CHAR	SEMI	<;>	11

                                     0002    76 	CHAR	LBRAKT	<[>	10

                                     0003    77 	CHAR	RBRAKT	<]>	9

                                     0004    78 	CHAR	COMMA	<,>	8

                                     0005    79 	CHAR	DOT	<.>	7

                                     0006    80 	CHAR	COLON	<:>	6

                                     0007    81 	CHAR	BLANK	< >	5

                                     0008    82 	CHAR	DOLLAR	<$>	4

                                     0009    83 	CHAR	UNDRSCR	<_>	3

                              00 00  000A    84 	.BYTE	0,0			; EOL AND FILLER FOR REMAINING COUNT

                                     000C    85  

                           0000000C  000C    86 CHR_K_TBLSIZ = . - CHR_TBL

                                     000C    87 

CHRSUB          - CHARACTER MANIPULATION SUBROUTINES             22-AUG-1978 00:32:05   VAX-11 MACRO X0.3-11               Page   3

01              TEST A CHARACTER FOR CLASS                                                                                       (3)



                                     000C    89 	.SBTTL	TEST A CHARACTER FOR CLASS

                                     000C    90 ;++

                                     000C    91 ; FUNCTIONAL DESCRIPTION:

                                     000C    92 ;

                                     000C    93 ;	THIS ROUTINE IS CALLED TO CLASSIFY AN ASCII CHARATER INTO

                                     000C    94 ;	ONE OF SEVERAL CLASSES. AN ALTERNATE ENTRY PROVIDES LOWER

                                     000C    95 ;	TO UPPER CASE CONVERSION AS WELL.

                                     000C    96 ;

                                     000C    97 ; CALLING SEQUENCE:

                                     000C    98 ;

                                     000C    99 ;	BSB/JSB	CHR_TSTCHR		; TEST THE CHARACTER

                                     000C   100 ;	BSB/JSB	CHR_CVT			; CONVERT AND TEST

                                     000C   101 ;

                                     000C   102 ; INPUT PARAMETERS:

                                     000C   103 ;

                                     000C   104 ;	R6 CONTAINS ADDRESS OF BYTE TO TEST

                                     000C   105 ;

                                     000C   106 ; IMPLICIT INPUTS:

                                     000C   107 ;

                                     000C   108 ;	STRING IS TERMINATED BY A ZERO BYTE

                                     000C   109 ;

                                     000C   110 ; OUTPUT PARAMETERS:

                                     000C   111 ;

                                     000C   112 ;	R0 SET TO "CHR_K_<CLASS_NAME>" IF ONE OF RECOGNIZED CHARACTERS

                                     000C   113 ;	   ELSE SET TO MINUS 1

                                     000C   114 ;

                                     000C   115 ; IMPLICIT OUTPUTS:

                                     000C   116 ;

                                     000C   117 ;	NONE

                                     000C   118 ;

                                     000C   119 ; COMPLETION CODES:

                                     000C   120 ;

                                     000C   121 ;	NONE

                                     000C   122 ;

                                     000C   123 ; SIDE EFFECTS:

                                     000C   124 ;

                                     000C   125 ;	NONE

                                     000C   126 ;

                                     000C   127 ;--

                                     000C   128  

                                     000C   129 CHR_CVT::				; CONVERT TO UPPER CASE

         61 8F            66     91  000C   130 	CMPB	(R6),#<^A/A/+^X20>	; LOWER CASE A?

                          0D     19  0010   131 	BLSS	CHR_TSTCHR		; BR IF NOT LOWER

         7A 8F            66     91  0012   132 	CMPB	(R6),#<^A/Z/+^X20>	; LOWER CASE Z?

                          07     14  0016   133 	BGTR	CHR_TSTCHR		; BR IF NOT LOWER

            66            20     82  0018   134 	SUBB	#^X20,(R6)		; CONVERT TO UPPER

                          02     11  001B   135 	BRB	CHR_TSTCHR		;

                                     001D   136  

                                     001D   137 CHR_TSTNXT::				; TEST NEXT CHAR

                          56     D6  001D   138 	INCL	R6			; ADD ONE TI ADDRESS

                                     001F   139  

                                     001F   140 CHR_TSTCHR::				; TEST A CHARACTER FOR CLASS

                          50     D4  001F   141 	CLRL	R0			; ASSUME END-OF-LINE

                          66     95  0021   142 	TSTB	(R6)			; END-OF-LINE?

                          56     13  0023   143 	BEQL	90$			; BR IF YES

                          50     D6  0025   144 	INCL	R0			; SET TYPE TO ALPHA

         41 8F            66     91  0027   145 	CMPB	(R6),#^A/A/		; CHECK AGAINST LOW LIMIT

CHRSUB          - CHARACTER MANIPULATION SUBROUTINES             22-AUG-1978 00:32:05   VAX-11 MACRO X0.3-11               Page   4

01              TEST A CHARACTER FOR CLASS                                                                                       (3)



                          06     19  002B   146 	BLSS	10$			; BR IF BELOW ALPHA

         5A 8F            66     91  002D   147 	CMPB	(R6),#^A/Z/		; NOW CHECK HI END

                          48     15  0031   148 	BLEQ	90$			; BR IF ALPHA

         61 8F            66     91  0033   149 10$:	CMPB	(R6),#<^A/A/+^X20>	; CHECK FOR LOWER CASE ALPHA

                          06     19  0037   150 	BLSS	20$			; BR IF NO

         7A 8F            66     91  0039   151 	CMPB	(R6),#<^A/Z/+^X20>	; OTHER LIMIT

                          3C     15  003D   152 	BLEQ	90$			; FOUND THE CLASS

                          50     D6  003F   153 20$:	INCL	R0			; ASSUME NUMERIC

            25            66     91  0041   154 	CMPB	(R6),#^A/%/		; CHECK FOR SPECIAL NUMERIC CHARACTERS

                          35     13  0044   155 	BEQL	90$			; HAVE A PERCENT SIGN (RADIX SPECIFIER)

            2B            66     91  0046   156 	CMPB	(R6),#^A/+/		; CHECK FOR PLUS SIGN

                          30     13  0049   157 	BEQL	90$			; HAVE A PLUS SIGN

            2D            66     91  004B   158 	CMPB	(R6),#^A/-/		; CHECK FOR MINUS SIGN

                          2B     13  004E   159 	BEQL	90$			; HAVE A MINUS SIGN

            30            66     91  0050   160 	CMPB	(R6),#^A/0/		; CHECK LOW LIMIT

                          05     19  0053   161 	BLSS	30$			; BR IF NOT NUMERIC

            39            66     91  0055   162 	CMPB	(R6),#^A/9/		; WHAT ABOUT THE HI LIMIT

                          21     15  0058   163 	BLEQ	90$			; BR IF NUMERIC

            0C            66     3A  005A   164 30$:	LOCC	(R6),#CHR_K_TBLSIZ,CHR_TBL ; CHECK IF ONE OF SPECIALS

                       A1 AF         005D       

                          1A     12  005F   165 	BNEQ	90$			; BR IF YES

            50            05     D0  0061   166 	MOVL	#CHR_K_BLANK,R0		; ASSUME TAB

            09            66     91  0064   167 	CMPB	(R6),#^A/	/	; IS IT A TAB?

                          12     13  0067   168 	BEQL	90$			; BR IF YES

            50            0A     D0  0069   169 	MOVL	#CHR_K_LBRAKT,R0	; ASSUME LEFT BRACKET

            3C            66     91  006C   170 	CMPB	(R6),#^A/</		; IS IT THE FUNNY BRAKET?

                          0A     13  006F   171 	BEQL	90$			; BR IF YES

                          50     D6  0071   172 	INCL	R0			; CHANGE CODE TO RIGHT BRACKET

            3E            66     91  0073   173 	CMPB	(R6),#^A/>/		; CHECK CLOSE BRAKET

                          03     13  0076   174 	BEQL	90$			; BR IF YES

            50            01     CE  0078   175 	MNEGL	#1,R0			; SET AS GENERAL SPECIAL

                          50     D5  007B   176 90$:	TSTL	R0			; SET STATUS BASED ON VALUE

                                 05  007D   177 	RSB				;

CHRSUB          - CHARACTER MANIPULATION SUBROUTINES             22-AUG-1978 00:32:05   VAX-11 MACRO X0.3-11               Page   5

01              TEST A CHARACTER FOR CLASS                                                                                       (5)



                                     007E   179 

                                     007E   180 	.SBTTL	GET TOKEN

                                     007E   181 ;++

                                     007E   182 ; FUNCTIONAL DESCRIPTION:

                                     007E   183 ;

                                     007E   184 ;	THIS ROUTINE IS CALLED TO PARSE THE NEXT TOKEN FROM THE

                                     007E   185 ;	COMMAND LINE.

                                     007E   186 ;

                                     007E   187 ; CALLING SEQUENCE:

                                     007E   188 ;

                                     007E   189 ;	BSB/JSB	CHR_GETOKEN		; GET TOKEN FROM LINE

                                     007E   190 ;	BSB/JSB	CHR_NXTOKEN		; TOKEN AFTER NEXT CHARACTER

                                     007E   191 ;

                                     007E   192 ; INPUT PARAMETERS:

                                     007E   193 ;

                                     007E   194 ;	R6 CONTAINS ADDRESS OF NEXT BYTE ON THE LINE

                                     007E   195 ;

                                     007E   196 ; IMPLICIT INPUTS:

                                     007E   197 ;

                                     007E   198 ;	STRING IS TERMINATED BY ZERO BYTE

                                     007E   199 ;

                                     007E   200 ; OUTPUT PARAMETERS:

                                     007E   201 ;

                                     007E   202 ;	R6 IS ADVANCED TO THE FIRST NONE BLANK CHARACTER AFTER THE TOKEN.

                                     007E   203 ;	R3,R4 ARE A DESCRIPTOR TO THE TOKEN

                                     007E   204 ;

                                     007E   205 ; IMPLICIT OUTPUTS:

                                     007E   206 ;

                                     007E   207 ;	"Z" BIT IS SET IF ZERO LENGTH TOKEN IS PARSED.

                                     007E   208 ;

                                     007E   209 ; COMPLETION CODES:

                                     007E   210 ;

                                     007E   211 ;	R0 IS SET TO THE TYPE OF THE CHARACTER

                                     007E   212 ;

                                     007E   213 ; SIDE EFFECTS:

                                     007E   214 ;

                                     007E   215 ;	NONE

                                     007E   216 ;

                                     007E   217 ;--

                                     007E   218 	.ENABL	LSB

                                     007E   219  

                                     007E   220 CHR_GETOKEN::				; GET TOKEN

                          56     D7  007E   221 	DECL	R6			; BACK UP ONE FOR SKIP

                                     0080   222 CHR_NXTOKEN::				; TOKEN FOLLOWING CURRENT CHAR

                          1C     10  0080   223 	BSBB	CHR_NXTNBLK		; FIND NON-BLANK

            54            66     9E  0082   224 	MOVAB	(R6),R4			; SET START ADDRESS OF TOKEN

                          56     D7  0085   225 	DECL	R6			; BACK UP SO SKIP WILL START HERE

            53         01 A6     9E  0087   226 10$:	MOVAB	1(R6),R3		; SET ADDRESS OF NEXT BYTE

                          90     10  008B   227 	BSBB	CHR_TSTNXT		; LOOK AT NEXT CHAR

                          09     13  008D   228 	BEQL	40$			; BR ON END OF LINE

            05            50     91  008F   229 	CMPB	R0,#CHR_K_BLANK		; VALID CHARACTER FOR TOKEN?

                          F3     1F  0092   230 	BLSSU	10$			; IF LSSU YES-KEEP LOOKING FOR TERMIATOR

                          02     12  0094   231 	BNEQ	40$			; BR IF NOT A SPACE

                          06     10  0096   232 	BSBB	CHR_NXTNBLK		; SKIP TO NON-BLANK

            53            54     C2  0098   233 40$:	SUBL	R4,R3			; FIND LENGTH OF TOKEN

                                 05  009B   234 50$:	RSB				; GET OUT

CHRSUB          - CHARACTER MANIPULATION SUBROUTINES             22-AUG-1978 00:32:05   VAX-11 MACRO X0.3-11               Page   6

01              GET TOKEN                                                                                                        (6)



                                     009C   236 	.DSABL	LSB

                                     009C   237 	.SBTTL	SET NONE BLANK

                                     009C   238 ;++

                                     009C   239 ; FUNCTIONAL DESCRIPTION:

                                     009C   240 ;

                                     009C   241 ;	THIS ROUTINE IS CALLED TO ADVANCE THE CHARACTER POINTER

                                     009C   242 ;	TO  THE FIRST NONE BLANK CHARATER ON THE LINE.

                                     009C   243 ;

                                     009C   244 ; CALLING SEQUENCE:

                                     009C   245 ;

                                     009C   246 ;	BSB/JSB	CHR_SETNB		; SET NONE BLANK

                                     009C   247 ;

                                     009C   248 ; INPUT PARAMETERS:

                                     009C   249 ;

                                     009C   250 ;	R6 CONTAINS ADDRESS OF NEXT BYTE ON THE LINE

                                     009C   251 ;

                                     009C   252 ; IMPLICIT INPUTS:

                                     009C   253 ;

                                     009C   254 ;	NONE

                                     009C   255 ;

                                     009C   256 ; OUTPUT PARAMETERS:

                                     009C   257 ;

                                     009C   258 ;	R6 IS ADVANCED TO THE FIRST NONE BLANK CHARACTER

                                     009C   259 ;

                                     009C   260 ; IMPLICIT OUTPUTS:

                                     009C   261 ;

                                     009C   262 ;	NONE

                                     009C   263 ;

                                     009C   264 ; COMPLETION CODES:

                                     009C   265 ;

                                     009C   266 ;	R0 = 1 IF MORE DATA ON LINE, 0 IS NO NONE BLANK CHARACTERS

                                     009C   267 ;

                                     009C   268 ; SIDE EFFECTS:

                                     009C   269 ;

                                     009C   270 ;	NONE

                                     009C   271 ;

                                     009C   272 ;--

                                     009C   273 	.ENABL	LSB

                                     009C   274  

                                     009C   275 CHR_SETNBLK::				; SET NONE BLANK

                          56     D7  009C   276 	DECL	R6			; BACK UP SO SKIP ONE WILL BE NOP

                                     009E   277 CHR_NXTNBLK::				; SKIP THEN-THEN NEXT NONE BLANK

                          FF7C   30  009E   278 20$:	BSBW	CHR_TSTNXT		;

                          08     13  00A1   279 	BEQL	40$			; BR IF END-OF-LINE

            05            50     91  00A3   280 	CMPB	R0,#CHR_K_BLANK		; NEXT CHAR BLANK

                          F6     13  00A6   281 	BEQL	20$			; IF YES-KEEP LOOKING

            50            01     D0  00A8   282 	MOVL	#1,R0			; SUCESS

                                 05  00AB   283 40$:	RSB				; ALL DONE

                                     00AC   284  

                                     00AC   285 	.DSABL	LSB

                                     00AC   286 	.END

CHRSUB          - CHARACTER MANIPULATION SUBROUTINES             22-AUG-1978 00:32:05   VAX-11 MACRO X0.3-11               Page   7

SYMBOL TABLE                                                                                                                     (6)



CHR_CVT          0000000C RG    02   

CHR_GETOKEN      0000007E RG    02   

CHR_K_ALPHA    = 00000001  G         

CHR_K_BLANK    = 00000005  G         

CHR_K_COLON    = 00000006  G         

CHR_K_COMMA    = 00000008  G         

CHR_K_DOLLAR   = 00000004  G         

CHR_K_DOT      = 00000007  G         

CHR_K_LBRAKT   = 0000000A  G         

CHR_K_NUMERIC  = 00000002  G         

CHR_K_RBRAKT   = 00000009  G         

CHR_K_SEMI     = 0000000B  G         

CHR_K_SLASH    = 0000000C  G         

CHR_K_TBLSIZ   = 0000000C            

CHR_K_UNDRSCR  = 00000003  G         

CHR_NXTNBLK      0000009E RG    02   

CHR_NXTOKEN      00000080 RG    02   

CHR_SETNBLK      0000009C RG    02   

CHR_TBL          00000000 R     02   

CHR_TSTCHR       0000001F RG    02   

CHR_TSTNXT       0000001D RG    02   





PROGRAM SECTION SYNOPSIS



.  ABS  .        00000000      00     NOPIC   USR   CON   ABS   LCL NOSHR NOEXE NORD  NOWRT BYTE  

. BLANK .        00000000      01     NOPIC   USR   CON   REL   LCL NOSHR   EXE   RD    WRT BYTE  

_LIB$CODE        000000AC      02     NOPIC   USR   CON   REL   LCL NOSHR   EXE   RD  NOWRT BYTE  





THERE WERE NO ERRORS OR WARNINGS.

27862. BYTES LEFT IN FREE MEMORY POOL.

OBJ$:CHRSUB,LIS$:CHRSUB/-SP=EXECML$/ML,LIB$:LOGIN/ML,SRC$:CHRSUB

0 MLB DIR RDS - 0 GETS TO DEFINE 0 MACROS. 3 INTER. FILE WRITES. 

