rcompile Overview

RCompile is a command-line application which compiles resources into a .CPP file for incorporation into a Un*x based YAAF application. This tool can also be used to generate .CPP source for resources which you would rather incorporate into a library rather than leave out as an external resource.

Usage

rcompile infile.rl outfile.cpp

Macintosh and Windows applications commonly rely on "resources", small snippets of data which contain things like error strings or the layout of the views inside of a window. Unix, on the other hand, doesn't have this utility. So the solution used by YAAF is to first convert these small data snippets into an array of data objects, and to create an accessor routine to get those snippets of data.

This process is automatically done by the RCompile tool.

The RCompile tool also compiles the resources used to specify the layout of a menu by YAAF, using a specification that is similar to that used by Microsoft Windows in an .RC file.

infile.rl format

The input file is a text file. Comments may be added by using C or C++ style comments; that is, anything between a /* and */ is ignored, as well as all text from a // to the end of line.

There are three different types of resource statements that are accepted by the RCompile tool.

raw type resID data-file

The 'raw' keyword accepts a raw binary data file (such as a bitmap file) into the resource. The type of the resource is a four-character string in single quotes which give the type of resource (such as 'bmap' or 'icon'), and the resID of the resource is an integer resource number to use. The data-file is a string giving the name of the raw binary data to incorporate.

rdata rdata-file

The 'rdata' keyword loads the resources stored in the binary 'rdata' file that was generated by the YAAF Constructor tool. The resource IDs and types are stored in this data file.

menu menuResID menu_definition

The 'menu' keyword defines the format of a menu as used by the YAAF library. This resource is defined in menu_definition, and the resource ID of the menu is in menuResID. The menu definition is:

menu_definition :== begin menu_list end

menu_list :== menu_item | menu_item menu_list

menu_item :== menu menu_name begin item_list end

item_list :== item_item | item_item item_list

item_item :== item | separator

item :== item item_name command_id [accelerator]

separator :== separator

For example, a simple menu item with two menus, a "file" and "edit" menu, would be defined as:

menu 128 begin
    menu "File" begin
        item "Exit"                   3
    end
    menu "Edit" begin
        item "Undo"                   4 'Z'
        separator
        item "Cut"                    5 'X'
        item "Copy"                   5 'C'
        item "Paste"                  5 'V'
        item "Clear"                  5
    end
end

License

The YAAF Constructor is licensed under the GNU General Public License, and may be freely redistributed so long as the terms of the GNU GPL are honored.