Annotation of mstools/samples/sdktools/mc/mc.h, revision 1.1.1.1

1.1       root        1: /*++
                      2: 
                      3: Copyright (c) 1991  Microsoft Corporation
                      4: 
                      5: Module Name:
                      6: 
                      7:     mc.h
                      8: 
                      9: Abstract:
                     10: 
                     11:     This is the main include file for the Win32 Message Compiler (MC)
                     12: 
                     13: Author:
                     14: 
                     15:     Steve Wood (stevewo) 21-Aug-1991
                     16: 
                     17: Revision History:
                     18: 
                     19: --*/
                     20: 
                     21: #if 0
                     22: #include <nt.h>
                     23: #include <ntrtl.h>
                     24: #include <nturtl.h>
                     25: #endif
                     26: 
                     27: #include <process.h>
                     28: #include <stdio.h>
                     29: #include <stddef.h>
                     30: #include <stdlib.h>
                     31: #include <stdarg.h>
                     32: #include <limits.h>
                     33: #include <malloc.h>
                     34: #include <errno.h>
                     35: #include <ctype.h>
                     36: #include <signal.h>
                     37: #include <string.h>
                     38: #include <time.h>
                     39: #include <io.h>
                     40: #include <fcntl.h>
                     41: #include <conio.h>
                     42: #include <sys\types.h>
                     43: #include <sys\stat.h>
                     44: 
                     45: #ifdef TOOL
                     46: 
                     47: #define MAX_PATH 265
                     48: 
                     49: #else
                     50: 
                     51: #include <windows.h>
                     52: 
                     53: #endif
                     54: 
                     55: //
                     56: // Global constants
                     57: //
                     58: 
                     59: #define MCCHAR_END_OF_LINE_COMMENT    ';'
                     60: 
                     61: #define MCTOK_END_OF_FILE             0x00
                     62: 
                     63: #define MCTOK_NUMBER                  0x01
                     64: #define MCTOK_NAME                    0x02
                     65: #define MCTOK_EQUAL                   0x03
                     66: #define MCTOK_LEFT_PAREN              0x04
                     67: #define MCTOK_RIGHT_PAREN             0x05
                     68: #define MCTOK_COLON                   0x06
                     69: #define MCTOK_PLUS                    0x07
                     70: #define MCTOK_END_OF_LINE_COMMENT     0x08
                     71: 
                     72: #define MCTOK_MSGIDTYPE_KEYWORD       0x11
                     73: #define MCTOK_SEVNAMES_KEYWORD        0x12
                     74: #define MCTOK_FACILITYNAMES_KEYWORD   0x13
                     75: #define MCTOK_LANGNAMES_KEYWORD       0x14
                     76: #define MCTOK_MESSAGEID_KEYWORD       0x15
                     77: #define MCTOK_SEVERITY_KEYWORD        0x16
                     78: #define MCTOK_FACILITY_KEYWORD        0x17
                     79: #define MCTOK_SYMBOLNAME_KEYWORD      0x18
                     80: #define MCTOK_LANGUAGE_KEYWORD        0x19
                     81: 
                     82: 
                     83: //
                     84: // Global data types
                     85: //
                     86: 
                     87: typedef struct _LANGUAGE_INFO {
                     88:     struct _LANGUAGE_INFO *Next;
                     89:     ULONG Id;
                     90:     ULONG Length;
                     91:     PCHAR Text;
                     92: } LANGUAGE_INFO, *PLANGUAGE_INFO;
                     93: 
                     94: typedef struct _MESSAGE_INFO {
                     95:     struct _MESSAGE_INFO *Next;
                     96:     ULONG Id;
                     97:     ULONG Method;
                     98:     PCHAR SymbolicName;
                     99:     PCHAR EndOfLineComment;
                    100:     PLANGUAGE_INFO MessageText;
                    101: } MESSAGE_INFO, *PMESSAGE_INFO;
                    102: 
                    103: #define MSG_PLUS_ONE 0
                    104: #define MSG_PLUS_VALUE 1
                    105: #define MSG_ABSOLUTE 2
                    106: 
                    107: typedef struct _MESSAGE_BLOCK {
                    108:     struct _MESSAGE_BLOCK *Next;
                    109:     ULONG LowId;
                    110:     ULONG HighId;
                    111:     ULONG InfoLength;
                    112:     PMESSAGE_INFO LowInfo;
                    113: } MESSAGE_BLOCK, *PMESSAGE_BLOCK;
                    114: 
                    115: typedef struct _NAME_INFO {
                    116:     struct _NAME_INFO *Next;
                    117:     ULONG LastId;
                    118:     ULONG Id;
                    119:     PVOID Value;
                    120:     BOOLEAN Used;
                    121:     char Name[ 1 ];
                    122: } NAME_INFO, *PNAME_INFO;
                    123: 
                    124: //
                    125: // These mirror the NT header types
                    126: //
                    127: //
                    128: // Code Review
                    129: //
                    130: typedef struct _MESSAGE_RESOURCE_ENTRY {
                    131:     USHORT Length;
                    132:     USHORT Flags;
                    133:     UCHAR Text[ 1 ];
                    134: } MESSAGE_RESOURCE_ENTRY, *PMESSAGE_RESOURCE_ENTRY;
                    135: 
                    136: #define MESSAGE_RESOURCE_UNICODE 0x0001
                    137: 
                    138: typedef struct _MESSAGE_RESOURCE_BLOCK {
                    139:     ULONG LowId;
                    140:     ULONG HighId;
                    141:     ULONG OffsetToEntries;
                    142: } MESSAGE_RESOURCE_BLOCK, *PMESSAGE_RESOURCE_BLOCK;
                    143: 
                    144: typedef struct _MESSAGE_RESOURCE_DATA {
                    145:     ULONG NumberOfBlocks;
                    146:     MESSAGE_RESOURCE_BLOCK Blocks[ 1 ];
                    147: } MESSAGE_RESOURCE_DATA, *PMESSAGE_RESOURCE_DATA;
                    148: 
                    149: 
                    150: 
                    151: 
                    152: //
                    153: // Global variables
                    154: //
                    155: 
                    156: int VerboseOutput;
                    157: int WarnOs2Compatible;
                    158: int InsertSymbolicName;
                    159: int GenerateDecimalValues;
                    160: int ResultCode;
                    161: ULONG CustomerMsgIdBit;
                    162: 
                    163: FILE *MessageFile;
                    164: char MessageFileName[ MAX_PATH ];
                    165: unsigned int MessageFileLineNumber;
                    166: unsigned int Token;
                    167: char TokenCharValue[ 256 ];
                    168: ULONG TokenNumericValue;
                    169: PNAME_INFO TokenKeyword;
                    170: 
                    171: FILE *HeaderFile;
                    172: char HeaderFileName[ MAX_PATH ];
                    173: FILE *RcInclFile;
                    174: char RcInclFileName[ MAX_PATH ];
                    175: FILE *BinaryMessageFile;
                    176: char BinaryMessageFileName[ MAX_PATH ];
                    177: 
                    178: char *MessageIdTypeName;
                    179: 
                    180: PNAME_INFO FacilityNames;
                    181: PNAME_INFO CurrentFacilityName;
                    182: PNAME_INFO SeverityNames;
                    183: PNAME_INFO CurrentSeverityName;
                    184: PNAME_INFO LanguageNames;
                    185: PNAME_INFO CurrentLanguageName;
                    186: 
                    187: PMESSAGE_INFO Messages;
                    188: PMESSAGE_INFO CurrentMessage;
                    189: 
                    190: //
                    191: // Functions defined in mc.c
                    192: //
                    193: 
                    194: void
                    195: McPrintUsage( void );
                    196: 
                    197: 
                    198: //
                    199: // Functions defined in mcparse.c
                    200: //
                    201: 
                    202: BOOLEAN
                    203: McParseFile( void );
                    204: 
                    205: BOOLEAN
                    206: McParseMessageDefinition( void );
                    207: 
                    208: BOOLEAN
                    209: McParseMessageText(
                    210:     PMESSAGE_INFO MessageInfo
                    211:     );
                    212: 
                    213: BOOLEAN
                    214: McParseNameList(
                    215:     PNAME_INFO *NameListHead,
                    216:     BOOLEAN ValueRequired,
                    217:     ULONG MaximumValue
                    218:     );
                    219: 
                    220: BOOLEAN
                    221: McParseName(
                    222:     PNAME_INFO NameListHead,
                    223:     PNAME_INFO *Result
                    224:     );
                    225: 
                    226: 
                    227: //
                    228: // Functions defined in mcout.c
                    229: //
                    230: 
                    231: BOOLEAN
                    232: McBlockMessages( void );
                    233: 
                    234: 
                    235: BOOLEAN
                    236: McWriteBinaryFiles( void );
                    237: 
                    238: 
                    239: 
                    240: //
                    241: // Functions defined in mclex.c
                    242: //
                    243: 
                    244: BOOLEAN
                    245: McInitLexer( void );
                    246: 
                    247: BOOLEAN
                    248: McOpenInputFile( void );
                    249: 
                    250: void
                    251: McFlushComments( void );
                    252: 
                    253: void
                    254: McCloseInputFile( void );
                    255: 
                    256: void
                    257: McCloseOutputFiles( void );
                    258: 
                    259: void
                    260: McInputError(
                    261:     char *Message,
                    262:     BOOLEAN Error,
                    263:     PVOID Argument
                    264:     );
                    265: 
                    266: char *
                    267: McGetLine( void );
                    268: 
                    269: void
                    270: McSkipLine( void );
                    271: 
                    272: char
                    273: McGetChar(
                    274:     BOOLEAN SkipWhiteSpace
                    275:     );
                    276: 
                    277: void
                    278: McUnGetChar(
                    279:     char c
                    280:     );
                    281: 
                    282: unsigned int
                    283: McGetToken(
                    284:     BOOLEAN KeywordExpected
                    285:     );
                    286: 
                    287: void
                    288: McUnGetToken( void );
                    289: 
                    290: char *
                    291: McSkipWhiteSpace(
                    292:     char *s
                    293:     );
                    294: 
                    295: //
                    296: // Functions defined in mcutil.c
                    297: //
                    298: 
                    299: PNAME_INFO
                    300: McAddName(
                    301:     PNAME_INFO *NameListHead,
                    302:     char *Name,
                    303:     ULONG Id,
                    304:     PVOID Value
                    305:     );
                    306: 
                    307: 
                    308: PNAME_INFO
                    309: McFindName(
                    310:     PNAME_INFO NameListHead,
                    311:     char *Name
                    312:     );
                    313: 
                    314: 
                    315: BOOLEAN
                    316: McCharToInteger(
                    317:     PCHAR String,
                    318:     int Base,
                    319:     PULONG Value
                    320:     );
                    321: 
                    322: char *
                    323: McMakeString(
                    324:     char *String
                    325:     );

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.