From d1735c61985d5821bb46a6f341114689506550be Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sun, 9 Apr 2000 18:35:07 +0000 Subject: [PATCH] Removed old resource compiler. --- rc/.cvsignore | 5 - rc/Makefile.in | 28 -- rc/README | 37 -- rc/README.sysres | 19 - rc/TODO | 63 --- rc/parser.h | 108 ------ rc/parser.l | 85 ----- rc/parser.y | 228 ----------- rc/systest.c | 109 ------ rc/winelogo.bmp | Bin 65078 -> 0 bytes rc/winerc.c | 971 ----------------------------------------------- 11 files changed, 1653 deletions(-) delete mode 100644 rc/.cvsignore delete mode 100644 rc/Makefile.in delete mode 100644 rc/README delete mode 100644 rc/README.sysres delete mode 100644 rc/TODO delete mode 100644 rc/parser.h delete mode 100644 rc/parser.l delete mode 100644 rc/parser.y delete mode 100644 rc/systest.c delete mode 100644 rc/winelogo.bmp delete mode 100644 rc/winerc.c diff --git a/rc/.cvsignore b/rc/.cvsignore deleted file mode 100644 index 84b6fb3499..0000000000 --- a/rc/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -Makefile -lex.yy.c -winerc -y.tab.c -y.tab.h diff --git a/rc/Makefile.in b/rc/Makefile.in deleted file mode 100644 index 13306f833f..0000000000 --- a/rc/Makefile.in +++ /dev/null @@ -1,28 +0,0 @@ -DEFS = -D__WINE__ -TOPSRCDIR = @top_srcdir@ -TOPOBJDIR = .. -SRCDIR = @srcdir@ -VPATH = @srcdir@ -PROGRAMS = winerc@PROGEXT@ -MODULE = none - -C_SRCS = winerc.c -EXTRA_SRCS = parser.y parser.l -EXTRA_OBJS = y.tab.o lex.yy.o - -all: $(PROGRAMS) - -depend:: y.tab.h - -@MAKE_RULES@ - -$(PROGRAMS): $(OBJS) - $(CC) $(CFLAGS) -o winerc@PROGEXT@ $(OBJS) $(LEXLIB) - -y.tab.c y.tab.h: parser.y - $(YACC) -d -t $(SRCDIR)/parser.y - -lex.yy.c: parser.l - $(LEX) -8 -I $(SRCDIR)/parser.l - -### Dependencies: diff --git a/rc/README b/rc/README deleted file mode 100644 index 314a03f783..0000000000 --- a/rc/README +++ /dev/null @@ -1,37 +0,0 @@ -This is winerc, the resource compiler for the Wine project. It takes the -same input as rc.exe, but generates C files as output. These C files can -be linked together with the application, which can access the resource -data directly instead of using FindResource/LoadResource/LockResource. -The generated C code contains arrays, which represent the resource as if -it was obtained from LoadResource. A table to map resource names to -pointers is also available. -Primary applications are the resources of sysres.dll and a future -commdlg.dll, but the use in the library version is possible as well. -The expected advantage of using winerc over sysres.dll is a speed -improvement, however, actual data to support that claim are not -available. The use of winerc might also simplify the source code. For -example, the system menu is managed in the function CopySysMenu -(controls/menu.c). A winerc-based implementation would just call - return LoadMenuIndirect(_Sysres_SYSMENU); -As the resources are already in the Wine image, they are loaded on -demand as any other part of a Unix executable image. - -Current State -This is the first release of winerc. It is alpha software, as the rest -of Wine is. If you use it for replacing sysres.dll, or if you write -other parts of Wine which require resource (like commdlg), you will -probably notice a loss in stability. This is especially true for cursor -and icon resources, as they are unlikely to work at all. See the TODO -file for details. - -Copying -The license for Wine applies for winerc as well. Read the files LICENSE -and WARRANTY in the current or any future distribution for details. You -can change any source files, and you can add your own copyright notice, -as long as you leave the existing copyrights intact. - -Bug Reports and Fixes -If you find a bug in winerc, you can report it to me, -martin@cs.csufresno.edu (Martin von Loewis) or to -comp.emulators.ms-windows.wine. If you can fix the bug, send the diffs -and ChangeLog entry to julliard@lrc.epfl.ch (Alexandre Julliard). diff --git a/rc/README.sysres b/rc/README.sysres deleted file mode 100644 index df59f95fbe..0000000000 --- a/rc/README.sysres +++ /dev/null @@ -1,19 +0,0 @@ -This release of winerc contains a resource script for sysres.dll, -obtained by saving it as RC in Borland's Resource Workshop. Obsolete -or duplicate resources where removed. If you find that I deleted to -little or to much, drop me a note. -You are encouraged to create sysres dumps using your favoured resource -editor. If the output cannot be compiled, or the generated C code is -different from mine, report this as a bug. When comparing the results, -note that only the order might be different, which is not considered a -bug. -systest.c is a Windows program which shows how to use winerc generated -resources. Compile it with your Windows compiler, and link it with -sysres.c. It also shows how to prevent curious people from spying your -bitmaps, dialogs, and menus :-) - -Deleted resources: -Bitmap: OBMCLOSE -Menu: 1, 0xF140+2 -Dialog: 0XF140+3, EXCLAMATION_MSGBOX, QUESTION_MSGBOX, STOP_MSGBOX -Icon: SYSIDI_STOPICON diff --git a/rc/TODO b/rc/TODO deleted file mode 100644 index c00d31e8eb..0000000000 --- a/rc/TODO +++ /dev/null @@ -1,63 +0,0 @@ -1. User interface -- use GNU's long_getopt -- allow to pass input and output files via command line -- add options for various not-yet-implemented features (Unicode, Win32 -format, non-native/native alignment and endianness, compact output -format) - -2. Input format -- improve input file processing - Currently, certain pre- and postprocessing is required. winerc - should accept an arbitrary resource script and generate the C file - with as little intermediate files as possible. I'm not sure how to - handle the symbols from windows.h. There are certain options: - * winerc predefines the symbols via the cpp command line - * windows.h is #include'd, and the resulting C code is dropped - (Should winerc do C parsing here?) - * a stripped-down version of windows.h is included, - generated by "grep '^#' windows.h" - * windows.h #ifdef's every C code with _RC_INVOKED - (commercial solution) -- complete input syntax - The goal here is to support every existing resource file which is - accepted by another resource compiler, not to put as much fancy - features into the compiler as possible. Every correct resource file - which generates a parse error can be reported as a bug, a problem - analysis and a fix would be appreciated. - -3. Output file format -- add missing resources (fonts, versioninfo, stringtables,rcdata) -- check style handling - The semantics of control and dialog styles is somewhat poorly - documented. For example, I couldn't find a reference that every - control has the WS_VISIBLE and WS_CHILD style, even if they are - not specified. What other styles are considered default? - The existance of default styles implies support for disabling these, - unlike any other proper programming language, - NOT WS_VISIBLE | WS_GROUP - does *not* mean ~WS_VISIBLE, but WS_CHILD|WS_GROUP (in C semantics). - What other strange semantics are there? -- check cursor and icon handling - At the moment, the .CUR and .ICO files are copied byte-by-byte into - the C array. This is probably wrong, as there are things like cursor - and icon groups. In which way should they be present in a Wine image? - Should we have arrays for every cursor, as well as the cursor group? - Is one cursor per group enough, in the context of X? If so, do we - still need the group? -- create a more compact output file - The current format is well-suited for debugging, as one can easily - match it with a resource' hex dump. A more compact format would use - strings instead of integer lists. A clever algorithm for embedding - values <32 and >127 is required. -- platform independence - Currently, the lay-out of the resources is just as it is in Win3.1 - - packed structures, little endian. Although this format can be used - on any architecture, aligned data and native endianness would speed-up - the resource manipulation and simplify the code. OTOH, this would - break applications that rely on the lay-out. All this is of interest - for the library version only. -- Win32 support - -4. Programming Style -- memory management - No memory is freed in the current implementation. diff --git a/rc/parser.h b/rc/parser.h deleted file mode 100644 index cb345ae4c9..0000000000 --- a/rc/parser.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * - * Copyright Martin von Loewis, 1994 - * - */ - -/* resource types */ -enum rt {acc,bmp,cur,dlg,fnt,ico,men,rdt,str}; -/* generic resource - Bytes can be inserted at arbitrary positions, the data field (res) - grows as required. As the dialog header contains the number of - controls, this number is generated in num_entries. If n_type if 0, - the resource name is i_name, and s_name otherwise. Top level - resources are linked via next. All gen_res objects are linked via - g_prev, g_next for debugging purposes. space is the length of res, - size is the used part of res. - As most bison rules are right recursive, new items are usually - inserted at the beginning -*/ -typedef struct gen_res{ - int size,space; - int num_entries; - enum rt type; - union{ - int i_name; - char* s_name; - }n; - int n_type; /*0 - integer, 1 = string*/ - struct gen_res *next; - struct gen_res *g_prev,*g_next; - unsigned char res[0]; -} gen_res; - -/* control/dialog style. or collects styles, and collects NOT styles */ -typedef struct rc_style{ - int and, or; -}rc_style; - -/* create a new resource */ -gen_res *new_res(void); -/* double the space of the resource */ -gen_res* grow(gen_res*); -/* insert byte array at the beginning, increase count */ -gen_res* insert_at_beginning(gen_res*,char*,int); -/* insert byte array at offset */ -gen_res* insert_bytes(gen_res*,char*,int,int); -/* delete bytes at offset */ -gen_res* delete_bytes(gen_res*,int,int); -/* create a new style */ -rc_style* new_style(void); -/* convert \t to tab etc. */ -char* parse_c_string(char*); -/* get the resources type, convert dlg to "DIALOG" and so on */ -char* get_typename(gen_res*); - -gen_res* add_accelerator(int,int,int,gen_res*); -gen_res* add_string_accelerator(char*,int,int,gen_res*); -gen_res* add_ascii_accelerator(int,int,int,gen_res*); -gen_res* add_vk_accelerator(int,int,int,gen_res*); - -gen_res* new_dialog(void); -gen_res* dialog_style(rc_style*,gen_res*); -int dialog_get_menu(gen_res*); -int dialog_get_class(gen_res*); -int dialog_get_caption(gen_res*); -int dialog_get_fontsize(gen_res*); -gen_res* dialog_caption(char*,gen_res*); -gen_res* dialog_font(short,char*,gen_res*); -gen_res* dialog_class(char*,gen_res*); -gen_res* dialog_menu_id(short,gen_res*); -gen_res* dialog_menu_str(char*,gen_res*); -gen_res* create_control_desc(int,int,int,int,int,rc_style*); -gen_res* label_control_desc(char*,gen_res*); -gen_res* create_generic_control(char*,int,char*,rc_style*,int,int,int,int); -gen_res* add_control(int,int,gen_res*,gen_res*); -gen_res* add_icon(char*,int,int,int,gen_res*,gen_res*); -gen_res* add_generic_control(gen_res*,gen_res*); -gen_res* make_dialog(gen_res*,int,int,int,int,gen_res*); - -gen_res *hex_to_raw(char*,gen_res*); -gen_res *int_to_raw(int,gen_res*); -gen_res *make_font(gen_res*); -gen_res *make_raw(gen_res*); -gen_res *make_bitmap(gen_res*); -gen_res *make_icon(gen_res*); -gen_res *make_cursor(gen_res*); -gen_res *load_file(char*); - -gen_res *add_menuitem(char*,int,int,gen_res*); -gen_res *add_popup(char*,short,gen_res*,gen_res*); -gen_res *make_menu(gen_res*); - -gen_res *add_resource(gen_res*,gen_res*); - -void add_str_tbl_elm(int,char*); - -void create_output(gen_res*); -void set_out_file(char*); - -#define CT_BUTTON 0x80 -#define CT_EDIT 0x81 -#define CT_STATIC 0x82 -#define CT_LISTBOX 0x83 -#define CT_SCROLLBAR 0x84 -#define CT_COMBOBOX 0x85 - -extern int verbose; - diff --git a/rc/parser.l b/rc/parser.l deleted file mode 100644 index 6b98c8da6b..0000000000 --- a/rc/parser.l +++ /dev/null @@ -1,85 +0,0 @@ -/* -*-C-*- - * - * Copyright Martin von Loewis, 1994 - * - */ -%{ - -#include -#include -#include -#include "parser.h" -#include "y.tab.h" - -#define YY_NO_UNPUT - -int line_number=1; -%} -%% -ACCELERATORS return ACCELERATORS; -ALT return ALT; -ASCII return ASCII; -BEGIN return tBEGIN; -BITMAP return tBITMAP; -CAPTION return CAPTION; -CHECKBOX return CHECKBOX; -CHECKED return CHECKED; -CLASS return CLASS; -COMBOBOX return COMBOBOX; -CONTROL return CONTROL; -CTEXT return CTEXT; -CURSOR return CURSOR; -DEFPUSHBUTTON return DEFPUSHBUTTON; -DIALOG return DIALOG; -DISCARDABLE return DISCARDABLE; -EDITTEXT return EDITTEXT; -END return tEND; -FIXED return tFIXED; -FONT return FONT; -GRAYED return GRAYED; -GROUPBOX return GROUPBOX; -HELP return HELP; -ICON return ICON; -INACTIVE return INACTIVE; -LISTBOX return LISTBOX; -LTEXT return LTEXT; -MENU return MENU; -MENUBARBREAK return MENUBARBREAK; -MENUBREAK return MENUBREAK; -MENUITEM return MENUITEM; -MOVEABLE return MOVEABLE; -LOADONCALL return LOADONCALL; -NOINVERT return NOINVERT; -NOT return NOT; -NUMBER return NUMBER; -POPUP return POPUP; -PRELOAD return PRELOAD; -PUSHBUTTON return PUSHBUTTON; -PURE return PURE; -RADIOBUTTON return RADIOBUTTON; -RCDATA return RCDATA; -RTEXT return RTEXT; -SCROLLBAR return SCROLLBAR; -SHIFT return SHIFT; -SEPARATOR return SEPARATOR; -STRING return tSTRING; -STRINGTABLE return STRINGTABLE; -STYLE return STYLE; -VERSIONINFO return VERSIONINFO; -VIRTKEY return VIRTKEY; -\{ return tBEGIN; -\} return tEND; -[+-]?[0-9]+ yylval.num=atoi(yytext);return NUMBER; -0x[0-9A-Fa-f]+L? yylval.num=strtoul(yytext,0,16);return NUMBER; -[A-Za-z][A-Za-z_0-9]* yylval.str=strdup(yytext);return IDENT; -\"[^"]*\" yylval.str=parse_c_string(yytext);return tSTRING; -\'[^']*\' yylval.str=strdup(yytext+1);return SINGLE_QUOTED; -\n { line_number++; } -[ \t\r] ; -. return yytext[0]; -%% - -#ifndef yywrap -int yywrap(void) { return 1; } -#endif - diff --git a/rc/parser.y b/rc/parser.y deleted file mode 100644 index cae8a1a843..0000000000 --- a/rc/parser.y +++ /dev/null @@ -1,228 +0,0 @@ -%{ -/* - * - * Copyright Martin von Loewis, 1994 - */ - -#include -#include -#include "parser.h" -#include "windows.h" - -int yylex(void); -int yyerror(const char *s); - -%} -%union{ - gen_res *res; - char *str; - int num; - struct rc_style *style; -} -%token NUMBER -%token tSTRING SINGLE_QUOTED IDENT -%token ACCELERATORS ALT ASCII tBEGIN tBITMAP CAPTION CHECKBOX CHECKED -%token CLASS COMBOBOX CONTROL CTEXT CURSOR DEFPUSHBUTTON DIALOG -%token DISCARDABLE EDITTEXT tEND tFIXED FONT GRAYED GROUPBOX HELP ICON -%token IDENT INACTIVE LISTBOX LTEXT MENU MENUBARBREAK MENUBREAK MENUITEM -%token MOVEABLE LOADONCALL NOINVERT NOT NOT_SUPPORTED POPUP PRELOAD -%token PURE PUSHBUTTON RADIOBUTTON RCDATA RTEXT SCROLLBAR SHIFT SEPARATOR -%token SINGLE_QUOTED tSTRING STRINGTABLE STYLE VERSIONINFO VIRTKEY -%type resource_file resource resources resource_definition accelerators -%type events bitmap cursor dialog dlg_attributes controls -%type generic_control labeled_control control_desc font icon -%type iconinfo menu menu_body item_definitions rcdata raw_data raw_elements -%type stringtable strings versioninfo -%type acc_options item_options -%type