1 #pragma comment (compiler)
2 //#pragma comment (date)
3 //#pragma comment (timestamp)
6 #include "Local.h" /* standard header file */
10 #pragma subtitle("stspack2 - Local string test functions ")
11 /********************************************************************/
14 /* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */
15 /* Date: 05 Oct 1992 */
16 /* Programmer: ALLAN DARLING */
19 /* Abstract: The stspack2 package contains functions to */
20 /* perform the isalnum through isxdigit functions */
21 /* on strings. The functions come in four forms: */
22 /* those that test NULL delimited strings and are */
23 /* named in the form sxxxxxxx, those that test at */
24 /* most n characters and are named in the form */
25 /* nxxxxxxx, those that search forward in a string */
26 /* and are named in the form nxtyyyyy, and those */
27 /* that search backward in a string and are named */
28 /* in the form lstyyyyy. */
30 /* The xxxxxxx is the name of the test applied to */
31 /* each character in the string, such as isalpha, */
32 /* thus a function to test a NULL delimited string */
33 /* an return a nonzero value if all characters in */
34 /* the string are digits is named sisdigit. */
36 /* The yyyyy is the name of the test applied to */
37 /* characters in a string, minus the 'is' prefix. */
38 /* Thus a function to find the next digit in a NULL */
39 /* delimited string and return a pointer to it is */
42 /* The only exception to the naming rule is for the */
43 /* functions that test for hexadecimal digits. */
44 /* These are named sisxdigi, nisxdigi, nxtxdigi, */
45 /* and lstxdigi because of the eight character */
46 /* function name limitation. */
48 /* The nxxxxxxx class of functions will test up to */
49 /* n characters or the first NULL character */
50 /* encountered, whichever comes first. For all */
51 /* classes of functions, the string sentinal is */
52 /* not included in the test. */
54 /* External Functions Called: */
55 /* isalnum, isalpha, iscntrl, isdigit, isgraph, */
56 /* islower, isprint, ispunct, isspace, isupper, */
59 /* Input: For sxxxxxxx class functions, a pointer to a */
60 /* NULL delimited character string. */
62 /* For nxtyyyyy class functions, a pointer to a */
63 /* NULL delimited character string. */
65 /* for nxxxxxxx class functions, a pointer to a */
66 /* character array, and a positive, nonzero integer.*/
68 /* for lstyyyyy class functions, a pointer to a */
69 /* character array, and a positive, nonzero integer.*/
71 /* Output: A nonzero value if the test is true for all */
72 /* characters in the string, a zero value otherwise.*/
74 /* Modification History: */
77 /********************************************************************/
80 int nisalnum(char *s, int n) {
82 for (; *s && n; s++, n--)
92 int nisalpha(char *s, int n) {
94 for (; *s && n; s++, n--)
104 int niscntrl(char *s, int n) {
106 for (; *s && n; s++, n--)
116 int nisdigit(char *s, int n) {
118 for (; *s && n; s++, n--)
128 int nisgraph(char *s, int n) {
130 for (; *s && n; s++, n--)
140 int nislower(char *s, int n) {
142 for (; *s && n; s++, n--)
152 int nisprint(char *s, int n) {
154 for (; *s && n; s++, n--)
164 int nispunct(char *s, int n) {
166 for (; *s && n; s++, n--)
176 int nisspace(char *s, int n) {
178 for (; *s && n; s++, n--)
188 int nisupper(char *s, int n) {
190 for (; *s && n; s++, n--)
200 int nisxdigi(char *s, int n) {
202 for (; *s && n; s++, n--)