⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rcos2.y

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 Y
📖 第 1 页 / 共 3 页
字号:
    | Y_MOVEABLE
        { $$.Mask = Y_MOVEABLE; }
    | Y_PURE
        { $$.Mask = Y_PURE; }
    | Y_IMPURE
        { $$.Mask = Y_IMPURE; }
    | Y_DISCARDABLE
        { $$.Mask = Y_DISCARDABLE; }
    | Y_SEGALIGN
        { $$.Mask = Y_SEGALIGN; }
    | Y_INTEGER
        { $$.Mask = Y_INTEGER; $$.Value = $1.val; }
    ;

file-name
    : Y_NAME
    | Y_DOS_FILENAME
    | string-constant
    ;

resource-type
    : Y_BITMAP
        { $$ = Y_BITMAP; }
    | Y_FONT
        { $$ = Y_FONT; }
    | Y_ICON
        { $$ = Y_ICON; }
    | Y_POINTER
        { $$ = Y_POINTER; }
    ;

user-defined-resource
    : Y_RESOURCE type-id comma-opt name-id user-defined-data
        {
            SemAddResourceFree( $4, $2,
                    MEMFLAG_DISCARDABLE | MEMFLAG_PURE | MEMFLAG_MOVEABLE, $5 );
        }
    | Y_RESOURCE type-id comma-opt name-id resource-options user-defined-data
        {
            SemOS2CheckResFlags( &($5), 0, MEMFLAG_DISCARDABLE | MEMFLAG_MOVEABLE,
                    MEMFLAG_PURE );
            SemAddResourceFree( $4, $2, $5.flags, $6 );
        }
    ;

user-defined-data
    : file-name
        { $$ = SemCopyRawFile( $1.string ); RcMemFree( $1.string ); }
    | raw-data-section
        { $$ = SemFlushDataElemList( $1, TRUE ); }
    ;

raw-data-section
    : Y_BEGIN raw-data-items Y_END
        { $$ = $2; }
    | Y_LBRACE raw-data-items Y_RBRACE
        { $$ = $2; }
    ;

control-data-section
    : Y_CTLDATA raw-data-items
       { $$ = $2; }
    ;

raw-data-items
    : raw-data-item
        { $$ = SemNewDataElemList( $1 ); }
    | raw-data-items raw-data-item
        { $$ = SemAppendDataElem( $1, $2 ); }
    | raw-data-items Y_COMMA
        { $$ = $1; }
    ;

raw-data-item
    : string-constant
        {
            $$.IsString    = TRUE;
            $$.LongItem    = $1.lstring;
            $$.StrLen      = $1.length;
            $$.TmpStr      = TRUE;
            $$.WriteNull   = FALSE;
            $$.Item.String = $1.string;
        }
    | constant-expression
        { $$.IsString = FALSE; $$.Item.Num = $1.Value; $$.LongItem = $1.longVal; }
    ;

raw-numeric-data-items
    : raw-numeric-data-item
        { $$ = SemNewDataElemList( $1 ); }
    | raw-numeric-data-items raw-numeric-data-item
        { $$ = SemAppendDataElem( $1, $2 ); }
    | raw-numeric-data-items Y_COMMA
        { $$ = $1; }
    ;

raw-numeric-data-item
    : constant-expression
        { $$.IsString = FALSE; $$.Item.Num = $1.Value; $$.LongItem = FALSE; }
    ;

rc-data-items
    : rc-data-item
        { $$ = SemNewDataElemList( $1 ); }
    | rc-data-items rc-data-item
        { $$ = SemAppendDataElem( $1, $2 ); }
    | rc-data-items Y_COMMA
        { $$ = $1; }
    ;

rc-data-item
    : string-constant
        {
            $$.IsString    = TRUE;
            $$.LongItem    = $1.lstring;
            $$.StrLen      = $1.length;
            $$.TmpStr      = TRUE;
            $$.WriteNull   = TRUE;
            $$.Item.String = $1.string;
        }
    | constant-expression
        { $$.IsString = FALSE; $$.Item.Num = $1.Value; $$.LongItem = $1.longVal; }
    ;

rc-data-section
    : Y_BEGIN rc-data-items Y_END
        { $$ = $2; }
    | Y_LBRACE rc-data-items Y_RBRACE
        { $$ = $2; }
    ;

rc-data
    : rc-data-section
        { $$ = SemFlushDataElemList( $1, TRUE ); }
    ;

rcdata-resource
    : Y_RCDATA name-id rc-data
        {
            SemAddResourceFree( $2, WResIDFromNum( OS2_RT_RCDATA ),
                    MEMFLAG_PURE | MEMFLAG_MOVEABLE, $3 );
        }
    | Y_RCDATA name-id resource-options rc-data
        {
            SemOS2CheckResFlags( &($3), 0, MEMFLAG_DISCARDABLE | MEMFLAG_MOVEABLE,
                    MEMFLAG_PURE );
            SemAddResourceFree( $2, WResIDFromNum( OS2_RT_RCDATA ), $3.flags, $4 );
        }
    ;

presparam-list
    : presparam-stmt
        { $$ = SemOS2NewPresParamList( $1 ); }
    | presparam-list presparam-stmt
        { $$ = SemOS2AppendPresParam( $1, $2 ); }
    | /* nothing */
        { $$ = NULL; }
    ;

presparam-stmt
    : Y_PRESPARAMS presparam-name comma-opt raw-data-items
        {
            $$.Name     = $2;
            $$.dataList = $4;
            $$.size     = 0;
        }
    ;

presparam-name
    : name-id
        { $$ = WResIDToNameOrOrd( $1 ); RcMemFree( $1 ); }
    ;

string-table-resource
    : Y_STRINGTABLE string-section
        {
            SemOS2MergeStrTable( $2,
                MEMFLAG_PURE | MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE,
                SemOS2DefaultCodepage() );
        }
    | Y_STRINGTABLE resource-options string-section
        {
            SemOS2CheckResFlags( &($2), 0, MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE,
                            MEMFLAG_PURE );
            SemOS2MergeStrTable( $3, $2.flags, $2.codePage );
        }
    ;

message-table-resource
    : Y_MESSAGETABLE string-section
        {
            SemOS2MergeMsgTable( $2,
                MEMFLAG_PURE | MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE );
        }
    | Y_MESSAGETABLE resource-options string-section
        {
            SemOS2CheckResFlags( &($2), 0, MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE,
                            MEMFLAG_PURE );
            SemOS2MergeMsgTable( $3, $2.flags );
        }
    ;

string-section
    : Y_BEGIN string-items Y_END
        { $$ = $2; }
    | Y_LBRACE string-items Y_RBRACE
        { $$ = $2; }
    ;

string-items
    : string-item
        {
            $$ = SemOS2NewStringTable();
            SemOS2AddStrToStringTable( $$, $1.ItemID, $1.String );
            RcMemFree( $1.String );
        }
    | string-items string-item
        {
            SemOS2AddStrToStringTable( $1, $2.ItemID, $2.String );
            $$ = $1;
            RcMemFree( $2.String );
        }
    ;

string-item
    : string-id comma-opt string-constant
        { $$.ItemID = $1; $$.String = $3.string; }
    ;

string-id
    : constant-expression
        { $$ = $1.Value; }
    ;

id-value
    : constant-expression
        { $$ = $1.Value; }
    ;

help-table-resource
    : Y_HELPTABLE name-id help-table-section
        {
            SemOS2WriteHelpTable( $2,
                MEMFLAG_PURE | MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE, $3 );
        }
    ;

help-table-section
    : Y_BEGIN help-items Y_END
        { $$ = $2; }
    | Y_LBRACE help-items Y_RBRACE
        { $$ = $2; }
    ;

help-items
    : help-item
        { $$ = SemOS2NewHelpTable( $1 ); }
    | help-items help-item
        { $$ = SemOS2AddHelpItem( $2, $1 ); }
    | /* nothing */
        { $$ = NULL; }
    ;

help-item
    : Y_HELPITEM id-value comma-opt id-value comma-opt id-value comma-opt
        { $$ = SemOS2MakeHelpItem( $2, $4, $6 ); }
    ;

help-subtable-resource
    : Y_HELPSUBTABLE name-id help-subtable-section
        {
            SemOS2WriteHelpSubTable( $2, 2,
                MEMFLAG_PURE | MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE, $3 );
        }
    | Y_HELPSUBTABLE name-id Y_SUBITEMSIZE constant-expression help-subtable-section
        {
            SemOS2WriteHelpSubTable( $2, $4.Value,
                MEMFLAG_PURE | MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE, $5 );
        }
    ;

help-subtable-section
    : Y_BEGIN help-subitems Y_END
        { $$ = $2; }
    | Y_LBRACE help-subitems Y_RBRACE
        { $$ = $2; }
    ;

help-subitems
    : help-subitem
        { $$ = SemOS2NewHelpSubTable( $1 ); }
    | help-subitems help-subitem
        { $$ = SemOS2AddHelpSubItem( $2, $1 ); }
    | /* nothing */
        { $$ = NULL; }
    ;

help-subitem
    : Y_HELPSUBITEM raw-numeric-data-items
        { $$ = $2; }
    ;

accel-table-resource
    : Y_ACCELTABLE name-id acc-section
        {
            SemOS2WriteAccelTable( $2, MEMFLAG_PURE | MEMFLAG_MOVEABLE,
                SemOS2DefaultCodepage(), $3 );
        }
    | Y_ACCELTABLE name-id resource-options acc-section
        {
            SemOS2CheckResFlags( &($3), 0, MEMFLAG_MOVEABLE, MEMFLAG_PURE );
            SemOS2WriteAccelTable( $2, $3.flags, $3.codePage, $4 );
        }
    ;

acc-section
    : Y_BEGIN acc-items Y_END
        { $$ = $2; }
    | Y_LBRACE acc-items Y_RBRACE
        { $$ = $2; }
    ;

acc-items
    : acc-item
        { $$ = SemOS2NewAccelTable( $1 ); }
    | acc-items acc-item
        { $$ = SemOS2AddAccelEntry( $2, $1 ); }
    ;

acc-item
    : acc-event comma-opt acc-cmd
        { $$ = SemOS2MakeAccItem( $1, $3, DefaultAccelFlagsOS2 ); }
    | acc-event comma-opt acc-cmd comma-opt acc-item-options
        { $$ = SemOS2MakeAccItem( $1, $3, $5 ); }
    ;

acc-event
    : string-constant
        {
            $$.event = SemOS2StrToAccelEvent( $1.string );
            $$.strevent = TRUE;
            RcMemFree( $1.string );
        }
    | constant-expression
        {
            $$.event = $1.Value;
            $$.strevent = FALSE;
        }
    ;

acc-cmd
    : constant-expression
        { $$ = $1.Value; }
    ;

acc-item-options
    : acc-item-option
    | acc-item-options comma-opt acc-item-option
        {
            if ($3.flags == OS2_ACCEL_CHAR) {
                $$.flags = $1.flags & ~OS2_ACCEL_VIRTUALKEY;
            } else {
                $$.flags = $1.flags | $3.flags;
            }
            $$.typegiven = $1.typegiven || $3.typegiven;
        }
    ;

acc-item-option
    : Y_ALT
        { $$.flags = OS2_ACCEL_ALT;  $$.typegiven = FALSE; }
    | Y_CHAR
        { $$.flags = OS2_ACCEL_CHAR; $$.typegiven = FALSE; }
    | Y_CONTROL
        { $$.flags = OS2_ACCEL_CTRL; $$.typegiven = FALSE; }
    | Y_HELP
        { $$.flags = OS2_ACCEL_HELP; $$.typegiven = FALSE; }
    | Y_LONEKEY
        { $$.flags = OS2_ACCEL_LONEKEY; $$.typegiven = FALSE; }
    | Y_SCANCODE
        { $$.flags = OS2_ACCEL_SCANCODE; $$.typegiven = FALSE; }
    | Y_SHIFT
        { $$.flags = OS2_ACCEL_SHIFT; $$.typegiven = FALSE; }
    | Y_SYSCOMMAND
        { $$.flags = OS2_ACCEL_SYSCOMMAND; $$.typegiven = FALSE; }
    | Y_VIRTUALKEY
        { $$.flags = OS2_ACCEL_VIRTUALKEY; $$.typegiven = TRUE; }
    ;

menu-resource
    : Y_MENU name-id menu-section
        { SemOS2WriteMenu( $2, MEMFLAG_PURE | MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE,
                    $3, Y_MENU, SemOS2DefaultCodepage() ); }
    | Y_MENU name-id resource-options menu-section
        {
            SemOS2CheckResFlags( &($3), 0, MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE,
                            MEMFLAG_PURE );
            SemOS2WriteMenu( $2, $3.flags, $4, Y_MENU, $3.codePage );
        }
    ;

menu-section
    : Y_BEGIN menu-items Y_END
        { $$ = $2; }
    | Y_LBRACE menu-items Y_RBRACE
        { $$ = $2; }
    ;

menu-items
    : menu-item
        { $$ = SemOS2NewMenu( $1 ); }
    | menu-items menu-item
        { $$ = SemOS2AddMenuItem( $1, $2 ); }
    | /* nothing */
        { $$ = NULL; }
    ;

menu-id
    : constant-expression
      { $$ = $1.Value; }
    ;

menuitem-style
    : constant-expression
      { $$ = $1.Value; }
    ;

menuitem-attrib
    : constant-expression
      { $$ = $1.Value; }
    ;

menu-item
    : menu-entry-stmt
        {
            $$.next = NULL;
            $$.prev = NULL;
            $$.item = $1;
            $$.submenu = NULL;
        }
    | submenu-entry-stmt
        { $$ = $1; }
    ;

menu-entry-stmt
    : Y_MENUITEM menu-entry-defn
        { $$ = $2; }
    ;

submenu-entry-stmt
    : Y_SUBMENU menu-text Y_COMMA menu-id submenu-section
        {
            $$.item.ItemStyle = OS2_MIS_SUBMENU | OS2_MIS_TEXT;
            $$.item.ItemAttrs = 0;
            $$.item.ItemCmd   = $4;
            $$.item.ItemText  = $2.string;
            $$.submenu        = $5;
        }
    | Y_SUBMENU menu-text Y_COMMA menu-id Y_COMMA menuitem-style submenu-section
        {
            $$.item.ItemStyle = OS2_MIS_SUBMENU | $6;
            $$.item.ItemAttrs = 0;
            $$.item.ItemCmd   = $4;
            $$.item.ItemText  = $2.string;
            $$.submenu        = $7;
        }
    | Y_SUBMENU menu-text Y_COMMA menu-id Y_COMMA menuitem-style
                Y_COMMA menuitem-attrib submenu-section
        {
            $$.item.ItemStyle = OS2_MIS_SUBMENU | $6;
            $$.item.ItemAttrs = $8;
            $$.item.ItemCmd   = $4;
            $$.item.ItemText  = $2.string;
            $$.submenu        = $9;
        }
     ;

submenu-section
    : Y_BEGIN menu-items Y_END
        { $$ = $2; }
    | Y_LBRACE menu-items Y_RBRACE
        { $$ = $2; }
    ;

menu-entry-defn
    : Y_SEPARATOR
        {
            $$.ItemStyle = OS2_MIS_SEPARATOR;
            $$.ItemAttrs = OS2_MIA_DISABLED;
            $$.ItemCmd   = -1;
            $$.ItemText  = NULL;
        }
    | menu-text Y_COMMA menu-id
        {
            $$.ItemStyle = OS2_MIS_TEXT;
            $$.ItemAttrs = 0;
            $$.ItemCmd   = $3;
            $$.ItemText  = $1.string;
        }

    | menu-text Y_COMMA menu-id Y_COMMA menuitem-style
        {
            $$.ItemStyle = $5;
            $$.ItemAttrs = 0;
            $$.ItemCmd   = $3;
            $$.ItemText  = $1.string;
        }
    | menu-text Y_COMMA menu-id Y_COMMA Y_COMMA menuitem-attrib
        {
            $$.ItemStyle = OS2_MIS_TEXT;
            $$.ItemAttrs = $6;
            $$.ItemCmd   = $3;
            $$.ItemText  = $1.string;
        }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -