CHRSUB          - CHARACTER MANIPULATION SUBROUTINES             21-AUG-1978 18:53:26   VAX-11 MACRO X0.3-11               Page   0

TABLE OF CONTENTS   



   (2)      39  DECLARATIONS

   (3)      92  TEST A CHARACTER FOR CLASS

   (5)     180  GET TOKEN

   (6)     237  SET NONE BLANK

CHRSUB          - CHARACTER MANIPULATION SUBROUTINES             21-AUG-1978 18:53:26   VAX-11 MACRO X0.3-11               Page   1

V01                                                                                                                              (1)



                                     0000     1 	.TITLE	CHRSUB - CHARACTER MANIPULATION SUBROUTINES

                                     0000     2 	.IDENT	/V01/

                                     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             21-AUG-1978 18:53:26   VAX-11 MACRO X0.3-11               Page   2

V01             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	_PURE	RD,NOWRT,BYTE

                                     0000    72  

                                     0000    73 CHRTBL:

                                     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 CHRTBLSIZ = . - CHRTBL

                                     000C    87  

                           2B 25 2D  000C    88 SPCNUM:	.ASCII	\-%+\			; SPECIAL CHARACTERS TREATED AS NUMERIC

                           00000003  000F    89 SPCNUMSIZ = . - SPCNUM

                                     000F    90 

CHRSUB          - CHARACTER MANIPULATION SUBROUTINES             21-AUG-1978 18:53:26   VAX-11 MACRO X0.3-11               Page   3

V01             TEST A CHARACTER FOR CLASS                                                                                       (3)



                                     000F    92 	.SBTTL	TEST A CHARACTER FOR CLASS

                                     000F    93 ;++

                                     000F    94 ; FUNCTIONAL DESCRIPTION:

                                     000F    95 ;

                                     000F    96 ;	THIS ROUTINE IS CALLED TO CLASSIFY AN ASCII CHARATER INTO

                                     000F    97 ;	ONE OF SEVERAL CLASSES. AN ALTERNATE ENTRY PROVIDES LOWER

                                     000F    98 ;	TO UPPER CASE CONVERSION AS WELL.

                                     000F    99 ;

                                     000F   100 ; CALLING SEQUENCE:

                                     000F   101 ;

                                     000F   102 ;	BSB/JSB	CHR$TSTCHR		; TEST THE CHARACTER

                                     000F   103 ;	BSB/JSB	CHR$CVT			; CONVERT AND TEST

                                     000F   104 ;

                                     000F   105 ; INPUT PARAMETERS:

                                     000F   106 ;

                                     000F   107 ;	R6 CONTAINS ADDRESS OF BYTE TO TEST

                                     000F   108 ;

                                     000F   109 ; IMPLICIT INPUTS:

                                     000F   110 ;

                                     000F   111 ;	STRING IS TERMINATED BY A ZERO BYTE

                                     000F   112 ;

                                     000F   113 ; OUTPUT PARAMETERS:

                                     000F   114 ;

                                     000F   115 ;	R0 SET TO "CHR$K_<CLASS_NAME>" IF ONE OF RECOGNIZED CHARACTERS

                                     000F   116 ;	   ELSE SET TO MINUS 1

                                     000F   117 ;

                                     000F   118 ; IMPLICIT OUTPUTS:

                                     000F   119 ;

                                     000F   120 ;	NONE

                                     000F   121 ;

                                     000F   122 ; COMPLETION CODES:

                                     000F   123 ;

                                     000F   124 ;	NONE

                                     000F   125 ;

                                     000F   126 ; SIDE EFFECTS:

                                     000F   127 ;

                                     000F   128 ;	NONE

                                     000F   129 ;

                                     000F   130 ;--

                                     000F   131  

                                     000F   132 CHR$CVT::				; CONVERT TO UPPER CASE

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

                          0D     19  0013   134 	BLSS	CHR$TSTCHR		; BR IF NOT LOWER

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

                          07     14  0019   136 	BGTR	CHR$TSTCHR		; BR IF NOT LOWER

            66            20     82  001B   137 	SUBB	#^X20,(R6)		; CONVERT TO UPPER

                          02     11  001E   138 	BRB	CHR$TSTCHR		;

                                     0020   139  

                                     0020   140 CHR$TSTNXT::				; TEST NEXT CHAR

                          56     D6  0020   141 	INCL	R6			; ADD ONE TI ADDRESS

                                     0022   142  

                                     0022   143 CHR$TSTCHR::				; TEST A CHARACTER FOR CLASS

                          50     D4  0022   144 	CLRL	R0			; ASSUME END-OF-LINE

                          66     95  0024   145 	TSTB	(R6)			; END-OF-LINE?

                          50     13  0026   146 	BEQL	90$			; BR IF YES

                          50     D6  0028   147 	INCL	R0			; SET TYPE TO ALPHA

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

CHRSUB          - CHARACTER MANIPULATION SUBROUTINES             21-AUG-1978 18:53:26   VAX-11 MACRO X0.3-11               Page   4

V01             TEST A CHARACTER FOR CLASS                                                                                       (3)



                          12     1F  002E   149 	BLSSU	20$			; BR IF BELOW ALPHA

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

                          42     15  0034   151 	BLEQ	90$			; BR IF ALPHA

         61 8F            66     91  0036   152 	CMPB	(R6),#<^A/A/+^X20>	; CHECK FOR LOWER CASE ALPHA

                          06     19  003A   153 	BLSS	20$			; BR IF NO

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

                          36     15  0040   155 	BLEQ	90$			; FOUND THE CLASS

                          02     DD  0042   156 20$:	PUSHL	S^#CHR$K_NUMERIC	; SET VALUE FOR NUMERIC CHARATERS

            03            66     3A  0044   157 	LOCC	(R6),#SPCNUMSIZ,SPCNUM	; CHECK FOR SPECIAL NUMERIC CHARACTERS

                       C3 AF         0047       

                          01     BA  0049   158 	POPR	#^M<R0>			; GET VALUE FOR NUMERIC CHARACTER

                          2B     12  004B   159 	BNEQ	90$			; BR IF CHARACTER IS SPECIAL NUMERIC

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

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

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

                          21     15  0055   163 	BLEQ	90$			; BR IF NUMERIC

            0C            66     3A  0057   164 30$:	LOCC	(R6),#CHRTBLSIZ,CHRTBL	; CHECK IF ONE OF SPECIALS

                       A4 AF         005A       

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

            50            05     D0  005E   166 	MOVL	#CHR$K_BLANK,R0		; ASSUME TAB

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

                          12     13  0064   168 	BEQL	90$			; BR IF YES

            50            0A     D0  0066   169 	MOVL	#CHR$K_LBRAKT,R0	; ASSUME LEFT BRACKET

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

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

                          50     D6  006E   172 	INCL	R0			; CHANGE CODE TO RIGHT BRACKET

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

                          03     13  0073   174 	BEQL	90$			; BR IF YES

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

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

                                 05  007A   177 	RSB				;

CHRSUB          - CHARACTER MANIPULATION SUBROUTINES             21-AUG-1978 18:53:26   VAX-11 MACRO X0.3-11               Page   5

V01             TEST A CHARACTER FOR CLASS                                                                                       (5)



                                     007B   179 

                                     007B   180 	.SBTTL	GET TOKEN

                                     007B   181 ;++

                                     007B   182 ; FUNCTIONAL DESCRIPTION:

                                     007B   183 ;

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

                                     007B   185 ;	COMMAND LINE.

                                     007B   186 ;

                                     007B   187 ; CALLING SEQUENCE:

                                     007B   188 ;

                                     007B   189 ;	BSB/JSB	CHR$GETOKEN		; GET TOKEN FROM LINE

                                     007B   190 ;	BSB/JSB	CHR$NXTOKEN		; TOKEN AFTER NEXT CHARACTER

                                     007B   191 ;

                                     007B   192 ; INPUT PARAMETERS:

                                     007B   193 ;

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

                                     007B   195 ;

                                     007B   196 ; IMPLICIT INPUTS:

                                     007B   197 ;

                                     007B   198 ;	STRING IS TERMINATED BY ZERO BYTE

                                     007B   199 ;

                                     007B   200 ; OUTPUT PARAMETERS:

                                     007B   201 ;

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

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

                                     007B   204 ;

                                     007B   205 ; IMPLICIT OUTPUTS:

                                     007B   206 ;

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

                                     007B   208 ;

                                     007B   209 ; COMPLETION CODES:

                                     007B   210 ;

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

                                     007B   212 ;

                                     007B   213 ; SIDE EFFECTS:

                                     007B   214 ;

                                     007B   215 ;	NONE

                                     007B   216 ;

                                     007B   217 ;--

                                     007B   218 	.ENABL	LSB

                                     007B   219  

                                     007B   220 CHR$GETOKEN::				; GET TOKEN

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

                                     007D   222 CHR$NXTOKEN::				; TOKEN FOLLOWING CURRENT CHAR

                          1C     10  007D   223 	BSBB	CHR$NXTNBLK		; FIND NON-BLANK

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

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

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

                          96     10  0088   227 	BSBB	CHR$TSTNXT		; LOOK AT NEXT CHAR

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

            05            50     91  008C   229 	CMPB	R0,#CHR$K_BLANK		; VALID CHARACTER FOR TOKEN?

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

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

                          06     10  0093   232 	BSBB	CHR$NXTNBLK		; SKIP TO NON-BLANK

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

                                 05  0098   234 50$:	RSB				; GET OUT

CHRSUB          - CHARACTER MANIPULATION SUBROUTINES             21-AUG-1978 18:53:26   VAX-11 MACRO X0.3-11               Page   6

V01             GET TOKEN                                                                                                        (6)



                                     0099   236 	.DSABL	LSB

                                     0099   237 	.SBTTL	SET NONE BLANK

                                     0099   238 ;++

                                     0099   239 ; FUNCTIONAL DESCRIPTION:

                                     0099   240 ;

                                     0099   241 ;	THIS ROUTINE IS CALLED TO ADVANCE THE CHARACTER POINTER

                                     0099   242 ;	TO  THE FIRST NONE BLANK CHARATER ON THE LINE.

                                     0099   243 ;

                                     0099   244 ; CALLING SEQUENCE:

                                     0099   245 ;

                                     0099   246 ;	BSB/JSB	CHR$SETNB		; SET NONE BLANK

                                     0099   247 ;

                                     0099   248 ; INPUT PARAMETERS:

                                     0099   249 ;

                                     0099   250 ;	R6 CONTAINS ADDRESS OF NEXT BYTE ON THE LINE

                                     0099   251 ;

                                     0099   252 ; IMPLICIT INPUTS:

                                     0099   253 ;

                                     0099   254 ;	NONE

                                     0099   255 ;

                                     0099   256 ; OUTPUT PARAMETERS:

                                     0099   257 ;

                                     0099   258 ;	R6 IS ADVANCED TO THE FIRST NONE BLANK CHARACTER

                                     0099   259 ;

                                     0099   260 ; IMPLICIT OUTPUTS:

                                     0099   261 ;

                                     0099   262 ;	NONE

                                     0099   263 ;

                                     0099   264 ; COMPLETION CODES:

                                     0099   265 ;

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

                                     0099   267 ;

                                     0099   268 ; SIDE EFFECTS:

                                     0099   269 ;

                                     0099   270 ;	NONE

                                     0099   271 ;

                                     0099   272 ;--

                                     0099   273 	.ENABL	LSB

                                     0099   274  

                                     0099   275 CHR$SETNBLK::				; SET NONE BLANK

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

                                     009B   277 CHR$NXTNBLK::				; SKIP THEN-THEN NEXT NONE BLANK

                          FF82   30  009B   278 20$:	BSBW	CHR$TSTNXT		;

                          08     13  009E   279 	BEQL	40$			; BR IF END-OF-LINE

            05            50     91  00A0   280 	CMPB	R0,#CHR$K_BLANK		; NEXT CHAR BLANK

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

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

                                 05  00A8   283 40$:	RSB				; ALL DONE

                                     00A9   284  

                                     00A9   285 	.DSABL	LSB

                                     00A9   286 	.END

CHRSUB          - CHARACTER MANIPULATION SUBROUTINES             21-AUG-1978 18:53:26   VAX-11 MACRO X0.3-11               Page   7

SYMBOL TABLE                                                                                                                     (6)



CHR$CVT          0000000F RG    02   

CHR$GETOKEN      0000007B 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_UNDRSCR  = 00000003  G         

CHR$NXTNBLK      0000009B RG    02   

CHR$NXTOKEN      0000007D RG    02   

CHR$SETNBLK      00000099 RG    02   

CHR$TSTCHR       00000022 RG    02   

CHR$TSTNXT       00000020 RG    02   

CHRTBL           00000000 R     02   

CHRTBLSIZ      = 0000000C            

SPCNUM           0000000C R     02   

SPCNUMSIZ      = 00000003            





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  

_PURE            000000A9      02     NOPIC   USR   CON   REL   LCL NOSHR   EXE   RD  NOWRT BYTE  





THERE WERE NO ERRORS OR WARNINGS.

27848. BYTES LEFT IN FREE MEMORY POOL.

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

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

