Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:15:27

0001 /*
0002  * Motif
0003  *
0004  * Copyright (c) 1987-2012, The Open Group. All rights reserved.
0005  *
0006  * These libraries and programs are free software; you can
0007  * redistribute them and/or modify them under the terms of the GNU
0008  * Lesser General Public License as published by the Free Software
0009  * Foundation; either version 2 of the License, or (at your option)
0010  * any later version.
0011  *
0012  * These libraries and programs are distributed in the hope that
0013  * they will be useful, but WITHOUT ANY WARRANTY; without even the
0014  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
0015  * PURPOSE. See the GNU Lesser General Public License for more
0016  * details.
0017  *
0018  * You should have received a copy of the GNU Lesser General Public
0019  * License along with these librararies and programs; if not, write
0020  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
0021  * Floor, Boston, MA 02110-1301 USA
0022  * 
0023  */
0024 #include <Xm/Picture.h>
0025 
0026 #define NUMDIGIT      '#'
0027 #define HEXDIGIT      'x'
0028 #define OCTALDIGIT    'o'
0029 #define NONCASELETTER '?'
0030 #define UPCASELETTER  '&'
0031 #define NONCASECHAR   '@'
0032 #define UPCASECHAR    '!'
0033 #define ESCAPE        ';'
0034 #define CLOSURE       '*'
0035 #define LBRACKET      '['
0036 #define RBRACKET      ']'
0037 #define LBRACE        '{'
0038 #define RBRACE        '}'
0039 #define ALTERNATIVE   ','
0040 
0041 #define NODE_START_COUNT 40
0042 
0043 typedef enum {
0044     NullTransition,     /* Transition on no input */
0045     NumericDigit,       /* eqivalent to [0-9] */
0046     HexDigit,           /* eqivalent to [0-9a-fA-F] */
0047     OctalDigit,         /* eqivalent to [0-7] */
0048     AnyLetter,          /* [a-zA-Z] */
0049     UpCaseLetter,       /* ditto, but translates [a-zA-Z] -> [A-Z] */
0050     AnyCharacter,       /* Any printing character */
0051     UpCaseCharacter,        /* ditto, case transition as above */
0052     LiteralCharacter        /* Single character */
0053 } XmTransType;
0054 
0055 typedef struct _XmPictureTransition {
0056     int                 destination;   /* Node to transition to */
0057     XmTransType         type;          /* literal, null, upcasechar, etc... */
0058     char                c;         /* key -- used for literals */
0059                        /* OR: count for closures */
0060     struct _XmPictureTransition *next; /* Next transition from our node */
0061 } XmPictureTransition;
0062 
0063 typedef struct _XmPictureNode {
0064     int                  index;
0065     XmPictureTransition *transitions;
0066 } XmPictureNode;
0067 
0068 typedef struct _XmPictureRec {
0069     char          * source; /* string it was parsed from */
0070     int             num_nodes;
0071     int             nodes_alloced;
0072     int             start_node;
0073     int             final_node;
0074     XmPictureNode **nodes;  /* array of nodes */
0075 } XmPictureRec;
0076 
0077 typedef struct _XmPictureStateRec {
0078     XmPictureRec  *picture;
0079     char          *current_string;
0080     char          *append;
0081     int            statesize;
0082     unsigned char *state;   /* bitvector of states */
0083     unsigned char *newstate;    /* scratch space for use in
0084                    transitions */
0085     char           current; /* currently added character */
0086     Boolean        upcase;
0087 } XmPictureStateRec;
0088 
0089 typedef struct _XmAutoFill {
0090     char    c;          /* char to fill */
0091     Boolean reject;     /* literal's didn't match: it's "right out" */
0092     Boolean digit;      /* isdigit(c) must be true */
0093     Boolean upcase;     /* isupper(c) must be true */
0094     Boolean letter;     /* isalpha(c) must be true */
0095     Boolean hexdigit;       /* isxdigit(c) must be true */
0096     Boolean octaldigit;     /* must be 0-7 */
0097 } XmAutoFill;