Subversion Repositories tendra.SVN

Rev

Rev 2 | 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
#ifndef USTRING_INCLUDED
32
#define USTRING_INCLUDED
33
 
34
 
35
/*
36
    UNSIGNED STRING HANDLING
37
 
38
    These macros are used to convert the normal string operations to the
39
    corresponding unsigned string operations.  The portability assumption,
40
    that char * and string are interchangeable in these operations is
41
    encapsulated in the tokens U2S and S2U.
42
*/
43
 
44
#if c_class_SPECIFICATION
45
#pragma token PROC ( EXP : string : ) EXP : char * : U2S #
46
#pragma token PROC ( EXP : const char * : ) EXP : string : S2U #
47
#pragma interface U2S S2U
48
#endif
49
 
50
#if c_class_IMPLEMENTATION
51
#define U2S( S )		( ( char * ) ( gen_ptr ) ( S ) )
52
#define S2U( S )		( ( string ) ( gen_ptr ) ( S ) )
53
#endif
54
 
55
#define ustrlit( S )		( S2U ( S ) )
56
#define strlit( S )		( U2S ( S ) )
57
 
58
#define ustrlen( S )		( strlen ( U2S ( S ) ) )
59
#define ustrcpy( S, T )		( S2U ( strcpy ( U2S ( S ), U2S ( T ) ) ) )
60
#define ustrcpy_v( S, T )	( strcpy_v ( U2S ( S ), U2S ( T ) ) )
61
#define ustrcmp( S, T )		( strcmp ( U2S ( S ), U2S ( T ) ) )
62
#define ustreq( S, T )		( strcmp ( U2S ( S ), U2S ( T ) ) == 0 )
63
#define ustrseq( S, T )		( strcmp ( U2S ( S ), ( T ) ) == 0 )
64
#define ustrchr( S, C )		( S2U ( strchr ( U2S ( S ), ( C ) ) ) )
65
#define ustrrchr( S, C )	( S2U ( strrchr ( U2S ( S ), ( C ) ) ) )
66
 
67
 
68
#endif