- Remove old RPCRT4.

svn path=/trunk/; revision=9305
This commit is contained in:
Filip Navara 2004-05-04 20:12:04 +00:00
parent 97a1bb9c2e
commit 4aeca8b2b1
12 changed files with 0 additions and 1001 deletions

View file

@ -1,117 +0,0 @@
/*
*
*/
#ifndef __LIB_RPCRT4_INCLUDE_RPC_H
#define __LIB_RPCRT4_INCLUDE_RPC_H
#define RPC_MGR_EPV VOID
typedef RPC_BINDING_HANDLE handle_t
/*
* RPC packet types
*/
#define RPC_REQUEST (0x0)
#define RPC_PING (0x1)
#define RPC_RESPONSE (0x2)
#define RPC_FAULT (0x3)
#define RPC_WORKING (0x4)
#define RPC_NOCALL (0x5)
#define RPC_REJECT (0x6)
#define RPC_ACK (0x7)
#define RPC_CL_CANCEL (0x8)
#define RPC_FACK (0x9)
#define RPC_CANCEL_ACK (0xa)
#define RPC_BIND (0xb)
#define RPC_BINDACK (0xc)
#define RPC_BINDNACK (0xd)
#define RPC_ALTCONT (0xe)
#define RPC_AUTH3 (0xf)
#define RPC_BINDCONT (0x10)
#define RPC_SHUTDOWN (0x10)
#define RPC_CO_CANCEL (0x11)
#define RPC_ORPHANED (0x12)
/*
* Common RPC packet header
*/
typedef struct _RPC_HEADER_PACKET
{
UCHAR MajorVersion;
UCHAR MinorVersion;
UCHAR PacketType;
UCHAR Flags;
ULONG DataRep;
USHORT FragLen;
USHORT AuthLen;
ULONG CallId;
} RPC_HEADER_PACKET, *PRPC_HEADER_PACKET;
/*
* Additional header for a RPC request packet
*/
typedef struct _RPC_REQUEST_PACKET
{
ULONG AllocHint;
USHORT ContextId;
USHORT Opcode;
} RPC_REQUEST_PACKET, *PRPC_REQUEST_PACKET;
typedef struct _RPC_RESPONSE_PACKET
{
ULONG AllocHint;
USHORT ContextId;
UCHAR CancelCount;
UCHAR Reserved;
} RPC_RESPONSE_PACKET, *PRPC_RESPONSE_PACKET;
typedef struct _RPC_VERSION
{
USHORT MajorVersion;
USHORT MinorVersion;
} RPC_VERSION, *PRPC_VERSION;
typedef struct _RPC_SYNTAX_IDENTIFIER
{
GUID SyntaxGuid;
RPC_VERSION SyntaxVersion;
} RPC_SYNTAX_IDENTIFIER, *PRPC_SYNTAX_IDENTIFIER;
typedef struct _RPC_MESSAGE
{
RPC_BINDING_HANDLE Handle;
ULONG DataRepresentation;
VOID* Buffer;
USHORT BufferLength;
USHORT ProcNum;
PRPC_SYNTAX_IDENTIFIER TransferSyntax;
VOID* RpcInterfaceInformation;
VOID* ReservedForRuntime;
RPC_MGR_EPV* ManagerEpv;
VOID* ImportContext;
ULONG RpcFlags;
} RPC_MESSAGE, *PRPC_MESSAGE;
typedef VOID (*RPC_DISPATCH_FUNCTION)(PRPC_MESSAGE Message);
typedef struct _RPC_DISPATCH_TABLE
{
ULONG DispatchTableCount;
RPC_DISPATCH_FUNCTION* DispatchTable;
LONG Reserved;
} RPC_DISPATCH_TABLE, *PRPC_DISPATCH_TABLE;
typedef struct _RPC_SERVER_INTERFACE
{
ULONG Length;
RPC_SYNTAX_IDENTIFIER InterfaceId;
RPC_SYNTAX_IDENTIFIER TransferSyntax;
PRPC_DISPATCH_TABLE DispatchTable;
ULONG RpcProtseqEndpointCount;
PRPC_PROTSEQ_ENDPOINT RpcProtseqEndpoint;
RPC_MGR_EPV* DefaultManagerEpv;
VOID CONST* InterpreterInfo;
ULONG Flags;
} RPC_SERVER_INTERFACE, *PRPC_SERVER_INTERFACE;
#endif /* __LIB_RPCRT4_INCLUDE_RPC_H */

View file

@ -1,43 +0,0 @@
#ifndef __INCLUDE_RPCRT4_RPC_H
#define __INCLUDE_RPCRT4_RPC_H
typedef void* RPC_BINDING_HANDLE;
typedef long RPC_STATUS;
typedef ULONG RPC_PROTOCOL_ID;
typedef ULONG RPC_PROTSEQ_ID;
typedef struct
{
RPC_PROTSEQ_ID ProtseqId;
ULONG Len;
sockaddr_t sa;
} *PRPC_ADDR;
typedef struct _RPC_PROTOCOL_VERSION
{
ULONG MajorVersion;
ULONG MinorVersion;
} RPC_PROTOCOL_VERSION, *PRPC_PROTOCOL_VERSION;
typedef struct _RPC_BINDING_REP
{
LIST_ENTRY ListEntry;
RPC_PROTOCOL_ID ProtocolId;
LONG ReferenceCount;
UUID ObjectId;
PRPC_ADDR RpcAddr;
BOOLEAN IsServer;
BOOLEAN AddrIsDynamic;
PVOID AuthInfo;
ULONG ExtendedBindFlag;
ULONG BoundServerInstance;
ULONG AddrHasEndpoint;
LONG CallsInProgress;
PVOID NsSpecific;
PRPC_PROTOCOL_VERSION ProtocolVersion;
} RPC_BINDING_REP, *PRPC_BINDING_REP;
#endif /* __INCLUDE_RPCRT4_RPC_H */

View file

@ -1,54 +0,0 @@
# $Id: Makefile,v 1.3 2003/08/07 04:03:23 royce Exp $
#
# ReactOS Operating System
#
TARGET=midl
CFLAGS =
# require os code to explicitly request A/W version of structs/functions
CFLAGS += -D_DISABLE_TIDENTS
all: midl$(EXE_POSTFIX)
idl.tab.o: idl.y
bison -t -v -d idl.y
$(NATIVE_CC) -c idl.tab.c -o idl.tab.o
lex.yy.o: idl.l idl.tab.h
flex idl.l
$(NATIVE_CC) -c lex.yy.c -o lex.yy.o
midl.o: midl.c midl.h idl.tab.h
$(NATIVE_CC) -c midl.c -o midl.o
option.o: option.c midl.h idl.tab.h
$(NATIVE_CC) -c option.c -o option.o
interface.o: interface.c midl.h idl.tab.h
$(NATIVE_CC) -c interface.c -o interface.o
types.o: types.c midl.h idl.tab.h types.h
$(NATIVE_CC) -c types.c -o types.o
midl$(EXE_POSTFIX): idl.tab.o lex.yy.o midl.o option.o interface.o types.o
$(NATIVE_CC) midl.o idl.tab.o lex.yy.o option.o interface.o -lfl \
types.o -o midl$(EXE_POSTFIX)
include ../../../rules.mak

View file

@ -1,34 +0,0 @@
[
uuid(b574a080-aceb-11d3-95f9-aa43ded19f71),
version(1.0),
pointer_default(unique)
]
interface hello
{
struct _hello_struct
{
int hello_member;
int hello1_member;
float hello3_member;
};
typedef struct _hello2_struct
{
int hello2_member;
} __hello2_struct;
typedef struct
{
int hello3_member;
} hello3_typedef;
typedef int hello_t;
void Hello4Proc([in] hello3_typedef ii);
void Hello3Proc([in] __hello2_struct h);
void Hello2Proc([in] struct _hello_struct h);
void HelloProc([in] hello_t pszString);
void Shutdown(void);
void RpcBenchmark(handle_t Server,
[out, size_is(32768)] unsigned char* pcOutBuffer);
}

View file

@ -1,114 +0,0 @@
%{
#include "midl.h"
#include "idl.tab.h"
#include <string.h>
int lineno = 1;
void yyerror(char* s);
char* current_file;
int nr_errors = 0;
#define TOK(n) { yylval.token = n; return n; }
%}
DIGIT [0-9]
ID [a-zA-Z_][a-zA-Z0-9_]*
UUID [a-z0-9]*
%%
uuid { TOK(UUID_KEYWORD); }
version { TOK(VERSION_KEYWORD); }
pointer_default { TOK(POINTER_DEFAULT_KEYWORD); }
unique { TOK(UNIQUE_KEYWORD); }
interface { TOK(INTERFACE_KEYWORD); }
aggregatable { TOK(AGGREGATABLE_KEYWORD); }
allocate { TOK(ALLOCATE_KEYWORD); }
appobject { TOK(APPOBJECT_KEYWORD); }
all_nodes { TOK(ALL_NODES_KEYWORD); }
single_node { TOK(SINGLE_NODE_KEYWORD); }
free { TOK(FREE_KEYWORD); }
dont_free { TOK(DONT_FREE_KEYWORD); }
typedef { TOK(TYPEDEF_KEYWORD); }
struct { TOK(STRUCT_KEYWORD); }
const { TOK(CONST_KEYWORD); }
signed { TOK(SIGNED_KEYWORD); }
unsigned { TOK(UNSIGNED_KEYWORD); }
in { TOK(IN_KEYWORD); }
out { TOK(OUT_KEYWORD); }
string { TOK(STRING_KEYWORD); }
implicit_handle { TOK(IMPLICIT_HANDLE_KEYWORD); }
auto_handle { TOK(AUTO_HANDLE_KEYWORD); }
size_is { TOK(SIZE_IS_KEYWORD); }
length_is { TOK(LENGTH_IS_KEYWORD); }
{ID} { int n;
if ((n = token_to_type(yytext)) != 0)
{
yylval.tval = n;
return(TYPE_KEYWORD);
}
else
{
yylval.id = strdup(yytext);
return(ID_TOKEN);
}
}
{DIGIT}+ { yylval.number = atoi(yytext);
return(NUMBER_TOKEN); }
{DIGIT}+"."{DIGIT}+ { char* ebuf;
yylval.version.major = strtoul(yytext, &ebuf, 0);
yylval.version.minor = strtoul(ebuf + 1, NULL, 0);
return(VERSION_TOKEN); }
{UUID}+"-"{UUID}+"-"{UUID}+"-"{UUID}+"-"{UUID}+ { yylval.uuid = strdup(yytext);
return(UUID_TOKEN); }
";" { TOK(LINE_TERMINATOR); }
"(" { TOK(LEFT_BRACKET); }
")" { TOK(RIGHT_BRACKET); }
"," { TOK(COMMA); }
"{" { TOK(LCURLY_BRACKET); }
"}" { TOK(RCURLY_BRACKET); }
"[" { TOK(LSQBRACKET); }
"]" { TOK(RSQBRACKET); }
"*" { TOK(STAR); }
"=" { TOK(ASSIGNMENT); }
\n lineno++;
[ \t\r]+ ;
. yyerror("invalid character");
%%
void yyerror(char* s)
{
nr_errors++;
printf("%s:%d: %s at %s\n", current_file, lineno, s, yytext);
}
void yyerror1(char* s)
{
nr_errors++;
printf("%s:%d: %s\n", current_file, lineno, s);
}

View file

@ -1,201 +0,0 @@
%{
#include "midl.h"
%}
%union {
int tval;
int token;
char* id;
int number;
char* uuid;
char operator;
char* string;
struct
{
int minor;
int major;
} version;
}
%token <id> ID_LITERAL
%token <uuid> UUID_LITERAL
%token NUMBER_LITERAL
%token <version> VERSION_LITERAL
%token STRING_LITERAL
%token ENDPOINT_KEYWORD
%token EXCEPTIONS_KEYWORD
%token LOCAL_KEYWORD
%token IMPORT_KEYWORD
%token UUID_KEYWORD
%token VERSION_KEYWORD
%token POINTER_DEFAULT_KEYWORD
%token <token> UNIQUE_KEYWORD
%token INTERFACE_KEYWORD
%token IMPLICIT_HANDLE_KEYWORD
%token AUTO_HANDLE_KEYWORD
%token AGGREGATABLE_KEYWORD
%token ALLOCATE_KEYWORD
%token APPOBJECT_KEYWORD
%token ALL_NODES_KEYWORD
%token SINGLE_NODE_KEYWORD
%token FREE_KEYWORD
%token DONT_FREE_KEYWORD
%token TYPEDEF_KEYWORD
%token STRUCT_KEYWORD
%token CONST_KEYWORD
%token IN_KEYWORD
%token OUT_KEYWORD
%token STRING_KEYWORD
%token SIZE_IS_KEYWORD
%token LENGTH_IS_KEYWORD
%token UNSIGNED_KEYWORD
%token SIGNED_KEYWORD
%token LSQBRACKET, RSQBRACKET, LBRACKET, RBRACKET
%token LCURLY_BRACKET, RCURLY_BRACKET, LINE_TERMINATOR, COMMA
%token LEFT_BRACKET, RIGHT_BRACKET
%token STAR
%token ASSIGNMENT
%token <tval> TYPE_KEYWORD
%type <tval> type
%type <tval> sign
%type <tval> struct_def
%%
idl_file:
LSQBRACKET options RSQBRACKET interface
;
options:
option
| option COMMA options
;
option:
UUID_KEYWORD LEFT_BRACKET UUID_TOKEN RIGHT_BRACKET
{ set_uuid($3); }
| VERSION_KEYWORD LEFT_BRACKET VERSION_TOKEN RIGHT_BRACKET
{ set_version($3.major, $3.minor); }
| ENDPOINT_KEYWORD LEFT_BRACKET port_specs RIGHT_BRACKET
| EXCEPTIONS_KEYWORD LEFT_BRACKET excep_names RIGHT_BRACKET
| LOCAL_KEYWORD
| POINTER_DEFAULT_KEYWORD LEFT_BRACKET UNIQUE_KEYWORD RIGHT_BRACKET
{ set_pointer_default($3); }
;
port_specs:
| STRING_TOKEN COMMA port_specs
;
excep_names: ID_TOKEN { }
| ID_TOKEN COMMA excep_names { }
;
interface: { start_interface(); }
INTERFACE_KEYWORD ID_TOKEN LCURLY_BRACKET interface_components
RCURLY_BRACKET
{ end_interface($3); }
interface_components:
| interface_component LINE_TERMINATOR interface_components
interface_component:
| IMPORT_KEYWORD import_list
| function
| TYPEDEF_KEYWORD typedef
| CONST_KEYWORD type ID_TOKEN ASSIGNMENT const_expr
| STRUCT_KEYWORD struct_def RCURLY_BRACKET
;
import_list: STRING_TOKEN
| STRING_TOKEN COMMA import_list
;
const_expr: NUMBER_TOKEN
| STRING_TOKEN
;
typedef: type ID_TOKEN { add_typedef($2, $1); };
function: { start_function(); }
type ID_TOKEN LEFT_BRACKET argument_list RIGHT_BRACKET
{ end_function($2, $3); }
;
argument_list:
| TYPE_KEYWORD { if ($1 != VOID_TYPE)
{
yyerror("parameter name ommitted");
}
}
| argument
| argument COMMA argument_list
;
argument: arg_attrs type ID_TOKEN { add_argument($2, $3); }
| type ID_TOKEN { add_argument($1, $2); }
;
type: sign TYPE_KEYWORD STAR { $$ = $2 | POINTER_TYPE_OPTION | $1; }
| sign TYPE_KEYWORD { $$ = $2 | $1; }
| TYPE_KEYWORD { $$ = $1; }
| TYPE_KEYWORD STAR { $$ = $1 | POINTER_TYPE_OPTION; }
| STRUCT_KEYWORD struct_def RCURLY_BRACKET { $$ = $2; }
| STRUCT_KEYWORD ID_TOKEN { $$ = struct_to_type($2); }
;
struct_def: ID_TOKEN { start_struct($1); } LCURLY_BRACKET
struct_members { $$ = end_struct(); }
| { start_struct(NULL); } LCURLY_BRACKET
struct_members { $$ = end_struct(); }
;
struct_members:
| type ID_TOKEN LINE_TERMINATOR struct_members
{ add_struct_member($2, $1); }
;
/*
* Rules for the optional sign for an integer type
*/
sign: UNSIGNED_KEYWORD { $$ = UNSIGNED_TYPE_OPTION; }
| SIGNED_KEYWORD { $$ = SIGNED_TYPE_OPTION; }
;
arg_attrs: LSQBRACKET arg_attr_list RSQBRACKET
;
/*
* Rules for the list of attributes for arguments
*/
arg_attr_list: arg_attr
| arg_attr COMMA arg_attr_list
;
/*
* Rules for the various attributes for arguments
*/
arg_attr: IN_KEYWORD
| OUT_KEYWORD
| STRING_KEYWORD
| LENGTH_IS_KEYWORD BRACKETED_QUANTITY
| SIZE_IS_KEYWORD BRACKETED_QUANTITY
;
/*
*
*/
BRACKETED_QUANTITY: LEFT_BRACKET NUMBER_TOKEN RIGHT_BRACKET
| LEFT_BRACKET ID_TOKEN RIGHT_BRACKET
;

View file

@ -1,74 +0,0 @@
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include "midl.h"
#include "idl.tab.h"
static interface* current_interface;
static function* current_function;
void add_argument(int type, char* name)
{
argument* arg;
arg = malloc(sizeof(argument));
arg->type = type;
arg->name = strdup(name);
arg->next = current_function->arguments;
current_function->arguments = arg;
}
void start_interface(void)
{
current_interface = (interface *)malloc(sizeof(interface));
}
void start_function(void)
{
function* f;
f = (function *)malloc(sizeof(function));
f->arguments = NULL;
f->next = current_interface->function_list;
current_interface->function_list = f;
current_function = f;
}
void end_function(int rtype, char* name)
{
current_function->return_type = rtype;
current_function->name = strdup(name);
}
void end_interface(char* name)
{
function* cur;
argument* a;
printf("interface_name: %s\n", name);
current_interface->name = strdup(name);
cur = current_interface->function_list;
while (cur != NULL)
{
print_type(cur->return_type);
printf(" function_name: %s (\n", cur->name, cur);
a = cur->arguments;
while (a != NULL)
{
printf("\t");
print_type(a->type);
printf(" %s\n", a->name);
a = a->next;
}
printf(")\n");
cur = cur->next;
}
}

View file

@ -1,79 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
extern FILE* yyin;
extern int yyparse(void);
extern int yydebug;
extern int nr_errors;
extern char* current_file;
int main(int argc, char* argv[])
{
int fd;
char* tempname;
int n, p, status;
char* args[9];
if (argc == 1)
{
printf("Not enough arguments\n");
exit(1);
}
tempname = tempnam(NULL, "midl");
args[0] = strdup("/usr/bin/gcc");
args[1] = strdup("-x");
args[2] = strdup("c");
args[3] = strdup("-P");
args[4] = strdup("-E");
args[5] = strdup(argv[1]);
args[6] = strdup("-o");
args[7] = strdup(tempname);
args[8] = NULL;
if ((n = fork()) == 0)
{
execv("/usr/bin/gcc", args);
perror("gcc");
exit(1);
}
else if (n == -1)
{
perror("midl");
exit(1);
}
p = waitpid(n, &status, WUNTRACED);
if (p == -1 || p == 0 || !WIFEXITED(status))
{
perror("midl");
exit(1);
}
if (WEXITSTATUS(status) != 0)
{
printf("midl: the preprocessor %s failed\n");
exit(1);
}
// yydebug = 1;
yyin = fopen(tempname, "r+b");
if (yyin == NULL)
{
perror(argv[1]);
exit(1);
}
current_file = strdup(argv[1]);
if (yyparse() != 0 || nr_errors > 0)
{
exit(1);
}
unlink(tempname);
}

View file

@ -1,37 +0,0 @@
#ifndef __MIDL_H
#define __MIDL_H
#include "types.h"
typedef struct _argument
{
int type;
char* name;
struct _argument* next;
} argument;
typedef struct _function
{
int return_type;
char* name;
argument* arguments;
struct _function* next;
} function;
typedef struct
{
char* name;
function* function_list;
} interface;
void set_uuid(char* uuid);
void set_version(int major, int minor);
void set_pointer_default(int option);
void start_interface(void);
void end_interface(char* name);
void start_function(void);
void end_function(int rtype, char* name);
void add_argument(int type, char* name);
#endif __MIDL_H

View file

@ -1,16 +0,0 @@
#include <stdio.h>
#include "midl.h"
#include "idl.tab.h"
void set_uuid(char* uuid)
{
}
void set_version(int major, int minor)
{
}
void set_pointer_default(int option)
{
}

View file

@ -1,190 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "midl.h"
struct _type;
typedef struct _struct_member
{
char* name;
unsigned int value;
struct _struct_member* next;
} struct_member;
typedef struct
{
struct_member* member_list;
char* tag;
struct _type* type_value;
} struct_type;
typedef struct _type
{
char* name;
unsigned int value;
unsigned int default_sign;
struct_type* struct_desc;
} type;
static struct_type struct_types[255];
static int next_struct_slot_free = 0;
static struct_type* current_struct;
static type types[255] = {
{NULL, 0, 0},
{"boolean", BOOLEAN_TYPE, UNSIGNED_TYPE_OPTION},
{"byte", BYTE_TYPE, 0},
{"char", CHAR_TYPE, UNSIGNED_TYPE_OPTION},
{"double", DOUBLE_TYPE, 0},
{"enum", ENUM_TYPE, 0},
{"error_status_t", ERROR_STATUS_TYPE, UNSIGNED_TYPE_OPTION},
{"float", FLOAT_TYPE, 0},
{"handle_t", HANDLE_TYPE, 0},
{"hyper", HYPER_TYPE, SIGNED_TYPE_OPTION},
{"int", INT_TYPE, SIGNED_TYPE_OPTION},
{"__int32", INT32_TYPE, SIGNED_TYPE_OPTION},
{"__int3264", INT32OR64_TYPE, SIGNED_TYPE_OPTION},
{"__int64", INT64_TYPE, SIGNED_TYPE_OPTION},
{"long", LONG_TYPE, SIGNED_TYPE_OPTION},
{"short", SHORT_TYPE, SIGNED_TYPE_OPTION},
{"small", SMALL_TYPE, SIGNED_TYPE_OPTION},
{"void", VOID_TYPE, 0},
{"wchar_t", WCHAR_TYPE, UNSIGNED_TYPE_OPTION},
{NULL, 0, 0}
};
static int next_free_slot = 18;
unsigned int struct_to_type(char* tag)
{
int i;
for (i = 0; i < next_struct_slot_free; i++)
{
if (strcmp(tag, struct_types[i].tag) == 0)
{
return(struct_types[i].type_value->value);
}
}
return(0);
}
void start_struct(char* tag)
{
char* name;
if (tag == NULL)
{
tag = malloc(255);
sprintf(tag, "__unnamed_struct%d", next_struct_slot_free);
}
name = malloc(strlen("struct ") + strlen(tag) + 1);
strcpy(name, "struct ");
strcat(name, tag);
struct_types[next_struct_slot_free].tag = strdup(tag);
struct_types[next_struct_slot_free].member_list = NULL;
current_struct = &struct_types[next_struct_slot_free];
types[next_free_slot].name = name;
types[next_free_slot].value = next_free_slot << 8;
types[next_free_slot].default_sign = 0;
types[next_free_slot].struct_desc =
&struct_types[next_struct_slot_free];
struct_types[next_struct_slot_free].type_value = &types[next_free_slot];
next_struct_slot_free++;
next_free_slot++;
}
void add_struct_member(char* name, unsigned int type)
{
struct_member* member;
member = malloc(sizeof(struct_member));
member->name = strdup(name);
member->value = type;
member->next = current_struct->member_list;
current_struct->member_list = member;
}
unsigned int end_struct(void)
{
int n;
struct_member* cur;
printf("Defining struct %s {\n", current_struct->tag);
cur = current_struct->member_list;
while (cur != NULL)
{
print_type(cur->value);
printf(" %s\n", cur->name);
cur = cur->next;
}
printf("}\n");
n = current_struct->type_value->value;
current_struct = NULL;
return(n);
}
void add_typedef(char* name, int type)
{
printf("Adding typedef %s to ", name);
print_type(type);
printf("\n");
types[next_free_slot].name = strdup(name);
types[next_free_slot].value = type;
types[next_free_slot].default_sign = 0;
next_free_slot++;
}
void print_type(int tval)
{
int i;
for (i = 1; i < next_free_slot; i++)
{
if ((tval & BASE_TYPE_MASK) == types[i].value)
{
if (tval & UNSIGNED_TYPE_OPTION)
{
printf("unsigned ");
}
if (tval & SIGNED_TYPE_OPTION)
{
printf("signed ");
}
printf("%s", types[i].name);
if (tval & POINTER_TYPE_OPTION)
{
printf("*");
}
return;
}
}
printf("unknown type");
}
int token_to_type(char* token)
{
int i;
for (i = 1; i < next_free_slot; i++)
{
if (strcmp(types[i].name, token) == 0)
{
return(types[i].value);
}
}
return(0);
}

View file

@ -1,42 +0,0 @@
#ifndef __TYPES_H
#define __TYPES_H
#define BASE_TYPE_MASK (~0xff)
#define BOOLEAN_TYPE (0x100)
#define BYTE_TYPE (0x200)
#define CHAR_TYPE (0x300)
#define DOUBLE_TYPE (0x400)
#define ERROR_STATUS_TYPE (0x500)
#define FLOAT_TYPE (0x600)
#define HANDLE_TYPE (0x700)
#define HYPER_TYPE (0x800)
#define INT_TYPE (0x900)
#define INT32_TYPE (0xA00)
#define INT32OR64_TYPE (0xB00)
#define INT64_TYPE (0xC00)
#define LONG_TYPE (0xD00)
#define SHORT_TYPE (0xE00)
#define SMALL_TYPE (0xF00)
#define VOID_TYPE (0x1000)
#define WCHAR_TYPE (0x1100)
#define UNSIGNED_TYPE_OPTION (0x1)
#define SIGNED_TYPE_OPTION (0x2)
#define POINTER_TYPE_OPTION (0x4)
#define IN_TYPE_OPTION (0x8)
#define OUT_TYPE_OPTION (0x10)
#define STRING_TYPE_OPTION (0x20)
int token_to_type(char* token);
void print_type(int tval);
void add_typedef(char* name, int type);
void start_struct(char* tag);
void add_struct_member(char* name, unsigned int type);
unsigned int end_struct(void);
unsigned int struct_to_type(char* tag);
#endif