Subversion Repositories tendra.SVN

Rev

Rev 2 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
/**** syntax.c --- Character classification.
32
 *
33
 ** Author: Steve Folkes <smf@hermes.mod.uk>
34
 *
35
 **** Commentary:
36
 *
37
 * This file implements the syntax table facility specified in the file
38
 * "syntax.h". See that file for more details.
39
 *
40
 * This particular implementation assumes that the ASCII character set is
41
 * being used. It will need changing for other character sets.
42
 *
43
 **** Change Log:
44
 * $Log: syntax.c,v $
45
 * Revision 1.1.1.1  1998/01/17  15:57:18  release
46
 * First version to be checked into rolling release.
47
 *
48
 * Revision 1.2  1994/12/12  11:45:52  smf
49
 * Performing changes for 'CR94_178.sid+tld-update' - bringing in line with
50
 * OSSG C Coding Standards.
51
 *
52
 * Revision 1.1.1.1  1994/07/25  16:06:12  smf
53
 * Initial import of os-interface shared files.
54
 *
55
**/
56
 
57
/****************************************************************************/
58
 
59
#include "syntax.h"
60
 
61
/*--------------------------------------------------------------------------*/
62
 
63
int
64
syntax_value PROTO_N ((c))
65
	     PROTO_T (char c)
66
{
67
    if ((c >= '0') && (c <= '9')) {
68
	return (c - '0');
69
    } else if ((c >= 'A') && (c <= 'Z')) {
70
	return (c - 'A' + 10);
71
    } else if ((c >= 'a') && (c <= 'z')) {
72
	return (c - 'a' + 10);
73
    }
74
    return (SYNTAX_NO_VALUE);
75
}
76
 
77
char
78
syntax_upcase PROTO_N ((c))
79
	      PROTO_T (char c)
80
{
81
    if ((c >= 'a') && (c <= 'z')) {
82
	return ((char) (c - 'a' + 'A'));
83
    }
84
    return (c);
85
}
86
 
87
char
88
syntax_downcase PROTO_N ((c))
89
		PROTO_T (char c)
90
{
91
    if ((c >= 'A') && (c <= 'Z')) {
92
	return ((char) (c - 'A' + 'a'));
93
    }
94
    return (c);
95
}
96
 
97
BoolT
98
syntax_is_white_space PROTO_N ((c))
99
		      PROTO_T (char c)
100
{
101
    return ((c < 33) || (c > 126));
102
}
103
 
104
BoolT
105
syntax_is_printable PROTO_N ((c))
106
		    PROTO_T (char c)
107
{
108
    return ((c > 31) && (c < 127));
109
}
110
 
111
BoolT
112
syntax_is_letter PROTO_N ((c))
113
		 PROTO_T (char c)
114
{
115
    return (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')));
116
}
117
 
118
BoolT
119
syntax_is_digit PROTO_N ((c))
120
		PROTO_T (char c)
121
{
122
    return ((c >= '0') && (c <= '9'));
123
}