From f0bd303530441667f2205f109b5e2342c8e6592c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Tue, 9 Aug 2011 22:51:55 +0000 Subject: [PATCH] [TOOLS] - sync wpp, widl and wrc with wine 1.3.26 svn path=/trunk/; revision=53158 --- reactos/include/host/nls.h | 493 ++- reactos/include/host/wine/wpp.h | 34 +- reactos/tools/widl/client.c | 534 ++-- reactos/tools/widl/expr.c | 5 + reactos/tools/widl/hash.c | 6 +- reactos/tools/widl/header.c | 211 +- reactos/tools/widl/header.h | 9 +- reactos/tools/widl/parser.l | 1 - reactos/tools/widl/parser.tab.c | 4490 ++++++++++++++------------- reactos/tools/widl/parser.tab.h | 13 +- reactos/tools/widl/parser.y | 98 +- reactos/tools/widl/parser.yy.c | 1679 +++++----- reactos/tools/widl/proxy.c | 389 ++- reactos/tools/widl/register.c | 198 +- reactos/tools/widl/server.c | 447 +-- reactos/tools/widl/typegen.c | 1259 ++++++-- reactos/tools/widl/typegen.h | 10 +- reactos/tools/widl/typelib.c | 5 +- reactos/tools/widl/typelib_struct.h | 4 +- reactos/tools/widl/utils.c | 94 + reactos/tools/widl/utils.h | 2 + reactos/tools/widl/widl.c | 24 +- reactos/tools/widl/widl.h | 11 +- reactos/tools/widl/widl.rbuild | 1 - reactos/tools/widl/widltypes.h | 17 +- reactos/tools/widl/write_msft.c | 51 +- reactos/tools/wpp/lex.yy.c | 2847 ++++++++++------- reactos/tools/wpp/ppl.l | 187 +- reactos/tools/wpp/ppy.tab.c | 1857 ++++++----- reactos/tools/wpp/ppy.tab.h | 102 +- reactos/tools/wpp/ppy.y | 125 +- reactos/tools/wpp/preproc.c | 314 +- reactos/tools/wpp/wpp.c | 102 +- reactos/tools/wpp/wpp_private.h | 14 +- reactos/tools/wrc/CMakeLists.txt | 1 + reactos/tools/wrc/dumpres.c | 132 +- reactos/tools/wrc/genres.c | 290 +- reactos/tools/wrc/lex.yy.c | 1838 ++++++----- reactos/tools/wrc/newstruc.c | 340 +- reactos/tools/wrc/newstruc.h | 52 +- reactos/tools/wrc/parser.h | 1 + reactos/tools/wrc/parser.l | 28 +- reactos/tools/wrc/parser.tab.c | 2421 +++++++-------- reactos/tools/wrc/parser.tab.h | 18 +- reactos/tools/wrc/parser.y | 246 +- reactos/tools/wrc/po.c | 1016 ++++++ reactos/tools/wrc/translation.c | 232 +- reactos/tools/wrc/utils.c | 62 +- reactos/tools/wrc/utils.h | 1 + reactos/tools/wrc/wrc.c | 253 +- reactos/tools/wrc/wrc.h | 16 +- reactos/tools/wrc/wrc.rbuild | 1 + reactos/tools/wrc/wrcrostypes.h | 29 + reactos/tools/wrc/wrctypes.h | 63 +- 54 files changed, 13181 insertions(+), 9492 deletions(-) create mode 100644 reactos/tools/wrc/po.c diff --git a/reactos/include/host/nls.h b/reactos/include/host/nls.h index 46ccd23cccc..837651a9568 100644 --- a/reactos/include/host/nls.h +++ b/reactos/include/host/nls.h @@ -20,118 +20,393 @@ typedef DWORD LCID; #define CP_UTF8 65001 -#define LANG_AFRIKAANS 0x36 -#define LANG_ALBANIAN 0x1c -#define LANG_ARABIC 0x01 -#define LANG_ARMENIAN 0x2b -#define LANG_ASSAMESE 0x4d -#define LANG_AZERI 0x2c -#define LANG_BASQUE 0x2d -#define LANG_BELARUSIAN 0x23 -#define LANG_BENGALI 0x45 -#define LANG_BULGARIAN 0x02 -#define LANG_CATALAN 0x03 -#define LANG_CHINESE 0x04 -#define LANG_CROATIAN 0x1a -#define LANG_CZECH 0x05 -#define LANG_DANISH 0x06 -#define LANG_DIVEHI 0x65 -#define LANG_DUTCH 0x13 -#define LANG_ENGLISH 0x09 -#define LANG_ESTONIAN 0x25 -#define LANG_FAEROESE 0x38 -#define LANG_FARSI 0x29 -#define LANG_FINNISH 0x0b -#define LANG_FRENCH 0x0c -#define LANG_GALICIAN 0x56 -#define LANG_GEORGIAN 0x37 -#define LANG_GERMAN 0x07 -#define LANG_GREEK 0x08 -#define LANG_GUJARATI 0x47 -#define LANG_HEBREW 0x0d -#define LANG_HINDI 0x39 -#define LANG_HUNGARIAN 0x0e -#define LANG_ICELANDIC 0x0f -#define LANG_INDONESIAN 0x21 -#define LANG_IRISH 0x3c -#define LANG_ITALIAN 0x10 -#define LANG_JAPANESE 0x11 -#define LANG_KANNADA 0x4b -#define LANG_KASHMIRI 0x60 -#define LANG_KAZAK 0x3f -#define LANG_KONKANI 0x57 -#define LANG_KOREAN 0x12 -#define LANG_KYRGYZ 0x40 -#define LANG_LATVIAN 0x26 -#define LANG_LITHUANIAN 0x27 -#define LANG_MACEDONIAN 0x2f -#define LANG_MANIPURI 0x58 -#define LANG_MALAY 0x3e -#define LANG_MALAYALAM 0x4c -#define LANG_MARATHI 0x4e -#define LANG_MONGOLIAN 0x50 -#define LANG_NEPALI 0x61 -#define LANG_NEUTRAL 0x00 -#define LANG_NORWEGIAN 0x14 -#define LANG_ORIYA 0x48 -#define LANG_POLISH 0x15 -#define LANG_PORTUGUESE 0x16 -#define LANG_PUNJABI 0x46 -#define LANG_ROMANIAN 0x18 -#define LANG_ROMANSH 0x17 -#define LANG_RUSSIAN 0x19 -#define LANG_SAMI 0x3b -#define LANG_SANSKRIT 0x4f -#define LANG_SERBIAN 0x1a -#define LANG_SINDHI 0x59 -#define LANG_SLOVAK 0x1b -#define LANG_SLOVENIAN 0x24 -#define LANG_SPANISH 0x0a -#define LANG_SWAHILI 0x41 -#define LANG_SWEDISH 0x1d -#define LANG_SYRIAC 0x5a -#define LANG_TAJIK 0x28 -#define LANG_TAMIL 0x49 -#define LANG_TATAR 0x44 -#define LANG_TELUGU 0x4a -#define LANG_THAI 0x1e -#define LANG_TURKISH 0x1f -#define LANG_UKRAINIAN 0x22 -#define LANG_URDU 0x20 -#define LANG_UZBEK 0x43 -#define LANG_VIETNAMESE 0x2a +#define LANG_NEUTRAL 0x00 +#define LANG_INVARIANT 0x7f + +#define LANG_AFRIKAANS 0x36 +#define LANG_ALBANIAN 0x1c +#define LANG_ALSATIAN 0x84 +#define LANG_AMHARIC 0x5e +#define LANG_ARABIC 0x01 +#define LANG_ARMENIAN 0x2b +#define LANG_ASSAMESE 0x4d +#define LANG_AZERI 0x2c +#define LANG_BASHKIR 0x6d +#define LANG_BASQUE 0x2d +#define LANG_BELARUSIAN 0x23 +#define LANG_BENGALI 0x45 +#define LANG_BOSNIAN 0x1a +#define LANG_BOSNIAN_NEUTRAL 0x781a +#define LANG_BRETON 0x7e +#define LANG_BULGARIAN 0x02 +#define LANG_CATALAN 0x03 +#define LANG_CHINESE 0x04 +#define LANG_CHINESE_SIMPLIFIED 0x0004 +#define LANG_CHINESE_TRADITIONAL 0x7c04 +#define LANG_CORSICAN 0x83 +#define LANG_CROATIAN 0x1a +#define LANG_CZECH 0x05 +#define LANG_DANISH 0x06 +#define LANG_DARI 0x8c +#define LANG_DIVEHI 0x65 +#define LANG_DUTCH 0x13 +#define LANG_ENGLISH 0x09 +#define LANG_ESTONIAN 0x25 +#define LANG_FAEROESE 0x38 +#define LANG_FARSI LANG_PERSIAN +#define LANG_FILIPINO 0x64 +#define LANG_FINNISH 0x0b +#define LANG_FRENCH 0x0c +#define LANG_FRISIAN 0x62 +#define LANG_GALICIAN 0x56 +#define LANG_GEORGIAN 0x37 +#define LANG_GERMAN 0x07 +#define LANG_GREEK 0x08 +#define LANG_GREENLANDIC 0x6f +#define LANG_GUJARATI 0x47 +#define LANG_HAUSA 0x68 +#define LANG_HEBREW 0x0d +#define LANG_HINDI 0x39 +#define LANG_HUNGARIAN 0x0e +#define LANG_ICELANDIC 0x0f +#define LANG_IGBO 0x70 +#define LANG_INDONESIAN 0x21 +#define LANG_INUKTITUT 0x5d +#define LANG_IRISH 0x3c +#define LANG_ITALIAN 0x10 +#define LANG_JAPANESE 0x11 +#define LANG_KANNADA 0x4b +#define LANG_KASHMIRI 0x60 +#define LANG_KAZAK 0x3f +#define LANG_KHMER 0x53 +#define LANG_KICHE 0x86 +#define LANG_KINYARWANDA 0x87 +#define LANG_KONKANI 0x57 +#define LANG_KOREAN 0x12 +#define LANG_KYRGYZ 0x40 +#define LANG_LAO 0x54 +#define LANG_LATVIAN 0x26 +#define LANG_LITHUANIAN 0x27 +#define LANG_LOWER_SORBIAN 0x2e +#define LANG_LUXEMBOURGISH 0x6e +#define LANG_MACEDONIAN 0x2f +#define LANG_MALAY 0x3e +#define LANG_MALAYALAM 0x4c +#define LANG_MALTESE 0x3a +#define LANG_MANIPURI 0x58 +#define LANG_MAORI 0x81 +#define LANG_MAPUDUNGUN 0x7a +#define LANG_MARATHI 0x4e +#define LANG_MOHAWK 0x7c +#define LANG_MONGOLIAN 0x50 +#define LANG_NEPALI 0x61 +#define LANG_NORWEGIAN 0x14 +#define LANG_OCCITAN 0x82 +#define LANG_ORIYA 0x48 +#define LANG_PASHTO 0x63 +#define LANG_PERSIAN 0x29 +#define LANG_POLISH 0x15 +#define LANG_PORTUGUESE 0x16 +#define LANG_PUNJABI 0x46 +#define LANG_QUECHUA 0x6b +#define LANG_ROMANIAN 0x18 +#define LANG_ROMANSH 0x17 +#define LANG_RUSSIAN 0x19 +#define LANG_SAMI 0x3b +#define LANG_SANSKRIT 0x4f +#define LANG_SERBIAN 0x1a +#define LANG_SERBIAN_NEUTRAL 0x7c1a +#define LANG_SINDHI 0x59 +#define LANG_SINHALESE 0x5b +#define LANG_SLOVAK 0x1b +#define LANG_SLOVENIAN 0x24 +#define LANG_SOTHO 0x6c +#define LANG_SPANISH 0x0a +#define LANG_SWAHILI 0x41 +#define LANG_SWEDISH 0x1d +#define LANG_SYRIAC 0x5a +#define LANG_TAJIK 0x28 +#define LANG_TAMAZIGHT 0x5f +#define LANG_TAMIL 0x49 +#define LANG_TATAR 0x44 +#define LANG_TELUGU 0x4a +#define LANG_THAI 0x1e +#define LANG_TIBETAN 0x51 +#define LANG_TIGRIGNA 0x73 +#define LANG_TSWANA 0x32 +#define LANG_TURKISH 0x1f +#define LANG_TURKMEN 0x42 +#define LANG_UIGHUR 0x80 +#define LANG_UKRAINIAN 0x22 +#define LANG_UPPER_SORBIAN 0x2e +#define LANG_URDU 0x20 +#define LANG_UZBEK 0x43 +#define LANG_VIETNAMESE 0x2a +#define LANG_WELSH 0x52 +#define LANG_WOLOF 0x88 +#define LANG_XHOSA 0x34 +#define LANG_YAKUT 0x85 +#define LANG_YI 0x78 +#define LANG_YORUBA 0x6a +#define LANG_ZULU 0x35 + +/* These are documented by the MSDN but are missing from the Windows header */ +#define LANG_MALAGASY 0x8d + +/* FIXME: these are not defined anywhere */ +#define LANG_SUTU 0x30 +#define LANG_TSONGA 0x31 +#define LANG_VENDA 0x33 /* non standard; keep the number high enough (but < 0xff) */ -#define LANG_ESPERANTO 0x8f -#define LANG_WALON 0x90 -#define LANG_CORNISH 0x91 -#define LANG_WELSH 0x92 -#define LANG_BRETON 0x93 +#define LANG_ESPERANTO 0x8f +#define LANG_WALON 0x90 +#define LANG_CORNISH 0x91 +#define LANG_GAELIC 0x94 -/* FIXME: these are not in the Windows header */ -#define LANG_GAELIC 0x94 -#define LANG_MALTESE 0x3a -#define LANG_RHAETO_ROMANCE 0x17 -#define LANG_SAAMI 0x3b -#define LANG_SORBIAN 0x2e -#define LANG_LOWER_SORBIAN 0x2e -#define LANG_UPPER_SORBIAN 0x2e -#define LANG_SUTU 0x30 -#define LANG_TSONGA 0x31 -#define LANG_TSWANA 0x32 -#define LANG_VENDA 0x33 -#define LANG_XHOSA 0x34 -#define LANG_ZULU 0x35 +/* Sublanguage definitions */ +#define SUBLANG_NEUTRAL 0x00 /* language neutral */ +#define SUBLANG_DEFAULT 0x01 /* user default */ +#define SUBLANG_SYS_DEFAULT 0x02 /* system default */ +#define SUBLANG_CUSTOM_DEFAULT 0x03 +#define SUBLANG_CUSTOM_UNSPECIFIED 0x04 +#define SUBLANG_UI_CUSTOM_DEFAULT 0x05 -/* Sublanguages */ -#define SUBLANG_AZERI_CYRILLIC 0x02 -#define SUBLANG_CHINESE_SINGAPORE 0x04 -#define SUBLANG_CHINESE_SIMPLIFIED 0x02 -#define SUBLANG_DEFAULT 0x01 -#define SUBLANG_NEUTRAL 0x00 -#define SUBLANG_NORWEGIAN_NYNORSK 0x02 -#define SUBLANG_SERBIAN_CYRILLIC 0x03 -#define SUBLANG_UZBEK_CYRILLIC 0x02 -#define SUBLANG_ENGLISH_US 0x01 +#define SUBLANG_AFRIKAANS_SOUTH_AFRICA 0x01 +#define SUBLANG_ALBANIAN_ALBANIA 0x01 +#define SUBLANG_ALSATIAN_FRANCE 0x01 +#define SUBLANG_AMHARIC_ETHIOPIA 0x01 +#define SUBLANG_ARABIC_SAUDI_ARABIA 0x01 +#define SUBLANG_ARABIC_IRAQ 0x02 +#define SUBLANG_ARABIC_EGYPT 0x03 +#define SUBLANG_ARABIC_LIBYA 0x04 +#define SUBLANG_ARABIC_ALGERIA 0x05 +#define SUBLANG_ARABIC_MOROCCO 0x06 +#define SUBLANG_ARABIC_TUNISIA 0x07 +#define SUBLANG_ARABIC_OMAN 0x08 +#define SUBLANG_ARABIC_YEMEN 0x09 +#define SUBLANG_ARABIC_SYRIA 0x0a +#define SUBLANG_ARABIC_JORDAN 0x0b +#define SUBLANG_ARABIC_LEBANON 0x0c +#define SUBLANG_ARABIC_KUWAIT 0x0d +#define SUBLANG_ARABIC_UAE 0x0e +#define SUBLANG_ARABIC_BAHRAIN 0x0f +#define SUBLANG_ARABIC_QATAR 0x10 +#define SUBLANG_ARMENIAN_ARMENIA 0x01 +#define SUBLANG_ASSAMESE_INDIA 0x01 +#define SUBLANG_AZERI_LATIN 0x01 +#define SUBLANG_AZERI_CYRILLIC 0x02 +#define SUBLANG_BASHKIR_RUSSIA 0x01 +#define SUBLANG_BASQUE_BASQUE 0x01 +#define SUBLANG_BELARUSIAN_BELARUS 0x01 +#define SUBLANG_BENGALI_INDIA 0x01 +#define SUBLANG_BENGALI_BANGLADESH 0x02 +#define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN 0x05 +#define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08 +#define SUBLANG_BRETON_FRANCE 0x01 +#define SUBLANG_BULGARIAN_BULGARIA 0x01 +#define SUBLANG_CATALAN_CATALAN 0x01 +#define SUBLANG_CHINESE_TRADITIONAL 0x01 +#define SUBLANG_CHINESE_SIMPLIFIED 0x02 +#define SUBLANG_CHINESE_HONGKONG 0x03 +#define SUBLANG_CHINESE_SINGAPORE 0x04 +#define SUBLANG_CHINESE_MACAU 0x05 +#define SUBLANG_CORSICAN_FRANCE 0x01 +#define SUBLANG_CROATIAN_CROATIA 0x01 +#define SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN 0x04 +#define SUBLANG_CZECH_CZECH_REPUBLIC 0x01 +#define SUBLANG_DANISH_DENMARK 0x01 +#define SUBLANG_DARI_AFGHANISTAN 0x01 +#define SUBLANG_DIVEHI_MALDIVES 0x01 +#define SUBLANG_DUTCH 0x01 +#define SUBLANG_DUTCH_BELGIAN 0x02 +#define SUBLANG_ENGLISH_US 0x01 +#define SUBLANG_ENGLISH_UK 0x02 +#define SUBLANG_ENGLISH_AUS 0x03 +#define SUBLANG_ENGLISH_CAN 0x04 +#define SUBLANG_ENGLISH_NZ 0x05 +#define SUBLANG_ENGLISH_EIRE 0x06 +#define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07 +#define SUBLANG_ENGLISH_JAMAICA 0x08 +#define SUBLANG_ENGLISH_CARIBBEAN 0x09 +#define SUBLANG_ENGLISH_BELIZE 0x0a +#define SUBLANG_ENGLISH_TRINIDAD 0x0b +#define SUBLANG_ENGLISH_ZIMBABWE 0x0c +#define SUBLANG_ENGLISH_PHILIPPINES 0x0d +#define SUBLANG_ENGLISH_INDIA 0x10 +#define SUBLANG_ENGLISH_MALAYSIA 0x11 +#define SUBLANG_ENGLISH_SINGAPORE 0x12 +#define SUBLANG_ESTONIAN_ESTONIA 0x01 +#define SUBLANG_FAEROESE_FAROE_ISLANDS 0x01 +#define SUBLANG_FILIPINO_PHILIPPINES 0x01 +#define SUBLANG_FINNISH_FINLAND 0x01 +#define SUBLANG_FRENCH 0x01 +#define SUBLANG_FRENCH_BELGIAN 0x02 +#define SUBLANG_FRENCH_CANADIAN 0x03 +#define SUBLANG_FRENCH_SWISS 0x04 +#define SUBLANG_FRENCH_LUXEMBOURG 0x05 +#define SUBLANG_FRENCH_MONACO 0x06 +#define SUBLANG_FRISIAN_NETHERLANDS 0x01 +#define SUBLANG_GALICIAN_GALICIAN 0x01 +#define SUBLANG_GEORGIAN_GEORGIA 0x01 +#define SUBLANG_GERMAN 0x01 +#define SUBLANG_GERMAN_SWISS 0x02 +#define SUBLANG_GERMAN_AUSTRIAN 0x03 +#define SUBLANG_GERMAN_LUXEMBOURG 0x04 +#define SUBLANG_GERMAN_LIECHTENSTEIN 0x05 +#define SUBLANG_GREEK_GREECE 0x01 +#define SUBLANG_GREENLANDIC_GREENLAND 0x01 +#define SUBLANG_GUJARATI_INDIA 0x01 +#define SUBLANG_HAUSA_NIGERIA_LATIN 0x01 +#define SUBLANG_HEBREW_ISRAEL 0x01 +#define SUBLANG_HINDI_INDIA 0x01 +#define SUBLANG_HUNGARIAN_HUNGARY 0x01 +#define SUBLANG_ICELANDIC_ICELAND 0x01 +#define SUBLANG_IGBO_NIGERIA 0x01 +#define SUBLANG_INDONESIAN_INDONESIA 0x01 +#define SUBLANG_INUKTITUT_CANADA 0x01 +#define SUBLANG_INUKTITUT_CANADA_LATIN 0x02 +#define SUBLANG_IRISH_IRELAND 0x02 +#define SUBLANG_ITALIAN 0x01 +#define SUBLANG_ITALIAN_SWISS 0x02 +#define SUBLANG_JAPANESE_JAPAN 0x01 +#define SUBLANG_KANNADA_INDIA 0x01 +#define SUBLANG_KASHMIRI_SASIA 0x02 +#define SUBLANG_KASHMIRI_INDIA 0x02 +#define SUBLANG_KAZAK_KAZAKHSTAN 0x01 +#define SUBLANG_KHMER_CAMBODIA 0x01 +#define SUBLANG_KICHE_GUATEMALA 0x01 +#define SUBLANG_KINYARWANDA_RWANDA 0X01 +#define SUBLANG_KONKANI_INDIA 0x01 +#define SUBLANG_KOREAN 0x01 +#define SUBLANG_KYRGYZ_KYRGYZSTAN 0x01 +#define SUBLANG_LAO_LAO 0x01 +#define SUBLANG_LATVIAN_LATVIA 0x01 +#define SUBLANG_LITHUANIAN_LITHUANIA 0x01 +#define SUBLANG_LOWER_SORBIAN_GERMANY 0x02 +#define SUBLANG_LUXEMBOURGISH_LUXEMBOURG 0x01 +#define SUBLANG_MACEDONIAN_MACEDONIA 0x01 +#define SUBLANG_MALAY_MALAYSIA 0x01 +#define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02 +#define SUBLANG_MALAYALAM_INDIA 0x01 +#define SUBLANG_MALTESE_MALTA 0x01 +#define SUBLANG_MAORI_NEW_ZEALAND 0x01 +#define SUBLANG_MAPUDUNGUN_CHILE 0x01 +#define SUBLANG_MARATHI_INDIA 0x01 +#define SUBLANG_MOHAWK_MOHAWK 0x01 +#define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA 0x01 +#define SUBLANG_MONGOLIAN_PRC 0x02 +#define SUBLANG_NEPALI_INDIA 0x02 +#define SUBLANG_NEPALI_NEPAL 0x01 +#define SUBLANG_NORWEGIAN_BOKMAL 0x01 +#define SUBLANG_NORWEGIAN_NYNORSK 0x02 +#define SUBLANG_OCCITAN_FRANCE 0x01 +#define SUBLANG_ORIYA_INDIA 0x01 +#define SUBLANG_PASHTO_AFGHANISTAN 0x01 +#define SUBLANG_PERSIAN_IRAN 0x01 +#define SUBLANG_POLISH_POLAND 0x01 +#define SUBLANG_PORTUGUESE 0x02 +#define SUBLANG_PORTUGUESE_BRAZILIAN 0x01 +#define SUBLANG_PUNJABI_INDIA 0x01 +#define SUBLANG_QUECHUA_BOLIVIA 0x01 +#define SUBLANG_QUECHUA_ECUADOR 0x02 +#define SUBLANG_QUECHUA_PERU 0x03 +#define SUBLANG_ROMANIAN_ROMANIA 0x01 +#define SUBLANG_ROMANSH_SWITZERLAND 0x01 +#define SUBLANG_RUSSIAN_RUSSIA 0x01 +#define SUBLANG_SAMI_NORTHERN_NORWAY 0x01 +#define SUBLANG_SAMI_NORTHERN_SWEDEN 0x02 +#define SUBLANG_SAMI_NORTHERN_FINLAND 0x03 +#define SUBLANG_SAMI_LULE_NORWAY 0x04 +#define SUBLANG_SAMI_LULE_SWEDEN 0x05 +#define SUBLANG_SAMI_SOUTHERN_NORWAY 0x06 +#define SUBLANG_SAMI_SOUTHERN_SWEDEN 0x07 +#define SUBLANG_SAMI_SKOLT_FINLAND 0x08 +#define SUBLANG_SAMI_INARI_FINLAND 0x09 +#define SUBLANG_SANSKRIT_INDIA 0x01 +#define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN 0x06 +#define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x07 +#define SUBLANG_SERBIAN_CROATIA 0x01 +#define SUBLANG_SERBIAN_LATIN 0x02 +#define SUBLANG_SERBIAN_CYRILLIC 0x03 +#define SUBLANG_SINDHI_AFGHANISTAN 0x02 +#define SUBLANG_SINHALESE_SRI_LANKA 0x01 +#define SUBLANG_SLOVAK_SLOVAKIA 0x01 +#define SUBLANG_SLOVENIAN_SLOVENIA 0x01 +#define SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA 0x01 +#define SUBLANG_SPANISH 0x01 +#define SUBLANG_SPANISH_MEXICAN 0x02 +#define SUBLANG_SPANISH_MODERN 0x03 +#define SUBLANG_SPANISH_GUATEMALA 0x04 +#define SUBLANG_SPANISH_COSTA_RICA 0x05 +#define SUBLANG_SPANISH_PANAMA 0x06 +#define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07 +#define SUBLANG_SPANISH_VENEZUELA 0x08 +#define SUBLANG_SPANISH_COLOMBIA 0x09 +#define SUBLANG_SPANISH_PERU 0x0a +#define SUBLANG_SPANISH_ARGENTINA 0x0b +#define SUBLANG_SPANISH_ECUADOR 0x0c +#define SUBLANG_SPANISH_CHILE 0x0d +#define SUBLANG_SPANISH_URUGUAY 0x0e +#define SUBLANG_SPANISH_PARAGUAY 0x0f +#define SUBLANG_SPANISH_BOLIVIA 0x10 +#define SUBLANG_SPANISH_EL_SALVADOR 0x11 +#define SUBLANG_SPANISH_HONDURAS 0x12 +#define SUBLANG_SPANISH_NICARAGUA 0x13 +#define SUBLANG_SPANISH_PUERTO_RICO 0x14 +#define SUBLANG_SPANISH_US 0x15 +#define SUBLANG_SWAHILI_KENYA 0x01 +#define SUBLANG_SWEDISH 0x01 +#define SUBLANG_SWEDISH_FINLAND 0x02 +#define SUBLANG_SYRIAC_SYRIA 0x01 +#define SUBLANG_TAJIK_TAJIKISTAN 0x01 +#define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02 +#define SUBLANG_TAMIL_INDIA 0x01 +#define SUBLANG_TATAR_RUSSIA 0x01 +#define SUBLANG_TELUGU_INDIA 0x01 +#define SUBLANG_THAI_THAILAND 0x01 +#define SUBLANG_TIBETAN_PRC 0x01 +#define SUBLANG_TIBETAN_BHUTAN 0x02 +#define SUBLANG_TIGRIGNA_ERITREA 0x02 +#define SUBLANG_TSWANA_SOUTH_AFRICA 0x01 +#define SUBLANG_TURKISH_TURKEY 0x01 +#define SUBLANG_TURKMEN_TURKMENISTAN 0x01 +#define SUBLANG_UIGHUR_PRC 0x01 +#define SUBLANG_UKRAINIAN_UKRAINE 0x01 +#define SUBLANG_UPPER_SORBIAN_GERMANY 0x01 +#define SUBLANG_URDU_PAKISTAN 0x01 +#define SUBLANG_URDU_INDIA 0x02 +#define SUBLANG_UZBEK_LATIN 0x01 +#define SUBLANG_UZBEK_CYRILLIC 0x02 +#define SUBLANG_VIETNAMESE_VIETNAM 0x01 +#define SUBLANG_WELSH_UNITED_KINGDOM 0x01 +#define SUBLANG_WOLOF_SENEGAL 0x01 +#define SUBLANG_XHOSA_SOUTH_AFRICA 0x01 +#define SUBLANG_YAKUT_RUSSIA 0x01 +#define SUBLANG_YI_PRC 0x01 +#define SUBLANG_YORUBA_NIGERIA 0x01 +#define SUBLANG_ZULU_SOUTH_AFRICA 0x01 + +/* These are documented by the MSDN but are missing from the Windows header */ +#define SUBLANG_ENGLISH_IRELAND SUBLANG_ENGLISH_EIRE +#define SUBLANG_HAUSA_NIGERIA SUBLANG_HAUSA_NIGERIA_LATIN +#define SUBLANG_LAO_LAO_PDR SUBLANG_LAO_LAO +#define SUBLANG_LITHUANIAN SUBLANG_LITHUANIAN_LITHUANIA +#define SUBLANG_PORTUGUESE_PORTUGAL SUBLANG_PORTUGUESE +#define SUBLANG_SWAHILI SUBLANG_SWAHILI_KENYA +#define SUBLANG_SWEDISH_SWEDEN SUBLANG_SWEDISH +#define SUBLANG_SYRIAC SUBLANG_SYRIAC_SYRIA + +/* FIXME: these are not defined anywhere */ +#define SUBLANG_DUTCH_SURINAM 0x03 +#define SUBLANG_ROMANIAN SUBLANG_ROMANIAN_ROMANIA +#define SUBLANG_ROMANIAN_MOLDAVIA 0x02 +#define SUBLANG_RUSSIAN SUBLANG_RUSSIAN_RUSSIA +#define SUBLANG_RUSSIAN_MOLDAVIA 0x02 +#define SUBLANG_CROATIAN SUBLANG_CROATIAN_CROATIA +#define SUBLANG_LITHUANIAN_CLASSIC 0x02 +#define SUBLANG_GAELIC 0x01 +#define SUBLANG_GAELIC_SCOTTISH 0x02 +#define SUBLANG_GAELIC_MANX 0x03 #endif diff --git a/reactos/include/host/wine/wpp.h b/reactos/include/host/wine/wpp.h index 10b71e0c785..2d284f154f0 100644 --- a/reactos/include/host/wine/wpp.h +++ b/reactos/include/host/wine/wpp.h @@ -22,15 +22,41 @@ #define __WINE_WPP_H #include +#include -extern void wpp_add_define( const char *name, const char *value ); +struct wpp_callbacks +{ + /* I/O callbacks */ + + /* Looks for a file to include, returning the path where it is found */ + /* parent_name is the directory of the parent source file (for local + * includes), includepath is an array of additional include paths */ + char *(*lookup)( const char *filename, const char *parent_name, + char **include_path, int include_path_count ); + /* Opens an include file */ + /* The type param is true if it is a local ("...") include */ + void *(*open)( const char *filename, int type ); + /* Closes a previously opened file */ + void (*close)( void *file ); + /* Reads buffer from the input */ + int (*read)( void *file, char *buffer, unsigned int len ); + /* Writes buffer to the output */ + void (*write)( const char *buffer, unsigned int len ); + + /* Error callbacks */ + void (*error)( const char *file, int line, int col, const char *near, const char *msg, va_list ap ); + void (*warning)( const char *file, int line, int col, const char *near, const char *msg, va_list ap ); +}; + +/* Return value == 0 means successful execution */ +extern int wpp_add_define( const char *name, const char *value ); extern void wpp_del_define( const char *name ); -extern void wpp_add_cmdline_define( const char *value ); +extern int wpp_add_cmdline_define( const char *value ); extern void wpp_set_debug( int lex_debug, int parser_debug, int msg_debug ); extern void wpp_set_pedantic( int on ); -extern void wpp_add_include_path( const char *path ); +extern int wpp_add_include_path( const char *path ); extern char *wpp_find_include( const char *name, const char *parent_name ); extern int wpp_parse( const char *input, FILE *output ); -extern int wpp_parse_temp( const char *input, const char *output_base, char **output_name ); +extern void wpp_set_callbacks( const struct wpp_callbacks *callbacks ); #endif /* __WINE_WPP_H */ diff --git a/reactos/tools/widl/client.c b/reactos/tools/widl/client.c index b5ac0ae4675..be42b1b8122 100644 --- a/reactos/tools/widl/client.c +++ b/reactos/tools/widl/client.c @@ -50,32 +50,248 @@ static void print_client( const char *format, ... ) va_end(va); } - -static void check_pointers(const var_t *func) +static void write_client_func_decl( const type_t *iface, const var_t *func ) { - const var_t *var; + const char *callconv = get_attrp(func->type->attrs, ATTR_CALLCONV); + const var_list_t *args = type_get_function_args(func->type); + type_t *rettype = type_function_get_rettype(func->type); - if (!type_get_function_args(func->type)) - return; + if (!callconv) callconv = "__cdecl"; + write_type_decl_left(client, rettype); + fprintf(client, " %s ", callconv); + fprintf(client, "%s%s(\n", prefix_client, get_name(func)); + indent++; + if (args) + write_args(client, args, iface->name, 0, TRUE); + else + print_client("void"); + fprintf(client, ")\n"); + indent--; +} - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry ) +static void write_function_stub( const type_t *iface, const var_t *func, + int method_count, unsigned int proc_offset ) +{ + unsigned char explicit_fc, implicit_fc; + int has_full_pointer = is_full_pointer_function(func); + type_t *rettype = type_function_get_rettype(func->type); + const var_t *handle_var = get_func_handle_var( iface, func, &explicit_fc, &implicit_fc ); + int has_ret = !is_void(rettype); + + if (is_interpreted_func( iface, func )) { - if (is_var_ptr(var) && cant_be_null(var)) - { - print_client("if (!%s)\n", var->name); - print_client("{\n"); - indent++; - print_client("RpcRaiseException(RPC_X_NULL_REF_POINTER);\n"); - indent--; - print_client("}\n\n"); - } + write_client_func_decl( iface, func ); + write_client_call_routine( client, iface, func, iface->name, proc_offset ); + return; } + + print_client( "struct __frame_%s%s\n{\n", prefix_client, get_name(func) ); + indent++; + print_client( "__DECL_EXCEPTION_FRAME\n" ); + print_client("MIDL_STUB_MESSAGE _StubMsg;\n"); + if (handle_var) + { + if (explicit_fc == RPC_FC_BIND_GENERIC) + print_client("%s %s;\n", + get_explicit_generic_handle_type(handle_var)->name, handle_var->name ); + print_client("RPC_BINDING_HANDLE _Handle;\n"); + } + + if (has_ret && decl_indirect(rettype)) + { + print_client("void *_p_%s;\n", "_RetVal" ); + } + indent--; + print_client( "};\n\n" ); + + print_client( "static void __finally_%s%s(", prefix_client, get_name(func) ); + print_client( " struct __frame_%s%s *__frame )\n{\n", prefix_client, get_name(func) ); + indent++; + + if (has_full_pointer) + write_full_pointer_free(client, indent, func); + + print_client("NdrFreeBuffer(&__frame->_StubMsg);\n"); + + if (explicit_fc == RPC_FC_BIND_GENERIC) + { + fprintf(client, "\n"); + print_client("if (__frame->_Handle)\n"); + indent++; + print_client("%s_unbind(__frame->%s, __frame->_Handle);\n", + get_explicit_generic_handle_type(handle_var)->name, handle_var->name); + indent--; + } + indent--; + print_client( "}\n\n" ); + + write_client_func_decl( iface, func ); + + /* write the functions body */ + fprintf(client, "{\n"); + indent++; + print_client( "struct __frame_%s%s __f, * const __frame = &__f;\n", prefix_client, get_name(func) ); + + /* declare return value '_RetVal' */ + if (has_ret) + { + print_client("%s", ""); + write_type_decl_left(client, rettype); + fprintf(client, " _RetVal;\n"); + } + print_client("RPC_MESSAGE _RpcMessage;\n"); + + if (handle_var) + { + print_client( "__frame->_Handle = 0;\n" ); + if (explicit_fc == RPC_FC_BIND_GENERIC) + print_client("__frame->%s = %s;\n", handle_var->name, handle_var->name ); + } + if (has_ret && decl_indirect(rettype)) + { + print_client("__frame->_p_%s = &%s;\n", + "_RetVal", "_RetVal"); + } + fprintf(client, "\n"); + + print_client( "RpcExceptionInit( 0, __finally_%s%s );\n", prefix_client, get_name(func) ); + + if (has_full_pointer) + write_full_pointer_init(client, indent, func, FALSE); + + /* check pointers */ + write_pointer_checks( client, indent, func ); + + print_client("RpcTryFinally\n"); + print_client("{\n"); + indent++; + + print_client("NdrClientInitializeNew(&_RpcMessage, &__frame->_StubMsg, &%s_StubDesc, %d);\n", + iface->name, method_count); + + if (is_attr(func->attrs, ATTR_IDEMPOTENT) || is_attr(func->attrs, ATTR_BROADCAST)) + { + print_client("_RpcMessage.RpcFlags = ( RPC_NCA_FLAGS_DEFAULT "); + if (is_attr(func->attrs, ATTR_IDEMPOTENT)) + fprintf(client, "| RPC_NCA_FLAGS_IDEMPOTENT "); + if (is_attr(func->attrs, ATTR_BROADCAST)) + fprintf(client, "| RPC_NCA_FLAGS_BROADCAST "); + fprintf(client, ");\n\n"); + } + + switch (explicit_fc) + { + case RPC_FC_BIND_PRIMITIVE: + print_client("__frame->_Handle = %s;\n", handle_var->name); + fprintf(client, "\n"); + break; + case RPC_FC_BIND_GENERIC: + print_client("__frame->_Handle = %s_bind(%s);\n", + get_explicit_generic_handle_type(handle_var)->name, handle_var->name); + fprintf(client, "\n"); + break; + case RPC_FC_BIND_CONTEXT: + { + /* if the context_handle attribute appears in the chain of types + * without pointers being followed, then the context handle must + * be direct, otherwise it is a pointer */ + int is_ch_ptr = !is_aliaschain_attr(handle_var->type, ATTR_CONTEXTHANDLE); + print_client("if (%s%s != 0)\n", is_ch_ptr ? "*" : "", handle_var->name); + indent++; + print_client("__frame->_Handle = NDRCContextBinding(%s%s);\n", + is_ch_ptr ? "*" : "", handle_var->name); + indent--; + if (is_attr(handle_var->attrs, ATTR_IN) && !is_attr(handle_var->attrs, ATTR_OUT)) + { + print_client("else\n"); + indent++; + print_client("RpcRaiseException(RPC_X_SS_IN_NULL_CONTEXT);\n"); + indent--; + } + fprintf(client, "\n"); + break; + } + case 0: /* implicit handle */ + if (handle_var) + { + print_client("__frame->_Handle = %s;\n", handle_var->name); + fprintf(client, "\n"); + } + break; + } + + write_remoting_arguments(client, indent, func, "", PASS_IN, PHASE_BUFFERSIZE); + + print_client("NdrGetBuffer(&__frame->_StubMsg, __frame->_StubMsg.BufferLength, "); + if (handle_var) + fprintf(client, "__frame->_Handle);\n\n"); + else + fprintf(client,"%s__MIDL_AutoBindHandle);\n\n", iface->name); + + /* marshal arguments */ + write_remoting_arguments(client, indent, func, "", PASS_IN, PHASE_MARSHAL); + + /* send/receive message */ + /* print_client("NdrNsSendReceive(\n"); */ + /* print_client("(unsigned char *)__frame->_StubMsg.Buffer,\n"); */ + /* print_client("(RPC_BINDING_HANDLE *) &%s__MIDL_AutoBindHandle);\n", iface->name); */ + print_client("NdrSendReceive(&__frame->_StubMsg, __frame->_StubMsg.Buffer);\n\n"); + + print_client("__frame->_StubMsg.BufferStart = _RpcMessage.Buffer;\n"); + print_client("__frame->_StubMsg.BufferEnd = __frame->_StubMsg.BufferStart + _RpcMessage.BufferLength;\n"); + + if (has_out_arg_or_return(func)) + { + fprintf(client, "\n"); + + print_client("if ((_RpcMessage.DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)\n"); + indent++; + print_client("NdrConvert(&__frame->_StubMsg, (PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);\n", + proc_offset); + indent--; + } + + /* unmarshall arguments */ + fprintf(client, "\n"); + write_remoting_arguments(client, indent, func, "", PASS_OUT, PHASE_UNMARSHAL); + + /* unmarshal return value */ + if (has_ret) + { + if (decl_indirect(rettype)) + print_client("MIDL_memset(&%s, 0, sizeof(%s));\n", "_RetVal", "_RetVal"); + else if (is_ptr(rettype) || is_array(rettype)) + print_client("%s = 0;\n", "_RetVal"); + write_remoting_arguments(client, indent, func, "", PASS_RETURN, PHASE_UNMARSHAL); + } + + indent--; + print_client("}\n"); + print_client("RpcFinally\n"); + print_client("{\n"); + indent++; + print_client( "__finally_%s%s( __frame );\n", prefix_client, get_name(func) ); + indent--; + print_client("}\n"); + print_client("RpcEndFinally\n"); + + + /* emit return code */ + if (has_ret) + { + fprintf(client, "\n"); + print_client("return _RetVal;\n"); + } + + indent--; + fprintf(client, "}\n"); + fprintf(client, "\n"); } static void write_function_stubs(type_t *iface, unsigned int *proc_offset) { const statement_t *stmt; - const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE); + const var_t *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE); int method_count = 0; if (!implicit_handle) @@ -84,243 +300,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset) STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) ) { const var_t *func = stmt->u.var; - const var_t* explicit_handle_var; - const var_t* explicit_generic_handle_var = NULL; - const var_t* context_handle_var = NULL; - int has_full_pointer = is_full_pointer_function(func); - const char *callconv = get_attrp(func->type->attrs, ATTR_CALLCONV); - const var_list_t *args = type_get_function_args(func->type); - - /* check for a defined binding handle */ - explicit_handle_var = get_explicit_handle_var(func); - if (!explicit_handle_var) - { - explicit_generic_handle_var = get_explicit_generic_handle_var(func); - if (!explicit_generic_handle_var) - context_handle_var = get_context_handle_var(func); - } - - print_client( "struct __frame_%s%s\n{\n", prefix_client, get_name(func) ); - indent++; - print_client( "__DECL_EXCEPTION_FRAME\n" ); - print_client("MIDL_STUB_MESSAGE _StubMsg;\n"); - if (implicit_handle || explicit_handle_var || explicit_generic_handle_var || context_handle_var) - { - if (!implicit_handle && explicit_generic_handle_var) - print_client("%s %s;\n", - get_explicit_generic_handle_type(explicit_generic_handle_var)->name, - explicit_generic_handle_var->name ); - print_client("RPC_BINDING_HANDLE _Handle;\n"); - } - - if (!is_void(type_function_get_rettype(func->type)) && - decl_indirect(type_function_get_rettype(func->type))) - { - print_client("void *_p_%s;\n", "_RetVal" ); - } - indent--; - print_client( "};\n\n" ); - - print_client( "static void __finally_%s%s(", prefix_client, get_name(func) ); - print_client( " struct __frame_%s%s *__frame )\n{\n", prefix_client, get_name(func) ); - indent++; - - if (has_full_pointer) - write_full_pointer_free(client, indent, func); - - print_client("NdrFreeBuffer(&__frame->_StubMsg);\n"); - - if (!implicit_handle && explicit_generic_handle_var) - { - fprintf(client, "\n"); - print_client("if (__frame->_Handle)\n"); - indent++; - print_client("%s_unbind(__frame->%s, __frame->_Handle);\n", - get_explicit_generic_handle_type(explicit_generic_handle_var)->name, - explicit_generic_handle_var->name); - indent--; - } - indent--; - print_client( "}\n\n" ); - - write_type_decl_left(client, type_function_get_rettype(func->type)); - if (needs_space_after(type_function_get_rettype(func->type))) - fprintf(client, " "); - if (callconv) fprintf(client, "%s ", callconv); - fprintf(client, "%s%s(\n", prefix_client, get_name(func)); - indent++; - if (args) - write_args(client, args, iface->name, 0, TRUE); - else - print_client("void"); - fprintf(client, ")\n"); - indent--; - - /* write the functions body */ - fprintf(client, "{\n"); - indent++; - print_client( "struct __frame_%s%s __f, * const __frame = &__f;\n", prefix_client, get_name(func) ); - - /* declare return value '_RetVal' */ - if (!is_void(type_function_get_rettype(func->type))) - { - print_client("%s", ""); - write_type_decl_left(client, type_function_get_rettype(func->type)); - fprintf(client, " _RetVal;\n"); - } - print_client("RPC_MESSAGE _RpcMessage;\n"); - - if (implicit_handle || explicit_handle_var || explicit_generic_handle_var || context_handle_var) - { - print_client( "__frame->_Handle = 0;\n" ); - if (!implicit_handle && explicit_generic_handle_var) - print_client("__frame->%s = %s;\n", - explicit_generic_handle_var->name, explicit_generic_handle_var->name ); - } - if (!is_void(type_function_get_rettype(func->type)) && - decl_indirect(type_function_get_rettype(func->type))) - { - print_client("__frame->_p_%s = &%s;\n", - "_RetVal", "_RetVal"); - } - fprintf(client, "\n"); - - print_client( "RpcExceptionInit( 0, __finally_%s%s );\n", prefix_client, get_name(func) ); - - if (has_full_pointer) - write_full_pointer_init(client, indent, func, FALSE); - - /* check pointers */ - check_pointers(func); - - print_client("RpcTryFinally\n"); - print_client("{\n"); - indent++; - - print_client("NdrClientInitializeNew(&_RpcMessage, &__frame->_StubMsg, &%s_StubDesc, %d);\n", - iface->name, method_count); - - if (is_attr(func->attrs, ATTR_IDEMPOTENT) || is_attr(func->attrs, ATTR_BROADCAST)) - { - print_client("_RpcMessage.RpcFlags = ( RPC_NCA_FLAGS_DEFAULT "); - if (is_attr(func->attrs, ATTR_IDEMPOTENT)) - fprintf(client, "| RPC_NCA_FLAGS_IDEMPOTENT "); - if (is_attr(func->attrs, ATTR_BROADCAST)) - fprintf(client, "| RPC_NCA_FLAGS_BROADCAST "); - fprintf(client, ");\n\n"); - } - - if (explicit_handle_var) - { - print_client("__frame->_Handle = %s;\n", explicit_handle_var->name); - fprintf(client, "\n"); - } - else if (explicit_generic_handle_var) - { - print_client("__frame->_Handle = %s_bind(%s);\n", - get_explicit_generic_handle_type(explicit_generic_handle_var)->name, - explicit_generic_handle_var->name); - fprintf(client, "\n"); - } - else if (context_handle_var) - { - /* if the context_handle attribute appears in the chain of types - * without pointers being followed, then the context handle must - * be direct, otherwise it is a pointer */ - int is_ch_ptr = is_aliaschain_attr(context_handle_var->type, ATTR_CONTEXTHANDLE) ? FALSE : TRUE; - print_client("if (%s%s != 0)\n", is_ch_ptr ? "*" : "", context_handle_var->name); - indent++; - print_client("__frame->_Handle = NDRCContextBinding(%s%s);\n", - is_ch_ptr ? "*" : "", context_handle_var->name); - indent--; - if (is_attr(context_handle_var->attrs, ATTR_IN) && - !is_attr(context_handle_var->attrs, ATTR_OUT)) - { - print_client("else\n"); - indent++; - print_client("RpcRaiseException(RPC_X_SS_IN_NULL_CONTEXT);\n"); - indent--; - } - fprintf(client, "\n"); - } - else if (implicit_handle) - { - print_client("__frame->_Handle = %s;\n", implicit_handle); - fprintf(client, "\n"); - } - - write_remoting_arguments(client, indent, func, "", PASS_IN, PHASE_BUFFERSIZE); - - print_client("NdrGetBuffer(&__frame->_StubMsg, __frame->_StubMsg.BufferLength, "); - if (implicit_handle || explicit_handle_var || explicit_generic_handle_var || context_handle_var) - fprintf(client, "__frame->_Handle);\n\n"); - else - fprintf(client,"%s__MIDL_AutoBindHandle);\n\n", iface->name); - - /* marshal arguments */ - write_remoting_arguments(client, indent, func, "", PASS_IN, PHASE_MARSHAL); - - /* send/receive message */ - /* print_client("NdrNsSendReceive(\n"); */ - /* print_client("(unsigned char *)__frame->_StubMsg.Buffer,\n"); */ - /* print_client("(RPC_BINDING_HANDLE *) &%s__MIDL_AutoBindHandle);\n", iface->name); */ - print_client("NdrSendReceive(&__frame->_StubMsg, __frame->_StubMsg.Buffer);\n\n"); - - print_client("__frame->_StubMsg.BufferStart = _RpcMessage.Buffer;\n"); - print_client("__frame->_StubMsg.BufferEnd = __frame->_StubMsg.BufferStart + _RpcMessage.BufferLength;\n"); - - if (has_out_arg_or_return(func)) - { - fprintf(client, "\n"); - - print_client("if ((_RpcMessage.DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)\n"); - indent++; - print_client("NdrConvert(&__frame->_StubMsg, (PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);\n", - *proc_offset); - indent--; - } - - /* unmarshall arguments */ - fprintf(client, "\n"); - write_remoting_arguments(client, indent, func, "", PASS_OUT, PHASE_UNMARSHAL); - - /* unmarshal return value */ - if (!is_void(type_function_get_rettype(func->type))) - { - if (decl_indirect(type_function_get_rettype(func->type))) - print_client("MIDL_memset(&%s, 0, sizeof(%s));\n", "_RetVal", "_RetVal"); - else if (is_ptr(type_function_get_rettype(func->type)) || - is_array(type_function_get_rettype(func->type))) - print_client("%s = 0;\n", "_RetVal"); - write_remoting_arguments(client, indent, func, "", PASS_RETURN, PHASE_UNMARSHAL); - } - - /* update proc_offset */ - *proc_offset += get_size_procformatstring_func( func ); - - indent--; - print_client("}\n"); - print_client("RpcFinally\n"); - print_client("{\n"); - indent++; - print_client( "__finally_%s%s( __frame );\n", prefix_client, get_name(func) ); - indent--; - print_client("}\n"); - print_client("RpcEndFinally\n"); - - - /* emit return code */ - if (!is_void(type_function_get_rettype(func->type))) - { - fprintf(client, "\n"); - print_client("return _RetVal;\n"); - } - - indent--; - fprintf(client, "}\n"); - fprintf(client, "\n"); - - method_count++; + write_function_stub( iface, func, method_count++, *proc_offset ); + *proc_offset += get_size_procformatstring_func( iface, func ); } } @@ -334,7 +315,7 @@ static void write_stubdescdecl(type_t *iface) static void write_stubdescriptor(type_t *iface, int expr_eval_routines) { - const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE); + const var_t *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE); print_client("static const MIDL_STUB_DESC %s_StubDesc =\n", iface->name); print_client("{\n"); @@ -345,13 +326,16 @@ static void write_stubdescriptor(type_t *iface, int expr_eval_routines) print_client("{\n"); indent++; if (implicit_handle) - print_client("&%s,\n", implicit_handle); + print_client("&%s,\n", implicit_handle->name); else print_client("&%s__MIDL_AutoBindHandle,\n", iface->name); indent--; print_client("},\n"); print_client("0,\n"); - print_client("0,\n"); + if (!list_empty( &generic_handle_list )) + print_client("BindingRoutines,\n"); + else + print_client("0,\n"); if (expr_eval_routines) print_client("ExprEvalRoutines,\n"); else @@ -359,7 +343,7 @@ static void write_stubdescriptor(type_t *iface, int expr_eval_routines) print_client("0,\n"); print_client("__MIDL_TypeFormatString.Format,\n"); print_client("1, /* -error bounds_check flag */\n"); - print_client("0x10001, /* Ndr library version */\n"); + print_client("0x%x, /* Ndr library version */\n", get_stub_mode() == MODE_Oif ? 0x50002 : 0x10001); print_client("0,\n"); print_client("0x50100a4, /* MIDL Version 5.1.164 */\n"); print_client("0,\n"); @@ -420,12 +404,12 @@ static void write_clientinterfacedecl(type_t *iface) static void write_implicithandledecl(type_t *iface) { - const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE); + const var_t *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE); if (implicit_handle) { - fprintf(client, "handle_t %s;\n", implicit_handle); - fprintf(client, "\n"); + write_type_decl( client, implicit_handle->type, implicit_handle->name ); + fprintf(client, ";\n\n"); } } @@ -438,10 +422,7 @@ static void init_client(void) print_client("/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name); print_client("#include \n"); - print_client("#ifdef _ALPHA_\n"); - print_client("#include \n"); - print_client("#endif\n"); - fprintf(client, "\n"); + print_client( "\n"); print_client("#include \"%s\"\n", header_name); print_client( "\n"); print_client( "#ifndef DECLSPEC_HIDDEN\n"); @@ -496,18 +477,39 @@ static void write_client_ifaces(const statement_list_t *stmts, int expr_eval_rou } } +static void write_generic_handle_routine_list(void) +{ + generic_handle_t *gh; + + if (list_empty( &generic_handle_list )) return; + print_client( "static const GENERIC_BINDING_ROUTINE_PAIR BindingRoutines[] =\n" ); + print_client( "{\n" ); + indent++; + LIST_FOR_EACH_ENTRY( gh, &generic_handle_list, generic_handle_t, entry ) + { + print_client( "{ (GENERIC_BINDING_ROUTINE)%s_bind, (GENERIC_UNBIND_ROUTINE)%s_unbind },\n", + gh->name, gh->name ); + } + indent--; + print_client( "};\n\n" ); +} + static void write_client_routines(const statement_list_t *stmts) { unsigned int proc_offset = 0; int expr_eval_routines; - write_exceptions( client ); - print_client( "\n"); + if (need_inline_stubs_file( stmts )) + { + write_exceptions( client ); + print_client( "\n"); + } write_formatstringsdecl(client, indent, stmts, need_stub); expr_eval_routines = write_expr_eval_routines(client, client_token); if (expr_eval_routines) write_expr_eval_routine_list(client, client_token); + write_generic_handle_routine_list(); write_user_quad_list(client); write_client_ifaces(stmts, expr_eval_routines, &proc_offset); diff --git a/reactos/tools/widl/expr.c b/reactos/tools/widl/expr.c index e1a5196d059..70123825072 100644 --- a/reactos/tools/widl/expr.c +++ b/reactos/tools/widl/expr.c @@ -94,6 +94,7 @@ static int is_signed_integer_type(const type_t *type) case TYPE_BASIC_HANDLE: return FALSE; } + /* FALLTHROUGH */ default: return FALSE; } @@ -648,6 +649,10 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc check_scalar_type(expr_loc, cont_type, result_first.type); result_second = resolve_expression(expr_loc, cont_type, e->u.ext); result_third = resolve_expression(expr_loc, cont_type, e->ext2); + check_scalar_type(expr_loc, cont_type, result_second.type); + check_scalar_type(expr_loc, cont_type, result_third.type); + if (!is_ptr(result_second.type) ^ !is_ptr(result_third.type)) + error_loc_info(&expr_loc->v->loc_info, "type mismatch in ?: expression\n" ); /* FIXME: determine the correct return type */ result = result_second; result.is_variable = FALSE; diff --git a/reactos/tools/widl/hash.c b/reactos/tools/widl/hash.c index 508d17131e2..d8a9b701934 100644 --- a/reactos/tools/widl/hash.c +++ b/reactos/tools/widl/hash.c @@ -21,7 +21,9 @@ #include #include -#include +#include "windef.h" +#include "winbase.h" +#include "winnls.h" #include "widltypes.h" #include "hash.h" @@ -537,7 +539,7 @@ unsigned int lhash_val_of_name_sys( syskind_t skind, LCID lcid, LPCSTR lpStr) case LANG_VIETNAMESE: case LANG_MALTESE: case LANG_IRISH: case LANG_SAMI: case LANG_UPPER_SORBIAN: case LANG_TSWANA: case LANG_XHOSA: case LANG_ZULU: case LANG_WELSH: - case LANG_BRETON: + case LANG_BRETON: case LANG_NEUTRAL: /* some languages not in all windows versions or ReactOS */ #ifdef LANG_GAELIC case LANG_GAELIC: diff --git a/reactos/tools/widl/header.c b/reactos/tools/widl/header.c index e0322c62fd1..9d20a3ee2bd 100644 --- a/reactos/tools/widl/header.c +++ b/reactos/tools/widl/header.c @@ -36,13 +36,11 @@ #include "expr.h" #include "typetree.h" -typedef struct _user_type_t generic_handle_t; - static int indentation = 0; static int is_object_interface = 0; user_type_list_t user_type_list = LIST_INIT(user_type_list); -static context_handle_list_t context_handle_list = LIST_INIT(context_handle_list); -static struct list generic_handle_list = LIST_INIT(generic_handle_list); +context_handle_list_t context_handle_list = LIST_INIT(context_handle_list); +generic_handle_list_t generic_handle_list = LIST_INIT(generic_handle_list); static void write_type_def_or_decl(FILE *f, type_t *t, int field, const char *name); @@ -131,6 +129,28 @@ void write_guid(FILE *f, const char *guid_prefix, const char *name, const UUID * uuid->Data4[6], uuid->Data4[7]); } +static void write_uuid_decl(FILE *f, const char *name, const UUID *uuid) +{ + fprintf(f, "#ifdef __CRT_UUID_DECL\n"); + fprintf(f, "__CRT_UUID_DECL(%s, 0x%08x, 0x%04x, 0x%04x, 0x%02x,0x%02x, 0x%02x," + "0x%02x,0x%02x,0x%02x,0x%02x,0x%02x)\n", + name, uuid->Data1, uuid->Data2, uuid->Data3, uuid->Data4[0], uuid->Data4[1], + uuid->Data4[2], uuid->Data4[3], uuid->Data4[4], uuid->Data4[5], uuid->Data4[6], + uuid->Data4[7]); + fprintf(f, "#endif\n"); +} + +static const char *uuid_string(const UUID *uuid) +{ + static char buf[37]; + + sprintf(buf, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", + uuid->Data1, uuid->Data2, uuid->Data3, uuid->Data4[0], uuid->Data4[1], uuid->Data4[2], + uuid->Data4[3], uuid->Data4[4], uuid->Data4[5], uuid->Data4[6], uuid->Data4[7]); + + return buf; +} + const char *get_name(const var_t *v) { static char buffer[256]; @@ -441,6 +461,46 @@ static int generic_handle_registered(const char *name) return 0; } +unsigned int get_context_handle_offset( const type_t *type ) +{ + context_handle_t *ch; + unsigned int index = 0; + + while (!is_attr( type->attrs, ATTR_CONTEXTHANDLE )) + { + if (type_is_alias( type )) type = type_alias_get_aliasee( type ); + else if (is_ptr( type )) type = type_pointer_get_ref( type ); + else error( "internal error: %s is not a context handle\n", type->name ); + } + LIST_FOR_EACH_ENTRY( ch, &context_handle_list, context_handle_t, entry ) + { + if (!strcmp( type->name, ch->name )) return index; + index++; + } + error( "internal error: %s is not registered as a context handle\n", type->name ); + return index; +} + +unsigned int get_generic_handle_offset( const type_t *type ) +{ + generic_handle_t *gh; + unsigned int index = 0; + + while (!is_attr( type->attrs, ATTR_HANDLE )) + { + if (type_is_alias( type )) type = type_alias_get_aliasee( type ); + else if (is_ptr( type )) type = type_pointer_get_ref( type ); + else error( "internal error: %s is not a generic handle\n", type->name ); + } + LIST_FOR_EACH_ENTRY( gh, &generic_handle_list, generic_handle_t, entry ) + { + if (!strcmp( type->name, gh->name )) return index; + index++; + } + error( "internal error: %s is not registered as a generic handle\n", type->name ); + return index; +} + /* check for types which require additional prototypes to be generated in the * header */ void check_for_additional_prototype_types(const var_list_t *list) @@ -617,23 +677,6 @@ static void write_library(FILE *header, const typelib_t *typelib) } -const var_t* get_explicit_handle_var(const var_t *func) -{ - const var_t* var; - - if (!type_get_function_args(func->type)) - return NULL; - - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry ) - { - const type_t *type = var->type; - if (type_get_type(type) == TYPE_BASIC && type_basic_get_type(type) == TYPE_BASIC_HANDLE) - return var; - } - - return NULL; -} - const type_t* get_explicit_generic_handle_type(const var_t* var) { const type_t *t; @@ -646,31 +689,44 @@ const type_t* get_explicit_generic_handle_type(const var_t* var) return NULL; } -const var_t* get_explicit_generic_handle_var(const var_t *func) +const var_t *get_func_handle_var( const type_t *iface, const var_t *func, + unsigned char *explicit_fc, unsigned char *implicit_fc ) { - const var_t* var; + const var_t *var; + const var_list_t *args = type_get_function_args( func->type ); - if (!type_get_function_args(func->type)) - return NULL; - - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry ) - if (get_explicit_generic_handle_type(var)) + *explicit_fc = *implicit_fc = 0; + if (args) LIST_FOR_EACH_ENTRY( var, args, const var_t, entry ) + { + if (!is_attr( var->attrs, ATTR_IN ) && is_attr( var->attrs, ATTR_OUT )) continue; + if (type_get_type( var->type ) == TYPE_BASIC && type_basic_get_type( var->type ) == TYPE_BASIC_HANDLE) + { + *explicit_fc = RPC_FC_BIND_PRIMITIVE; return var; - - return NULL; -} - -const var_t* get_context_handle_var(const var_t *func) -{ - const var_t* var; - - if (!type_get_function_args(func->type)) - return NULL; - - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry ) - if (is_attr(var->attrs, ATTR_IN) && is_context_handle(var->type)) + } + if (get_explicit_generic_handle_type( var )) + { + *explicit_fc = RPC_FC_BIND_GENERIC; return var; + } + if (is_context_handle( var->type )) + { + *explicit_fc = RPC_FC_BIND_CONTEXT; + return var; + } + } + if ((var = get_attrp( iface->attrs, ATTR_IMPLICIT_HANDLE ))) + { + if (type_get_type( var->type ) == TYPE_BASIC && + type_basic_get_type( var->type ) == TYPE_BASIC_HANDLE) + *implicit_fc = RPC_FC_BIND_PRIMITIVE; + else + *implicit_fc = RPC_FC_BIND_GENERIC; + return var; + } + + *implicit_fc = RPC_FC_AUTO_HANDLE; return NULL; } @@ -960,10 +1016,10 @@ static void write_function_proto(FILE *header, const type_t *iface, const var_t { const char *callconv = get_attrp(fun->type->attrs, ATTR_CALLCONV); + if (!callconv) callconv = "__cdecl"; /* FIXME: do we need to handle call_as? */ write_type_decl_left(header, type_function_get_rettype(fun->type)); - fprintf(header, " "); - if (callconv) fprintf(header, "%s ", callconv); + fprintf(header, " %s ", callconv); fprintf(header, "%s%s(\n", prefix, get_name(fun)); if (type_get_function_args(fun->type)) write_args(header, type_get_function_args(fun->type), iface->name, 0, TRUE); @@ -980,24 +1036,6 @@ static void write_forward(FILE *header, type_t *iface) fprintf(header, "#endif\n\n" ); } -static void write_iface_guid(FILE *header, const type_t *iface) -{ - const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID); - write_guid(header, "IID", iface->name, uuid); -} - -static void write_dispiface_guid(FILE *header, const type_t *iface) -{ - const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID); - write_guid(header, "DIID", iface->name, uuid); -} - -static void write_coclass_guid(FILE *header, const type_t *cocl) -{ - const UUID *uuid = get_attrp(cocl->attrs, ATTR_UUID); - write_guid(header, "CLSID", cocl->name, uuid); -} - static void write_com_interface_start(FILE *header, const type_t *iface) { int dispinterface = is_attr(iface->attrs, ATTR_DISPINTERFACE); @@ -1011,21 +1049,26 @@ static void write_com_interface_start(FILE *header, const type_t *iface) static void write_com_interface_end(FILE *header, type_t *iface) { int dispinterface = is_attr(iface->attrs, ATTR_DISPINTERFACE); - if (dispinterface) - write_dispiface_guid(header, iface); - else - write_iface_guid(header, iface); + const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID); + + if (uuid) + write_guid(header, dispinterface ? "DIID" : "IID", iface->name, uuid); + /* C++ interface */ fprintf(header, "#if defined(__cplusplus) && !defined(CINTERFACE)\n"); + if (uuid) + fprintf(header, "MIDL_INTERFACE(\"%s\")\n", uuid_string(uuid)); + else + fprintf(header, "interface "); if (type_iface_get_inherit(iface)) { - fprintf(header, "interface %s : public %s\n", iface->name, + fprintf(header, "%s : public %s\n", iface->name, type_iface_get_inherit(iface)->name); fprintf(header, "{\n"); } else { - fprintf(header, "interface %s\n", iface->name); + fprintf(header, "%s\n", iface->name); fprintf(header, "{\n"); fprintf(header, " BEGIN_INTERFACE\n"); fprintf(header, "\n"); @@ -1041,6 +1084,8 @@ static void write_com_interface_end(FILE *header, type_t *iface) if (!type_iface_get_inherit(iface)) fprintf(header, " END_INTERFACE\n"); fprintf(header, "};\n"); + if (uuid) + write_uuid_decl(header, iface->name, uuid); fprintf(header, "#else\n"); /* C interface */ fprintf(header, "typedef struct %sVtbl {\n", iface->name); @@ -1080,14 +1125,19 @@ static void write_com_interface_end(FILE *header, type_t *iface) static void write_rpc_interface_start(FILE *header, const type_t *iface) { unsigned int ver = get_attrv(iface->attrs, ATTR_VERSION); - const char *var = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE); + const var_t *var = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE); fprintf(header, "/*****************************************************************************\n"); fprintf(header, " * %s interface (v%d.%d)\n", iface->name, MAJORVERSION(ver), MINORVERSION(ver)); fprintf(header, " */\n"); fprintf(header,"#ifndef __%s_INTERFACE_DEFINED__\n", iface->name); fprintf(header,"#define __%s_INTERFACE_DEFINED__\n\n", iface->name); - if (var) fprintf(header, "extern handle_t %s;\n", var); + if (var) + { + fprintf(header, "extern "); + write_type_decl( header, var->type, var->name ); + fprintf(header, ";\n"); + } if (old_names) { fprintf(header, "extern RPC_IF_HANDLE %s%s_ClientIfHandle;\n", prefix_client, iface->name); @@ -1109,10 +1159,24 @@ static void write_rpc_interface_end(FILE *header, const type_t *iface) static void write_coclass(FILE *header, type_t *cocl) { + const UUID *uuid = get_attrp(cocl->attrs, ATTR_UUID); + fprintf(header, "/*****************************************************************************\n"); fprintf(header, " * %s coclass\n", cocl->name); fprintf(header, " */\n\n"); - write_coclass_guid(header, cocl); + if (uuid) + write_guid(header, "CLSID", cocl->name, uuid); + fprintf(header, "\n#ifdef __cplusplus\n"); + if (uuid) + { + fprintf(header, "class DECLSPEC_UUID(\"%s\") %s;\n", uuid_string(uuid), cocl->name); + write_uuid_decl(header, cocl->name, uuid); + } + else + { + fprintf(header, "class %s;\n", cocl->name); + } + fprintf(header, "#endif\n"); fprintf(header, "\n"); } @@ -1225,7 +1289,7 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons write_header_stmts(header, type_iface_get_stmts(iface), iface, FALSE); write_rpc_interface_end(header, iface); } - if (is_object(iface)) is_object_interface++; + if (is_object(iface)) is_object_interface--; } else if (type_get_type(stmt->u.type) == TYPE_COCLASS) write_coclass(header, stmt->u.type); @@ -1299,6 +1363,11 @@ void write_header(const statement_list_t *stmts) fprintf(header, "#include \n" ); fprintf(header, "#include \n\n" ); + fprintf(header, "#if !defined(COM_NO_WINDOWS_H) && !defined(__WINESRC__)\n"); + fprintf(header, "#include \n"); + fprintf(header, "#include \n"); + fprintf(header, "#endif\n\n"); + fprintf(header, "#ifndef __WIDL_%s\n", header_token); fprintf(header, "#define __WIDL_%s\n\n", header_token); diff --git a/reactos/tools/widl/header.h b/reactos/tools/widl/header.h index 6a37192f395..6d056db2df5 100644 --- a/reactos/tools/widl/header.h +++ b/reactos/tools/widl/header.h @@ -36,21 +36,24 @@ extern void write_type_left(FILE *h, type_t *t, int declonly); extern void write_type_right(FILE *h, type_t *t, int is_field); extern void write_type_decl(FILE *f, type_t *t, const char *name); extern void write_type_decl_left(FILE *f, type_t *t); +extern unsigned int get_context_handle_offset( const type_t *type ); +extern unsigned int get_generic_handle_offset( const type_t *type ); extern int needs_space_after(type_t *t); extern int is_object(const type_t *iface); extern int is_local(const attr_list_t *list); extern int count_methods(const type_t *iface); extern int need_stub(const type_t *iface); extern int need_proxy(const type_t *iface); +extern int need_inline_stubs(const type_t *iface); extern int need_stub_files(const statement_list_t *stmts); extern int need_proxy_file(const statement_list_t *stmts); +extern int need_inline_stubs_file(const statement_list_t *stmts); extern const var_t *is_callas(const attr_list_t *list); extern void write_args(FILE *h, const var_list_t *arg, const char *name, int obj, int do_indent); extern void write_array(FILE *h, array_dims_t *v, int field); -extern const var_t* get_explicit_handle_var(const var_t *func); extern const type_t* get_explicit_generic_handle_type(const var_t* var); -extern const var_t* get_explicit_generic_handle_var(const var_t *func); -extern const var_t* get_context_handle_var(const var_t *func); +extern const var_t *get_func_handle_var( const type_t *iface, const var_t *func, + unsigned char *explicit_fc, unsigned char *implicit_fc ); extern int has_out_arg_or_return(const var_t *func); extern void write_guid(FILE *f, const char *guid_prefix, const char *name, const UUID *uuid); diff --git a/reactos/tools/widl/parser.l b/reactos/tools/widl/parser.l index 3a535e829fa..e80616792b4 100644 --- a/reactos/tools/widl/parser.l +++ b/reactos/tools/widl/parser.l @@ -142,7 +142,6 @@ UUID *parse_uuid(const char *u) error_loc("Malformed '#...' line-directive; missing terminating \"\n"); *cptr = '\0'; line_number = lineno - 1; /* We didn't read the newline */ - free( input_name ); input_name = xstrdup(fname); } \" yy_push_state(QUOTE); cbufidx = 0; diff --git a/reactos/tools/widl/parser.tab.c b/reactos/tools/widl/parser.tab.c index 0166dbd56c8..d86106855bf 100644 --- a/reactos/tools/widl/parser.tab.c +++ b/reactos/tools/widl/parser.tab.c @@ -1,10 +1,9 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.4.2. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,7 +45,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.1" +#define YYBISON_VERSION "2.4.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -212,7 +211,7 @@ static attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs); static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs); static attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs); const char *get_attr_display_name(enum attr_type type); -static void add_explicit_handle_if_necessary(var_t *func); +static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func); static void check_def(const type_t *t); static statement_t *make_statement(enum statement_type type); @@ -231,7 +230,7 @@ static statement_list_t *append_statement(statement_list_t *list, statement_t *s /* Line 189 of yacc.c */ -#line 235 "parser.tab.c" +#line 234 "parser.tab.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -479,7 +478,7 @@ typedef union YYSTYPE /* Line 214 of yacc.c */ -#line 483 "parser.tab.c" +#line 482 "parser.tab.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -491,7 +490,7 @@ typedef union YYSTYPE /* Line 264 of yacc.c */ -#line 495 "parser.tab.c" +#line 494 "parser.tab.c" #ifdef short # undef short @@ -541,7 +540,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -706,16 +705,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 2650 +#define YYLAST 2742 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 208 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 100 /* YYNRULES -- Number of rules. */ -#define YYNRULES 376 +#define YYNRULES 380 /* YYNRULES -- Number of states. */ -#define YYNSTATES 655 +#define YYNSTATES 661 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -781,41 +780,42 @@ static const yytype_uint16 yyprhs[] = 0, 0, 3, 5, 6, 9, 12, 16, 19, 22, 25, 28, 29, 32, 35, 39, 42, 45, 48, 51, 54, 55, 58, 59, 61, 63, 66, 69, 71, 74, - 76, 78, 80, 83, 86, 89, 94, 98, 102, 108, - 111, 115, 120, 121, 123, 125, 129, 131, 135, 139, - 142, 146, 150, 151, 153, 157, 159, 163, 168, 170, - 174, 175, 177, 182, 184, 186, 188, 190, 192, 197, - 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, - 222, 227, 229, 231, 233, 238, 240, 242, 244, 249, - 254, 256, 258, 260, 262, 267, 272, 277, 282, 287, - 289, 294, 296, 298, 303, 305, 311, 313, 315, 320, - 325, 327, 329, 331, 333, 335, 337, 339, 341, 343, - 345, 347, 349, 351, 353, 358, 360, 362, 364, 369, - 374, 376, 378, 380, 382, 384, 391, 393, 398, 400, - 402, 404, 409, 411, 413, 415, 420, 425, 430, 435, - 437, 439, 444, 449, 451, 453, 458, 463, 468, 470, - 472, 474, 476, 478, 480, 482, 483, 486, 491, 495, - 496, 499, 501, 503, 507, 511, 513, 519, 521, 525, - 526, 528, 530, 532, 534, 536, 538, 540, 542, 544, - 546, 548, 554, 558, 562, 566, 570, 574, 578, 582, - 586, 590, 594, 598, 602, 606, 610, 614, 618, 622, - 626, 629, 632, 635, 638, 641, 644, 648, 652, 658, - 664, 669, 673, 675, 679, 681, 683, 684, 687, 692, - 696, 699, 702, 703, 706, 709, 711, 715, 717, 721, - 724, 725, 727, 728, 730, 732, 734, 736, 738, 740, - 742, 745, 748, 750, 752, 754, 756, 758, 760, 761, - 763, 765, 768, 770, 773, 776, 778, 780, 782, 785, - 788, 791, 797, 798, 801, 804, 807, 810, 813, 816, - 820, 823, 827, 833, 839, 840, 843, 846, 849, 852, - 859, 868, 871, 874, 877, 880, 883, 886, 892, 894, - 896, 898, 900, 902, 903, 906, 909, 913, 914, 916, - 919, 922, 925, 929, 932, 934, 936, 940, 943, 948, - 952, 955, 957, 961, 964, 965, 967, 971, 974, 976, - 980, 985, 989, 992, 994, 998, 1001, 1002, 1004, 1006, - 1010, 1013, 1015, 1019, 1024, 1026, 1030, 1031, 1034, 1037, - 1039, 1043, 1045, 1049, 1051, 1053, 1055, 1057, 1059, 1061, - 1063, 1065, 1071, 1073, 1075, 1077, 1079, 1082, 1084, 1087, - 1089, 1092, 1097, 1102, 1108, 1119, 1121 + 76, 79, 81, 84, 86, 89, 92, 95, 98, 103, + 107, 111, 117, 120, 124, 129, 130, 132, 134, 138, + 140, 144, 148, 151, 155, 159, 162, 163, 165, 169, + 171, 175, 180, 182, 186, 187, 189, 194, 196, 198, + 200, 202, 204, 209, 214, 216, 218, 220, 222, 224, + 226, 228, 230, 232, 234, 239, 241, 243, 245, 250, + 252, 254, 256, 261, 266, 268, 270, 272, 274, 279, + 284, 289, 294, 299, 301, 306, 308, 310, 315, 317, + 322, 324, 326, 331, 336, 338, 340, 342, 344, 346, + 348, 350, 352, 354, 356, 358, 360, 362, 364, 369, + 371, 373, 375, 380, 385, 387, 389, 391, 393, 395, + 402, 404, 409, 411, 413, 415, 420, 422, 424, 426, + 431, 436, 441, 446, 448, 450, 455, 460, 462, 464, + 469, 474, 479, 481, 483, 485, 487, 489, 491, 493, + 494, 497, 502, 506, 507, 510, 512, 514, 518, 522, + 524, 530, 532, 536, 537, 539, 541, 543, 545, 547, + 549, 551, 553, 555, 557, 559, 565, 569, 573, 577, + 581, 585, 589, 593, 597, 601, 605, 609, 613, 617, + 621, 625, 629, 633, 637, 640, 643, 646, 649, 652, + 655, 659, 663, 669, 675, 680, 684, 686, 690, 692, + 694, 695, 698, 703, 707, 710, 713, 714, 717, 720, + 722, 726, 728, 732, 735, 736, 738, 739, 741, 743, + 745, 747, 749, 751, 753, 756, 759, 761, 763, 765, + 767, 769, 771, 772, 774, 776, 779, 781, 784, 787, + 789, 791, 793, 796, 799, 802, 808, 809, 812, 815, + 818, 821, 824, 827, 831, 834, 838, 844, 850, 851, + 854, 857, 860, 863, 870, 879, 882, 885, 888, 891, + 894, 897, 903, 905, 907, 909, 911, 913, 914, 917, + 920, 924, 925, 927, 930, 933, 936, 940, 943, 945, + 947, 951, 954, 959, 963, 966, 968, 972, 975, 976, + 978, 982, 985, 987, 991, 996, 1000, 1003, 1005, 1009, + 1012, 1013, 1015, 1017, 1021, 1024, 1026, 1030, 1035, 1037, + 1041, 1042, 1045, 1048, 1050, 1054, 1056, 1060, 1062, 1064, + 1066, 1068, 1070, 1072, 1074, 1076, 1082, 1084, 1086, 1088, + 1090, 1093, 1095, 1098, 1100, 1103, 1108, 1113, 1119, 1130, + 1132 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ @@ -828,112 +828,113 @@ static const yytype_int16 yyrhs[] = 263, -1, 211, 278, -1, 211, 214, -1, 211, 219, -1, 211, 222, -1, -1, 212, 214, -1, -1, 202, -1, 216, -1, 215, 202, -1, 254, 202, -1, 218, - -1, 305, 202, -1, 240, -1, 303, -1, 306, -1, - 229, 240, -1, 229, 303, -1, 229, 306, -1, 48, - 203, 8, 204, -1, 89, 8, 202, -1, 217, 211, - 12, -1, 90, 203, 8, 204, 213, -1, 101, 3, - -1, 229, 220, 205, -1, 221, 211, 206, 213, -1, - -1, 225, -1, 226, -1, 224, 179, 226, -1, 224, - -1, 224, 179, 22, -1, 229, 283, 294, -1, 283, - 294, -1, 200, 242, 201, -1, 200, 189, 201, -1, - -1, 229, -1, 200, 230, 201, -1, 232, -1, 230, - 179, 232, -1, 230, 201, 200, 232, -1, 8, -1, - 231, 179, 8, -1, -1, 23, -1, 25, 203, 8, - 204, -1, 26, -1, 27, -1, 29, -1, 30, -1, - 32, -1, 35, 203, 257, 204, -1, 37, 203, 244, - 204, -1, 41, -1, 42, -1, 44, -1, 45, -1, - 46, -1, 47, -1, 49, -1, 50, -1, 51, -1, - 52, -1, 53, 203, 246, 204, -1, 54, -1, 55, - -1, 56, -1, 58, 203, 8, 204, -1, 60, -1, - 61, -1, 62, -1, 63, 203, 231, 204, -1, 64, - 203, 246, 204, -1, 67, -1, 71, -1, 73, -1, - 74, -1, 76, 203, 245, 204, -1, 77, 203, 8, - 204, -1, 78, 203, 8, 204, -1, 79, 203, 245, - 204, -1, 80, 203, 8, 204, -1, 81, -1, 83, - 203, 245, 204, -1, 84, -1, 85, -1, 86, 203, - 243, 204, -1, 87, -1, 88, 203, 75, 3, 204, - -1, 91, -1, 94, -1, 100, 203, 241, 204, -1, - 99, 203, 245, 204, -1, 99, -1, 102, -1, 103, - -1, 105, -1, 106, -1, 109, -1, 110, -1, 111, - -1, 112, -1, 113, -1, 114, -1, 116, -1, 117, - -1, 118, -1, 119, 203, 8, 204, -1, 120, -1, - 121, -1, 122, -1, 124, 203, 302, 204, -1, 125, - 203, 8, 204, -1, 127, -1, 128, -1, 129, -1, - 130, -1, 132, -1, 133, 203, 245, 179, 245, 204, - -1, 134, -1, 137, 203, 304, 204, -1, 138, -1, - 139, -1, 140, -1, 144, 203, 241, 204, -1, 147, - -1, 150, -1, 151, -1, 154, 203, 243, 204, -1, - 155, 203, 304, 204, -1, 157, 203, 304, 204, -1, - 156, 203, 301, 204, -1, 160, -1, 164, -1, 165, - 203, 304, 204, -1, 166, 203, 233, 204, -1, 167, - -1, 168, -1, 169, 203, 307, 204, -1, 170, 203, - 8, 204, -1, 173, 203, 304, 204, -1, 302, -1, - 11, -1, 8, -1, 38, -1, 70, -1, 123, -1, - 149, -1, -1, 235, 236, -1, 37, 245, 181, 251, - -1, 50, 181, 251, -1, -1, 238, 179, -1, 238, - -1, 239, -1, 238, 179, 239, -1, 257, 207, 245, - -1, 257, -1, 65, 256, 205, 237, 206, -1, 242, - -1, 241, 179, 242, -1, -1, 243, -1, 5, -1, - 6, -1, 7, -1, 69, -1, 115, -1, 158, -1, - 8, -1, 9, -1, 10, -1, 3, -1, 243, 180, - 243, 181, 243, -1, 243, 20, 243, -1, 243, 21, - 243, -1, 243, 182, 243, -1, 243, 183, 243, -1, - 243, 184, 243, -1, 243, 16, 243, -1, 243, 17, - 243, -1, 243, 186, 243, -1, 243, 185, 243, -1, - 243, 18, 243, -1, 243, 19, 243, -1, 243, 13, - 243, -1, 243, 14, 243, -1, 243, 188, 243, -1, - 243, 187, 243, -1, 243, 191, 243, -1, 243, 189, - 243, -1, 243, 190, 243, -1, 192, 243, -1, 193, - 243, -1, 188, 243, -1, 187, 243, -1, 184, 243, - -1, 189, 243, -1, 243, 15, 3, -1, 243, 199, - 3, -1, 203, 283, 290, 204, 243, -1, 145, 203, - 283, 290, 204, -1, 243, 200, 243, 201, -1, 203, - 243, 204, -1, 245, -1, 244, 179, 245, -1, 243, - -1, 243, -1, -1, 247, 248, -1, 228, 283, 299, - 202, -1, 228, 306, 202, -1, 252, 202, -1, 229, - 202, -1, -1, 250, 249, -1, 252, 202, -1, 202, - -1, 228, 283, 286, -1, 254, -1, 229, 283, 300, - -1, 283, 300, -1, -1, 257, -1, -1, 3, -1, - 4, -1, 3, -1, 4, -1, 33, -1, 172, -1, - 260, -1, 143, 260, -1, 163, 260, -1, 163, -1, - 72, -1, 59, -1, 31, -1, 66, -1, 75, -1, - -1, 95, -1, 95, -1, 142, 259, -1, 146, -1, - 104, 259, -1, 82, 259, -1, 97, -1, 39, -1, - 96, -1, 40, 3, -1, 40, 4, -1, 229, 261, - -1, 262, 205, 264, 206, 213, -1, -1, 264, 265, - -1, 228, 275, -1, 57, 3, -1, 57, 4, -1, - 229, 266, -1, 126, 181, -1, 268, 252, 202, -1, - 107, 181, -1, 269, 253, 202, -1, 267, 205, 268, - 269, 206, -1, 267, 205, 272, 202, 206, -1, -1, - 181, 4, -1, 98, 3, -1, 98, 4, -1, 229, - 272, -1, 273, 271, 205, 212, 206, 213, -1, 273, - 181, 3, 205, 218, 212, 206, 213, -1, 270, 213, - -1, 272, 202, -1, 266, 202, -1, 108, 3, -1, - 108, 4, -1, 229, 276, -1, 277, 205, 212, 206, - 213, -1, 68, -1, 148, -1, 136, -1, 93, -1, - 43, -1, -1, 282, 281, -1, 304, 284, -1, 285, - 304, 284, -1, -1, 285, -1, 281, 284, -1, 280, - 284, -1, 279, 284, -1, 189, 282, 286, -1, 234, - 286, -1, 287, -1, 257, -1, 203, 286, 204, -1, - 287, 227, -1, 287, 203, 223, 204, -1, 189, 282, - 290, -1, 234, 290, -1, 291, -1, 189, 282, 294, - -1, 234, 294, -1, -1, 288, -1, 203, 289, 204, - -1, 291, 227, -1, 227, -1, 203, 223, 204, -1, - 291, 203, 223, 204, -1, 189, 282, 294, -1, 234, - 294, -1, 295, -1, 189, 282, 294, -1, 234, 294, - -1, -1, 292, -1, 257, -1, 203, 293, 204, -1, - 295, 227, -1, 227, -1, 203, 223, 204, -1, 295, - 203, 223, 204, -1, 286, -1, 296, 179, 286, -1, - -1, 181, 246, -1, 292, 297, -1, 298, -1, 299, - 179, 298, -1, 286, -1, 286, 207, 246, -1, 174, - -1, 175, -1, 176, -1, 177, -1, 178, -1, 135, - -1, 162, -1, 131, -1, 152, 256, 205, 247, 206, - -1, 171, -1, 4, -1, 258, -1, 240, -1, 65, - 3, -1, 303, -1, 152, 3, -1, 306, -1, 161, - 3, -1, 141, 203, 304, 204, -1, 159, 228, 283, - 296, -1, 161, 256, 205, 250, 206, -1, 161, 256, - 153, 203, 252, 204, 255, 205, 235, 206, -1, 5, - -1, 5, 199, 5, -1 + -1, 305, 202, -1, 240, -1, 65, 3, -1, 303, + -1, 152, 3, -1, 306, -1, 161, 3, -1, 229, + 240, -1, 229, 303, -1, 229, 306, -1, 48, 203, + 8, 204, -1, 89, 8, 202, -1, 217, 211, 12, + -1, 90, 203, 8, 204, 213, -1, 101, 3, -1, + 229, 220, 205, -1, 221, 211, 206, 213, -1, -1, + 225, -1, 226, -1, 224, 179, 226, -1, 224, -1, + 224, 179, 22, -1, 229, 283, 294, -1, 283, 294, + -1, 200, 243, 201, -1, 200, 189, 201, -1, 200, + 201, -1, -1, 229, -1, 200, 230, 201, -1, 232, + -1, 230, 179, 232, -1, 230, 201, 200, 232, -1, + 8, -1, 231, 179, 8, -1, -1, 23, -1, 25, + 203, 8, 204, -1, 26, -1, 27, -1, 29, -1, + 30, -1, 32, -1, 35, 203, 257, 204, -1, 37, + 203, 244, 204, -1, 41, -1, 42, -1, 44, -1, + 45, -1, 46, -1, 47, -1, 49, -1, 50, -1, + 51, -1, 52, -1, 53, 203, 246, 204, -1, 54, + -1, 55, -1, 56, -1, 58, 203, 8, 204, -1, + 60, -1, 61, -1, 62, -1, 63, 203, 231, 204, + -1, 64, 203, 246, 204, -1, 67, -1, 71, -1, + 73, -1, 74, -1, 76, 203, 245, 204, -1, 77, + 203, 8, 204, -1, 78, 203, 8, 204, -1, 79, + 203, 245, 204, -1, 80, 203, 8, 204, -1, 81, + -1, 83, 203, 245, 204, -1, 84, -1, 85, -1, + 86, 203, 243, 204, -1, 87, -1, 88, 203, 226, + 204, -1, 91, -1, 94, -1, 100, 203, 241, 204, + -1, 99, 203, 245, 204, -1, 99, -1, 102, -1, + 103, -1, 105, -1, 106, -1, 109, -1, 110, -1, + 111, -1, 112, -1, 113, -1, 114, -1, 116, -1, + 117, -1, 118, -1, 119, 203, 8, 204, -1, 120, + -1, 121, -1, 122, -1, 124, 203, 302, 204, -1, + 125, 203, 8, 204, -1, 127, -1, 128, -1, 129, + -1, 130, -1, 132, -1, 133, 203, 245, 179, 245, + 204, -1, 134, -1, 137, 203, 304, 204, -1, 138, + -1, 139, -1, 140, -1, 144, 203, 241, 204, -1, + 147, -1, 150, -1, 151, -1, 154, 203, 243, 204, + -1, 155, 203, 304, 204, -1, 157, 203, 304, 204, + -1, 156, 203, 301, 204, -1, 160, -1, 164, -1, + 165, 203, 304, 204, -1, 166, 203, 233, 204, -1, + 167, -1, 168, -1, 169, 203, 307, 204, -1, 170, + 203, 8, 204, -1, 173, 203, 304, 204, -1, 302, + -1, 11, -1, 8, -1, 38, -1, 70, -1, 123, + -1, 149, -1, -1, 235, 236, -1, 37, 245, 181, + 251, -1, 50, 181, 251, -1, -1, 238, 179, -1, + 238, -1, 239, -1, 238, 179, 239, -1, 257, 207, + 245, -1, 257, -1, 65, 256, 205, 237, 206, -1, + 242, -1, 241, 179, 242, -1, -1, 243, -1, 5, + -1, 6, -1, 7, -1, 69, -1, 115, -1, 158, + -1, 8, -1, 9, -1, 10, -1, 3, -1, 243, + 180, 243, 181, 243, -1, 243, 20, 243, -1, 243, + 21, 243, -1, 243, 182, 243, -1, 243, 183, 243, + -1, 243, 184, 243, -1, 243, 16, 243, -1, 243, + 17, 243, -1, 243, 186, 243, -1, 243, 185, 243, + -1, 243, 18, 243, -1, 243, 19, 243, -1, 243, + 13, 243, -1, 243, 14, 243, -1, 243, 188, 243, + -1, 243, 187, 243, -1, 243, 191, 243, -1, 243, + 189, 243, -1, 243, 190, 243, -1, 192, 243, -1, + 193, 243, -1, 188, 243, -1, 187, 243, -1, 184, + 243, -1, 189, 243, -1, 243, 15, 3, -1, 243, + 199, 3, -1, 203, 283, 290, 204, 243, -1, 145, + 203, 283, 290, 204, -1, 243, 200, 243, 201, -1, + 203, 243, 204, -1, 245, -1, 244, 179, 245, -1, + 243, -1, 243, -1, -1, 247, 248, -1, 228, 283, + 299, 202, -1, 228, 306, 202, -1, 252, 202, -1, + 229, 202, -1, -1, 250, 249, -1, 252, 202, -1, + 202, -1, 228, 283, 286, -1, 254, -1, 229, 283, + 300, -1, 283, 300, -1, -1, 257, -1, -1, 3, + -1, 4, -1, 3, -1, 4, -1, 33, -1, 172, + -1, 260, -1, 143, 260, -1, 163, 260, -1, 163, + -1, 72, -1, 59, -1, 31, -1, 66, -1, 75, + -1, -1, 95, -1, 95, -1, 142, 259, -1, 146, + -1, 104, 259, -1, 82, 259, -1, 97, -1, 39, + -1, 96, -1, 40, 3, -1, 40, 4, -1, 229, + 261, -1, 262, 205, 264, 206, 213, -1, -1, 264, + 265, -1, 228, 275, -1, 57, 3, -1, 57, 4, + -1, 229, 266, -1, 126, 181, -1, 268, 252, 202, + -1, 107, 181, -1, 269, 253, 202, -1, 267, 205, + 268, 269, 206, -1, 267, 205, 272, 202, 206, -1, + -1, 181, 4, -1, 98, 3, -1, 98, 4, -1, + 229, 272, -1, 273, 271, 205, 212, 206, 213, -1, + 273, 181, 3, 205, 218, 212, 206, 213, -1, 270, + 213, -1, 272, 202, -1, 266, 202, -1, 108, 3, + -1, 108, 4, -1, 229, 276, -1, 277, 205, 212, + 206, 213, -1, 68, -1, 148, -1, 136, -1, 93, + -1, 43, -1, -1, 282, 281, -1, 304, 284, -1, + 285, 304, 284, -1, -1, 285, -1, 281, 284, -1, + 280, 284, -1, 279, 284, -1, 189, 282, 286, -1, + 234, 286, -1, 287, -1, 257, -1, 203, 286, 204, + -1, 287, 227, -1, 287, 203, 223, 204, -1, 189, + 282, 290, -1, 234, 290, -1, 291, -1, 189, 282, + 294, -1, 234, 294, -1, -1, 288, -1, 203, 289, + 204, -1, 291, 227, -1, 227, -1, 203, 223, 204, + -1, 291, 203, 223, 204, -1, 189, 282, 294, -1, + 234, 294, -1, 295, -1, 189, 282, 294, -1, 234, + 294, -1, -1, 292, -1, 257, -1, 203, 293, 204, + -1, 295, 227, -1, 227, -1, 203, 223, 204, -1, + 295, 203, 223, 204, -1, 286, -1, 296, 179, 286, + -1, -1, 181, 246, -1, 292, 297, -1, 298, -1, + 299, 179, 298, -1, 286, -1, 286, 207, 246, -1, + 174, -1, 175, -1, 176, -1, 177, -1, 178, -1, + 135, -1, 162, -1, 131, -1, 152, 256, 205, 247, + 206, -1, 171, -1, 4, -1, 258, -1, 240, -1, + 65, 3, -1, 303, -1, 152, 3, -1, 306, -1, + 161, 3, -1, 141, 203, 304, 204, -1, 159, 228, + 283, 296, -1, 161, 256, 205, 250, 206, -1, 161, + 256, 153, 203, 252, 204, 255, 205, 235, 206, -1, + 5, -1, 5, 199, 5, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -942,41 +943,42 @@ static const yytype_uint16 yyrline[] = 0, 328, 328, 342, 343, 344, 345, 348, 351, 352, 353, 356, 357, 358, 359, 360, 363, 364, 365, 366, 369, 370, 373, 374, 378, 379, 380, 381, 382, 386, - 387, 388, 389, 390, 391, 394, 396, 404, 410, 414, - 416, 420, 427, 428, 431, 432, 435, 436, 440, 445, - 452, 453, 456, 457, 461, 464, 465, 466, 469, 470, - 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, - 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, - 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, - 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, - 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, - 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, - 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, - 543, 544, 545, 546, 547, 548, 552, 553, 554, 555, - 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, - 566, 567, 568, 569, 570, 571, 572, 573, 574, 578, - 579, 584, 585, 586, 587, 590, 591, 594, 598, 604, - 605, 606, 609, 613, 622, 626, 631, 634, 635, 648, - 649, 652, 653, 654, 655, 656, 657, 658, 659, 660, - 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, - 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, - 681, 682, 683, 684, 685, 686, 687, 688, 689, 691, - 693, 694, 697, 698, 701, 707, 713, 714, 717, 722, - 729, 730, 733, 734, 738, 739, 742, 748, 756, 760, - 765, 766, 769, 770, 771, 774, 776, 779, 780, 781, - 782, 783, 784, 785, 786, 787, 788, 789, 792, 793, - 796, 797, 798, 799, 800, 801, 802, 803, 806, 807, - 815, 821, 825, 826, 830, 833, 834, 837, 846, 847, - 850, 851, 854, 860, 866, 867, 870, 871, 874, 884, - 891, 897, 901, 902, 905, 906, 909, 914, 921, 922, - 923, 927, 931, 934, 935, 938, 939, 943, 944, 948, - 949, 950, 954, 956, 958, 962, 963, 964, 965, 973, - 975, 977, 982, 984, 989, 990, 995, 996, 997, 998, - 1003, 1012, 1014, 1015, 1020, 1022, 1026, 1027, 1034, 1035, - 1036, 1037, 1038, 1043, 1051, 1052, 1055, 1056, 1059, 1066, - 1067, 1072, 1073, 1077, 1078, 1079, 1080, 1081, 1085, 1086, - 1087, 1090, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, - 1101, 1102, 1105, 1111, 1113, 1119, 1120 + 387, 388, 389, 390, 391, 392, 393, 394, 397, 399, + 407, 413, 417, 419, 423, 430, 431, 434, 435, 438, + 439, 443, 448, 455, 459, 460, 463, 464, 468, 471, + 472, 473, 476, 477, 480, 481, 482, 483, 484, 485, + 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, + 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, + 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, + 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, + 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, + 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, + 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, + 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, + 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, + 579, 580, 581, 585, 586, 591, 592, 593, 594, 597, + 598, 601, 605, 611, 612, 613, 616, 620, 629, 633, + 638, 641, 642, 645, 646, 649, 650, 651, 652, 653, + 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, + 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, + 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, + 684, 685, 686, 688, 690, 691, 694, 695, 698, 704, + 710, 711, 714, 719, 726, 727, 730, 731, 735, 736, + 739, 745, 753, 757, 762, 763, 766, 767, 768, 771, + 773, 776, 777, 778, 779, 780, 781, 782, 783, 784, + 785, 786, 789, 790, 793, 794, 795, 796, 797, 798, + 799, 800, 803, 804, 812, 818, 822, 823, 827, 830, + 831, 834, 843, 844, 847, 848, 851, 857, 863, 864, + 867, 868, 871, 881, 888, 894, 898, 899, 902, 903, + 906, 911, 918, 919, 920, 924, 928, 931, 932, 935, + 936, 940, 941, 945, 946, 947, 951, 953, 955, 959, + 960, 961, 962, 970, 972, 974, 979, 981, 986, 987, + 992, 993, 994, 995, 1000, 1009, 1011, 1012, 1017, 1019, + 1023, 1024, 1031, 1032, 1033, 1034, 1035, 1040, 1048, 1049, + 1052, 1053, 1056, 1063, 1064, 1069, 1070, 1074, 1075, 1076, + 1077, 1078, 1082, 1083, 1084, 1087, 1090, 1091, 1092, 1093, + 1094, 1095, 1096, 1097, 1098, 1099, 1102, 1108, 1110, 1116, + 1117 }; #endif @@ -1082,9 +1084,10 @@ static const yytype_uint16 yyr1[] = 0, 208, 209, 210, 210, 210, 210, 210, 210, 210, 210, 211, 211, 211, 211, 211, 211, 211, 211, 211, 212, 212, 213, 213, 214, 214, 214, 214, 214, 215, - 215, 215, 215, 215, 215, 216, 217, 218, 219, 220, - 221, 222, 223, 223, 224, 224, 225, 225, 226, 226, - 227, 227, 228, 228, 229, 230, 230, 230, 231, 231, + 215, 215, 215, 215, 215, 215, 215, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 223, 224, 224, 225, + 225, 226, 226, 227, 227, 227, 228, 228, 229, 230, + 230, 230, 231, 231, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, @@ -1094,29 +1097,29 @@ static const yytype_uint16 yyr1[] = 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, - 232, 232, 232, 232, 232, 232, 232, 232, 232, 233, - 233, 234, 234, 234, 234, 235, 235, 236, 236, 237, - 237, 237, 238, 238, 239, 239, 240, 241, 241, 242, - 242, 243, 243, 243, 243, 243, 243, 243, 243, 243, + 232, 232, 232, 233, 233, 234, 234, 234, 234, 235, + 235, 236, 236, 237, 237, 237, 238, 238, 239, 239, + 240, 241, 241, 242, 242, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 244, 244, 245, 246, 247, 247, 248, 248, - 249, 249, 250, 250, 251, 251, 252, 253, 254, 254, - 255, 255, 256, 256, 256, 257, 257, 258, 258, 258, - 258, 258, 258, 258, 258, 258, 258, 258, 259, 259, - 260, 260, 260, 260, 260, 260, 260, 260, 261, 261, - 262, 263, 264, 264, 265, 266, 266, 267, 268, 268, - 269, 269, 270, 270, 271, 271, 272, 272, 273, 274, - 274, 274, 275, 275, 276, 276, 277, 278, 279, 279, - 279, 280, 281, 282, 282, 283, 283, 284, 284, 285, - 285, 285, 286, 286, 286, 287, 287, 287, 287, 288, - 288, 288, 289, 289, 290, 290, 291, 291, 291, 291, - 291, 292, 292, 292, 293, 293, 294, 294, 295, 295, - 295, 295, 295, 295, 296, 296, 297, 297, 298, 299, - 299, 300, 300, 301, 301, 301, 301, 301, 302, 302, - 302, 303, 304, 304, 304, 304, 304, 304, 304, 304, - 304, 304, 305, 306, 306, 307, 307 + 243, 243, 243, 243, 243, 243, 244, 244, 245, 246, + 247, 247, 248, 248, 249, 249, 250, 250, 251, 251, + 252, 253, 254, 254, 255, 255, 256, 256, 256, 257, + 257, 258, 258, 258, 258, 258, 258, 258, 258, 258, + 258, 258, 259, 259, 260, 260, 260, 260, 260, 260, + 260, 260, 261, 261, 262, 263, 264, 264, 265, 266, + 266, 267, 268, 268, 269, 269, 270, 270, 271, 271, + 272, 272, 273, 274, 274, 274, 275, 275, 276, 276, + 277, 278, 279, 279, 279, 280, 281, 282, 282, 283, + 283, 284, 284, 285, 285, 285, 286, 286, 286, 287, + 287, 287, 287, 288, 288, 288, 289, 289, 290, 290, + 291, 291, 291, 291, 291, 292, 292, 292, 293, 293, + 294, 294, 295, 295, 295, 295, 295, 295, 296, 296, + 297, 297, 298, 299, 299, 300, 300, 301, 301, 301, + 301, 301, 302, 302, 302, 303, 304, 304, 304, 304, + 304, 304, 304, 304, 304, 304, 305, 306, 306, 307, + 307 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -1125,41 +1128,42 @@ static const yytype_uint8 yyr2[] = 0, 2, 1, 0, 2, 2, 3, 2, 2, 2, 2, 0, 2, 2, 3, 2, 2, 2, 2, 2, 0, 2, 0, 1, 1, 2, 2, 1, 2, 1, - 1, 1, 2, 2, 2, 4, 3, 3, 5, 2, - 3, 4, 0, 1, 1, 3, 1, 3, 3, 2, - 3, 3, 0, 1, 3, 1, 3, 4, 1, 3, - 0, 1, 4, 1, 1, 1, 1, 1, 4, 4, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 4, 1, 1, 1, 4, 1, 1, 1, 4, 4, - 1, 1, 1, 1, 4, 4, 4, 4, 4, 1, - 4, 1, 1, 4, 1, 5, 1, 1, 4, 4, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 4, 1, 1, 1, 4, 4, - 1, 1, 1, 1, 1, 6, 1, 4, 1, 1, - 1, 4, 1, 1, 1, 4, 4, 4, 4, 1, - 1, 4, 4, 1, 1, 4, 4, 4, 1, 1, - 1, 1, 1, 1, 1, 0, 2, 4, 3, 0, - 2, 1, 1, 3, 3, 1, 5, 1, 3, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 5, 3, 3, 3, 3, 3, 3, 3, 3, + 2, 1, 2, 1, 2, 2, 2, 2, 4, 3, + 3, 5, 2, 3, 4, 0, 1, 1, 3, 1, + 3, 3, 2, 3, 3, 2, 0, 1, 3, 1, + 3, 4, 1, 3, 0, 1, 4, 1, 1, 1, + 1, 1, 4, 4, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, + 1, 1, 4, 4, 1, 1, 1, 1, 4, 4, + 4, 4, 4, 1, 4, 1, 1, 4, 1, 4, + 1, 1, 4, 4, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, + 1, 1, 4, 4, 1, 1, 1, 1, 1, 6, + 1, 4, 1, 1, 1, 4, 1, 1, 1, 4, + 4, 4, 4, 1, 1, 4, 4, 1, 1, 4, + 4, 4, 1, 1, 1, 1, 1, 1, 1, 0, + 2, 4, 3, 0, 2, 1, 1, 3, 3, 1, + 5, 1, 3, 0, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 2, 2, 2, 2, 2, 3, 3, 5, 5, - 4, 3, 1, 3, 1, 1, 0, 2, 4, 3, - 2, 2, 0, 2, 2, 1, 3, 1, 3, 2, - 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 1, 1, 1, 1, 1, 1, 0, 1, - 1, 2, 1, 2, 2, 1, 1, 1, 2, 2, - 2, 5, 0, 2, 2, 2, 2, 2, 2, 3, - 2, 3, 5, 5, 0, 2, 2, 2, 2, 6, - 8, 2, 2, 2, 2, 2, 2, 5, 1, 1, - 1, 1, 1, 0, 2, 2, 3, 0, 1, 2, - 2, 2, 3, 2, 1, 1, 3, 2, 4, 3, - 2, 1, 3, 2, 0, 1, 3, 2, 1, 3, - 4, 3, 2, 1, 3, 2, 0, 1, 1, 3, - 2, 1, 3, 4, 1, 3, 0, 2, 2, 1, - 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, - 1, 5, 1, 1, 1, 1, 2, 1, 2, 1, - 2, 4, 4, 5, 10, 1, 3 + 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, + 3, 3, 5, 5, 4, 3, 1, 3, 1, 1, + 0, 2, 4, 3, 2, 2, 0, 2, 2, 1, + 3, 1, 3, 2, 0, 1, 0, 1, 1, 1, + 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, + 1, 1, 0, 1, 1, 2, 1, 2, 2, 1, + 1, 1, 2, 2, 2, 5, 0, 2, 2, 2, + 2, 2, 2, 3, 2, 3, 5, 5, 0, 2, + 2, 2, 2, 6, 8, 2, 2, 2, 2, 2, + 2, 5, 1, 1, 1, 1, 1, 0, 2, 2, + 3, 0, 1, 2, 2, 2, 3, 2, 1, 1, + 3, 2, 4, 3, 2, 1, 3, 2, 0, 1, + 3, 2, 1, 3, 4, 3, 2, 1, 3, 2, + 0, 1, 1, 3, 2, 1, 3, 4, 1, 3, + 0, 2, 2, 1, 3, 1, 3, 1, 1, 1, + 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, + 2, 1, 2, 1, 2, 4, 4, 5, 10, 1, + 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -1167,720 +1171,740 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint16 yydefact[] = { - 3, 0, 2, 1, 363, 255, 247, 266, 0, 302, - 0, 0, 254, 242, 256, 298, 253, 257, 258, 0, - 301, 260, 267, 265, 0, 258, 300, 0, 258, 0, - 262, 299, 242, 52, 242, 252, 362, 248, 60, 10, - 0, 24, 11, 27, 11, 9, 0, 365, 0, 364, - 249, 0, 0, 7, 0, 0, 22, 0, 284, 5, - 4, 0, 8, 307, 307, 307, 0, 0, 367, 307, - 0, 369, 268, 269, 0, 275, 276, 366, 244, 0, - 259, 264, 0, 286, 287, 263, 0, 261, 250, 368, - 0, 0, 53, 370, 0, 251, 61, 0, 63, 64, - 65, 66, 67, 0, 0, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 0, 81, 82, 83, 0, - 85, 86, 87, 0, 0, 90, 91, 92, 93, 0, - 0, 0, 0, 0, 99, 0, 101, 102, 0, 104, - 0, 106, 107, 110, 0, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, 123, 0, 125, - 126, 127, 0, 0, 130, 131, 132, 133, 360, 134, - 0, 136, 358, 0, 138, 139, 140, 0, 142, 143, - 144, 0, 0, 0, 0, 149, 359, 150, 0, 0, - 153, 154, 0, 0, 0, 0, 55, 158, 25, 0, - 0, 0, 0, 0, 365, 270, 277, 288, 296, 0, - 367, 369, 26, 6, 272, 293, 0, 23, 291, 292, - 0, 0, 20, 311, 308, 310, 309, 245, 246, 161, - 162, 163, 164, 303, 0, 0, 315, 351, 314, 239, - 365, 367, 307, 369, 305, 28, 0, 169, 36, 0, - 226, 0, 0, 232, 0, 0, 0, 0, 0, 0, + 3, 0, 2, 1, 367, 259, 251, 270, 0, 306, + 0, 0, 258, 246, 260, 302, 257, 261, 262, 0, + 305, 264, 271, 269, 0, 262, 304, 0, 262, 0, + 266, 303, 246, 56, 246, 256, 366, 252, 64, 10, + 0, 24, 11, 27, 11, 9, 0, 369, 0, 368, + 253, 0, 0, 7, 0, 0, 22, 0, 288, 5, + 4, 0, 8, 311, 311, 311, 0, 0, 371, 311, + 0, 373, 272, 273, 0, 279, 280, 370, 248, 0, + 263, 268, 0, 290, 291, 267, 0, 265, 254, 372, + 0, 0, 57, 374, 0, 255, 65, 0, 67, 68, + 69, 70, 71, 0, 0, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 0, 85, 86, 87, 0, + 89, 90, 91, 0, 0, 94, 95, 96, 97, 0, + 0, 0, 0, 0, 103, 0, 105, 106, 0, 108, + 0, 110, 111, 114, 0, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 0, 129, + 130, 131, 0, 0, 134, 135, 136, 137, 364, 138, + 0, 140, 362, 0, 142, 143, 144, 0, 146, 147, + 148, 0, 0, 0, 0, 153, 363, 154, 0, 0, + 157, 158, 0, 0, 0, 0, 59, 162, 25, 0, + 0, 246, 0, 0, 246, 246, 0, 369, 274, 281, + 292, 300, 0, 371, 373, 26, 6, 276, 297, 0, + 23, 295, 296, 0, 0, 20, 315, 312, 314, 313, + 249, 250, 165, 166, 167, 168, 307, 0, 0, 319, + 355, 318, 243, 369, 371, 311, 373, 309, 28, 0, + 173, 39, 0, 230, 0, 0, 236, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 179, 0, 0, 0, 0, 0, 179, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 60, 54, 37, 0, - 17, 18, 19, 0, 15, 13, 12, 16, 22, 39, - 294, 295, 40, 238, 52, 0, 52, 0, 0, 285, - 20, 0, 0, 0, 313, 0, 179, 42, 317, 306, - 35, 0, 171, 172, 175, 371, 52, 344, 372, 52, - 52, 0, 0, 190, 181, 182, 183, 187, 188, 189, - 184, 185, 0, 186, 0, 0, 0, 0, 0, 0, - 0, 224, 0, 222, 225, 0, 0, 58, 0, 0, + 0, 0, 0, 183, 0, 0, 0, 0, 0, 183, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 58, 40, 0, 17, 18, 19, 0, 15, 13, 12, + 16, 22, 370, 42, 298, 299, 372, 374, 43, 242, + 56, 0, 56, 0, 0, 289, 20, 0, 0, 0, + 317, 0, 0, 45, 321, 310, 38, 0, 175, 176, + 179, 375, 56, 348, 376, 56, 56, 0, 0, 194, + 185, 186, 187, 191, 192, 193, 188, 189, 0, 190, + 0, 0, 0, 0, 0, 0, 0, 228, 0, 226, + 229, 0, 0, 62, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 340, 0, 0, 181, 184, + 0, 0, 0, 0, 0, 0, 0, 0, 357, 358, + 359, 360, 361, 0, 0, 0, 164, 163, 0, 379, + 0, 0, 0, 60, 64, 0, 14, 44, 22, 0, + 277, 282, 0, 0, 0, 0, 0, 0, 0, 22, + 21, 0, 308, 316, 320, 356, 0, 55, 0, 0, + 49, 46, 47, 180, 174, 0, 365, 0, 231, 0, + 0, 377, 57, 237, 0, 66, 72, 0, 218, 217, + 216, 219, 214, 215, 0, 328, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 177, 180, 0, 0, 0, 0, 0, 0, 0, 0, - 353, 354, 355, 356, 357, 0, 0, 0, 160, 159, - 0, 375, 0, 0, 0, 56, 60, 0, 14, 41, - 22, 0, 273, 278, 0, 0, 0, 0, 0, 0, - 0, 22, 21, 0, 304, 312, 316, 352, 0, 0, - 0, 46, 43, 44, 0, 336, 176, 170, 0, 361, - 0, 227, 0, 0, 373, 53, 233, 0, 62, 68, - 0, 214, 213, 212, 215, 210, 211, 0, 324, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 69, 80, 84, 0, 88, 89, 94, 95, - 96, 97, 98, 100, 103, 0, 109, 179, 108, 124, - 128, 129, 0, 137, 141, 145, 146, 148, 147, 151, - 152, 0, 155, 156, 157, 57, 0, 271, 274, 280, - 0, 279, 282, 0, 0, 237, 283, 20, 22, 297, - 51, 50, 318, 0, 336, 303, 42, 341, 336, 338, - 337, 49, 333, 173, 174, 0, 369, 345, 240, 231, - 230, 324, 221, 303, 42, 328, 324, 325, 0, 321, - 203, 204, 216, 197, 198, 201, 202, 192, 193, 0, - 194, 195, 196, 200, 199, 206, 205, 208, 209, 207, - 217, 0, 223, 59, 105, 178, 0, 376, 22, 236, - 281, 0, 289, 47, 45, 48, 336, 303, 0, 336, - 0, 332, 42, 340, 346, 349, 0, 229, 0, 241, - 0, 324, 303, 0, 336, 0, 320, 0, 42, 327, - 0, 220, 135, 38, 22, 331, 336, 342, 335, 339, - 0, 0, 348, 0, 228, 165, 219, 319, 336, 329, - 323, 326, 218, 0, 191, 290, 334, 343, 347, 350, - 0, 322, 330, 0, 0, 374, 166, 0, 52, 52, - 235, 168, 0, 167, 234 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, + 84, 88, 0, 92, 93, 98, 99, 100, 101, 102, + 104, 107, 109, 340, 307, 45, 345, 340, 342, 341, + 52, 337, 113, 183, 112, 128, 132, 133, 0, 141, + 145, 149, 150, 152, 151, 155, 156, 0, 159, 160, + 161, 61, 0, 275, 278, 284, 0, 283, 286, 0, + 0, 241, 287, 20, 22, 301, 54, 53, 322, 0, + 177, 178, 0, 373, 349, 244, 235, 234, 328, 225, + 307, 45, 332, 328, 329, 0, 325, 207, 208, 220, + 201, 202, 205, 206, 196, 197, 0, 198, 199, 200, + 204, 203, 210, 209, 212, 213, 211, 221, 0, 227, + 63, 51, 340, 307, 0, 340, 0, 336, 45, 344, + 182, 0, 380, 22, 240, 285, 0, 293, 50, 48, + 350, 353, 0, 233, 0, 245, 0, 328, 307, 0, + 340, 0, 324, 0, 45, 331, 0, 224, 335, 340, + 346, 339, 343, 0, 139, 41, 22, 0, 352, 0, + 232, 169, 223, 323, 340, 333, 327, 330, 222, 0, + 195, 338, 347, 294, 351, 354, 0, 326, 334, 0, + 0, 378, 170, 0, 56, 56, 239, 172, 0, 171, + 238 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 1, 2, 199, 311, 218, 412, 40, 41, 42, - 43, 291, 203, 44, 292, 420, 421, 422, 423, 527, - 405, 92, 195, 358, 196, 390, 528, 640, 646, 321, - 322, 323, 240, 369, 370, 351, 352, 353, 355, 326, - 431, 436, 330, 651, 652, 514, 48, 598, 79, 529, - 49, 81, 50, 293, 52, 294, 304, 402, 54, 55, - 306, 407, 56, 221, 57, 58, 295, 296, 208, 61, - 297, 63, 64, 65, 312, 66, 223, 67, 237, 238, - 547, 605, 548, 549, 530, 590, 531, 532, 328, 622, - 595, 596, 239, 385, 197, 241, 69, 70, 243, 392 + -1, 1, 2, 199, 317, 221, 420, 40, 41, 42, + 43, 294, 206, 44, 295, 429, 430, 431, 432, 496, + 413, 92, 195, 364, 196, 398, 497, 646, 652, 327, + 328, 329, 243, 377, 378, 357, 358, 359, 361, 332, + 438, 443, 336, 657, 658, 530, 48, 604, 79, 498, + 49, 81, 50, 296, 52, 297, 310, 410, 54, 55, + 312, 415, 56, 224, 57, 58, 298, 299, 211, 61, + 300, 63, 64, 65, 318, 66, 226, 67, 240, 241, + 554, 611, 555, 556, 499, 586, 500, 501, 334, 628, + 601, 602, 242, 393, 197, 244, 69, 70, 246, 400 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -511 +#define YYPACT_NINF -509 static const yytype_int16 yypact[] = { - -511, 65, 1251, -511, -511, -511, -511, -511, 54, -511, - -131, 131, -511, 176, -511, -511, -511, -511, 21, 167, - -511, -511, -511, -511, 223, 21, -511, -37, 21, 36, - -511, -511, 228, -62, 238, 36, -511, -511, 2477, -511, - -41, -511, -511, -511, -511, -511, 2161, -25, -21, -511, - -511, -19, -18, -511, -17, -15, -9, -7, 29, -511, - -511, 15, -511, -6, -6, -6, 428, 2327, 13, -6, - 22, 26, -511, -511, 229, -511, -511, 41, -511, 50, - -511, -511, 71, -511, -511, -511, 2327, -511, -511, 41, - 70, 2233, -511, -115, -109, -511, -511, 82, -511, -511, - -511, -511, -511, 85, 87, -511, -511, -511, -511, -511, - -511, -511, -511, -511, -511, 91, -511, -511, -511, 93, - -511, -511, -511, 95, 96, -511, -511, -511, -511, 97, - 98, 104, 109, 113, -511, 115, -511, -511, 117, -511, - 118, -511, -511, 121, 123, -511, -511, -511, -511, -511, - -511, -511, -511, -511, -511, -511, -511, -511, 133, -511, - -511, -511, 134, 136, -511, -511, -511, -511, -511, -511, - 137, -511, -511, 138, -511, -511, -511, 141, -511, -511, - -511, 151, 152, 156, 159, -511, -511, -511, 160, 163, - -511, -511, 165, 168, 169, -124, -511, -511, -511, 1124, - 466, 378, 240, 177, 183, -511, -511, -511, -511, 428, - 184, 185, -511, -511, -511, -511, -44, -511, -511, -511, - 247, 186, -511, -511, -511, -511, -511, -511, -511, -511, - -511, -511, -511, -511, 428, 428, -511, 181, -130, -511, - -511, -511, -6, -511, -511, -511, 188, 276, -511, 190, - -511, 428, 192, -511, 388, 276, 324, 324, 389, 390, - 324, 324, 391, 393, 324, 394, 324, 324, 328, 324, - 324, 398, -86, 399, 324, 2327, 324, 324, 2327, 202, - 2327, 2327, 84, 404, 409, 2327, 2477, 218, -511, 217, - -511, -511, -511, 219, -511, -511, -511, -511, -9, -511, - -511, -511, -511, -511, -77, 241, -79, 222, 221, -511, - -511, 580, 300, 224, -511, 324, 906, 1670, -511, -511, - -511, 227, 248, -511, 230, -511, -59, -511, 250, -62, - -42, 231, 232, -511, -511, -511, -511, -511, -511, -511, - -511, -511, 235, -511, 324, 324, 324, 324, 324, 324, - 981, 1957, -126, -511, 1957, 236, 237, -511, -120, 239, - 242, 244, 246, 249, 251, 252, 1668, 431, 253, -111, - -511, 1957, 254, 255, 256, 263, 258, -94, 1740, 259, - -511, -511, -511, -511, -511, 260, 261, 264, -511, -511, - 267, 245, 268, 270, 273, -511, 2477, 443, -511, -511, - -9, 9, -511, -511, 271, 2233, 265, 867, 272, 365, - 681, -9, -511, 2233, -511, -511, -511, -511, 94, 279, - 280, 306, -511, -511, 2233, 595, -511, 276, 324, -511, - 2233, -511, 428, 283, -511, 286, -511, 288, -511, -511, - 2233, 8, 8, 8, 8, 8, 8, 1765, 566, 324, - 324, 488, 324, 324, 324, 324, 324, 324, 324, 324, - 324, 324, 324, 324, 324, 324, 324, 324, 324, 489, - 324, 324, -511, -511, -511, 485, -511, -511, -511, -511, - -511, -511, -511, -511, -511, 290, -511, 324, -511, -511, - -511, -511, 324, -511, -511, -511, -511, -511, -511, -511, - -511, 490, -511, -511, -511, -511, 292, -511, -511, -511, - 428, -511, -511, 2233, 298, -511, -511, -511, -9, -511, - -511, -511, -511, 1576, 595, -511, 1378, -511, 595, -511, - -511, -511, -95, -511, -511, 595, 299, -511, 276, -511, - -511, 566, -511, -511, 1504, -511, 566, -511, 303, -64, - 158, 158, -511, 1047, 1047, 505, 505, 1811, 1919, 1882, - 1900, 1990, 1973, 505, 505, 161, 161, 8, 8, 8, - -511, 1860, -511, -511, -511, -511, 311, -511, -9, -511, - -511, 795, -511, -511, -511, -511, 153, -511, 318, 595, - 322, -511, 1670, -511, 321, -511, -123, -511, 305, -511, - 325, 45, -511, 326, 595, 329, -511, 324, 1670, -511, - 324, -511, -511, -511, -9, -511, 153, -511, -511, -511, - 331, 324, -511, 595, -511, -511, -511, -511, 153, -511, - -511, -511, 8, 333, 1957, -511, -511, -511, -511, -511, - 10, -511, -511, 324, 347, -511, -511, 358, -76, -76, - -511, -511, 338, -511, -511 + -509, 85, 1435, -509, -509, -509, -509, -509, 73, -509, + -105, 90, -509, 205, -509, -509, -509, -509, 12, 110, + -509, -509, -509, -509, 258, 12, -509, -83, 12, 362, + -509, -509, 260, -70, 262, 362, -509, -509, 2569, -509, + -58, -509, -509, -509, -509, -509, 2253, -42, -40, -509, + -509, -31, -73, -509, -9, -68, 11, 13, -26, -509, + -509, -17, -509, 56, 56, 56, 93, 2419, 17, 56, + 21, 33, -509, -509, 170, -509, -509, -60, -509, 40, + -509, -509, 70, -509, -509, -509, 2419, -509, -509, -52, + 65, 2325, -509, -99, -97, -509, -509, 76, -509, -509, + -509, -509, -509, 78, 101, -509, -509, -509, -509, -509, + -509, -509, -509, -509, -509, 113, -509, -509, -509, 117, + -509, -509, -509, 123, 128, -509, -509, -509, -509, 130, + 133, 134, 135, 136, -509, 137, -509, -509, 138, -509, + 140, -509, -509, 141, 144, -509, -509, -509, -509, -509, + -509, -509, -509, -509, -509, -509, -509, -509, 145, -509, + -509, -509, 146, 147, -509, -509, -509, -509, -509, -509, + 148, -509, -509, 151, -509, -509, -509, 169, -509, -509, + -509, 173, 174, 175, 177, -509, -509, -509, 179, 180, + -509, -509, 182, 185, 188, -121, -509, -509, -509, 1308, + 495, 274, 342, 285, 289, 303, 189, 191, -509, -509, + -509, -509, 93, 194, 195, -509, -509, -509, -509, -59, + -509, -509, -509, 305, 193, -509, -509, -509, -509, -509, + -509, -509, -509, -509, -509, -509, -509, 93, 93, -509, + 139, -57, -509, -509, -509, 56, -509, -509, -509, 196, + 325, -509, 198, -509, 93, 201, -509, 399, 325, 821, + 821, 400, 401, 821, 821, 404, 406, 821, 409, 821, + 821, 1854, 821, 821, 411, -78, 414, 821, 2419, 821, + 821, 2419, 9, 2419, 2419, 143, 420, 418, 2419, 2569, + 228, -509, 226, -509, -509, -509, 230, -509, -509, -509, + -509, 11, 229, -509, -509, -509, 229, -92, -509, -509, + -128, 252, -81, 233, 231, -509, -509, 596, 71, 234, + -509, 821, 1110, 1854, -509, -509, -509, 235, 263, -509, + 232, -509, -84, -509, 264, -70, -71, 241, 256, -509, + -509, -509, -509, -509, -509, -509, -509, -509, 253, -509, + 821, 821, 821, 821, 821, 821, 1039, 2065, -134, -509, + 2065, 261, 265, -509, -117, 266, 267, 268, 269, 270, + 271, 272, 1231, 273, 2325, 87, 276, -93, -509, 2065, + 277, 278, 280, 283, 281, -87, 1852, 287, -509, -509, + -509, -509, -509, 288, 290, 291, -509, -509, 292, 279, + 296, 297, 298, -509, 2569, 459, -509, -509, 11, -19, + -509, -509, 306, 2325, 301, 925, 299, 379, 710, 11, + -509, 2325, -509, -509, -509, -509, 1143, -509, 433, 302, + 310, -509, -509, -509, 325, 821, -509, 2325, -509, 93, + 307, -509, 308, -509, 311, -509, -509, 2325, 22, 22, + 22, 22, 22, 22, 1924, -21, 821, 821, 511, 821, + 821, 821, 821, 821, 821, 821, 821, 821, 821, 821, + 821, 821, 821, 821, 821, 821, 512, 821, 821, -509, + -509, -509, 508, -509, -509, -509, -509, -509, -509, -509, + -509, -509, -509, 87, -509, 1562, -509, 87, -509, -509, + -509, -39, -509, 821, -509, -509, -509, -509, 821, -509, + -509, -509, -509, -509, -509, -509, -509, 513, -509, -509, + -509, -509, 313, -509, -509, -509, 93, -509, -509, 2325, + 318, -509, -509, -509, 11, -509, -509, -509, -509, 1760, + -509, -509, 87, 319, -509, 325, -509, -509, -21, -509, + -509, 1688, -509, -21, -509, 320, -23, 112, 112, -509, + 732, 732, 68, 68, 1970, 1994, 2044, 1076, 2082, 1018, + 68, 68, 95, 95, 22, 22, 22, -509, 1949, -509, + -509, -509, 25, -509, 321, 87, 323, -509, 1854, -509, + -509, 327, -509, 11, -509, -509, 811, -509, -509, -509, + 348, -509, -114, -509, 317, -509, 328, 341, -509, 329, + 87, 332, -509, 821, 1854, -509, 821, -509, -509, 25, + -509, -509, -509, 335, -509, -509, 11, 821, -509, 87, + -509, -509, -509, -509, 25, -509, -509, -509, 22, 336, + 2065, -509, -509, -509, -509, -509, -10, -509, -509, 821, + 364, -509, -509, 365, -136, -136, -509, -509, 345, -509, + -509 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -511, -511, -511, 499, -292, -289, 19, -511, -511, -511, - 135, -511, -511, -511, 543, -494, -511, -511, 23, -227, - -20, -2, -511, -511, -259, -511, -65, -511, -511, -511, - -511, 120, 2, 274, -276, -196, -511, -254, -246, -511, - -511, -511, -511, -100, -217, -511, 146, -511, 128, -63, - -511, 81, 130, 40, -511, 552, -511, -511, 511, -511, - -511, -511, -511, -511, -3, -511, 556, 3, -511, -511, - 558, -511, -511, -293, -398, -40, -30, -39, -218, -511, - -511, -511, -510, -511, -506, -511, -461, -511, -511, -511, - -58, -511, 357, -511, 295, 6, -45, -511, 0, -511 + -509, -509, -509, 504, -304, -296, 41, -509, -509, -509, + 149, -509, -509, -509, 548, -462, -509, -509, -264, -221, + -27, -2, -509, -509, -268, -509, -65, -509, -509, -509, + -509, 119, 2, 286, 48, -104, -509, -254, -252, -509, + -509, -509, -509, -100, -197, -509, 153, -509, 39, -47, + -509, 142, 105, 58, -509, 555, -509, -509, 516, -509, + -509, -509, -509, -509, -24, -509, 556, 1, -509, -509, + 557, -509, -509, -309, -450, -32, -14, -33, -213, -509, + -509, -509, -506, -509, -508, -509, -179, -509, -509, -509, + -56, -509, 352, -509, 294, 6, -51, -509, 0, -509 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -244 +#define YYTABLE_NINF -248 static const yytype_int16 yytable[] = { - 46, 235, 71, 236, 47, 60, 209, 360, 68, 399, - 363, 318, 365, 91, 359, 368, 313, 314, 410, 414, - 375, 39, 242, 451, 224, 224, 224, 395, 404, 594, - 224, 600, 588, 327, 225, 226, 606, 9, -243, 244, - 419, 249, 51, 207, 252, 168, 211, 643, 204, 172, - 603, 251, 210, 471, 24, 286, 623, 72, 73, 475, - 644, 354, 15, 585, 354, 3, 11, 591, 487, 417, - 316, 366, 74, 317, 371, 7, 186, 287, 472, 624, - 371, 378, 305, 229, 476, 487, 205, 20, 9, 406, - -243, 627, 388, 488, 415, 389, 253, 333, 620, 334, - 335, 336, 337, 338, 339, 316, 85, 24, 592, 87, - 494, 507, 433, 437, 633, 230, 80, 594, 18, 354, - 371, 38, 519, 38, 38, 615, 650, 586, 618, 400, - 26, 21, 22, 23, 75, 76, 316, 505, 38, 608, - 25, 38, 31, 630, 235, 601, 236, 429, 441, 442, - 443, 444, 445, 446, 447, 636, 227, 228, 38, 88, - 90, 198, 94, 340, 434, 95, 86, 641, 231, 235, - 235, 236, 236, 451, 534, 82, 451, -29, 28, 77, - 78, 212, 30, 213, 324, 215, 235, 214, 236, 616, - 216, 229, 332, 217, 232, 219, 9, 46, 46, 71, - 71, 47, 47, 224, 628, 68, 68, 469, 470, 341, - 220, 575, 319, 307, 537, -30, 645, 572, 290, 290, - 222, 545, 444, 230, 245, 581, 83, 84, -31, 582, - 376, 89, 78, 379, 543, 386, 387, 246, 576, 342, - 394, 93, 78, 300, 301, 316, -243, 235, 544, 236, - 308, 309, 343, 550, 551, 247, 553, 554, 555, 556, - 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, - 567, 568, 569, 248, 571, 250, 231, 425, 344, 227, - 228, 345, 346, 347, 401, 254, 348, 349, 255, 613, - 256, 371, 579, 414, 257, 520, 258, 350, 259, 260, - 261, 262, 232, 227, 228, 593, 430, 263, 414, 413, - 448, 71, 264, 47, 545, 424, 265, 68, 266, 545, - 267, 268, 609, 414, 269, 635, 270, 333, 435, 334, - 335, 336, 337, 338, 339, 414, 271, 272, 229, 273, - 274, 275, 525, 9, 276, 464, 465, 466, 467, 468, - 466, 467, 468, 316, 277, 278, 526, 469, 470, 279, - 469, 470, 280, 281, 324, 510, 282, 235, 283, 236, - 230, 284, 285, 209, 545, 638, 380, 381, 382, 383, - 384, 299, 302, 546, 524, -32, -33, -34, 315, 647, - 535, 310, 320, 340, 325, 329, 331, 356, 357, 361, - 541, 362, 364, 367, 508, 513, 372, 374, 413, 391, - 71, 632, 47, 211, 634, 204, 68, 393, 396, 210, - 397, 398, 403, 231, 408, 354, 409, 427, 416, 432, - 536, 227, 228, 426, 485, 438, 439, 428, 440, 341, - 473, 474, 492, 477, 501, 235, 478, 236, 479, 232, - 480, 506, 509, 481, 19, 482, 483, 486, 489, 490, - 491, 589, 493, 496, 497, 498, 229, 511, 499, 342, - 4, 500, 502, 209, 503, 599, 546, 504, 516, 604, - 521, 546, 343, 425, 522, 523, 425, 538, 539, 233, - 540, 552, 570, 573, 574, 577, 578, 5, 230, 6, - 580, 597, 621, 234, 425, 7, 8, 607, 344, 9, - 625, 345, 346, 347, 10, 612, 348, 349, 449, 450, - 451, 424, 617, 11, 424, 12, 619, 350, 648, 626, - 629, 13, 14, 631, 15, 637, 546, 642, 16, 649, - 654, 17, 424, 200, 517, 45, 584, 533, 18, 653, - 377, 231, 425, 515, 53, 19, 289, 206, 59, 20, - 62, 21, 22, 23, 24, 639, 303, 373, 425, 0, - 25, 0, 0, 0, 0, 0, 0, 232, 0, 413, - 0, 71, 0, 47, 4, 0, 0, 68, 0, 0, - 424, 0, 0, 0, 0, 0, 0, 0, 227, 228, - 0, 0, 26, 0, 229, 0, 424, 27, 28, 29, - 0, 5, 30, 6, 31, 0, 0, 233, 32, 7, - 0, 0, 0, 9, 0, 33, 0, 34, 10, 35, - 0, 234, 0, 229, 0, 0, 230, 36, 37, 12, + 46, 238, 71, 60, 47, 407, 91, 373, 68, 422, + 366, 365, 418, 369, 212, 371, 245, 232, 376, 239, + 324, 403, 210, 383, 319, 320, 412, 649, 230, 231, + 227, 227, 227, 584, 600, 252, 227, 458, 11, 24, + 650, 333, 606, 39, 582, 478, 214, 612, 207, 233, + 228, 229, 213, 168, -247, 247, 255, 172, 289, 254, + 51, -247, 482, 232, 38, 629, 656, 311, 9, 425, + 479, 90, 38, 94, 230, 231, 72, 73, 408, 24, + 290, 456, 457, 458, 186, 3, 503, 483, 630, 609, + 230, 231, 503, 75, 76, 233, 230, 231, 74, 9, + 607, 633, 234, -34, 208, 423, -247, 80, 256, 232, + 458, 504, 523, -247, 9, 414, 38, 510, 82, 38, + 86, 600, 436, 535, 15, 232, 623, 458, 235, 38, + 38, 232, 217, 619, 88, 441, 521, 219, 440, 444, + 95, 233, -30, 322, 198, -247, 323, 238, 234, 20, + -32, 396, 639, -247, 397, 223, 360, 233, 634, 360, + -29, 322, 215, 233, 588, 239, 372, 85, 550, 379, + 87, 216, 238, 238, 235, 379, 386, 322, 249, 322, + 614, 541, 551, 388, 389, 390, 391, 392, 225, 238, + 239, 239, 26, 218, 234, 313, 651, 46, 46, 71, + 71, 47, 47, 330, 31, 68, 68, 239, 77, 78, + 234, 338, 227, 220, 494, 222, 234, 360, 428, -31, + 235, 476, 477, 248, 579, 322, 544, 384, 495, 596, + 387, 325, 394, 395, 552, -33, 235, 402, 597, 375, + 293, 293, 235, 90, 94, 250, 448, 449, 450, 451, + 452, 453, 454, 238, 591, 471, 472, 473, 474, 475, + 236, 83, 84, 89, 78, 93, 78, 476, 477, 374, + 253, 239, 251, 422, 237, 599, 494, 302, 78, 257, + 589, 258, 236, 409, 473, 474, 475, 322, 304, 305, + 495, 375, 306, 78, 476, 477, 237, 625, 422, 471, + 472, 473, 474, 475, 259, 437, 307, 78, 314, 315, + 422, 476, 477, 594, 581, 421, 260, 71, 587, 47, + 261, 374, 451, 68, 455, 422, 262, 552, 230, 231, + 643, 263, 552, 264, 442, 615, 265, 266, 267, 268, + 269, 270, 493, 271, 272, 303, 321, 273, 274, 275, + 276, 277, 557, 558, 278, 560, 561, 562, 563, 564, + 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, + 575, 576, 279, 578, 238, 644, 280, 281, 282, 232, + 283, 526, 284, 285, 9, 286, 552, 330, 287, 212, + 553, 288, 239, -35, 308, 653, -36, -37, 316, 379, + 326, 7, 331, 618, 335, 542, 621, 337, 362, 363, + 524, 233, 367, 529, 368, 548, 421, 370, 71, 380, + 47, 214, 382, 207, 68, 399, 401, 213, 404, 405, + 585, 636, 406, 411, -247, 416, 417, 543, 424, 435, + 641, 433, 434, 439, 18, 445, 456, 457, 458, 459, + 460, 461, 462, 463, 464, 647, 447, 21, 22, 23, + 446, 238, 508, 375, 234, 480, 25, 522, 19, 481, + 484, 485, 486, 487, 488, 489, 490, 492, 517, 239, + 502, 505, 506, 553, 507, 509, 610, 525, 553, 539, + 235, 512, 513, 374, 514, 515, 516, 212, 605, 4, + 518, 519, 520, 527, 28, 532, 538, 375, 30, 638, + 546, 545, 640, 547, 559, 577, 580, 593, 592, 375, + 595, 603, 631, 360, 613, 620, 5, 622, 6, 627, + 550, 624, 632, 635, 7, 8, 637, 374, 9, 642, + 648, 322, 553, 10, 551, 654, 655, 660, 200, 374, + 45, 590, 11, 540, 12, 659, 375, 53, 59, 62, + 13, 14, 209, 15, 309, 385, 533, 16, 531, 381, + 17, 0, 0, 645, 0, 0, 0, 18, 0, 0, + 0, 0, 375, 0, 19, 292, 374, 0, 20, 0, + 21, 22, 23, 24, 421, 0, 71, 0, 47, 25, + 4, 0, 68, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 374, 465, 0, 466, 467, 468, 469, 470, + 471, 472, 473, 474, 475, 0, 0, 5, 0, 6, + 0, 26, 476, 477, 537, 7, 27, 28, 29, 9, + 0, 30, 0, 31, 10, 0, 0, 32, 0, 0, + 0, 0, 0, 0, 33, 12, 34, 0, 35, 0, + 0, 13, 14, 0, 15, 0, 36, 37, 16, 0, + 0, 17, 0, 0, 0, 0, 0, 0, 18, 0, + 0, 0, 0, 0, 0, 19, 0, 0, 0, 20, + 0, 21, 22, 23, 0, 38, 0, 0, 0, 0, + 25, 301, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 26, 0, 0, 0, 0, 27, 28, 29, + 0, 5, 30, 6, 31, 456, 457, 458, 32, 7, + 461, 462, 0, 9, 0, 33, 0, 34, 10, 35, + 0, 0, 0, 0, 0, 0, 0, 36, 37, 12, 0, 0, 0, 0, 0, 13, 14, 0, 15, 0, 0, 0, 16, 0, 0, 17, 0, 0, 0, 0, - 0, 0, 18, 0, 0, 230, 38, 0, 0, 19, - 0, 0, 298, 20, 0, 21, 22, 23, 0, 0, - 0, 0, 0, 0, 25, 4, 0, 0, 0, 231, - 0, 0, 464, 465, 466, 467, 468, 0, 0, 0, - 0, 0, 0, 0, 469, 470, 0, 0, 0, 0, - 0, 0, 5, 0, 6, 232, 26, 0, 231, 0, + 0, 0, 18, 0, 0, 0, 38, 0, 0, 19, + 0, 0, 419, 20, 0, 21, 22, 23, 0, 0, + 0, 0, 0, 0, 25, 4, 0, 0, 0, 0, + 0, 0, 0, 0, 339, 0, 340, 341, 342, 343, + 344, 345, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 6, 0, 26, 0, 0, 0, 7, 27, 28, 29, 9, 0, 30, 0, 31, 10, 0, 0, 32, 0, 0, 0, 0, 0, 0, 33, - 12, 34, 0, 35, 232, 0, 13, 14, 0, 15, - 0, 36, 37, 16, 0, 543, 17, 0, 0, 0, - 0, 0, 0, 18, 0, 0, 316, 0, 0, 544, + 12, 34, 0, 35, 0, 0, 13, 14, 0, 15, + 0, 36, 37, 16, 0, 0, 17, 0, 0, 0, + 346, 0, 0, 18, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 20, 0, 21, 22, 23, 0, - 38, 0, 0, 0, 525, 25, 411, 0, 0, 0, - 0, 0, 0, 0, 0, 316, 0, 0, 526, 4, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 38, 0, 0, 0, 0, 25, 534, 469, 470, 471, + 472, 473, 474, 475, 0, 0, 0, 0, 0, 4, + 0, 476, 477, 0, 0, 0, 347, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 27, 28, 29, 0, 5, 30, 6, 31, - 0, 0, 0, 32, 7, 0, 0, 0, 9, 0, - 33, 0, 34, 10, 35, 0, 0, 0, 0, 0, + 0, 0, 0, 32, 7, 0, 348, 0, 9, 0, + 33, 0, 34, 0, 35, 0, 0, 0, 0, 349, 0, 0, 36, 37, 12, 0, 0, 0, 0, 0, - 13, 14, 0, 15, 0, 0, 0, 16, 0, 0, - 17, 4, 0, 0, 0, 0, 0, 18, 0, 0, - 0, 38, 0, 0, 19, 0, 0, 518, 20, 0, - 21, 22, 23, 0, 0, 0, 0, 0, 5, 25, - 6, 0, 0, 0, 0, 0, 7, 0, 0, 333, - 9, 334, 335, 336, 337, 338, 339, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, - 0, 26, 13, 14, 0, 15, 27, 28, 29, 16, - 0, 30, 17, 31, 0, 0, 0, 32, 0, 18, - 0, 0, 0, 0, 33, 0, 34, 0, 35, 0, - 20, 0, 21, 22, 23, 0, 36, 37, 0, 0, - 0, 25, 0, 0, 0, 340, 0, 0, 0, 0, - 0, 0, 0, 0, 333, 4, 334, 335, 336, 337, - 338, 339, 0, 0, 0, 38, 0, 0, 0, 0, - 0, 614, 0, 26, 0, 0, 0, 0, 27, 28, - 29, 0, 5, 30, 6, 31, 0, 0, 0, 32, - 7, 341, 0, 0, 9, 0, 0, 0, 34, 0, - 35, 0, 0, 0, 0, 0, 0, 0, 36, 37, - 12, 0, 0, 0, 0, 0, 13, 14, 0, 15, - 340, 342, 0, 16, 0, 0, 17, 0, 0, 0, - 449, 450, 451, 18, 343, 454, 455, 38, 0, 0, - 0, 0, 0, 512, 20, 0, 21, 22, 23, 0, - 0, 0, 0, 0, 0, 25, 0, 0, 0, 0, - 344, 0, 0, 345, 346, 418, 341, 0, 348, 349, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 350, - 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, - 0, 0, 27, 28, 29, 0, 342, 30, 4, 31, - 0, 0, 0, 32, 0, 0, 288, 0, 0, 343, - 0, 0, 34, 0, 35, 0, 0, 0, 0, 0, - 0, 0, 36, 37, 0, 5, 0, 6, 0, 0, - 0, 0, 0, 7, 8, 344, 0, 9, 345, 346, - 347, 0, 10, 348, 349, 0, 0, 0, 0, 0, - 0, 11, 0, 12, 350, 0, 0, 0, 0, 13, - 14, 0, 15, 0, 0, 0, 16, 0, 0, 17, - 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, - 0, 0, 0, 19, 289, 0, 0, 20, 0, 21, - 22, 23, 24, 0, 0, 0, 0, 0, 25, 0, - 0, 0, 462, 463, 464, 465, 466, 467, 468, 0, - 0, 0, 0, 0, 0, 0, 469, 470, 0, 0, - 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, - 26, 0, 0, 0, 0, 27, 28, 29, 0, 0, - 30, 0, 31, 0, 0, 0, 32, 0, 0, 0, - 0, 0, 5, 33, 6, 34, 0, 35, 0, 0, - 7, 8, 0, 0, 9, 36, 37, 0, 0, 10, - 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, - 12, 0, 0, 0, 0, 0, 13, 14, 0, 15, - 0, 0, 0, 16, 38, 0, 17, 0, 0, 0, - 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, - 19, 0, 0, 0, 20, 0, 21, 22, 23, 24, - 0, 0, 0, 0, 0, 25, 0, 0, 0, 0, + 201, 14, 0, 15, 0, 0, 0, 16, 0, 0, + 17, 0, 0, 0, 0, 350, 0, 18, 351, 352, + 353, 38, 0, 354, 355, 0, 0, 626, 20, 0, + 21, 22, 23, 0, 356, 0, 0, 0, 0, 25, + 0, 456, 457, 458, 459, 460, 461, 462, 0, 0, + 0, 0, 339, 4, 340, 341, 342, 343, 344, 345, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 26, 0, 0, 0, 0, 27, 28, 29, 0, + 5, 30, 6, 31, 0, 0, 0, 204, 7, 0, + 0, 0, 9, 0, 0, 0, 205, 0, 35, 456, + 457, 458, 459, 460, 461, 462, 36, 37, 12, 0, + 0, 0, 0, 0, 201, 14, 0, 15, 346, 0, + 0, 16, 0, 339, 17, 340, 341, 342, 343, 344, + 345, 18, 0, 0, 0, 38, 0, 0, 0, 0, + 0, 528, 20, 0, 21, 22, 23, 0, 0, 0, + 0, 0, 0, 25, 0, 0, 339, 0, 340, 341, + 342, 343, 344, 345, 347, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 4, 0, 0, 0, 0, 26, 0, 0, - 0, 0, 27, 28, 29, 0, 0, 30, 0, 31, - 0, 0, 0, 32, 0, 0, 0, 0, 0, 5, - 33, 6, 34, 0, 35, 0, 229, 7, 0, 0, - 0, 9, 36, 37, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, - 0, 0, 0, 13, 14, 0, 15, 0, 230, 0, - 16, 38, 0, 17, 0, 0, 0, 0, 0, 0, - 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 20, 0, 21, 22, 23, 0, 0, 0, 0, - 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 231, 0, 0, 0, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 26, 0, 0, 0, 346, + 27, 28, 29, 0, 348, 30, 0, 31, 0, 0, + 0, 204, 0, 0, 0, 0, 0, 349, 0, 0, + 205, 0, 35, 469, 470, 471, 472, 473, 474, 475, + 36, 37, 346, 0, 0, 0, 0, 476, 477, 0, + 0, 0, 0, 350, 0, 347, 351, 352, 353, 0, + 0, 354, 355, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 356, 0, 456, 457, 458, 459, 460, 461, + 462, 463, 464, 0, 0, 348, 0, 0, 347, 467, + 468, 469, 470, 471, 472, 473, 474, 475, 349, 0, + 0, 0, 0, 0, 0, 476, 477, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 348, 0, + 0, 0, 0, 0, 350, 0, 0, 351, 352, 426, + 0, 349, 354, 355, 0, 0, 0, 0, 0, 0, + 0, 427, 4, 356, 0, 0, 0, 0, 0, 0, + 291, 0, 0, 0, 0, 0, 0, 350, 0, 0, + 351, 352, 353, 0, 0, 354, 355, 0, 0, 5, + 0, 6, 0, 0, 536, 0, 356, 7, 8, 0, + 0, 9, 0, 0, 0, 0, 10, 0, 0, 0, + 0, 0, 0, 0, 0, 11, 0, 12, 0, 0, + 0, 0, 0, 13, 14, 0, 15, 0, 0, 0, + 16, 0, 0, 17, 0, 0, 0, 0, 0, 0, + 18, 0, 0, 0, 0, 0, 0, 19, 292, 0, + 0, 20, 0, 21, 22, 23, 24, 0, 0, 0, + 0, 465, 25, 466, 467, 468, 469, 470, 471, 472, + 473, 474, 475, 0, 0, 0, 0, 0, 0, 0, + 476, 477, 0, 0, 0, 491, 0, 0, 0, 4, 0, 0, 0, 0, 26, 0, 0, 0, 0, 27, - 28, 29, 0, 0, 30, 0, 31, 232, 0, 0, - 32, 0, 0, 0, 0, 5, 0, 6, 0, 34, - 0, 35, 229, 7, 0, 0, 0, 9, 0, 36, - 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 12, 0, 0, 0, 587, 0, 13, - 14, 0, 15, 0, 230, 0, 16, 0, 38, 17, - 4, 0, 0, 0, 0, 0, 18, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 20, 583, 21, - 22, 23, 0, 0, 0, 0, 0, 5, 25, 6, - 0, 0, 0, 0, 0, 7, 0, 0, 0, 9, - 0, 0, 0, 0, 0, 0, 0, 231, 0, 0, - 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, - 26, 13, 14, 0, 15, 27, 28, 29, 16, 0, - 30, 17, 31, 232, 0, 0, 32, 0, 18, 0, - 0, 0, 0, 0, 0, 34, 0, 35, 0, 20, - 0, 21, 22, 23, 4, 36, 37, 0, 0, 0, - 25, 449, 450, 451, 452, 453, 454, 455, 456, 457, - 0, 0, 0, 602, 0, 0, 0, 0, 0, 0, - 0, 5, 0, 6, 38, 0, 0, 0, 0, 7, - 0, 0, 26, 9, 0, 0, 0, 27, 28, 29, - 0, 0, 30, 0, 31, 0, 0, 0, 32, 12, - 0, 0, 0, 0, 0, 13, 14, 34, 15, 35, - 0, 0, 16, 0, 0, 17, 0, 36, 37, 0, - 0, 0, 18, 449, 450, 451, 452, 453, 454, 455, - 456, 457, 0, 20, 0, 21, 22, 23, 0, 0, - 0, 0, 0, 0, 25, 0, 38, 0, 449, 450, - 451, 452, 453, 454, 455, 456, 457, 0, 0, 0, + 28, 29, 0, 0, 30, 0, 31, 0, 0, 0, + 32, 0, 0, 0, 0, 0, 5, 33, 6, 34, + 0, 35, 0, 0, 7, 8, 0, 0, 9, 36, + 37, 0, 0, 10, 0, 0, 0, 0, 0, 0, + 0, 0, 11, 0, 12, 0, 0, 0, 0, 0, + 13, 14, 0, 15, 0, 0, 0, 16, 38, 0, + 17, 0, 0, 0, 0, 0, 0, 18, 0, 0, + 0, 0, 0, 0, 19, 0, 0, 0, 20, 0, + 21, 22, 23, 24, 0, 0, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, + 0, 26, 0, 0, 0, 0, 27, 28, 29, 0, + 0, 30, 0, 31, 0, 0, 0, 32, 0, 0, + 0, 0, 0, 5, 33, 6, 34, 0, 35, 0, + 232, 7, 0, 0, 0, 9, 36, 37, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 12, 0, 0, 0, 0, 0, 201, 14, 0, + 15, 0, 233, 0, 16, 38, 0, 17, 0, 0, + 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 20, 0, 21, 22, 23, + 0, 0, 0, 0, 0, 0, 25, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 234, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, 0, 0, 26, 0, + 0, 0, 0, 27, 28, 29, 0, 0, 30, 0, + 31, 235, 0, 0, 204, 0, 0, 0, 0, 5, + 0, 6, 0, 205, 0, 35, 232, 7, 0, 0, + 0, 9, 0, 36, 37, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, + 0, 583, 0, 201, 14, 0, 15, 0, 233, 0, + 16, 0, 38, 17, 4, 0, 0, 0, 0, 0, + 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 20, 598, 21, 22, 23, 0, 0, 0, 0, + 0, 5, 25, 6, 0, 0, 0, 0, 0, 7, + 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, + 0, 234, 0, 0, 0, 0, 0, 0, 0, 12, + 0, 0, 0, 0, 26, 201, 14, 0, 15, 27, + 28, 29, 16, 0, 30, 17, 31, 235, 0, 0, + 204, 0, 18, 0, 0, 0, 0, 0, 0, 205, + 0, 35, 0, 20, 0, 21, 22, 23, 4, 36, + 37, 0, 0, 0, 25, 456, 457, 458, 459, 460, + 461, 462, 463, 464, 0, 0, 0, 608, 0, 0, + 0, 0, 0, 0, 0, 5, 0, 6, 38, 0, + 0, 0, 0, 7, 0, 0, 26, 9, 0, 0, 0, 27, 28, 29, 0, 0, 30, 0, 31, 0, - 0, 0, 32, 0, 449, 450, 451, 452, 453, 454, - 455, 34, 457, 35, 0, 0, 0, 0, 0, 0, - 0, 36, 37, 0, 0, 0, 0, 0, 458, 0, - 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, - 0, 0, 0, 0, 0, 0, 0, 469, 470, 0, - 38, 0, 484, 449, 450, 451, 452, 453, 454, 455, - 456, 457, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 449, 450, 451, 452, 453, - 454, 455, 456, 457, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 449, 450, 451, 452, 453, 454, 455, - 458, 0, 459, 460, 461, 462, 463, 464, 465, 466, - 467, 468, 449, 450, 451, 452, 453, 454, 455, 469, - 470, 0, 0, 0, 495, 458, 0, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 0, 0, 0, - 0, 0, 0, 0, 469, 470, 0, 0, 0, 542, - 449, 450, 451, 452, 453, 454, 455, 456, 457, 0, - 0, 0, 0, 0, 0, 0, 449, 450, 451, 452, - 453, 454, 455, 459, 460, 461, 462, 463, 464, 465, - 466, 467, 468, 449, 450, 451, 452, 453, 454, 455, - 469, 470, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 204, 12, 0, 0, 0, 0, 0, 201, + 14, 205, 15, 35, 0, 0, 16, 0, 0, 17, + 0, 36, 37, 0, 0, 0, 18, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 0, 20, 0, 21, + 22, 23, 0, 0, 0, 0, 0, 0, 25, 0, + 38, 0, 456, 457, 458, 459, 460, 461, 462, 463, + 464, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 456, 457, 458, 459, 460, 461, 462, + 26, 464, 0, 0, 0, 27, 28, 29, 0, 0, + 30, 0, 31, 0, 0, 0, 204, 456, 457, 458, + 459, 460, 461, 462, 0, 205, 0, 35, 0, 0, + 0, 0, 0, 0, 0, 36, 37, 0, 0, 0, + 0, 0, 465, 0, 466, 467, 468, 469, 470, 471, + 472, 473, 474, 475, 0, 0, 0, 0, 0, 0, + 0, 476, 477, 0, 38, 0, 511, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 456, 457, + 458, 459, 460, 461, 462, 463, 464, 0, 0, 0, + 0, 0, 0, 0, 0, 456, 457, 458, 459, 460, + 461, 462, 0, 0, 465, 0, 466, 467, 468, 469, + 470, 471, 472, 473, 474, 475, 0, 0, 0, 0, + 0, 0, 0, 476, 477, 0, 0, 0, 549, 465, + 0, 466, 467, 468, 469, 470, 471, 472, 473, 474, + 475, 0, 0, 0, 0, 0, 0, 0, 476, 477, + 617, 0, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 0, 0, 0, 0, 0, 0, 0, 476, + 477, 0, 0, 0, 0, 0, 466, 467, 468, 469, + 470, 471, 472, 473, 474, 475, 0, 0, 0, 0, + 0, 0, 0, 476, 477, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 458, 0, 459, 460, 461, 462, 463, 464, 465, 466, - 467, 468, 0, 0, 0, 0, 0, 0, 0, 469, - 470, 611, 458, 610, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 0, 0, 0, 0, 0, 0, - 0, 469, 470, 460, 461, 462, 463, 464, 465, 466, - 467, 468, 0, 0, 0, 0, 0, 0, 0, 469, - 470, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 0, 0, 0, 0, 0, 0, 0, 469, 470, + 0, 0, 0, 0, 465, 616, 466, 467, 468, 469, + 470, 471, 472, 473, 474, 475, 0, 0, 0, 0, + 0, 0, 0, 476, 477, 465, 0, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 4, 0, 0, + 0, 0, 0, 0, 476, 477, 468, 469, 470, 471, + 472, 473, 474, 475, 0, 0, 0, 0, 0, 0, + 0, 476, 477, 0, 5, 0, 6, 0, 0, 0, + 0, 0, 7, 8, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 458, 0, 459, - 460, 461, 462, 463, 464, 465, 466, 467, 468, 0, - 0, 0, 0, 0, 0, 0, 469, 470, 462, 463, - 464, 465, 466, 467, 468, 4, 0, 0, 0, 0, - 0, 0, 469, 470, 461, 462, 463, 464, 465, 466, - 467, 468, 0, 0, 0, 0, 0, 0, 0, 469, - 470, 0, 5, 0, 6, 0, 0, 0, 0, 0, - 7, 8, 0, 0, 9, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, - 12, 0, 0, 0, 0, 0, 13, 14, 0, 15, - 0, 0, 0, 16, 0, 0, 17, 4, 0, 0, - 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 20, 0, 21, 22, 23, 24, - 0, 0, 201, 0, 5, 25, 6, 0, 0, 202, - 0, 0, 7, 0, 0, 0, 9, 0, 0, 0, + 11, 0, 12, 0, 0, 0, 0, 0, 201, 14, + 0, 15, 0, 0, 0, 16, 0, 0, 17, 4, + 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 20, 0, 21, 22, + 23, 24, 0, 0, 202, 0, 5, 25, 6, 0, + 0, 203, 0, 0, 7, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 12, 0, 0, 0, 0, 26, 13, 14, - 0, 15, 27, 28, 29, 16, 0, 30, 17, 31, - 0, 0, 0, 32, 0, 18, 0, 0, 0, 0, - 0, 0, 34, 0, 35, 0, 20, 0, 21, 22, - 23, 4, 36, 37, 0, 0, 0, 25, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, - 6, 0, 0, 0, 0, 0, 7, 0, 0, 26, - 0, 0, 0, 0, 27, 28, 29, 0, 0, 30, - 0, 31, 0, 0, 0, 32, 12, 0, 0, 0, - 0, 0, 13, 14, 34, 0, 35, 0, 0, 16, - 0, 0, 17, 0, 36, 37, 0, 0, 0, 18, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 21, 22, 23, 0, 0, 0, 0, 0, - 0, 25, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 12, 0, 0, 0, 0, 26, + 201, 14, 0, 15, 27, 28, 29, 16, 0, 30, + 17, 31, 0, 0, 0, 204, 0, 18, 0, 0, + 0, 0, 0, 0, 205, 0, 35, 0, 20, 0, + 21, 22, 23, 4, 36, 37, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 27, 28, - 29, 0, 0, 30, 0, 0, 0, 0, 0, 32, - 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, - 35, 0, 0, 0, 0, 0, 0, 0, 36, 37, - 96, 0, 97, 98, 99, 0, 100, 101, 0, 102, - 0, 0, 103, 0, 104, 0, 0, 0, 105, 106, - 0, 107, 108, 109, 110, 0, 111, 112, 113, 114, - 115, 116, 117, 118, 0, 119, 0, 120, 121, 122, - 123, 124, 0, 0, 125, 0, 0, 0, 126, 0, - 127, 128, 0, 129, 130, 131, 132, 133, 134, 0, - 135, 136, 137, 138, 139, 140, 0, 0, 141, 0, - 0, 142, 0, 0, 0, 0, 143, 144, 0, 145, - 146, 0, 147, 148, 0, 0, 149, 150, 151, 152, - 153, 154, 0, 155, 156, 157, 158, 159, 160, 161, - 0, 162, 163, 0, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 0, 173, 174, 175, 176, 0, 0, - 0, 177, 0, 0, 178, 0, 0, 179, 180, 0, - 0, 181, 182, 183, 184, 0, 0, 185, 0, 186, - 0, 187, 188, 189, 190, 191, 192, 193, 0, 0, - 194 + 5, 0, 6, 0, 0, 0, 0, 0, 7, 0, + 0, 26, 0, 0, 0, 0, 27, 28, 29, 0, + 0, 30, 0, 31, 0, 0, 0, 204, 12, 0, + 0, 0, 0, 0, 201, 14, 205, 0, 35, 0, + 0, 16, 0, 0, 17, 0, 36, 37, 0, 0, + 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 21, 22, 23, 0, 0, 0, + 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 27, 28, 29, 0, 0, 30, 0, 0, 0, 0, + 0, 204, 0, 0, 0, 0, 0, 0, 0, 0, + 205, 0, 35, 0, 0, 0, 0, 0, 0, 0, + 36, 37, 96, 0, 97, 98, 99, 0, 100, 101, + 0, 102, 0, 0, 103, 0, 104, 0, 0, 0, + 105, 106, 0, 107, 108, 109, 110, 0, 111, 112, + 113, 114, 115, 116, 117, 118, 0, 119, 0, 120, + 121, 122, 123, 124, 0, 0, 125, 0, 0, 0, + 126, 0, 127, 128, 0, 129, 130, 131, 132, 133, + 134, 0, 135, 136, 137, 138, 139, 140, 0, 0, + 141, 0, 0, 142, 0, 0, 0, 0, 143, 144, + 0, 145, 146, 0, 147, 148, 0, 0, 149, 150, + 151, 152, 153, 154, 0, 155, 156, 157, 158, 159, + 160, 161, 0, 162, 163, 0, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 0, 173, 174, 175, 176, + 0, 0, 0, 177, 0, 0, 178, 0, 0, 179, + 180, 0, 0, 181, 182, 183, 184, 0, 0, 185, + 0, 186, 0, 187, 188, 189, 190, 191, 192, 193, + 0, 0, 194 }; static const yytype_int16 yycheck[] = { - 2, 66, 2, 66, 2, 2, 46, 261, 2, 298, - 264, 238, 266, 33, 260, 269, 234, 235, 310, 312, - 274, 2, 67, 15, 63, 64, 65, 286, 107, 535, - 69, 541, 526, 251, 64, 65, 546, 43, 153, 69, - 316, 86, 2, 46, 153, 131, 46, 37, 46, 135, - 544, 91, 46, 179, 98, 179, 179, 3, 4, 179, - 50, 257, 68, 524, 260, 0, 57, 528, 179, 315, - 200, 267, 203, 203, 270, 39, 162, 201, 204, 202, - 276, 277, 126, 38, 204, 179, 46, 93, 43, 306, - 205, 601, 8, 204, 312, 11, 205, 3, 592, 5, - 6, 7, 8, 9, 10, 200, 25, 98, 203, 28, - 204, 400, 329, 330, 608, 70, 95, 623, 82, 315, - 316, 200, 411, 200, 200, 586, 202, 525, 589, 206, - 136, 95, 96, 97, 3, 4, 200, 396, 200, 203, - 104, 200, 148, 604, 209, 543, 209, 206, 344, 345, - 346, 347, 348, 349, 350, 616, 3, 4, 200, 29, - 32, 202, 34, 69, 206, 35, 203, 628, 123, 234, - 235, 234, 235, 15, 428, 8, 15, 202, 142, 3, - 4, 202, 146, 202, 247, 202, 251, 205, 251, 587, - 205, 38, 255, 202, 149, 202, 43, 199, 200, 199, - 200, 199, 200, 242, 602, 199, 200, 199, 200, 115, - 181, 487, 242, 216, 432, 202, 206, 471, 199, 200, - 205, 448, 418, 70, 202, 517, 3, 4, 202, 518, - 275, 3, 4, 278, 189, 280, 281, 8, 492, 145, - 285, 3, 4, 3, 4, 200, 205, 312, 203, 312, - 3, 4, 158, 449, 450, 205, 452, 453, 454, 455, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, - 466, 467, 468, 202, 470, 205, 123, 317, 184, 3, - 4, 187, 188, 189, 304, 203, 192, 193, 203, 578, - 203, 487, 510, 586, 203, 201, 203, 203, 203, 203, - 203, 203, 149, 3, 4, 532, 326, 203, 601, 311, - 350, 311, 203, 311, 541, 317, 203, 311, 203, 546, - 203, 203, 549, 616, 203, 614, 203, 3, 330, 5, - 6, 7, 8, 9, 10, 628, 203, 203, 38, 203, - 203, 203, 189, 43, 203, 187, 188, 189, 190, 191, - 189, 190, 191, 200, 203, 203, 203, 199, 200, 203, - 199, 200, 203, 203, 427, 405, 203, 432, 203, 432, - 70, 203, 203, 413, 601, 621, 174, 175, 176, 177, - 178, 3, 205, 448, 424, 202, 202, 202, 207, 643, - 430, 205, 204, 69, 204, 203, 8, 8, 8, 8, - 440, 8, 8, 75, 401, 407, 8, 8, 410, 5, - 410, 607, 410, 413, 610, 413, 410, 8, 200, 413, - 203, 202, 181, 123, 202, 621, 205, 179, 204, 179, - 430, 3, 4, 206, 3, 204, 204, 207, 203, 115, - 204, 204, 179, 204, 199, 510, 204, 510, 204, 149, - 204, 8, 181, 204, 89, 204, 204, 204, 204, 204, - 204, 526, 204, 204, 204, 204, 38, 202, 204, 145, - 4, 204, 204, 513, 204, 538, 541, 204, 206, 544, - 201, 546, 158, 523, 204, 179, 526, 204, 202, 189, - 202, 3, 3, 8, 204, 5, 204, 31, 70, 33, - 202, 202, 181, 203, 544, 39, 40, 204, 184, 43, - 205, 187, 188, 189, 48, 204, 192, 193, 13, 14, - 15, 523, 204, 57, 526, 59, 204, 203, 181, 204, - 204, 65, 66, 204, 68, 204, 601, 204, 72, 181, - 202, 75, 544, 44, 409, 2, 523, 427, 82, 649, - 276, 123, 592, 407, 2, 89, 90, 46, 2, 93, - 2, 95, 96, 97, 98, 623, 209, 272, 608, -1, - 104, -1, -1, -1, -1, -1, -1, 149, -1, 581, - -1, 581, -1, 581, 4, -1, -1, 581, -1, -1, - 592, -1, -1, -1, -1, -1, -1, -1, 3, 4, - -1, -1, 136, -1, 38, -1, 608, 141, 142, 143, - -1, 31, 146, 33, 148, -1, -1, 189, 152, 39, - -1, -1, -1, 43, -1, 159, -1, 161, 48, 163, - -1, 203, -1, 38, -1, -1, 70, 171, 172, 59, + 2, 66, 2, 2, 2, 301, 33, 271, 2, 318, + 264, 263, 316, 267, 46, 269, 67, 38, 272, 66, + 241, 289, 46, 277, 237, 238, 107, 37, 3, 4, + 63, 64, 65, 495, 542, 86, 69, 15, 57, 98, + 50, 254, 548, 2, 494, 179, 46, 553, 46, 70, + 64, 65, 46, 131, 153, 69, 153, 135, 179, 91, + 2, 153, 179, 38, 200, 179, 202, 126, 43, 321, + 204, 32, 200, 34, 3, 4, 3, 4, 206, 98, + 201, 13, 14, 15, 162, 0, 179, 204, 202, 551, + 3, 4, 179, 3, 4, 70, 3, 4, 203, 43, + 550, 607, 123, 202, 46, 318, 205, 95, 205, 38, + 15, 204, 408, 205, 43, 312, 200, 204, 8, 200, + 203, 629, 206, 419, 68, 38, 588, 15, 149, 200, + 200, 38, 205, 583, 29, 206, 404, 205, 335, 336, + 35, 70, 202, 200, 202, 205, 203, 212, 123, 93, + 202, 8, 614, 205, 11, 181, 260, 70, 608, 263, + 202, 200, 202, 70, 203, 212, 270, 25, 189, 273, + 28, 202, 237, 238, 149, 279, 280, 200, 8, 200, + 203, 435, 203, 174, 175, 176, 177, 178, 205, 254, + 237, 238, 136, 202, 123, 219, 206, 199, 200, 199, + 200, 199, 200, 250, 148, 199, 200, 254, 3, 4, + 123, 258, 245, 202, 189, 202, 123, 321, 322, 202, + 149, 199, 200, 202, 478, 200, 439, 278, 203, 533, + 281, 245, 283, 284, 455, 202, 149, 288, 534, 271, + 199, 200, 149, 204, 205, 205, 350, 351, 352, 353, + 354, 355, 356, 318, 508, 187, 188, 189, 190, 191, + 189, 3, 4, 3, 4, 3, 4, 199, 200, 271, + 205, 318, 202, 582, 203, 539, 189, 3, 4, 203, + 501, 203, 189, 310, 189, 190, 191, 200, 3, 4, + 203, 323, 3, 4, 199, 200, 203, 593, 607, 187, + 188, 189, 190, 191, 203, 332, 3, 4, 3, 4, + 619, 199, 200, 526, 493, 317, 203, 317, 497, 317, + 203, 323, 426, 317, 356, 634, 203, 548, 3, 4, + 626, 203, 553, 203, 336, 556, 203, 203, 203, 203, + 203, 203, 374, 203, 203, 3, 207, 203, 203, 203, + 203, 203, 456, 457, 203, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 203, 477, 439, 627, 203, 203, 203, 38, + 203, 413, 203, 203, 43, 203, 607, 434, 203, 421, + 455, 203, 439, 202, 205, 649, 202, 202, 205, 503, + 204, 39, 204, 582, 203, 437, 585, 8, 8, 8, + 409, 70, 8, 415, 8, 447, 418, 8, 418, 8, + 418, 421, 8, 421, 418, 5, 8, 421, 200, 203, + 495, 610, 202, 181, 205, 202, 205, 437, 204, 207, + 619, 206, 179, 179, 82, 204, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 634, 203, 95, 96, 97, + 204, 526, 179, 495, 123, 204, 104, 8, 89, 204, + 204, 204, 204, 204, 204, 204, 204, 204, 199, 526, + 204, 204, 204, 548, 204, 204, 551, 181, 553, 179, + 149, 204, 204, 495, 204, 204, 204, 529, 545, 4, + 204, 204, 204, 202, 142, 206, 204, 539, 146, 613, + 202, 204, 616, 202, 3, 3, 8, 204, 5, 551, + 202, 202, 205, 627, 204, 204, 31, 204, 33, 181, + 189, 204, 204, 204, 39, 40, 204, 539, 43, 204, + 204, 200, 607, 48, 203, 181, 181, 202, 44, 551, + 2, 503, 57, 434, 59, 655, 588, 2, 2, 2, + 65, 66, 46, 68, 212, 279, 417, 72, 415, 275, + 75, -1, -1, 629, -1, -1, -1, 82, -1, -1, + -1, -1, 614, -1, 89, 90, 588, -1, 93, -1, + 95, 96, 97, 98, 596, -1, 596, -1, 596, 104, + 4, -1, 596, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 614, 180, -1, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, -1, -1, 31, -1, 33, + -1, 136, 199, 200, 201, 39, 141, 142, 143, 43, + -1, 146, -1, 148, 48, -1, -1, 152, -1, -1, + -1, -1, -1, -1, 159, 59, 161, -1, 163, -1, + -1, 65, 66, -1, 68, -1, 171, 172, 72, -1, + -1, 75, -1, -1, -1, -1, -1, -1, 82, -1, + -1, -1, -1, -1, -1, 89, -1, -1, -1, 93, + -1, 95, 96, 97, -1, 200, -1, -1, -1, -1, + 104, 206, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 136, -1, -1, -1, -1, 141, 142, 143, + -1, 31, 146, 33, 148, 13, 14, 15, 152, 39, + 18, 19, -1, 43, -1, 159, -1, 161, 48, 163, + -1, -1, -1, -1, -1, -1, -1, 171, 172, 59, -1, -1, -1, -1, -1, 65, 66, -1, 68, -1, -1, -1, 72, -1, -1, 75, -1, -1, -1, -1, - -1, -1, 82, -1, -1, 70, 200, -1, -1, 89, + -1, -1, 82, -1, -1, -1, 200, -1, -1, 89, -1, -1, 206, 93, -1, 95, 96, 97, -1, -1, - -1, -1, -1, -1, 104, 4, -1, -1, -1, 123, - -1, -1, 187, 188, 189, 190, 191, -1, -1, -1, - -1, -1, -1, -1, 199, 200, -1, -1, -1, -1, - -1, -1, 31, -1, 33, 149, 136, -1, 123, -1, + -1, -1, -1, -1, 104, 4, -1, -1, -1, -1, + -1, -1, -1, -1, 3, -1, 5, 6, 7, 8, + 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 31, -1, 33, -1, 136, -1, -1, -1, 39, 141, 142, 143, 43, -1, 146, -1, 148, 48, -1, -1, 152, -1, -1, -1, -1, -1, -1, 159, - 59, 161, -1, 163, 149, -1, 65, 66, -1, 68, - -1, 171, 172, 72, -1, 189, 75, -1, -1, -1, - -1, -1, -1, 82, -1, -1, 200, -1, -1, 203, + 59, 161, -1, 163, -1, -1, 65, 66, -1, 68, + -1, 171, 172, 72, -1, -1, 75, -1, -1, -1, + 69, -1, -1, 82, -1, -1, -1, -1, -1, -1, 89, -1, -1, -1, 93, -1, 95, 96, 97, -1, - 200, -1, -1, -1, 189, 104, 206, -1, -1, -1, - -1, -1, -1, -1, -1, 200, -1, -1, 203, 4, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 200, -1, -1, -1, -1, 104, 206, 185, 186, 187, + 188, 189, 190, 191, -1, -1, -1, -1, -1, 4, + -1, 199, 200, -1, -1, -1, 115, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 136, -1, -1, -1, -1, 141, 142, 143, -1, 31, 146, 33, 148, - -1, -1, -1, 152, 39, -1, -1, -1, 43, -1, - 159, -1, 161, 48, 163, -1, -1, -1, -1, -1, + -1, -1, -1, 152, 39, -1, 145, -1, 43, -1, + 159, -1, 161, -1, 163, -1, -1, -1, -1, 158, -1, -1, 171, 172, 59, -1, -1, -1, -1, -1, 65, 66, -1, 68, -1, -1, -1, 72, -1, -1, - 75, 4, -1, -1, -1, -1, -1, 82, -1, -1, - -1, 200, -1, -1, 89, -1, -1, 206, 93, -1, - 95, 96, 97, -1, -1, -1, -1, -1, 31, 104, - 33, -1, -1, -1, -1, -1, 39, -1, -1, 3, - 43, 5, 6, 7, 8, 9, 10, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, - -1, 136, 65, 66, -1, 68, 141, 142, 143, 72, - -1, 146, 75, 148, -1, -1, -1, 152, -1, 82, - -1, -1, -1, -1, 159, -1, 161, -1, 163, -1, - 93, -1, 95, 96, 97, -1, 171, 172, -1, -1, - -1, 104, -1, -1, -1, 69, -1, -1, -1, -1, - -1, -1, -1, -1, 3, 4, 5, 6, 7, 8, - 9, 10, -1, -1, -1, 200, -1, -1, -1, -1, - -1, 206, -1, 136, -1, -1, -1, -1, 141, 142, - 143, -1, 31, 146, 33, 148, -1, -1, -1, 152, - 39, 115, -1, -1, 43, -1, -1, -1, 161, -1, - 163, -1, -1, -1, -1, -1, -1, -1, 171, 172, - 59, -1, -1, -1, -1, -1, 65, 66, -1, 68, - 69, 145, -1, 72, -1, -1, 75, -1, -1, -1, - 13, 14, 15, 82, 158, 18, 19, 200, -1, -1, - -1, -1, -1, 206, 93, -1, 95, 96, 97, -1, - -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, - 184, -1, -1, 187, 188, 189, 115, -1, 192, 193, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 203, - -1, -1, -1, -1, -1, -1, -1, 136, -1, -1, - -1, -1, 141, 142, 143, -1, 145, 146, 4, 148, - -1, -1, -1, 152, -1, -1, 12, -1, -1, 158, - -1, -1, 161, -1, 163, -1, -1, -1, -1, -1, - -1, -1, 171, 172, -1, 31, -1, 33, -1, -1, - -1, -1, -1, 39, 40, 184, -1, 43, 187, 188, - 189, -1, 48, 192, 193, -1, -1, -1, -1, -1, - -1, 57, -1, 59, 203, -1, -1, -1, -1, 65, - 66, -1, 68, -1, -1, -1, 72, -1, -1, 75, - -1, -1, -1, -1, -1, -1, 82, -1, -1, -1, - -1, -1, -1, 89, 90, -1, -1, 93, -1, 95, - 96, 97, 98, -1, -1, -1, -1, -1, 104, -1, - -1, -1, 185, 186, 187, 188, 189, 190, 191, -1, - -1, -1, -1, -1, -1, -1, 199, 200, -1, -1, - -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, - 136, -1, -1, -1, -1, 141, 142, 143, -1, -1, - 146, -1, 148, -1, -1, -1, 152, -1, -1, -1, - -1, -1, 31, 159, 33, 161, -1, 163, -1, -1, - 39, 40, -1, -1, 43, 171, 172, -1, -1, 48, - -1, -1, -1, -1, -1, -1, -1, -1, 57, -1, - 59, -1, -1, -1, -1, -1, 65, 66, -1, 68, - -1, -1, -1, 72, 200, -1, 75, -1, -1, -1, - -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, - 89, -1, -1, -1, 93, -1, 95, 96, 97, 98, - -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, + 75, -1, -1, -1, -1, 184, -1, 82, 187, 188, + 189, 200, -1, 192, 193, -1, -1, 206, 93, -1, + 95, 96, 97, -1, 203, -1, -1, -1, -1, 104, + -1, 13, 14, 15, 16, 17, 18, 19, -1, -1, + -1, -1, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 136, -1, -1, -1, -1, 141, 142, 143, -1, + 31, 146, 33, 148, -1, -1, -1, 152, 39, -1, + -1, -1, 43, -1, -1, -1, 161, -1, 163, 13, + 14, 15, 16, 17, 18, 19, 171, 172, 59, -1, + -1, -1, -1, -1, 65, 66, -1, 68, 69, -1, + -1, 72, -1, 3, 75, 5, 6, 7, 8, 9, + 10, 82, -1, -1, -1, 200, -1, -1, -1, -1, + -1, 206, 93, -1, 95, 96, 97, -1, -1, -1, + -1, -1, -1, 104, -1, -1, 3, -1, 5, 6, + 7, 8, 9, 10, 115, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 4, -1, -1, -1, -1, 136, -1, -1, - -1, -1, 141, 142, 143, -1, -1, 146, -1, 148, - -1, -1, -1, 152, -1, -1, -1, -1, -1, 31, - 159, 33, 161, -1, 163, -1, 38, 39, -1, -1, - -1, 43, 171, 172, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, - -1, -1, -1, 65, 66, -1, 68, -1, 70, -1, - 72, 200, -1, 75, -1, -1, -1, -1, -1, -1, - 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 93, -1, 95, 96, 97, -1, -1, -1, -1, - -1, -1, 104, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 123, -1, -1, -1, -1, -1, -1, 4, -1, + -1, -1, -1, -1, -1, 136, -1, -1, -1, 69, + 141, 142, 143, -1, 145, 146, -1, 148, -1, -1, + -1, 152, -1, -1, -1, -1, -1, 158, -1, -1, + 161, -1, 163, 185, 186, 187, 188, 189, 190, 191, + 171, 172, 69, -1, -1, -1, -1, 199, 200, -1, + -1, -1, -1, 184, -1, 115, 187, 188, 189, -1, + -1, 192, 193, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 203, -1, 13, 14, 15, 16, 17, 18, + 19, 20, 21, -1, -1, 145, -1, -1, 115, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 158, -1, + -1, -1, -1, -1, -1, 199, 200, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 145, -1, + -1, -1, -1, -1, 184, -1, -1, 187, 188, 189, + -1, 158, 192, 193, -1, -1, -1, -1, -1, -1, + -1, 201, 4, 203, -1, -1, -1, -1, -1, -1, + 12, -1, -1, -1, -1, -1, -1, 184, -1, -1, + 187, 188, 189, -1, -1, 192, 193, -1, -1, 31, + -1, 33, -1, -1, 201, -1, 203, 39, 40, -1, + -1, 43, -1, -1, -1, -1, 48, -1, -1, -1, + -1, -1, -1, -1, -1, 57, -1, 59, -1, -1, + -1, -1, -1, 65, 66, -1, 68, -1, -1, -1, + 72, -1, -1, 75, -1, -1, -1, -1, -1, -1, + 82, -1, -1, -1, -1, -1, -1, 89, 90, -1, + -1, 93, -1, 95, 96, 97, 98, -1, -1, -1, + -1, 180, 104, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, -1, -1, -1, -1, -1, -1, -1, + 199, 200, -1, -1, -1, 204, -1, -1, -1, 4, -1, -1, -1, -1, 136, -1, -1, -1, -1, 141, - 142, 143, -1, -1, 146, -1, 148, 149, -1, -1, - 152, -1, -1, -1, -1, 31, -1, 33, -1, 161, - -1, 163, 38, 39, -1, -1, -1, 43, -1, 171, - 172, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 59, -1, -1, -1, 189, -1, 65, - 66, -1, 68, -1, 70, -1, 72, -1, 200, 75, - 4, -1, -1, -1, -1, -1, 82, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 93, 22, 95, - 96, 97, -1, -1, -1, -1, -1, 31, 104, 33, - -1, -1, -1, -1, -1, 39, -1, -1, -1, 43, - -1, -1, -1, -1, -1, -1, -1, 123, -1, -1, - -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, - 136, 65, 66, -1, 68, 141, 142, 143, 72, -1, - 146, 75, 148, 149, -1, -1, 152, -1, 82, -1, - -1, -1, -1, -1, -1, 161, -1, 163, -1, 93, - -1, 95, 96, 97, 4, 171, 172, -1, -1, -1, - 104, 13, 14, 15, 16, 17, 18, 19, 20, 21, - -1, -1, -1, 189, -1, -1, -1, -1, -1, -1, - -1, 31, -1, 33, 200, -1, -1, -1, -1, 39, - -1, -1, 136, 43, -1, -1, -1, 141, 142, 143, - -1, -1, 146, -1, 148, -1, -1, -1, 152, 59, - -1, -1, -1, -1, -1, 65, 66, 161, 68, 163, - -1, -1, 72, -1, -1, 75, -1, 171, 172, -1, - -1, -1, 82, 13, 14, 15, 16, 17, 18, 19, - 20, 21, -1, 93, -1, 95, 96, 97, -1, -1, - -1, -1, -1, -1, 104, -1, 200, -1, 13, 14, - 15, 16, 17, 18, 19, 20, 21, -1, -1, -1, + 142, 143, -1, -1, 146, -1, 148, -1, -1, -1, + 152, -1, -1, -1, -1, -1, 31, 159, 33, 161, + -1, 163, -1, -1, 39, 40, -1, -1, 43, 171, + 172, -1, -1, 48, -1, -1, -1, -1, -1, -1, + -1, -1, 57, -1, 59, -1, -1, -1, -1, -1, + 65, 66, -1, 68, -1, -1, -1, 72, 200, -1, + 75, -1, -1, -1, -1, -1, -1, 82, -1, -1, + -1, -1, -1, -1, 89, -1, -1, -1, 93, -1, + 95, 96, 97, 98, -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 136, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, + -1, 136, -1, -1, -1, -1, 141, 142, 143, -1, + -1, 146, -1, 148, -1, -1, -1, 152, -1, -1, + -1, -1, -1, 31, 159, 33, 161, -1, 163, -1, + 38, 39, -1, -1, -1, 43, 171, 172, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 59, -1, -1, -1, -1, -1, 65, 66, -1, + 68, -1, 70, -1, 72, 200, -1, 75, -1, -1, + -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 93, -1, 95, 96, 97, + -1, -1, -1, -1, -1, -1, 104, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 123, -1, -1, -1, -1, + -1, -1, 4, -1, -1, -1, -1, -1, 136, -1, + -1, -1, -1, 141, 142, 143, -1, -1, 146, -1, + 148, 149, -1, -1, 152, -1, -1, -1, -1, 31, + -1, 33, -1, 161, -1, 163, 38, 39, -1, -1, + -1, 43, -1, 171, 172, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, + -1, 189, -1, 65, 66, -1, 68, -1, 70, -1, + 72, -1, 200, 75, 4, -1, -1, -1, -1, -1, + 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 93, 22, 95, 96, 97, -1, -1, -1, -1, + -1, 31, 104, 33, -1, -1, -1, -1, -1, 39, + -1, -1, -1, 43, -1, -1, -1, -1, -1, -1, + -1, 123, -1, -1, -1, -1, -1, -1, -1, 59, + -1, -1, -1, -1, 136, 65, 66, -1, 68, 141, + 142, 143, 72, -1, 146, 75, 148, 149, -1, -1, + 152, -1, 82, -1, -1, -1, -1, -1, -1, 161, + -1, 163, -1, 93, -1, 95, 96, 97, 4, 171, + 172, -1, -1, -1, 104, 13, 14, 15, 16, 17, + 18, 19, 20, 21, -1, -1, -1, 189, -1, -1, + -1, -1, -1, -1, -1, 31, -1, 33, 200, -1, + -1, -1, -1, 39, -1, -1, 136, 43, -1, -1, -1, 141, 142, 143, -1, -1, 146, -1, 148, -1, - -1, -1, 152, -1, 13, 14, 15, 16, 17, 18, - 19, 161, 21, 163, -1, -1, -1, -1, -1, -1, - -1, 171, 172, -1, -1, -1, -1, -1, 180, -1, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - -1, -1, -1, -1, -1, -1, -1, 199, 200, -1, - 200, -1, 204, 13, 14, 15, 16, 17, 18, 19, - 20, 21, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 13, 14, 15, 16, 17, - 18, 19, 20, 21, -1, -1, -1, -1, -1, -1, + -1, -1, 152, 59, -1, -1, -1, -1, -1, 65, + 66, 161, 68, 163, -1, -1, 72, -1, -1, 75, + -1, 171, 172, -1, -1, -1, 82, 13, 14, 15, + 16, 17, 18, 19, 20, 21, -1, 93, -1, 95, + 96, 97, -1, -1, -1, -1, -1, -1, 104, -1, + 200, -1, 13, 14, 15, 16, 17, 18, 19, 20, + 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 13, 14, 15, 16, 17, 18, 19, - 180, -1, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 13, 14, 15, 16, 17, 18, 19, 199, - 200, -1, -1, -1, 204, 180, -1, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, -1, -1, -1, - -1, -1, -1, -1, 199, 200, -1, -1, -1, 204, - 13, 14, 15, 16, 17, 18, 19, 20, 21, -1, - -1, -1, -1, -1, -1, -1, 13, 14, 15, 16, - 17, 18, 19, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 13, 14, 15, 16, 17, 18, 19, - 199, 200, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 180, -1, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, -1, -1, -1, -1, -1, -1, -1, 199, - 200, 201, 180, 181, 182, 183, 184, 185, 186, 187, + 136, 21, -1, -1, -1, 141, 142, 143, -1, -1, + 146, -1, 148, -1, -1, -1, 152, 13, 14, 15, + 16, 17, 18, 19, -1, 161, -1, 163, -1, -1, + -1, -1, -1, -1, -1, 171, 172, -1, -1, -1, + -1, -1, 180, -1, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, -1, -1, -1, -1, -1, -1, - -1, 199, 200, 183, 184, 185, 186, 187, 188, 189, - 190, 191, -1, -1, -1, -1, -1, -1, -1, 199, - 200, 182, 183, 184, 185, 186, 187, 188, 189, 190, + -1, 199, 200, -1, 200, -1, 204, 13, 14, 15, + 16, 17, 18, 19, 20, 21, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 13, 14, + 15, 16, 17, 18, 19, 20, 21, -1, -1, -1, + -1, -1, -1, -1, -1, 13, 14, 15, 16, 17, + 18, 19, -1, -1, 180, -1, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, -1, -1, -1, -1, + -1, -1, -1, 199, 200, -1, -1, -1, 204, 180, + -1, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, -1, -1, -1, -1, -1, -1, -1, 199, 200, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 180, -1, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, -1, - -1, -1, -1, -1, -1, -1, 199, 200, 185, 186, - 187, 188, 189, 190, 191, 4, -1, -1, -1, -1, - -1, -1, 199, 200, 184, 185, 186, 187, 188, 189, + 201, -1, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, -1, -1, -1, -1, -1, -1, -1, 199, - 200, -1, 31, -1, 33, -1, -1, -1, -1, -1, - 39, 40, -1, -1, 43, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 57, -1, - 59, -1, -1, -1, -1, -1, 65, 66, -1, 68, - -1, -1, -1, 72, -1, -1, 75, 4, -1, -1, - -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 93, -1, 95, 96, 97, 98, - -1, -1, 101, -1, 31, 104, 33, -1, -1, 108, - -1, -1, 39, -1, -1, -1, 43, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 59, -1, -1, -1, -1, 136, 65, 66, - -1, 68, 141, 142, 143, 72, -1, 146, 75, 148, - -1, -1, -1, 152, -1, 82, -1, -1, -1, -1, - -1, -1, 161, -1, 163, -1, 93, -1, 95, 96, - 97, 4, 171, 172, -1, -1, -1, 104, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 31, -1, - 33, -1, -1, -1, -1, -1, 39, -1, -1, 136, - -1, -1, -1, -1, 141, 142, 143, -1, -1, 146, - -1, 148, -1, -1, -1, 152, 59, -1, -1, -1, - -1, -1, 65, 66, 161, -1, 163, -1, -1, 72, - -1, -1, 75, -1, 171, 172, -1, -1, -1, 82, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 95, 96, 97, -1, -1, -1, -1, -1, - -1, 104, -1, -1, -1, -1, -1, -1, -1, -1, + 200, -1, -1, -1, -1, -1, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, -1, -1, -1, -1, + -1, -1, -1, 199, 200, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 141, 142, - 143, -1, -1, 146, -1, -1, -1, -1, -1, 152, - -1, -1, -1, -1, -1, -1, -1, -1, 161, -1, - 163, -1, -1, -1, -1, -1, -1, -1, 171, 172, - 23, -1, 25, 26, 27, -1, 29, 30, -1, 32, - -1, -1, 35, -1, 37, -1, -1, -1, 41, 42, - -1, 44, 45, 46, 47, -1, 49, 50, 51, 52, - 53, 54, 55, 56, -1, 58, -1, 60, 61, 62, - 63, 64, -1, -1, 67, -1, -1, -1, 71, -1, - 73, 74, -1, 76, 77, 78, 79, 80, 81, -1, - 83, 84, 85, 86, 87, 88, -1, -1, 91, -1, - -1, 94, -1, -1, -1, -1, 99, 100, -1, 102, - 103, -1, 105, 106, -1, -1, 109, 110, 111, 112, - 113, 114, -1, 116, 117, 118, 119, 120, 121, 122, - -1, 124, 125, -1, 127, 128, 129, 130, 131, 132, - 133, 134, 135, -1, 137, 138, 139, 140, -1, -1, - -1, 144, -1, -1, 147, -1, -1, 150, 151, -1, - -1, 154, 155, 156, 157, -1, -1, 160, -1, 162, - -1, 164, 165, 166, 167, 168, 169, 170, -1, -1, - 173 + -1, -1, -1, -1, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, -1, -1, -1, -1, + -1, -1, -1, 199, 200, 180, -1, 182, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 4, -1, -1, + -1, -1, -1, -1, 199, 200, 184, 185, 186, 187, + 188, 189, 190, 191, -1, -1, -1, -1, -1, -1, + -1, 199, 200, -1, 31, -1, 33, -1, -1, -1, + -1, -1, 39, 40, -1, -1, 43, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 57, -1, 59, -1, -1, -1, -1, -1, 65, 66, + -1, 68, -1, -1, -1, 72, -1, -1, 75, 4, + -1, -1, -1, -1, -1, 82, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 93, -1, 95, 96, + 97, 98, -1, -1, 101, -1, 31, 104, 33, -1, + -1, 108, -1, -1, 39, -1, -1, -1, 43, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 59, -1, -1, -1, -1, 136, + 65, 66, -1, 68, 141, 142, 143, 72, -1, 146, + 75, 148, -1, -1, -1, 152, -1, 82, -1, -1, + -1, -1, -1, -1, 161, -1, 163, -1, 93, -1, + 95, 96, 97, 4, 171, 172, -1, -1, -1, 104, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 31, -1, 33, -1, -1, -1, -1, -1, 39, -1, + -1, 136, -1, -1, -1, -1, 141, 142, 143, -1, + -1, 146, -1, 148, -1, -1, -1, 152, 59, -1, + -1, -1, -1, -1, 65, 66, 161, -1, 163, -1, + -1, 72, -1, -1, 75, -1, 171, 172, -1, -1, + -1, 82, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 95, 96, 97, -1, -1, -1, + -1, -1, -1, 104, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 141, 142, 143, -1, -1, 146, -1, -1, -1, -1, + -1, 152, -1, -1, -1, -1, -1, -1, -1, -1, + 161, -1, 163, -1, -1, -1, -1, -1, -1, -1, + 171, 172, 23, -1, 25, 26, 27, -1, 29, 30, + -1, 32, -1, -1, 35, -1, 37, -1, -1, -1, + 41, 42, -1, 44, 45, 46, 47, -1, 49, 50, + 51, 52, 53, 54, 55, 56, -1, 58, -1, 60, + 61, 62, 63, 64, -1, -1, 67, -1, -1, -1, + 71, -1, 73, 74, -1, 76, 77, 78, 79, 80, + 81, -1, 83, 84, 85, 86, 87, 88, -1, -1, + 91, -1, -1, 94, -1, -1, -1, -1, 99, 100, + -1, 102, 103, -1, 105, 106, -1, -1, 109, 110, + 111, 112, 113, 114, -1, 116, 117, 118, 119, 120, + 121, 122, -1, 124, 125, -1, 127, 128, 129, 130, + 131, 132, 133, 134, 135, -1, 137, 138, 139, 140, + -1, -1, -1, 144, -1, -1, 147, -1, -1, 150, + 151, -1, -1, 154, 155, 156, 157, -1, -1, 160, + -1, 162, -1, 164, 165, 166, 167, 168, 169, 170, + -1, -1, 173 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -1907,52 +1931,53 @@ static const yytype_uint16 yystos[] = 133, 134, 135, 137, 138, 139, 140, 144, 147, 150, 151, 154, 155, 156, 157, 160, 162, 164, 165, 166, 167, 168, 169, 170, 173, 230, 232, 302, 202, 211, - 211, 101, 108, 220, 240, 261, 266, 272, 276, 283, - 303, 306, 202, 202, 205, 202, 205, 202, 213, 202, - 181, 271, 205, 284, 285, 284, 284, 3, 4, 38, - 70, 123, 149, 189, 203, 234, 257, 286, 287, 300, - 240, 303, 304, 306, 284, 202, 8, 205, 202, 304, - 205, 283, 153, 205, 203, 203, 203, 203, 203, 203, + 211, 65, 101, 108, 152, 161, 220, 240, 261, 266, + 272, 276, 283, 303, 306, 202, 202, 205, 202, 205, + 202, 213, 202, 181, 271, 205, 284, 285, 284, 284, + 3, 4, 38, 70, 123, 149, 189, 203, 234, 257, + 286, 287, 300, 240, 303, 304, 306, 284, 202, 8, + 205, 202, 304, 205, 283, 153, 205, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, - 203, 203, 203, 203, 203, 203, 179, 201, 12, 90, - 214, 219, 222, 261, 263, 274, 275, 278, 206, 3, - 3, 4, 205, 300, 264, 126, 268, 272, 3, 4, - 205, 212, 282, 286, 286, 207, 200, 203, 227, 284, - 204, 237, 238, 239, 257, 204, 247, 286, 296, 203, - 250, 8, 257, 3, 5, 6, 7, 8, 9, 10, - 69, 115, 145, 158, 184, 187, 188, 189, 192, 193, - 203, 243, 244, 245, 243, 246, 8, 8, 231, 246, - 245, 8, 8, 245, 8, 245, 243, 75, 245, 241, - 242, 243, 8, 302, 8, 245, 304, 241, 243, 304, - 174, 175, 176, 177, 178, 301, 304, 304, 8, 11, - 233, 5, 307, 8, 304, 232, 200, 203, 202, 213, - 206, 228, 265, 181, 107, 228, 252, 269, 202, 205, - 212, 206, 214, 229, 281, 286, 204, 246, 189, 242, - 223, 224, 225, 226, 229, 283, 206, 179, 207, 206, - 228, 248, 179, 252, 206, 229, 249, 252, 204, 204, - 203, 243, 243, 243, 243, 243, 243, 243, 283, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 180, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 199, - 200, 179, 204, 204, 204, 179, 204, 204, 204, 204, - 204, 204, 204, 204, 204, 3, 204, 179, 204, 204, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 179, + 201, 12, 90, 214, 219, 222, 261, 263, 274, 275, + 278, 206, 3, 3, 3, 4, 3, 3, 205, 300, + 264, 126, 268, 272, 3, 4, 205, 212, 282, 286, + 286, 207, 200, 203, 227, 284, 204, 237, 238, 239, + 257, 204, 247, 286, 296, 203, 250, 8, 257, 3, + 5, 6, 7, 8, 9, 10, 69, 115, 145, 158, + 184, 187, 188, 189, 192, 193, 203, 243, 244, 245, + 243, 246, 8, 8, 231, 246, 245, 8, 8, 245, + 8, 245, 243, 226, 229, 283, 245, 241, 242, 243, + 8, 302, 8, 245, 304, 241, 243, 304, 174, 175, + 176, 177, 178, 301, 304, 304, 8, 11, 233, 5, + 307, 8, 304, 232, 200, 203, 202, 213, 206, 228, + 265, 181, 107, 228, 252, 269, 202, 205, 212, 206, + 214, 229, 281, 286, 204, 246, 189, 201, 243, 223, + 224, 225, 226, 206, 179, 207, 206, 228, 248, 179, + 252, 206, 229, 249, 252, 204, 204, 203, 243, 243, + 243, 243, 243, 243, 243, 283, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 180, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 199, 200, 179, 204, 204, 204, 179, 204, 204, 204, 204, 204, 204, 204, - 204, 199, 204, 204, 204, 232, 8, 213, 275, 181, - 283, 202, 206, 229, 253, 254, 206, 218, 206, 213, - 201, 201, 204, 179, 283, 189, 203, 227, 234, 257, - 292, 294, 295, 239, 245, 283, 306, 286, 204, 202, - 202, 283, 204, 189, 203, 227, 234, 288, 290, 291, - 243, 243, 3, 243, 243, 243, 243, 243, 243, 243, + 204, 204, 204, 283, 189, 203, 227, 234, 257, 292, + 294, 295, 204, 179, 204, 204, 204, 204, 179, 204, + 204, 204, 204, 204, 204, 204, 204, 199, 204, 204, + 204, 232, 8, 213, 275, 181, 283, 202, 206, 229, + 253, 254, 206, 218, 206, 213, 201, 201, 204, 179, + 239, 245, 283, 306, 286, 204, 202, 202, 283, 204, + 189, 203, 227, 234, 288, 290, 291, 243, 243, 3, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 3, 243, 245, 8, 204, 242, 245, 5, 204, 286, - 202, 212, 213, 22, 226, 294, 282, 189, 223, 234, - 293, 294, 203, 227, 292, 298, 299, 202, 255, 257, - 290, 282, 189, 223, 234, 289, 290, 204, 203, 227, - 181, 201, 204, 213, 206, 294, 282, 204, 294, 204, - 223, 181, 297, 179, 202, 205, 204, 290, 282, 204, - 294, 204, 243, 223, 243, 213, 294, 204, 246, 298, - 235, 294, 204, 37, 50, 206, 236, 245, 181, 181, - 202, 251, 252, 251, 202 + 243, 243, 243, 243, 243, 243, 243, 3, 243, 245, + 8, 294, 282, 189, 223, 234, 293, 294, 203, 227, + 242, 245, 5, 204, 286, 202, 212, 213, 22, 226, + 292, 298, 299, 202, 255, 257, 290, 282, 189, 223, + 234, 289, 290, 204, 203, 227, 181, 201, 294, 282, + 204, 294, 204, 223, 204, 213, 206, 181, 297, 179, + 202, 205, 204, 290, 282, 204, 294, 204, 243, 223, + 243, 294, 204, 213, 246, 298, 235, 294, 204, 37, + 50, 206, 236, 245, 181, 181, 202, 251, 252, 251, + 202 }; #define yyerrok (yyerrstatus = 0) @@ -1967,9 +1992,18 @@ static const yytype_uint16 yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ #define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif #define YYRECOVERING() (!!yyerrstatus) @@ -2026,7 +2060,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -2765,7 +2799,7 @@ yyreduce: { case 2: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 328 "parser.y" { fix_incomplete(); check_statements((yyvsp[(1) - (1)].stmt_list), FALSE); @@ -2783,28 +2817,28 @@ yyreduce: case 3: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 342 "parser.y" { (yyval.stmt_list) = NULL; ;} break; case 4: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 343 "parser.y" { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_reference((yyvsp[(2) - (2)].type))); ;} break; case 5: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 344 "parser.y" { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_type_decl((yyvsp[(2) - (2)].type))); ;} break; case 6: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 345 "parser.y" { (yyval.stmt_list) = (yyvsp[(1) - (3)].stmt_list); reg_type((yyvsp[(2) - (3)].type), (yyvsp[(2) - (3)].type)->name, 0); @@ -2813,7 +2847,7 @@ yyreduce: case 7: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 348 "parser.y" { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_type_decl((yyvsp[(2) - (2)].type))); reg_type((yyvsp[(2) - (2)].type), (yyvsp[(2) - (2)].type)->name, 0); @@ -2822,56 +2856,56 @@ yyreduce: case 8: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 351 "parser.y" { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_module((yyvsp[(2) - (2)].type))); ;} break; case 9: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 352 "parser.y" { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_library((yyvsp[(2) - (2)].typelib))); ;} break; case 10: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 353 "parser.y" { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), (yyvsp[(2) - (2)].statement)); ;} break; case 11: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 356 "parser.y" { (yyval.stmt_list) = NULL; ;} break; case 12: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 357 "parser.y" { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_reference((yyvsp[(2) - (2)].type))); ;} break; case 13: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 358 "parser.y" { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_type_decl((yyvsp[(2) - (2)].type))); ;} break; case 14: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 359 "parser.y" { (yyval.stmt_list) = (yyvsp[(1) - (3)].stmt_list); reg_type((yyvsp[(2) - (3)].type), (yyvsp[(2) - (3)].type)->name, 0); ;} break; case 15: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 360 "parser.y" { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_type_decl((yyvsp[(2) - (2)].type))); reg_type((yyvsp[(2) - (2)].type), (yyvsp[(2) - (2)].type)->name, 0); @@ -2880,113 +2914,134 @@ yyreduce: case 16: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 363 "parser.y" { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_module((yyvsp[(2) - (2)].type))); ;} break; case 17: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 364 "parser.y" { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), (yyvsp[(2) - (2)].statement)); ;} break; case 18: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 365 "parser.y" { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_importlib((yyvsp[(2) - (2)].str))); ;} break; case 19: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 366 "parser.y" { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_library((yyvsp[(2) - (2)].typelib))); ;} break; case 20: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 369 "parser.y" { (yyval.stmt_list) = NULL; ;} break; case 21: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 370 "parser.y" { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), (yyvsp[(2) - (2)].statement)); ;} break; case 24: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 378 "parser.y" { (yyval.statement) = make_statement_cppquote((yyvsp[(1) - (1)].str)); ;} break; case 25: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 379 "parser.y" { (yyval.statement) = make_statement_type_decl((yyvsp[(1) - (2)].type)); ;} break; case 26: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 380 "parser.y" { (yyval.statement) = make_statement_declaration((yyvsp[(1) - (2)].var)); ;} break; case 27: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 381 "parser.y" { (yyval.statement) = make_statement_import((yyvsp[(1) - (1)].str)); ;} break; case 28: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 382 "parser.y" { (yyval.statement) = (yyvsp[(1) - (2)].statement); ;} break; - case 32: + case 30: -/* Line 1455 of yacc.c */ -#line 389 "parser.y" - { (yyval.type) = (yyvsp[(2) - (2)].type); (yyval.type)->attrs = check_enum_attrs((yyvsp[(1) - (2)].attr_list)); ;} +/* Line 1464 of yacc.c */ +#line 387 "parser.y" + { (yyval.type) = type_new_enum((yyvsp[(2) - (2)].str), FALSE, NULL); ;} break; - case 33: + case 32: -/* Line 1455 of yacc.c */ -#line 390 "parser.y" - { (yyval.type) = (yyvsp[(2) - (2)].type); (yyval.type)->attrs = check_struct_attrs((yyvsp[(1) - (2)].attr_list)); ;} +/* Line 1464 of yacc.c */ +#line 389 "parser.y" + { (yyval.type) = type_new_struct((yyvsp[(2) - (2)].str), FALSE, NULL); ;} break; case 34: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 391 "parser.y" - { (yyval.type) = (yyvsp[(2) - (2)].type); (yyval.type)->attrs = check_union_attrs((yyvsp[(1) - (2)].attr_list)); ;} + { (yyval.type) = type_new_nonencapsulated_union((yyvsp[(2) - (2)].str), FALSE, NULL); ;} break; case 35: -/* Line 1455 of yacc.c */ -#line 394 "parser.y" - { (yyval.str) = (yyvsp[(3) - (4)].str); ;} +/* Line 1464 of yacc.c */ +#line 392 "parser.y" + { (yyval.type) = (yyvsp[(2) - (2)].type); (yyval.type)->attrs = check_enum_attrs((yyvsp[(1) - (2)].attr_list)); ;} break; case 36: -/* Line 1455 of yacc.c */ -#line 396 "parser.y" +/* Line 1464 of yacc.c */ +#line 393 "parser.y" + { (yyval.type) = (yyvsp[(2) - (2)].type); (yyval.type)->attrs = check_struct_attrs((yyvsp[(1) - (2)].attr_list)); ;} + break; + + case 37: + +/* Line 1464 of yacc.c */ +#line 394 "parser.y" + { (yyval.type) = (yyvsp[(2) - (2)].type); (yyval.type)->attrs = check_union_attrs((yyvsp[(1) - (2)].attr_list)); ;} + break; + + case 38: + +/* Line 1464 of yacc.c */ +#line 397 "parser.y" + { (yyval.str) = (yyvsp[(3) - (4)].str); ;} + break; + + case 39: + +/* Line 1464 of yacc.c */ +#line 399 "parser.y" { assert(yychar == YYEMPTY); (yyval.import) = xmalloc(sizeof(struct _import_t)); (yyval.import)->name = (yyvsp[(2) - (3)].str); @@ -2995,81 +3050,81 @@ yyreduce: ;} break; - case 37: + case 40: -/* Line 1455 of yacc.c */ -#line 404 "parser.y" +/* Line 1464 of yacc.c */ +#line 407 "parser.y" { (yyval.str) = (yyvsp[(1) - (3)].import)->name; if ((yyvsp[(1) - (3)].import)->import_performed) pop_import(); free((yyvsp[(1) - (3)].import)); ;} break; - case 38: + case 41: -/* Line 1455 of yacc.c */ -#line 411 "parser.y" +/* Line 1464 of yacc.c */ +#line 414 "parser.y" { (yyval.str) = (yyvsp[(3) - (5)].str); if(!parse_only) add_importlib((yyvsp[(3) - (5)].str)); ;} break; - case 39: + case 42: -/* Line 1455 of yacc.c */ -#line 414 "parser.y" +/* Line 1464 of yacc.c */ +#line 417 "parser.y" { (yyval.str) = (yyvsp[(2) - (2)].str); ;} break; - case 40: + case 43: -/* Line 1455 of yacc.c */ -#line 416 "parser.y" +/* Line 1464 of yacc.c */ +#line 419 "parser.y" { (yyval.typelib) = make_library((yyvsp[(2) - (3)].str), check_library_attrs((yyvsp[(2) - (3)].str), (yyvsp[(1) - (3)].attr_list))); if (!parse_only) start_typelib((yyval.typelib)); ;} break; - case 41: + case 44: -/* Line 1455 of yacc.c */ -#line 421 "parser.y" +/* Line 1464 of yacc.c */ +#line 424 "parser.y" { (yyval.typelib) = (yyvsp[(1) - (4)].typelib); (yyval.typelib)->stmts = (yyvsp[(2) - (4)].stmt_list); if (!parse_only) end_typelib(); ;} break; - case 42: - -/* Line 1455 of yacc.c */ -#line 427 "parser.y" - { (yyval.var_list) = NULL; ;} - break; - - case 44: - -/* Line 1455 of yacc.c */ -#line 431 "parser.y" - { check_arg_attrs((yyvsp[(1) - (1)].var)); (yyval.var_list) = append_var( NULL, (yyvsp[(1) - (1)].var) ); ;} - break; - case 45: -/* Line 1455 of yacc.c */ -#line 432 "parser.y" - { check_arg_attrs((yyvsp[(3) - (3)].var)); (yyval.var_list) = append_var( (yyvsp[(1) - (3)].var_list), (yyvsp[(3) - (3)].var) ); ;} +/* Line 1464 of yacc.c */ +#line 430 "parser.y" + { (yyval.var_list) = NULL; ;} break; case 47: -/* Line 1455 of yacc.c */ -#line 436 "parser.y" - { (yyval.var_list) = append_var( (yyvsp[(1) - (3)].var_list), make_var(strdup("...")) ); ;} +/* Line 1464 of yacc.c */ +#line 434 "parser.y" + { check_arg_attrs((yyvsp[(1) - (1)].var)); (yyval.var_list) = append_var( NULL, (yyvsp[(1) - (1)].var) ); ;} break; case 48: -/* Line 1455 of yacc.c */ -#line 440 "parser.y" +/* Line 1464 of yacc.c */ +#line 435 "parser.y" + { check_arg_attrs((yyvsp[(3) - (3)].var)); (yyval.var_list) = append_var( (yyvsp[(1) - (3)].var_list), (yyvsp[(3) - (3)].var) ); ;} + break; + + case 50: + +/* Line 1464 of yacc.c */ +#line 439 "parser.y" + { (yyval.var_list) = append_var( (yyvsp[(1) - (3)].var_list), make_var(strdup("...")) ); ;} + break; + + case 51: + +/* Line 1464 of yacc.c */ +#line 443 "parser.y" { if ((yyvsp[(2) - (3)].declspec)->stgclass != STG_NONE && (yyvsp[(2) - (3)].declspec)->stgclass != STG_REGISTER) error_loc("invalid storage class for function parameter\n"); (yyval.var) = declare_var((yyvsp[(1) - (3)].attr_list), (yyvsp[(2) - (3)].declspec), (yyvsp[(3) - (3)].declarator), TRUE); @@ -3077,10 +3132,10 @@ yyreduce: ;} break; - case 49: + case 52: -/* Line 1455 of yacc.c */ -#line 445 "parser.y" +/* Line 1464 of yacc.c */ +#line 448 "parser.y" { if ((yyvsp[(1) - (2)].declspec)->stgclass != STG_NONE && (yyvsp[(1) - (2)].declspec)->stgclass != STG_REGISTER) error_loc("invalid storage class for function parameter\n"); (yyval.var) = declare_var(NULL, (yyvsp[(1) - (2)].declspec), (yyvsp[(2) - (2)].declarator), TRUE); @@ -3088,863 +3143,873 @@ yyreduce: ;} break; - case 50: + case 53: -/* Line 1455 of yacc.c */ -#line 452 "parser.y" - { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} - break; - - case 51: - -/* Line 1455 of yacc.c */ -#line 453 "parser.y" - { (yyval.expr) = make_expr(EXPR_VOID); ;} - break; - - case 52: - -/* Line 1455 of yacc.c */ -#line 456 "parser.y" - { (yyval.attr_list) = NULL; ;} +/* Line 1464 of yacc.c */ +#line 455 "parser.y" + { (yyval.expr) = (yyvsp[(2) - (3)].expr); + if (!(yyval.expr)->is_const) + error_loc("array dimension is not an integer constant\n"); + ;} break; case 54: -/* Line 1455 of yacc.c */ -#line 461 "parser.y" - { (yyval.attr_list) = (yyvsp[(2) - (3)].attr_list); ;} +/* Line 1464 of yacc.c */ +#line 459 "parser.y" + { (yyval.expr) = make_expr(EXPR_VOID); ;} break; case 55: -/* Line 1455 of yacc.c */ -#line 464 "parser.y" - { (yyval.attr_list) = append_attr( NULL, (yyvsp[(1) - (1)].attr) ); ;} +/* Line 1464 of yacc.c */ +#line 460 "parser.y" + { (yyval.expr) = make_expr(EXPR_VOID); ;} break; case 56: -/* Line 1455 of yacc.c */ -#line 465 "parser.y" - { (yyval.attr_list) = append_attr( (yyvsp[(1) - (3)].attr_list), (yyvsp[(3) - (3)].attr) ); ;} - break; - - case 57: - -/* Line 1455 of yacc.c */ -#line 466 "parser.y" - { (yyval.attr_list) = append_attr( (yyvsp[(1) - (4)].attr_list), (yyvsp[(4) - (4)].attr) ); ;} +/* Line 1464 of yacc.c */ +#line 463 "parser.y" + { (yyval.attr_list) = NULL; ;} break; case 58: -/* Line 1455 of yacc.c */ -#line 469 "parser.y" - { (yyval.str_list) = append_str( NULL, (yyvsp[(1) - (1)].str) ); ;} +/* Line 1464 of yacc.c */ +#line 468 "parser.y" + { (yyval.attr_list) = (yyvsp[(2) - (3)].attr_list); ;} break; case 59: -/* Line 1455 of yacc.c */ -#line 470 "parser.y" - { (yyval.str_list) = append_str( (yyvsp[(1) - (3)].str_list), (yyvsp[(3) - (3)].str) ); ;} +/* Line 1464 of yacc.c */ +#line 471 "parser.y" + { (yyval.attr_list) = append_attr( NULL, (yyvsp[(1) - (1)].attr) ); ;} break; case 60: -/* Line 1455 of yacc.c */ -#line 473 "parser.y" - { (yyval.attr) = NULL; ;} +/* Line 1464 of yacc.c */ +#line 472 "parser.y" + { (yyval.attr_list) = append_attr( (yyvsp[(1) - (3)].attr_list), (yyvsp[(3) - (3)].attr) ); ;} break; case 61: -/* Line 1455 of yacc.c */ -#line 474 "parser.y" - { (yyval.attr) = make_attr(ATTR_AGGREGATABLE); ;} +/* Line 1464 of yacc.c */ +#line 473 "parser.y" + { (yyval.attr_list) = append_attr( (yyvsp[(1) - (4)].attr_list), (yyvsp[(4) - (4)].attr) ); ;} break; case 62: -/* Line 1455 of yacc.c */ -#line 475 "parser.y" - { (yyval.attr) = make_attrp(ATTR_ANNOTATION, (yyvsp[(3) - (4)].str)); ;} +/* Line 1464 of yacc.c */ +#line 476 "parser.y" + { (yyval.str_list) = append_str( NULL, (yyvsp[(1) - (1)].str) ); ;} break; case 63: -/* Line 1455 of yacc.c */ -#line 476 "parser.y" - { (yyval.attr) = make_attr(ATTR_APPOBJECT); ;} +/* Line 1464 of yacc.c */ +#line 477 "parser.y" + { (yyval.str_list) = append_str( (yyvsp[(1) - (3)].str_list), (yyvsp[(3) - (3)].str) ); ;} break; case 64: -/* Line 1455 of yacc.c */ -#line 477 "parser.y" - { (yyval.attr) = make_attr(ATTR_ASYNC); ;} +/* Line 1464 of yacc.c */ +#line 480 "parser.y" + { (yyval.attr) = NULL; ;} break; case 65: -/* Line 1455 of yacc.c */ -#line 478 "parser.y" - { (yyval.attr) = make_attr(ATTR_AUTO_HANDLE); ;} +/* Line 1464 of yacc.c */ +#line 481 "parser.y" + { (yyval.attr) = make_attr(ATTR_AGGREGATABLE); ;} break; case 66: -/* Line 1455 of yacc.c */ -#line 479 "parser.y" - { (yyval.attr) = make_attr(ATTR_BINDABLE); ;} +/* Line 1464 of yacc.c */ +#line 482 "parser.y" + { (yyval.attr) = make_attrp(ATTR_ANNOTATION, (yyvsp[(3) - (4)].str)); ;} break; case 67: -/* Line 1455 of yacc.c */ -#line 480 "parser.y" - { (yyval.attr) = make_attr(ATTR_BROADCAST); ;} +/* Line 1464 of yacc.c */ +#line 483 "parser.y" + { (yyval.attr) = make_attr(ATTR_APPOBJECT); ;} break; case 68: -/* Line 1455 of yacc.c */ -#line 481 "parser.y" - { (yyval.attr) = make_attrp(ATTR_CALLAS, (yyvsp[(3) - (4)].var)); ;} +/* Line 1464 of yacc.c */ +#line 484 "parser.y" + { (yyval.attr) = make_attr(ATTR_ASYNC); ;} break; case 69: -/* Line 1455 of yacc.c */ -#line 482 "parser.y" - { (yyval.attr) = make_attrp(ATTR_CASE, (yyvsp[(3) - (4)].expr_list)); ;} +/* Line 1464 of yacc.c */ +#line 485 "parser.y" + { (yyval.attr) = make_attr(ATTR_AUTO_HANDLE); ;} break; case 70: -/* Line 1455 of yacc.c */ -#line 483 "parser.y" - { (yyval.attr) = make_attr(ATTR_CODE); ;} +/* Line 1464 of yacc.c */ +#line 486 "parser.y" + { (yyval.attr) = make_attr(ATTR_BINDABLE); ;} break; case 71: -/* Line 1455 of yacc.c */ -#line 484 "parser.y" - { (yyval.attr) = make_attr(ATTR_COMMSTATUS); ;} +/* Line 1464 of yacc.c */ +#line 487 "parser.y" + { (yyval.attr) = make_attr(ATTR_BROADCAST); ;} break; case 72: -/* Line 1455 of yacc.c */ -#line 485 "parser.y" - { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); ;} +/* Line 1464 of yacc.c */ +#line 488 "parser.y" + { (yyval.attr) = make_attrp(ATTR_CALLAS, (yyvsp[(3) - (4)].var)); ;} break; case 73: -/* Line 1455 of yacc.c */ -#line 486 "parser.y" - { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_DONT_SERIALIZE */ ;} +/* Line 1464 of yacc.c */ +#line 489 "parser.y" + { (yyval.attr) = make_attrp(ATTR_CASE, (yyvsp[(3) - (4)].expr_list)); ;} break; case 74: -/* Line 1455 of yacc.c */ -#line 487 "parser.y" - { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_SERIALIZE */ ;} +/* Line 1464 of yacc.c */ +#line 490 "parser.y" + { (yyval.attr) = make_attr(ATTR_CODE); ;} break; case 75: -/* Line 1455 of yacc.c */ -#line 488 "parser.y" - { (yyval.attr) = make_attr(ATTR_CONTROL); ;} +/* Line 1464 of yacc.c */ +#line 491 "parser.y" + { (yyval.attr) = make_attr(ATTR_COMMSTATUS); ;} break; case 76: -/* Line 1455 of yacc.c */ -#line 489 "parser.y" - { (yyval.attr) = make_attr(ATTR_DECODE); ;} +/* Line 1464 of yacc.c */ +#line 492 "parser.y" + { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); ;} break; case 77: -/* Line 1455 of yacc.c */ -#line 490 "parser.y" - { (yyval.attr) = make_attr(ATTR_DEFAULT); ;} +/* Line 1464 of yacc.c */ +#line 493 "parser.y" + { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_DONT_SERIALIZE */ ;} break; case 78: -/* Line 1455 of yacc.c */ -#line 491 "parser.y" - { (yyval.attr) = make_attr(ATTR_DEFAULTBIND); ;} +/* Line 1464 of yacc.c */ +#line 494 "parser.y" + { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_SERIALIZE */ ;} break; case 79: -/* Line 1455 of yacc.c */ -#line 492 "parser.y" - { (yyval.attr) = make_attr(ATTR_DEFAULTCOLLELEM); ;} +/* Line 1464 of yacc.c */ +#line 495 "parser.y" + { (yyval.attr) = make_attr(ATTR_CONTROL); ;} break; case 80: -/* Line 1455 of yacc.c */ -#line 493 "parser.y" - { (yyval.attr) = make_attrp(ATTR_DEFAULTVALUE, (yyvsp[(3) - (4)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 496 "parser.y" + { (yyval.attr) = make_attr(ATTR_DECODE); ;} break; case 81: -/* Line 1455 of yacc.c */ -#line 494 "parser.y" - { (yyval.attr) = make_attr(ATTR_DEFAULTVTABLE); ;} +/* Line 1464 of yacc.c */ +#line 497 "parser.y" + { (yyval.attr) = make_attr(ATTR_DEFAULT); ;} break; case 82: -/* Line 1455 of yacc.c */ -#line 495 "parser.y" - { (yyval.attr) = make_attr(ATTR_DISABLECONSISTENCYCHECK); ;} +/* Line 1464 of yacc.c */ +#line 498 "parser.y" + { (yyval.attr) = make_attr(ATTR_DEFAULTBIND); ;} break; case 83: -/* Line 1455 of yacc.c */ -#line 496 "parser.y" - { (yyval.attr) = make_attr(ATTR_DISPLAYBIND); ;} +/* Line 1464 of yacc.c */ +#line 499 "parser.y" + { (yyval.attr) = make_attr(ATTR_DEFAULTCOLLELEM); ;} break; case 84: -/* Line 1455 of yacc.c */ -#line 497 "parser.y" - { (yyval.attr) = make_attrp(ATTR_DLLNAME, (yyvsp[(3) - (4)].str)); ;} +/* Line 1464 of yacc.c */ +#line 500 "parser.y" + { (yyval.attr) = make_attrp(ATTR_DEFAULTVALUE, (yyvsp[(3) - (4)].expr)); ;} break; case 85: -/* Line 1455 of yacc.c */ -#line 498 "parser.y" - { (yyval.attr) = make_attr(ATTR_DUAL); ;} +/* Line 1464 of yacc.c */ +#line 501 "parser.y" + { (yyval.attr) = make_attr(ATTR_DEFAULTVTABLE); ;} break; case 86: -/* Line 1455 of yacc.c */ -#line 499 "parser.y" - { (yyval.attr) = make_attr(ATTR_ENABLEALLOCATE); ;} +/* Line 1464 of yacc.c */ +#line 502 "parser.y" + { (yyval.attr) = make_attr(ATTR_DISABLECONSISTENCYCHECK); ;} break; case 87: -/* Line 1455 of yacc.c */ -#line 500 "parser.y" - { (yyval.attr) = make_attr(ATTR_ENCODE); ;} +/* Line 1464 of yacc.c */ +#line 503 "parser.y" + { (yyval.attr) = make_attr(ATTR_DISPLAYBIND); ;} break; case 88: -/* Line 1455 of yacc.c */ -#line 501 "parser.y" - { (yyval.attr) = make_attrp(ATTR_ENDPOINT, (yyvsp[(3) - (4)].str_list)); ;} +/* Line 1464 of yacc.c */ +#line 504 "parser.y" + { (yyval.attr) = make_attrp(ATTR_DLLNAME, (yyvsp[(3) - (4)].str)); ;} break; case 89: -/* Line 1455 of yacc.c */ -#line 502 "parser.y" - { (yyval.attr) = make_attrp(ATTR_ENTRY, (yyvsp[(3) - (4)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 505 "parser.y" + { (yyval.attr) = make_attr(ATTR_DUAL); ;} break; case 90: -/* Line 1455 of yacc.c */ -#line 503 "parser.y" - { (yyval.attr) = make_attr(ATTR_EXPLICIT_HANDLE); ;} +/* Line 1464 of yacc.c */ +#line 506 "parser.y" + { (yyval.attr) = make_attr(ATTR_ENABLEALLOCATE); ;} break; case 91: -/* Line 1455 of yacc.c */ -#line 504 "parser.y" - { (yyval.attr) = make_attr(ATTR_FAULTSTATUS); ;} +/* Line 1464 of yacc.c */ +#line 507 "parser.y" + { (yyval.attr) = make_attr(ATTR_ENCODE); ;} break; case 92: -/* Line 1455 of yacc.c */ -#line 505 "parser.y" - { (yyval.attr) = make_attr(ATTR_FORCEALLOCATE); ;} +/* Line 1464 of yacc.c */ +#line 508 "parser.y" + { (yyval.attr) = make_attrp(ATTR_ENDPOINT, (yyvsp[(3) - (4)].str_list)); ;} break; case 93: -/* Line 1455 of yacc.c */ -#line 506 "parser.y" - { (yyval.attr) = make_attr(ATTR_HANDLE); ;} +/* Line 1464 of yacc.c */ +#line 509 "parser.y" + { (yyval.attr) = make_attrp(ATTR_ENTRY, (yyvsp[(3) - (4)].expr)); ;} break; case 94: -/* Line 1455 of yacc.c */ -#line 507 "parser.y" - { (yyval.attr) = make_attrp(ATTR_HELPCONTEXT, (yyvsp[(3) - (4)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 510 "parser.y" + { (yyval.attr) = make_attr(ATTR_EXPLICIT_HANDLE); ;} break; case 95: -/* Line 1455 of yacc.c */ -#line 508 "parser.y" - { (yyval.attr) = make_attrp(ATTR_HELPFILE, (yyvsp[(3) - (4)].str)); ;} +/* Line 1464 of yacc.c */ +#line 511 "parser.y" + { (yyval.attr) = make_attr(ATTR_FAULTSTATUS); ;} break; case 96: -/* Line 1455 of yacc.c */ -#line 509 "parser.y" - { (yyval.attr) = make_attrp(ATTR_HELPSTRING, (yyvsp[(3) - (4)].str)); ;} +/* Line 1464 of yacc.c */ +#line 512 "parser.y" + { (yyval.attr) = make_attr(ATTR_FORCEALLOCATE); ;} break; case 97: -/* Line 1455 of yacc.c */ -#line 510 "parser.y" - { (yyval.attr) = make_attrp(ATTR_HELPSTRINGCONTEXT, (yyvsp[(3) - (4)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 513 "parser.y" + { (yyval.attr) = make_attr(ATTR_HANDLE); ;} break; case 98: -/* Line 1455 of yacc.c */ -#line 511 "parser.y" - { (yyval.attr) = make_attrp(ATTR_HELPSTRINGDLL, (yyvsp[(3) - (4)].str)); ;} +/* Line 1464 of yacc.c */ +#line 514 "parser.y" + { (yyval.attr) = make_attrp(ATTR_HELPCONTEXT, (yyvsp[(3) - (4)].expr)); ;} break; case 99: -/* Line 1455 of yacc.c */ -#line 512 "parser.y" - { (yyval.attr) = make_attr(ATTR_HIDDEN); ;} +/* Line 1464 of yacc.c */ +#line 515 "parser.y" + { (yyval.attr) = make_attrp(ATTR_HELPFILE, (yyvsp[(3) - (4)].str)); ;} break; case 100: -/* Line 1455 of yacc.c */ -#line 513 "parser.y" - { (yyval.attr) = make_attrp(ATTR_ID, (yyvsp[(3) - (4)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 516 "parser.y" + { (yyval.attr) = make_attrp(ATTR_HELPSTRING, (yyvsp[(3) - (4)].str)); ;} break; case 101: -/* Line 1455 of yacc.c */ -#line 514 "parser.y" - { (yyval.attr) = make_attr(ATTR_IDEMPOTENT); ;} +/* Line 1464 of yacc.c */ +#line 517 "parser.y" + { (yyval.attr) = make_attrp(ATTR_HELPSTRINGCONTEXT, (yyvsp[(3) - (4)].expr)); ;} break; case 102: -/* Line 1455 of yacc.c */ -#line 515 "parser.y" - { (yyval.attr) = make_attr(ATTR_IGNORE); ;} +/* Line 1464 of yacc.c */ +#line 518 "parser.y" + { (yyval.attr) = make_attrp(ATTR_HELPSTRINGDLL, (yyvsp[(3) - (4)].str)); ;} break; case 103: -/* Line 1455 of yacc.c */ -#line 516 "parser.y" - { (yyval.attr) = make_attrp(ATTR_IIDIS, (yyvsp[(3) - (4)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 519 "parser.y" + { (yyval.attr) = make_attr(ATTR_HIDDEN); ;} break; case 104: -/* Line 1455 of yacc.c */ -#line 517 "parser.y" - { (yyval.attr) = make_attr(ATTR_IMMEDIATEBIND); ;} +/* Line 1464 of yacc.c */ +#line 520 "parser.y" + { (yyval.attr) = make_attrp(ATTR_ID, (yyvsp[(3) - (4)].expr)); ;} break; case 105: -/* Line 1455 of yacc.c */ -#line 518 "parser.y" - { (yyval.attr) = make_attrp(ATTR_IMPLICIT_HANDLE, (yyvsp[(4) - (5)].str)); ;} +/* Line 1464 of yacc.c */ +#line 521 "parser.y" + { (yyval.attr) = make_attr(ATTR_IDEMPOTENT); ;} break; case 106: -/* Line 1455 of yacc.c */ -#line 519 "parser.y" - { (yyval.attr) = make_attr(ATTR_IN); ;} +/* Line 1464 of yacc.c */ +#line 522 "parser.y" + { (yyval.attr) = make_attr(ATTR_IGNORE); ;} break; case 107: -/* Line 1455 of yacc.c */ -#line 520 "parser.y" - { (yyval.attr) = make_attr(ATTR_INPUTSYNC); ;} +/* Line 1464 of yacc.c */ +#line 523 "parser.y" + { (yyval.attr) = make_attrp(ATTR_IIDIS, (yyvsp[(3) - (4)].expr)); ;} break; case 108: -/* Line 1455 of yacc.c */ -#line 521 "parser.y" - { (yyval.attr) = make_attrp(ATTR_LENGTHIS, (yyvsp[(3) - (4)].expr_list)); ;} +/* Line 1464 of yacc.c */ +#line 524 "parser.y" + { (yyval.attr) = make_attr(ATTR_IMMEDIATEBIND); ;} break; case 109: -/* Line 1455 of yacc.c */ -#line 522 "parser.y" - { (yyval.attr) = make_attrp(ATTR_LIBLCID, (yyvsp[(3) - (4)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 525 "parser.y" + { (yyval.attr) = make_attrp(ATTR_IMPLICIT_HANDLE, (yyvsp[(3) - (4)].var)); ;} break; case 110: -/* Line 1455 of yacc.c */ -#line 523 "parser.y" - { (yyval.attr) = make_attr(ATTR_PARAMLCID); ;} +/* Line 1464 of yacc.c */ +#line 526 "parser.y" + { (yyval.attr) = make_attr(ATTR_IN); ;} break; case 111: -/* Line 1455 of yacc.c */ -#line 524 "parser.y" - { (yyval.attr) = make_attr(ATTR_LICENSED); ;} +/* Line 1464 of yacc.c */ +#line 527 "parser.y" + { (yyval.attr) = make_attr(ATTR_INPUTSYNC); ;} break; case 112: -/* Line 1455 of yacc.c */ -#line 525 "parser.y" - { (yyval.attr) = make_attr(ATTR_LOCAL); ;} +/* Line 1464 of yacc.c */ +#line 528 "parser.y" + { (yyval.attr) = make_attrp(ATTR_LENGTHIS, (yyvsp[(3) - (4)].expr_list)); ;} break; case 113: -/* Line 1455 of yacc.c */ -#line 526 "parser.y" - { (yyval.attr) = make_attr(ATTR_MAYBE); ;} +/* Line 1464 of yacc.c */ +#line 529 "parser.y" + { (yyval.attr) = make_attrp(ATTR_LIBLCID, (yyvsp[(3) - (4)].expr)); ;} break; case 114: -/* Line 1455 of yacc.c */ -#line 527 "parser.y" - { (yyval.attr) = make_attr(ATTR_MESSAGE); ;} +/* Line 1464 of yacc.c */ +#line 530 "parser.y" + { (yyval.attr) = make_attr(ATTR_PARAMLCID); ;} break; case 115: -/* Line 1455 of yacc.c */ -#line 528 "parser.y" - { (yyval.attr) = make_attr(ATTR_NOCODE); ;} +/* Line 1464 of yacc.c */ +#line 531 "parser.y" + { (yyval.attr) = make_attr(ATTR_LICENSED); ;} break; case 116: -/* Line 1455 of yacc.c */ -#line 529 "parser.y" - { (yyval.attr) = make_attr(ATTR_NONBROWSABLE); ;} +/* Line 1464 of yacc.c */ +#line 532 "parser.y" + { (yyval.attr) = make_attr(ATTR_LOCAL); ;} break; case 117: -/* Line 1455 of yacc.c */ -#line 530 "parser.y" - { (yyval.attr) = make_attr(ATTR_NONCREATABLE); ;} +/* Line 1464 of yacc.c */ +#line 533 "parser.y" + { (yyval.attr) = make_attr(ATTR_MAYBE); ;} break; case 118: -/* Line 1455 of yacc.c */ -#line 531 "parser.y" - { (yyval.attr) = make_attr(ATTR_NONEXTENSIBLE); ;} +/* Line 1464 of yacc.c */ +#line 534 "parser.y" + { (yyval.attr) = make_attr(ATTR_MESSAGE); ;} break; case 119: -/* Line 1455 of yacc.c */ -#line 532 "parser.y" - { (yyval.attr) = make_attr(ATTR_NOTIFY); ;} +/* Line 1464 of yacc.c */ +#line 535 "parser.y" + { (yyval.attr) = make_attr(ATTR_NOCODE); ;} break; case 120: -/* Line 1455 of yacc.c */ -#line 533 "parser.y" - { (yyval.attr) = make_attr(ATTR_NOTIFYFLAG); ;} +/* Line 1464 of yacc.c */ +#line 536 "parser.y" + { (yyval.attr) = make_attr(ATTR_NONBROWSABLE); ;} break; case 121: -/* Line 1455 of yacc.c */ -#line 534 "parser.y" - { (yyval.attr) = make_attr(ATTR_OBJECT); ;} +/* Line 1464 of yacc.c */ +#line 537 "parser.y" + { (yyval.attr) = make_attr(ATTR_NONCREATABLE); ;} break; case 122: -/* Line 1455 of yacc.c */ -#line 535 "parser.y" - { (yyval.attr) = make_attr(ATTR_ODL); ;} +/* Line 1464 of yacc.c */ +#line 538 "parser.y" + { (yyval.attr) = make_attr(ATTR_NONEXTENSIBLE); ;} break; case 123: -/* Line 1455 of yacc.c */ -#line 536 "parser.y" - { (yyval.attr) = make_attr(ATTR_OLEAUTOMATION); ;} +/* Line 1464 of yacc.c */ +#line 539 "parser.y" + { (yyval.attr) = make_attr(ATTR_NOTIFY); ;} break; case 124: -/* Line 1455 of yacc.c */ -#line 537 "parser.y" - { (yyval.attr) = make_attrp(ATTR_OPTIMIZE, (yyvsp[(3) - (4)].str)); ;} +/* Line 1464 of yacc.c */ +#line 540 "parser.y" + { (yyval.attr) = make_attr(ATTR_NOTIFYFLAG); ;} break; case 125: -/* Line 1455 of yacc.c */ -#line 538 "parser.y" - { (yyval.attr) = make_attr(ATTR_OPTIONAL); ;} +/* Line 1464 of yacc.c */ +#line 541 "parser.y" + { (yyval.attr) = make_attr(ATTR_OBJECT); ;} break; case 126: -/* Line 1455 of yacc.c */ -#line 539 "parser.y" - { (yyval.attr) = make_attr(ATTR_OUT); ;} +/* Line 1464 of yacc.c */ +#line 542 "parser.y" + { (yyval.attr) = make_attr(ATTR_ODL); ;} break; case 127: -/* Line 1455 of yacc.c */ -#line 540 "parser.y" - { (yyval.attr) = make_attr(ATTR_PARTIALIGNORE); ;} +/* Line 1464 of yacc.c */ +#line 543 "parser.y" + { (yyval.attr) = make_attr(ATTR_OLEAUTOMATION); ;} break; case 128: -/* Line 1455 of yacc.c */ -#line 541 "parser.y" - { (yyval.attr) = make_attrv(ATTR_POINTERDEFAULT, (yyvsp[(3) - (4)].num)); ;} +/* Line 1464 of yacc.c */ +#line 544 "parser.y" + { (yyval.attr) = make_attrp(ATTR_OPTIMIZE, (yyvsp[(3) - (4)].str)); ;} break; case 129: -/* Line 1455 of yacc.c */ -#line 542 "parser.y" - { (yyval.attr) = make_attrp(ATTR_PROGID, (yyvsp[(3) - (4)].str)); ;} +/* Line 1464 of yacc.c */ +#line 545 "parser.y" + { (yyval.attr) = make_attr(ATTR_OPTIONAL); ;} break; case 130: -/* Line 1455 of yacc.c */ -#line 543 "parser.y" - { (yyval.attr) = make_attr(ATTR_PROPGET); ;} +/* Line 1464 of yacc.c */ +#line 546 "parser.y" + { (yyval.attr) = make_attr(ATTR_OUT); ;} break; case 131: -/* Line 1455 of yacc.c */ -#line 544 "parser.y" - { (yyval.attr) = make_attr(ATTR_PROPPUT); ;} +/* Line 1464 of yacc.c */ +#line 547 "parser.y" + { (yyval.attr) = make_attr(ATTR_PARTIALIGNORE); ;} break; case 132: -/* Line 1455 of yacc.c */ -#line 545 "parser.y" - { (yyval.attr) = make_attr(ATTR_PROPPUTREF); ;} +/* Line 1464 of yacc.c */ +#line 548 "parser.y" + { (yyval.attr) = make_attrv(ATTR_POINTERDEFAULT, (yyvsp[(3) - (4)].num)); ;} break; case 133: -/* Line 1455 of yacc.c */ -#line 546 "parser.y" - { (yyval.attr) = make_attr(ATTR_PROXY); ;} +/* Line 1464 of yacc.c */ +#line 549 "parser.y" + { (yyval.attr) = make_attrp(ATTR_PROGID, (yyvsp[(3) - (4)].str)); ;} break; case 134: -/* Line 1455 of yacc.c */ -#line 547 "parser.y" - { (yyval.attr) = make_attr(ATTR_PUBLIC); ;} +/* Line 1464 of yacc.c */ +#line 550 "parser.y" + { (yyval.attr) = make_attr(ATTR_PROPGET); ;} break; case 135: -/* Line 1455 of yacc.c */ -#line 549 "parser.y" +/* Line 1464 of yacc.c */ +#line 551 "parser.y" + { (yyval.attr) = make_attr(ATTR_PROPPUT); ;} + break; + + case 136: + +/* Line 1464 of yacc.c */ +#line 552 "parser.y" + { (yyval.attr) = make_attr(ATTR_PROPPUTREF); ;} + break; + + case 137: + +/* Line 1464 of yacc.c */ +#line 553 "parser.y" + { (yyval.attr) = make_attr(ATTR_PROXY); ;} + break; + + case 138: + +/* Line 1464 of yacc.c */ +#line 554 "parser.y" + { (yyval.attr) = make_attr(ATTR_PUBLIC); ;} + break; + + case 139: + +/* Line 1464 of yacc.c */ +#line 556 "parser.y" { expr_list_t *list = append_expr( NULL, (yyvsp[(3) - (6)].expr) ); list = append_expr( list, (yyvsp[(5) - (6)].expr) ); (yyval.attr) = make_attrp(ATTR_RANGE, list); ;} break; - case 136: - -/* Line 1455 of yacc.c */ -#line 552 "parser.y" - { (yyval.attr) = make_attr(ATTR_READONLY); ;} - break; - - case 137: - -/* Line 1455 of yacc.c */ -#line 553 "parser.y" - { (yyval.attr) = make_attrp(ATTR_REPRESENTAS, (yyvsp[(3) - (4)].type)); ;} - break; - - case 138: - -/* Line 1455 of yacc.c */ -#line 554 "parser.y" - { (yyval.attr) = make_attr(ATTR_REQUESTEDIT); ;} - break; - - case 139: - -/* Line 1455 of yacc.c */ -#line 555 "parser.y" - { (yyval.attr) = make_attr(ATTR_RESTRICTED); ;} - break; - case 140: -/* Line 1455 of yacc.c */ -#line 556 "parser.y" - { (yyval.attr) = make_attr(ATTR_RETVAL); ;} +/* Line 1464 of yacc.c */ +#line 559 "parser.y" + { (yyval.attr) = make_attr(ATTR_READONLY); ;} break; case 141: -/* Line 1455 of yacc.c */ -#line 557 "parser.y" - { (yyval.attr) = make_attrp(ATTR_SIZEIS, (yyvsp[(3) - (4)].expr_list)); ;} +/* Line 1464 of yacc.c */ +#line 560 "parser.y" + { (yyval.attr) = make_attrp(ATTR_REPRESENTAS, (yyvsp[(3) - (4)].type)); ;} break; case 142: -/* Line 1455 of yacc.c */ -#line 558 "parser.y" - { (yyval.attr) = make_attr(ATTR_SOURCE); ;} +/* Line 1464 of yacc.c */ +#line 561 "parser.y" + { (yyval.attr) = make_attr(ATTR_REQUESTEDIT); ;} break; case 143: -/* Line 1455 of yacc.c */ -#line 559 "parser.y" - { (yyval.attr) = make_attr(ATTR_STRICTCONTEXTHANDLE); ;} +/* Line 1464 of yacc.c */ +#line 562 "parser.y" + { (yyval.attr) = make_attr(ATTR_RESTRICTED); ;} break; case 144: -/* Line 1455 of yacc.c */ -#line 560 "parser.y" - { (yyval.attr) = make_attr(ATTR_STRING); ;} +/* Line 1464 of yacc.c */ +#line 563 "parser.y" + { (yyval.attr) = make_attr(ATTR_RETVAL); ;} break; case 145: -/* Line 1455 of yacc.c */ -#line 561 "parser.y" - { (yyval.attr) = make_attrp(ATTR_SWITCHIS, (yyvsp[(3) - (4)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 564 "parser.y" + { (yyval.attr) = make_attrp(ATTR_SIZEIS, (yyvsp[(3) - (4)].expr_list)); ;} break; case 146: -/* Line 1455 of yacc.c */ -#line 562 "parser.y" - { (yyval.attr) = make_attrp(ATTR_SWITCHTYPE, (yyvsp[(3) - (4)].type)); ;} +/* Line 1464 of yacc.c */ +#line 565 "parser.y" + { (yyval.attr) = make_attr(ATTR_SOURCE); ;} break; case 147: -/* Line 1455 of yacc.c */ -#line 563 "parser.y" - { (yyval.attr) = make_attrp(ATTR_TRANSMITAS, (yyvsp[(3) - (4)].type)); ;} +/* Line 1464 of yacc.c */ +#line 566 "parser.y" + { (yyval.attr) = make_attr(ATTR_STRICTCONTEXTHANDLE); ;} break; case 148: -/* Line 1455 of yacc.c */ -#line 564 "parser.y" - { (yyval.attr) = make_attrv(ATTR_THREADING, (yyvsp[(3) - (4)].num)); ;} +/* Line 1464 of yacc.c */ +#line 567 "parser.y" + { (yyval.attr) = make_attr(ATTR_STRING); ;} break; case 149: -/* Line 1455 of yacc.c */ -#line 565 "parser.y" - { (yyval.attr) = make_attr(ATTR_UIDEFAULT); ;} +/* Line 1464 of yacc.c */ +#line 568 "parser.y" + { (yyval.attr) = make_attrp(ATTR_SWITCHIS, (yyvsp[(3) - (4)].expr)); ;} break; case 150: -/* Line 1455 of yacc.c */ -#line 566 "parser.y" - { (yyval.attr) = make_attr(ATTR_USESGETLASTERROR); ;} +/* Line 1464 of yacc.c */ +#line 569 "parser.y" + { (yyval.attr) = make_attrp(ATTR_SWITCHTYPE, (yyvsp[(3) - (4)].type)); ;} break; case 151: -/* Line 1455 of yacc.c */ -#line 567 "parser.y" - { (yyval.attr) = make_attrp(ATTR_USERMARSHAL, (yyvsp[(3) - (4)].type)); ;} +/* Line 1464 of yacc.c */ +#line 570 "parser.y" + { (yyval.attr) = make_attrp(ATTR_TRANSMITAS, (yyvsp[(3) - (4)].type)); ;} break; case 152: -/* Line 1455 of yacc.c */ -#line 568 "parser.y" - { (yyval.attr) = make_attrp(ATTR_UUID, (yyvsp[(3) - (4)].uuid)); ;} +/* Line 1464 of yacc.c */ +#line 571 "parser.y" + { (yyval.attr) = make_attrv(ATTR_THREADING, (yyvsp[(3) - (4)].num)); ;} break; case 153: -/* Line 1455 of yacc.c */ -#line 569 "parser.y" - { (yyval.attr) = make_attr(ATTR_V1ENUM); ;} +/* Line 1464 of yacc.c */ +#line 572 "parser.y" + { (yyval.attr) = make_attr(ATTR_UIDEFAULT); ;} break; case 154: -/* Line 1455 of yacc.c */ -#line 570 "parser.y" - { (yyval.attr) = make_attr(ATTR_VARARG); ;} +/* Line 1464 of yacc.c */ +#line 573 "parser.y" + { (yyval.attr) = make_attr(ATTR_USESGETLASTERROR); ;} break; case 155: -/* Line 1455 of yacc.c */ -#line 571 "parser.y" - { (yyval.attr) = make_attrv(ATTR_VERSION, (yyvsp[(3) - (4)].num)); ;} +/* Line 1464 of yacc.c */ +#line 574 "parser.y" + { (yyval.attr) = make_attrp(ATTR_USERMARSHAL, (yyvsp[(3) - (4)].type)); ;} break; case 156: -/* Line 1455 of yacc.c */ -#line 572 "parser.y" - { (yyval.attr) = make_attrp(ATTR_VIPROGID, (yyvsp[(3) - (4)].str)); ;} +/* Line 1464 of yacc.c */ +#line 575 "parser.y" + { (yyval.attr) = make_attrp(ATTR_UUID, (yyvsp[(3) - (4)].uuid)); ;} break; case 157: -/* Line 1455 of yacc.c */ -#line 573 "parser.y" - { (yyval.attr) = make_attrp(ATTR_WIREMARSHAL, (yyvsp[(3) - (4)].type)); ;} +/* Line 1464 of yacc.c */ +#line 576 "parser.y" + { (yyval.attr) = make_attr(ATTR_V1ENUM); ;} break; case 158: -/* Line 1455 of yacc.c */ -#line 574 "parser.y" - { (yyval.attr) = make_attrv(ATTR_POINTERTYPE, (yyvsp[(1) - (1)].num)); ;} +/* Line 1464 of yacc.c */ +#line 577 "parser.y" + { (yyval.attr) = make_attr(ATTR_VARARG); ;} + break; + + case 159: + +/* Line 1464 of yacc.c */ +#line 578 "parser.y" + { (yyval.attr) = make_attrv(ATTR_VERSION, (yyvsp[(3) - (4)].num)); ;} break; case 160: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 579 "parser.y" + { (yyval.attr) = make_attrp(ATTR_VIPROGID, (yyvsp[(3) - (4)].str)); ;} + break; + + case 161: + +/* Line 1464 of yacc.c */ +#line 580 "parser.y" + { (yyval.attr) = make_attrp(ATTR_WIREMARSHAL, (yyvsp[(3) - (4)].type)); ;} + break; + + case 162: + +/* Line 1464 of yacc.c */ +#line 581 "parser.y" + { (yyval.attr) = make_attrv(ATTR_POINTERTYPE, (yyvsp[(1) - (1)].num)); ;} + break; + + case 164: + +/* Line 1464 of yacc.c */ +#line 586 "parser.y" { if (!is_valid_uuid((yyvsp[(1) - (1)].str))) error_loc("invalid UUID: %s\n", (yyvsp[(1) - (1)].str)); (yyval.uuid) = parse_uuid((yyvsp[(1) - (1)].str)); ;} break; - case 161: - -/* Line 1455 of yacc.c */ -#line 584 "parser.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} - break; - - case 162: - -/* Line 1455 of yacc.c */ -#line 585 "parser.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} - break; - - case 163: - -/* Line 1455 of yacc.c */ -#line 586 "parser.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} - break; - - case 164: - -/* Line 1455 of yacc.c */ -#line 587 "parser.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} - break; - case 165: -/* Line 1455 of yacc.c */ -#line 590 "parser.y" - { (yyval.var_list) = NULL; ;} +/* Line 1464 of yacc.c */ +#line 591 "parser.y" + { (yyval.str) = xstrdup("__cdecl"); ;} break; case 166: -/* Line 1455 of yacc.c */ -#line 591 "parser.y" - { (yyval.var_list) = append_var( (yyvsp[(1) - (2)].var_list), (yyvsp[(2) - (2)].var) ); ;} +/* Line 1464 of yacc.c */ +#line 592 "parser.y" + { (yyval.str) = xstrdup("__fastcall"); ;} break; case 167: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ +#line 593 "parser.y" + { (yyval.str) = xstrdup("__pascal"); ;} + break; + + case 168: + +/* Line 1464 of yacc.c */ #line 594 "parser.y" + { (yyval.str) = xstrdup("__stdcall"); ;} + break; + + case 169: + +/* Line 1464 of yacc.c */ +#line 597 "parser.y" + { (yyval.var_list) = NULL; ;} + break; + + case 170: + +/* Line 1464 of yacc.c */ +#line 598 "parser.y" + { (yyval.var_list) = append_var( (yyvsp[(1) - (2)].var_list), (yyvsp[(2) - (2)].var) ); ;} + break; + + case 171: + +/* Line 1464 of yacc.c */ +#line 601 "parser.y" { attr_t *a = make_attrp(ATTR_CASE, append_expr( NULL, (yyvsp[(2) - (4)].expr) )); (yyval.var) = (yyvsp[(4) - (4)].var); if (!(yyval.var)) (yyval.var) = make_var(NULL); (yyval.var)->attrs = append_attr( (yyval.var)->attrs, a ); ;} break; - case 168: + case 172: -/* Line 1455 of yacc.c */ -#line 598 "parser.y" +/* Line 1464 of yacc.c */ +#line 605 "parser.y" { attr_t *a = make_attr(ATTR_DEFAULT); (yyval.var) = (yyvsp[(3) - (3)].var); if (!(yyval.var)) (yyval.var) = make_var(NULL); (yyval.var)->attrs = append_attr( (yyval.var)->attrs, a ); ;} break; - case 169: + case 173: -/* Line 1455 of yacc.c */ -#line 604 "parser.y" +/* Line 1464 of yacc.c */ +#line 611 "parser.y" { (yyval.var_list) = NULL; ;} break; - case 170: + case 174: -/* Line 1455 of yacc.c */ -#line 605 "parser.y" +/* Line 1464 of yacc.c */ +#line 612 "parser.y" { (yyval.var_list) = (yyvsp[(1) - (2)].var_list); ;} break; - case 172: + case 176: -/* Line 1455 of yacc.c */ -#line 609 "parser.y" +/* Line 1464 of yacc.c */ +#line 616 "parser.y" { if (!(yyvsp[(1) - (1)].var)->eval) (yyvsp[(1) - (1)].var)->eval = make_exprl(EXPR_NUM, 0 /* default for first enum entry */); (yyval.var_list) = append_var( NULL, (yyvsp[(1) - (1)].var) ); ;} break; - case 173: + case 177: -/* Line 1455 of yacc.c */ -#line 613 "parser.y" +/* Line 1464 of yacc.c */ +#line 620 "parser.y" { if (!(yyvsp[(3) - (3)].var)->eval) { var_t *last = LIST_ENTRY( list_tail((yyval.var_list)), var_t, entry ); @@ -3954,464 +4019,464 @@ yyreduce: ;} break; - case 174: + case 178: -/* Line 1455 of yacc.c */ -#line 622 "parser.y" +/* Line 1464 of yacc.c */ +#line 629 "parser.y" { (yyval.var) = reg_const((yyvsp[(1) - (3)].var)); (yyval.var)->eval = (yyvsp[(3) - (3)].expr); (yyval.var)->type = type_new_int(TYPE_BASIC_INT, 0); ;} break; - case 175: + case 179: -/* Line 1455 of yacc.c */ -#line 626 "parser.y" +/* Line 1464 of yacc.c */ +#line 633 "parser.y" { (yyval.var) = reg_const((yyvsp[(1) - (1)].var)); (yyval.var)->type = type_new_int(TYPE_BASIC_INT, 0); ;} break; - case 176: + case 180: -/* Line 1455 of yacc.c */ -#line 631 "parser.y" +/* Line 1464 of yacc.c */ +#line 638 "parser.y" { (yyval.type) = type_new_enum((yyvsp[(2) - (5)].str), TRUE, (yyvsp[(4) - (5)].var_list)); ;} break; - case 177: - -/* Line 1455 of yacc.c */ -#line 634 "parser.y" - { (yyval.expr_list) = append_expr( NULL, (yyvsp[(1) - (1)].expr) ); ;} - break; - - case 178: - -/* Line 1455 of yacc.c */ -#line 635 "parser.y" - { (yyval.expr_list) = append_expr( (yyvsp[(1) - (3)].expr_list), (yyvsp[(3) - (3)].expr) ); ;} - break; - - case 179: - -/* Line 1455 of yacc.c */ -#line 648 "parser.y" - { (yyval.expr) = make_expr(EXPR_VOID); ;} - break; - case 181: -/* Line 1455 of yacc.c */ -#line 652 "parser.y" - { (yyval.expr) = make_exprl(EXPR_NUM, (yyvsp[(1) - (1)].num)); ;} +/* Line 1464 of yacc.c */ +#line 641 "parser.y" + { (yyval.expr_list) = append_expr( NULL, (yyvsp[(1) - (1)].expr) ); ;} break; case 182: -/* Line 1455 of yacc.c */ -#line 653 "parser.y" - { (yyval.expr) = make_exprl(EXPR_HEXNUM, (yyvsp[(1) - (1)].num)); ;} +/* Line 1464 of yacc.c */ +#line 642 "parser.y" + { (yyval.expr_list) = append_expr( (yyvsp[(1) - (3)].expr_list), (yyvsp[(3) - (3)].expr) ); ;} break; case 183: -/* Line 1455 of yacc.c */ -#line 654 "parser.y" - { (yyval.expr) = make_exprd(EXPR_DOUBLE, (yyvsp[(1) - (1)].dbl)); ;} - break; - - case 184: - -/* Line 1455 of yacc.c */ -#line 655 "parser.y" - { (yyval.expr) = make_exprl(EXPR_TRUEFALSE, 0); ;} +/* Line 1464 of yacc.c */ +#line 645 "parser.y" + { (yyval.expr) = make_expr(EXPR_VOID); ;} break; case 185: -/* Line 1455 of yacc.c */ -#line 656 "parser.y" - { (yyval.expr) = make_exprl(EXPR_NUM, 0); ;} +/* Line 1464 of yacc.c */ +#line 649 "parser.y" + { (yyval.expr) = make_exprl(EXPR_NUM, (yyvsp[(1) - (1)].num)); ;} break; case 186: -/* Line 1455 of yacc.c */ -#line 657 "parser.y" - { (yyval.expr) = make_exprl(EXPR_TRUEFALSE, 1); ;} +/* Line 1464 of yacc.c */ +#line 650 "parser.y" + { (yyval.expr) = make_exprl(EXPR_HEXNUM, (yyvsp[(1) - (1)].num)); ;} break; case 187: -/* Line 1455 of yacc.c */ -#line 658 "parser.y" - { (yyval.expr) = make_exprs(EXPR_STRLIT, (yyvsp[(1) - (1)].str)); ;} +/* Line 1464 of yacc.c */ +#line 651 "parser.y" + { (yyval.expr) = make_exprd(EXPR_DOUBLE, (yyvsp[(1) - (1)].dbl)); ;} break; case 188: -/* Line 1455 of yacc.c */ -#line 659 "parser.y" - { (yyval.expr) = make_exprs(EXPR_WSTRLIT, (yyvsp[(1) - (1)].str)); ;} +/* Line 1464 of yacc.c */ +#line 652 "parser.y" + { (yyval.expr) = make_exprl(EXPR_TRUEFALSE, 0); ;} break; case 189: -/* Line 1455 of yacc.c */ -#line 660 "parser.y" - { (yyval.expr) = make_exprs(EXPR_CHARCONST, (yyvsp[(1) - (1)].str)); ;} +/* Line 1464 of yacc.c */ +#line 653 "parser.y" + { (yyval.expr) = make_exprl(EXPR_NUM, 0); ;} break; case 190: -/* Line 1455 of yacc.c */ -#line 661 "parser.y" - { (yyval.expr) = make_exprs(EXPR_IDENTIFIER, (yyvsp[(1) - (1)].str)); ;} +/* Line 1464 of yacc.c */ +#line 654 "parser.y" + { (yyval.expr) = make_exprl(EXPR_TRUEFALSE, 1); ;} break; case 191: -/* Line 1455 of yacc.c */ -#line 662 "parser.y" - { (yyval.expr) = make_expr3(EXPR_COND, (yyvsp[(1) - (5)].expr), (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 655 "parser.y" + { (yyval.expr) = make_exprs(EXPR_STRLIT, (yyvsp[(1) - (1)].str)); ;} break; case 192: -/* Line 1455 of yacc.c */ -#line 663 "parser.y" - { (yyval.expr) = make_expr2(EXPR_LOGOR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 656 "parser.y" + { (yyval.expr) = make_exprs(EXPR_WSTRLIT, (yyvsp[(1) - (1)].str)); ;} break; case 193: -/* Line 1455 of yacc.c */ -#line 664 "parser.y" - { (yyval.expr) = make_expr2(EXPR_LOGAND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 657 "parser.y" + { (yyval.expr) = make_exprs(EXPR_CHARCONST, (yyvsp[(1) - (1)].str)); ;} break; case 194: -/* Line 1455 of yacc.c */ -#line 665 "parser.y" - { (yyval.expr) = make_expr2(EXPR_OR , (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 658 "parser.y" + { (yyval.expr) = make_exprs(EXPR_IDENTIFIER, (yyvsp[(1) - (1)].str)); ;} break; case 195: -/* Line 1455 of yacc.c */ -#line 666 "parser.y" - { (yyval.expr) = make_expr2(EXPR_XOR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 659 "parser.y" + { (yyval.expr) = make_expr3(EXPR_COND, (yyvsp[(1) - (5)].expr), (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].expr)); ;} break; case 196: -/* Line 1455 of yacc.c */ -#line 667 "parser.y" - { (yyval.expr) = make_expr2(EXPR_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 660 "parser.y" + { (yyval.expr) = make_expr2(EXPR_LOGOR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 197: -/* Line 1455 of yacc.c */ -#line 668 "parser.y" - { (yyval.expr) = make_expr2(EXPR_EQUALITY, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 661 "parser.y" + { (yyval.expr) = make_expr2(EXPR_LOGAND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 198: -/* Line 1455 of yacc.c */ -#line 669 "parser.y" - { (yyval.expr) = make_expr2(EXPR_INEQUALITY, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 662 "parser.y" + { (yyval.expr) = make_expr2(EXPR_OR , (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 199: -/* Line 1455 of yacc.c */ -#line 670 "parser.y" - { (yyval.expr) = make_expr2(EXPR_GTR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 663 "parser.y" + { (yyval.expr) = make_expr2(EXPR_XOR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 200: -/* Line 1455 of yacc.c */ -#line 671 "parser.y" - { (yyval.expr) = make_expr2(EXPR_LESS, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 664 "parser.y" + { (yyval.expr) = make_expr2(EXPR_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 201: -/* Line 1455 of yacc.c */ -#line 672 "parser.y" - { (yyval.expr) = make_expr2(EXPR_GTREQL, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 665 "parser.y" + { (yyval.expr) = make_expr2(EXPR_EQUALITY, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 202: -/* Line 1455 of yacc.c */ -#line 673 "parser.y" - { (yyval.expr) = make_expr2(EXPR_LESSEQL, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 666 "parser.y" + { (yyval.expr) = make_expr2(EXPR_INEQUALITY, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 203: -/* Line 1455 of yacc.c */ -#line 674 "parser.y" - { (yyval.expr) = make_expr2(EXPR_SHL, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 667 "parser.y" + { (yyval.expr) = make_expr2(EXPR_GTR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 204: -/* Line 1455 of yacc.c */ -#line 675 "parser.y" - { (yyval.expr) = make_expr2(EXPR_SHR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 668 "parser.y" + { (yyval.expr) = make_expr2(EXPR_LESS, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 205: -/* Line 1455 of yacc.c */ -#line 676 "parser.y" - { (yyval.expr) = make_expr2(EXPR_ADD, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 669 "parser.y" + { (yyval.expr) = make_expr2(EXPR_GTREQL, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 206: -/* Line 1455 of yacc.c */ -#line 677 "parser.y" - { (yyval.expr) = make_expr2(EXPR_SUB, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 670 "parser.y" + { (yyval.expr) = make_expr2(EXPR_LESSEQL, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 207: -/* Line 1455 of yacc.c */ -#line 678 "parser.y" - { (yyval.expr) = make_expr2(EXPR_MOD, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 671 "parser.y" + { (yyval.expr) = make_expr2(EXPR_SHL, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 208: -/* Line 1455 of yacc.c */ -#line 679 "parser.y" - { (yyval.expr) = make_expr2(EXPR_MUL, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 672 "parser.y" + { (yyval.expr) = make_expr2(EXPR_SHR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 209: -/* Line 1455 of yacc.c */ -#line 680 "parser.y" - { (yyval.expr) = make_expr2(EXPR_DIV, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 673 "parser.y" + { (yyval.expr) = make_expr2(EXPR_ADD, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 210: -/* Line 1455 of yacc.c */ -#line 681 "parser.y" - { (yyval.expr) = make_expr1(EXPR_LOGNOT, (yyvsp[(2) - (2)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 674 "parser.y" + { (yyval.expr) = make_expr2(EXPR_SUB, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 211: -/* Line 1455 of yacc.c */ -#line 682 "parser.y" - { (yyval.expr) = make_expr1(EXPR_NOT, (yyvsp[(2) - (2)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 675 "parser.y" + { (yyval.expr) = make_expr2(EXPR_MOD, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 212: -/* Line 1455 of yacc.c */ -#line 683 "parser.y" - { (yyval.expr) = make_expr1(EXPR_POS, (yyvsp[(2) - (2)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 676 "parser.y" + { (yyval.expr) = make_expr2(EXPR_MUL, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 213: -/* Line 1455 of yacc.c */ -#line 684 "parser.y" - { (yyval.expr) = make_expr1(EXPR_NEG, (yyvsp[(2) - (2)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 677 "parser.y" + { (yyval.expr) = make_expr2(EXPR_DIV, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 214: -/* Line 1455 of yacc.c */ -#line 685 "parser.y" - { (yyval.expr) = make_expr1(EXPR_ADDRESSOF, (yyvsp[(2) - (2)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 678 "parser.y" + { (yyval.expr) = make_expr1(EXPR_LOGNOT, (yyvsp[(2) - (2)].expr)); ;} break; case 215: -/* Line 1455 of yacc.c */ -#line 686 "parser.y" - { (yyval.expr) = make_expr1(EXPR_PPTR, (yyvsp[(2) - (2)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 679 "parser.y" + { (yyval.expr) = make_expr1(EXPR_NOT, (yyvsp[(2) - (2)].expr)); ;} break; case 216: -/* Line 1455 of yacc.c */ -#line 687 "parser.y" - { (yyval.expr) = make_expr2(EXPR_MEMBER, make_expr1(EXPR_PPTR, (yyvsp[(1) - (3)].expr)), make_exprs(EXPR_IDENTIFIER, (yyvsp[(3) - (3)].str))); ;} +/* Line 1464 of yacc.c */ +#line 680 "parser.y" + { (yyval.expr) = make_expr1(EXPR_POS, (yyvsp[(2) - (2)].expr)); ;} break; case 217: -/* Line 1455 of yacc.c */ -#line 688 "parser.y" - { (yyval.expr) = make_expr2(EXPR_MEMBER, (yyvsp[(1) - (3)].expr), make_exprs(EXPR_IDENTIFIER, (yyvsp[(3) - (3)].str))); ;} +/* Line 1464 of yacc.c */ +#line 681 "parser.y" + { (yyval.expr) = make_expr1(EXPR_NEG, (yyvsp[(2) - (2)].expr)); ;} break; case 218: -/* Line 1455 of yacc.c */ -#line 690 "parser.y" - { (yyval.expr) = make_exprt(EXPR_CAST, declare_var(NULL, (yyvsp[(2) - (5)].declspec), (yyvsp[(3) - (5)].declarator), 0), (yyvsp[(5) - (5)].expr)); free((yyvsp[(2) - (5)].declspec)); free((yyvsp[(3) - (5)].declarator)); ;} +/* Line 1464 of yacc.c */ +#line 682 "parser.y" + { (yyval.expr) = make_expr1(EXPR_ADDRESSOF, (yyvsp[(2) - (2)].expr)); ;} break; case 219: -/* Line 1455 of yacc.c */ -#line 692 "parser.y" - { (yyval.expr) = make_exprt(EXPR_SIZEOF, declare_var(NULL, (yyvsp[(3) - (5)].declspec), (yyvsp[(4) - (5)].declarator), 0), NULL); free((yyvsp[(3) - (5)].declspec)); free((yyvsp[(4) - (5)].declarator)); ;} +/* Line 1464 of yacc.c */ +#line 683 "parser.y" + { (yyval.expr) = make_expr1(EXPR_PPTR, (yyvsp[(2) - (2)].expr)); ;} break; case 220: -/* Line 1455 of yacc.c */ -#line 693 "parser.y" - { (yyval.expr) = make_expr2(EXPR_ARRAY, (yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 684 "parser.y" + { (yyval.expr) = make_expr2(EXPR_MEMBER, make_expr1(EXPR_PPTR, (yyvsp[(1) - (3)].expr)), make_exprs(EXPR_IDENTIFIER, (yyvsp[(3) - (3)].str))); ;} break; case 221: -/* Line 1455 of yacc.c */ -#line 694 "parser.y" - { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} +/* Line 1464 of yacc.c */ +#line 685 "parser.y" + { (yyval.expr) = make_expr2(EXPR_MEMBER, (yyvsp[(1) - (3)].expr), make_exprs(EXPR_IDENTIFIER, (yyvsp[(3) - (3)].str))); ;} break; case 222: -/* Line 1455 of yacc.c */ -#line 697 "parser.y" - { (yyval.expr_list) = append_expr( NULL, (yyvsp[(1) - (1)].expr) ); ;} +/* Line 1464 of yacc.c */ +#line 687 "parser.y" + { (yyval.expr) = make_exprt(EXPR_CAST, declare_var(NULL, (yyvsp[(2) - (5)].declspec), (yyvsp[(3) - (5)].declarator), 0), (yyvsp[(5) - (5)].expr)); free((yyvsp[(2) - (5)].declspec)); free((yyvsp[(3) - (5)].declarator)); ;} break; case 223: -/* Line 1455 of yacc.c */ -#line 698 "parser.y" - { (yyval.expr_list) = append_expr( (yyvsp[(1) - (3)].expr_list), (yyvsp[(3) - (3)].expr) ); ;} +/* Line 1464 of yacc.c */ +#line 689 "parser.y" + { (yyval.expr) = make_exprt(EXPR_SIZEOF, declare_var(NULL, (yyvsp[(3) - (5)].declspec), (yyvsp[(4) - (5)].declarator), 0), NULL); free((yyvsp[(3) - (5)].declspec)); free((yyvsp[(4) - (5)].declarator)); ;} break; case 224: -/* Line 1455 of yacc.c */ -#line 701 "parser.y" +/* Line 1464 of yacc.c */ +#line 690 "parser.y" + { (yyval.expr) = make_expr2(EXPR_ARRAY, (yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr)); ;} + break; + + case 225: + +/* Line 1464 of yacc.c */ +#line 691 "parser.y" + { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} + break; + + case 226: + +/* Line 1464 of yacc.c */ +#line 694 "parser.y" + { (yyval.expr_list) = append_expr( NULL, (yyvsp[(1) - (1)].expr) ); ;} + break; + + case 227: + +/* Line 1464 of yacc.c */ +#line 695 "parser.y" + { (yyval.expr_list) = append_expr( (yyvsp[(1) - (3)].expr_list), (yyvsp[(3) - (3)].expr) ); ;} + break; + + case 228: + +/* Line 1464 of yacc.c */ +#line 698 "parser.y" { (yyval.expr) = (yyvsp[(1) - (1)].expr); if (!(yyval.expr)->is_const) error_loc("expression is not an integer constant\n"); ;} break; - case 225: + case 229: -/* Line 1455 of yacc.c */ -#line 707 "parser.y" +/* Line 1464 of yacc.c */ +#line 704 "parser.y" { (yyval.expr) = (yyvsp[(1) - (1)].expr); if (!(yyval.expr)->is_const && (yyval.expr)->type != EXPR_STRLIT && (yyval.expr)->type != EXPR_WSTRLIT) error_loc("expression is not constant\n"); ;} break; - case 226: + case 230: -/* Line 1455 of yacc.c */ -#line 713 "parser.y" +/* Line 1464 of yacc.c */ +#line 710 "parser.y" { (yyval.var_list) = NULL; ;} break; - case 227: + case 231: -/* Line 1455 of yacc.c */ -#line 714 "parser.y" +/* Line 1464 of yacc.c */ +#line 711 "parser.y" { (yyval.var_list) = append_var_list((yyvsp[(1) - (2)].var_list), (yyvsp[(2) - (2)].var_list)); ;} break; - case 228: + case 232: -/* Line 1455 of yacc.c */ -#line 718 "parser.y" +/* Line 1464 of yacc.c */ +#line 715 "parser.y" { const char *first = LIST_ENTRY(list_head((yyvsp[(3) - (4)].declarator_list)), declarator_t, entry)->var->name; check_field_attrs(first, (yyvsp[(1) - (4)].attr_list)); (yyval.var_list) = set_var_types((yyvsp[(1) - (4)].attr_list), (yyvsp[(2) - (4)].declspec), (yyvsp[(3) - (4)].declarator_list)); ;} break; - case 229: + case 233: -/* Line 1455 of yacc.c */ -#line 722 "parser.y" +/* Line 1464 of yacc.c */ +#line 719 "parser.y" { var_t *v = make_var(NULL); v->type = (yyvsp[(2) - (3)].type); v->attrs = (yyvsp[(1) - (3)].attr_list); (yyval.var_list) = append_var(NULL, v); ;} break; - case 230: - -/* Line 1455 of yacc.c */ -#line 729 "parser.y" - { (yyval.var) = (yyvsp[(1) - (2)].var); ;} - break; - - case 231: - -/* Line 1455 of yacc.c */ -#line 730 "parser.y" - { (yyval.var) = make_var(NULL); (yyval.var)->attrs = (yyvsp[(1) - (2)].attr_list); ;} - break; - - case 232: - -/* Line 1455 of yacc.c */ -#line 733 "parser.y" - { (yyval.var_list) = NULL; ;} - break; - - case 233: - -/* Line 1455 of yacc.c */ -#line 734 "parser.y" - { (yyval.var_list) = append_var( (yyvsp[(1) - (2)].var_list), (yyvsp[(2) - (2)].var) ); ;} - break; - case 234: -/* Line 1455 of yacc.c */ -#line 738 "parser.y" +/* Line 1464 of yacc.c */ +#line 726 "parser.y" { (yyval.var) = (yyvsp[(1) - (2)].var); ;} break; case 235: -/* Line 1455 of yacc.c */ -#line 739 "parser.y" - { (yyval.var) = NULL; ;} +/* Line 1464 of yacc.c */ +#line 727 "parser.y" + { (yyval.var) = make_var(NULL); (yyval.var)->attrs = (yyvsp[(1) - (2)].attr_list); ;} break; case 236: -/* Line 1455 of yacc.c */ -#line 742 "parser.y" +/* Line 1464 of yacc.c */ +#line 730 "parser.y" + { (yyval.var_list) = NULL; ;} + break; + + case 237: + +/* Line 1464 of yacc.c */ +#line 731 "parser.y" + { (yyval.var_list) = append_var( (yyvsp[(1) - (2)].var_list), (yyvsp[(2) - (2)].var) ); ;} + break; + + case 238: + +/* Line 1464 of yacc.c */ +#line 735 "parser.y" + { (yyval.var) = (yyvsp[(1) - (2)].var); ;} + break; + + case 239: + +/* Line 1464 of yacc.c */ +#line 736 "parser.y" + { (yyval.var) = NULL; ;} + break; + + case 240: + +/* Line 1464 of yacc.c */ +#line 739 "parser.y" { (yyval.var) = declare_var(check_field_attrs((yyvsp[(3) - (3)].declarator)->var->name, (yyvsp[(1) - (3)].attr_list)), (yyvsp[(2) - (3)].declspec), (yyvsp[(3) - (3)].declarator), FALSE); free((yyvsp[(3) - (3)].declarator)); ;} break; - case 237: + case 241: -/* Line 1455 of yacc.c */ -#line 748 "parser.y" +/* Line 1464 of yacc.c */ +#line 745 "parser.y" { (yyval.var) = (yyvsp[(1) - (1)].var); if (type_get_type((yyval.var)->type) != TYPE_FUNCTION) error_loc("only methods may be declared inside the methods section of a dispinterface\n"); @@ -4419,203 +4484,203 @@ yyreduce: ;} break; - case 238: + case 242: -/* Line 1455 of yacc.c */ -#line 757 "parser.y" +/* Line 1464 of yacc.c */ +#line 754 "parser.y" { (yyval.var) = declare_var((yyvsp[(1) - (3)].attr_list), (yyvsp[(2) - (3)].declspec), (yyvsp[(3) - (3)].declarator), FALSE); free((yyvsp[(3) - (3)].declarator)); ;} break; - case 239: + case 243: -/* Line 1455 of yacc.c */ -#line 760 "parser.y" +/* Line 1464 of yacc.c */ +#line 757 "parser.y" { (yyval.var) = declare_var(NULL, (yyvsp[(1) - (2)].declspec), (yyvsp[(2) - (2)].declarator), FALSE); free((yyvsp[(2) - (2)].declarator)); ;} break; - case 240: - -/* Line 1455 of yacc.c */ -#line 765 "parser.y" - { (yyval.var) = NULL; ;} - break; - - case 242: - -/* Line 1455 of yacc.c */ -#line 769 "parser.y" - { (yyval.str) = NULL; ;} - break; - - case 243: - -/* Line 1455 of yacc.c */ -#line 770 "parser.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} - break; - case 244: -/* Line 1455 of yacc.c */ -#line 771 "parser.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} - break; - - case 245: - -/* Line 1455 of yacc.c */ -#line 774 "parser.y" - { (yyval.var) = make_var((yyvsp[(1) - (1)].str)); ;} +/* Line 1464 of yacc.c */ +#line 762 "parser.y" + { (yyval.var) = NULL; ;} break; case 246: -/* Line 1455 of yacc.c */ -#line 776 "parser.y" - { (yyval.var) = make_var((yyvsp[(1) - (1)].str)); ;} +/* Line 1464 of yacc.c */ +#line 766 "parser.y" + { (yyval.str) = NULL; ;} break; case 247: -/* Line 1455 of yacc.c */ -#line 779 "parser.y" - { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} +/* Line 1464 of yacc.c */ +#line 767 "parser.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; case 248: -/* Line 1455 of yacc.c */ -#line 780 "parser.y" - { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} +/* Line 1464 of yacc.c */ +#line 768 "parser.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + break; + + case 249: + +/* Line 1464 of yacc.c */ +#line 771 "parser.y" + { (yyval.var) = make_var((yyvsp[(1) - (1)].str)); ;} break; case 250: -/* Line 1455 of yacc.c */ -#line 782 "parser.y" - { (yyval.type) = type_new_int(type_basic_get_type((yyvsp[(2) - (2)].type)), -1); ;} +/* Line 1464 of yacc.c */ +#line 773 "parser.y" + { (yyval.var) = make_var((yyvsp[(1) - (1)].str)); ;} break; case 251: -/* Line 1455 of yacc.c */ -#line 783 "parser.y" - { (yyval.type) = type_new_int(type_basic_get_type((yyvsp[(2) - (2)].type)), 1); ;} +/* Line 1464 of yacc.c */ +#line 776 "parser.y" + { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} break; case 252: -/* Line 1455 of yacc.c */ -#line 784 "parser.y" - { (yyval.type) = type_new_int(TYPE_BASIC_INT, 1); ;} - break; - - case 253: - -/* Line 1455 of yacc.c */ -#line 785 "parser.y" +/* Line 1464 of yacc.c */ +#line 777 "parser.y" { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} break; case 254: -/* Line 1455 of yacc.c */ -#line 786 "parser.y" - { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} +/* Line 1464 of yacc.c */ +#line 779 "parser.y" + { (yyval.type) = type_new_int(type_basic_get_type((yyvsp[(2) - (2)].type)), -1); ;} break; case 255: -/* Line 1455 of yacc.c */ -#line 787 "parser.y" - { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} +/* Line 1464 of yacc.c */ +#line 780 "parser.y" + { (yyval.type) = type_new_int(type_basic_get_type((yyvsp[(2) - (2)].type)), 1); ;} break; case 256: -/* Line 1455 of yacc.c */ -#line 788 "parser.y" - { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} +/* Line 1464 of yacc.c */ +#line 781 "parser.y" + { (yyval.type) = type_new_int(TYPE_BASIC_INT, 1); ;} break; case 257: -/* Line 1455 of yacc.c */ -#line 789 "parser.y" +/* Line 1464 of yacc.c */ +#line 782 "parser.y" + { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} + break; + + case 258: + +/* Line 1464 of yacc.c */ +#line 783 "parser.y" + { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} + break; + + case 259: + +/* Line 1464 of yacc.c */ +#line 784 "parser.y" { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} break; case 260: -/* Line 1455 of yacc.c */ -#line 796 "parser.y" - { (yyval.type) = type_new_int(TYPE_BASIC_INT, 0); ;} +/* Line 1464 of yacc.c */ +#line 785 "parser.y" + { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} break; case 261: -/* Line 1455 of yacc.c */ -#line 797 "parser.y" - { (yyval.type) = type_new_int(TYPE_BASIC_INT16, 0); ;} - break; - - case 262: - -/* Line 1455 of yacc.c */ -#line 798 "parser.y" - { (yyval.type) = type_new_int(TYPE_BASIC_INT8, 0); ;} - break; - - case 263: - -/* Line 1455 of yacc.c */ -#line 799 "parser.y" - { (yyval.type) = type_new_int(TYPE_BASIC_INT32, 0); ;} +/* Line 1464 of yacc.c */ +#line 786 "parser.y" + { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} break; case 264: -/* Line 1455 of yacc.c */ -#line 800 "parser.y" - { (yyval.type) = type_new_int(TYPE_BASIC_HYPER, 0); ;} +/* Line 1464 of yacc.c */ +#line 793 "parser.y" + { (yyval.type) = type_new_int(TYPE_BASIC_INT, 0); ;} break; case 265: -/* Line 1455 of yacc.c */ -#line 801 "parser.y" - { (yyval.type) = type_new_int(TYPE_BASIC_INT64, 0); ;} +/* Line 1464 of yacc.c */ +#line 794 "parser.y" + { (yyval.type) = type_new_int(TYPE_BASIC_INT16, 0); ;} break; case 266: -/* Line 1455 of yacc.c */ -#line 802 "parser.y" - { (yyval.type) = type_new_int(TYPE_BASIC_CHAR, 0); ;} +/* Line 1464 of yacc.c */ +#line 795 "parser.y" + { (yyval.type) = type_new_int(TYPE_BASIC_INT8, 0); ;} break; case 267: -/* Line 1455 of yacc.c */ -#line 803 "parser.y" - { (yyval.type) = type_new_int(TYPE_BASIC_INT3264, 0); ;} +/* Line 1464 of yacc.c */ +#line 796 "parser.y" + { (yyval.type) = type_new_int(TYPE_BASIC_INT32, 0); ;} break; case 268: -/* Line 1455 of yacc.c */ -#line 806 "parser.y" - { (yyval.type) = type_new_coclass((yyvsp[(2) - (2)].str)); ;} +/* Line 1464 of yacc.c */ +#line 797 "parser.y" + { (yyval.type) = type_new_int(TYPE_BASIC_HYPER, 0); ;} break; case 269: -/* Line 1455 of yacc.c */ -#line 807 "parser.y" +/* Line 1464 of yacc.c */ +#line 798 "parser.y" + { (yyval.type) = type_new_int(TYPE_BASIC_INT64, 0); ;} + break; + + case 270: + +/* Line 1464 of yacc.c */ +#line 799 "parser.y" + { (yyval.type) = type_new_int(TYPE_BASIC_CHAR, 0); ;} + break; + + case 271: + +/* Line 1464 of yacc.c */ +#line 800 "parser.y" + { (yyval.type) = type_new_int(TYPE_BASIC_INT3264, 0); ;} + break; + + case 272: + +/* Line 1464 of yacc.c */ +#line 803 "parser.y" + { (yyval.type) = type_new_coclass((yyvsp[(2) - (2)].str)); ;} + break; + + case 273: + +/* Line 1464 of yacc.c */ +#line 804 "parser.y" { (yyval.type) = find_type((yyvsp[(2) - (2)].str), 0); if (type_get_type_detect_alias((yyval.type)) != TYPE_COCLASS) error_loc("%s was not declared a coclass at %s:%d\n", @@ -4624,62 +4689,62 @@ yyreduce: ;} break; - case 270: + case 274: -/* Line 1455 of yacc.c */ -#line 815 "parser.y" +/* Line 1464 of yacc.c */ +#line 812 "parser.y" { (yyval.type) = (yyvsp[(2) - (2)].type); check_def((yyval.type)); (yyval.type)->attrs = check_coclass_attrs((yyvsp[(2) - (2)].type)->name, (yyvsp[(1) - (2)].attr_list)); ;} break; - case 271: - -/* Line 1455 of yacc.c */ -#line 822 "parser.y" - { (yyval.type) = type_coclass_define((yyvsp[(1) - (5)].type), (yyvsp[(3) - (5)].ifref_list)); ;} - break; - - case 272: - -/* Line 1455 of yacc.c */ -#line 825 "parser.y" - { (yyval.ifref_list) = NULL; ;} - break; - - case 273: - -/* Line 1455 of yacc.c */ -#line 826 "parser.y" - { (yyval.ifref_list) = append_ifref( (yyvsp[(1) - (2)].ifref_list), (yyvsp[(2) - (2)].ifref) ); ;} - break; - - case 274: - -/* Line 1455 of yacc.c */ -#line 830 "parser.y" - { (yyval.ifref) = make_ifref((yyvsp[(2) - (2)].type)); (yyval.ifref)->attrs = (yyvsp[(1) - (2)].attr_list); ;} - break; - case 275: -/* Line 1455 of yacc.c */ -#line 833 "parser.y" - { (yyval.type) = get_type(TYPE_INTERFACE, (yyvsp[(2) - (2)].str), 0); ;} +/* Line 1464 of yacc.c */ +#line 819 "parser.y" + { (yyval.type) = type_coclass_define((yyvsp[(1) - (5)].type), (yyvsp[(3) - (5)].ifref_list)); ;} break; case 276: -/* Line 1455 of yacc.c */ -#line 834 "parser.y" - { (yyval.type) = get_type(TYPE_INTERFACE, (yyvsp[(2) - (2)].str), 0); ;} +/* Line 1464 of yacc.c */ +#line 822 "parser.y" + { (yyval.ifref_list) = NULL; ;} break; case 277: -/* Line 1455 of yacc.c */ -#line 837 "parser.y" +/* Line 1464 of yacc.c */ +#line 823 "parser.y" + { (yyval.ifref_list) = append_ifref( (yyvsp[(1) - (2)].ifref_list), (yyvsp[(2) - (2)].ifref) ); ;} + break; + + case 278: + +/* Line 1464 of yacc.c */ +#line 827 "parser.y" + { (yyval.ifref) = make_ifref((yyvsp[(2) - (2)].type)); (yyval.ifref)->attrs = (yyvsp[(1) - (2)].attr_list); ;} + break; + + case 279: + +/* Line 1464 of yacc.c */ +#line 830 "parser.y" + { (yyval.type) = get_type(TYPE_INTERFACE, (yyvsp[(2) - (2)].str), 0); ;} + break; + + case 280: + +/* Line 1464 of yacc.c */ +#line 831 "parser.y" + { (yyval.type) = get_type(TYPE_INTERFACE, (yyvsp[(2) - (2)].str), 0); ;} + break; + + case 281: + +/* Line 1464 of yacc.c */ +#line 834 "parser.y" { attr_t *attrs; (yyval.type) = (yyvsp[(2) - (2)].type); check_def((yyval.type)); @@ -4689,84 +4754,84 @@ yyreduce: ;} break; - case 278: - -/* Line 1455 of yacc.c */ -#line 846 "parser.y" - { (yyval.var_list) = NULL; ;} - break; - - case 279: - -/* Line 1455 of yacc.c */ -#line 847 "parser.y" - { (yyval.var_list) = append_var( (yyvsp[(1) - (3)].var_list), (yyvsp[(2) - (3)].var) ); ;} - break; - - case 280: - -/* Line 1455 of yacc.c */ -#line 850 "parser.y" - { (yyval.var_list) = NULL; ;} - break; - - case 281: - -/* Line 1455 of yacc.c */ -#line 851 "parser.y" - { (yyval.var_list) = append_var( (yyvsp[(1) - (3)].var_list), (yyvsp[(2) - (3)].var) ); ;} - break; - case 282: -/* Line 1455 of yacc.c */ -#line 857 "parser.y" +/* Line 1464 of yacc.c */ +#line 843 "parser.y" + { (yyval.var_list) = NULL; ;} + break; + + case 283: + +/* Line 1464 of yacc.c */ +#line 844 "parser.y" + { (yyval.var_list) = append_var( (yyvsp[(1) - (3)].var_list), (yyvsp[(2) - (3)].var) ); ;} + break; + + case 284: + +/* Line 1464 of yacc.c */ +#line 847 "parser.y" + { (yyval.var_list) = NULL; ;} + break; + + case 285: + +/* Line 1464 of yacc.c */ +#line 848 "parser.y" + { (yyval.var_list) = append_var( (yyvsp[(1) - (3)].var_list), (yyvsp[(2) - (3)].var) ); ;} + break; + + case 286: + +/* Line 1464 of yacc.c */ +#line 854 "parser.y" { (yyval.type) = (yyvsp[(1) - (5)].type); type_dispinterface_define((yyval.type), (yyvsp[(3) - (5)].var_list), (yyvsp[(4) - (5)].var_list)); ;} break; - case 283: + case 287: -/* Line 1455 of yacc.c */ -#line 861 "parser.y" +/* Line 1464 of yacc.c */ +#line 858 "parser.y" { (yyval.type) = (yyvsp[(1) - (5)].type); type_dispinterface_define_from_iface((yyval.type), (yyvsp[(3) - (5)].type)); ;} break; - case 284: + case 288: -/* Line 1455 of yacc.c */ -#line 866 "parser.y" +/* Line 1464 of yacc.c */ +#line 863 "parser.y" { (yyval.type) = NULL; ;} break; - case 285: + case 289: -/* Line 1455 of yacc.c */ -#line 867 "parser.y" +/* Line 1464 of yacc.c */ +#line 864 "parser.y" { (yyval.type) = find_type_or_error2((yyvsp[(2) - (2)].str), 0); ;} break; - case 286: + case 290: -/* Line 1455 of yacc.c */ -#line 870 "parser.y" +/* Line 1464 of yacc.c */ +#line 867 "parser.y" { (yyval.type) = get_type(TYPE_INTERFACE, (yyvsp[(2) - (2)].str), 0); ;} break; - case 287: + case 291: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ +#line 868 "parser.y" + { (yyval.type) = get_type(TYPE_INTERFACE, (yyvsp[(2) - (2)].str), 0); ;} + break; + + case 292: + +/* Line 1464 of yacc.c */ #line 871 "parser.y" - { (yyval.type) = get_type(TYPE_INTERFACE, (yyvsp[(2) - (2)].str), 0); ;} - break; - - case 288: - -/* Line 1455 of yacc.c */ -#line 874 "parser.y" { (yyval.ifinfo).interface = (yyvsp[(2) - (2)].type); (yyval.ifinfo).old_pointer_default = pointer_default; if (is_attr((yyvsp[(1) - (2)].attr_list), ATTR_POINTERDEFAULT)) @@ -4777,617 +4842,617 @@ yyreduce: ;} break; - case 289: + case 293: -/* Line 1455 of yacc.c */ -#line 885 "parser.y" +/* Line 1464 of yacc.c */ +#line 882 "parser.y" { (yyval.type) = (yyvsp[(1) - (6)].ifinfo).interface; type_interface_define((yyval.type), (yyvsp[(2) - (6)].type), (yyvsp[(4) - (6)].stmt_list)); pointer_default = (yyvsp[(1) - (6)].ifinfo).old_pointer_default; ;} break; - case 290: + case 294: -/* Line 1455 of yacc.c */ -#line 893 "parser.y" +/* Line 1464 of yacc.c */ +#line 890 "parser.y" { (yyval.type) = (yyvsp[(1) - (8)].ifinfo).interface; type_interface_define((yyval.type), find_type_or_error2((yyvsp[(3) - (8)].str), 0), (yyvsp[(6) - (8)].stmt_list)); pointer_default = (yyvsp[(1) - (8)].ifinfo).old_pointer_default; ;} break; - case 291: - -/* Line 1455 of yacc.c */ -#line 897 "parser.y" - { (yyval.type) = (yyvsp[(1) - (2)].type); ;} - break; - - case 292: - -/* Line 1455 of yacc.c */ -#line 901 "parser.y" - { (yyval.type) = (yyvsp[(1) - (2)].type); ;} - break; - - case 293: - -/* Line 1455 of yacc.c */ -#line 902 "parser.y" - { (yyval.type) = (yyvsp[(1) - (2)].type); ;} - break; - - case 294: - -/* Line 1455 of yacc.c */ -#line 905 "parser.y" - { (yyval.type) = type_new_module((yyvsp[(2) - (2)].str)); ;} - break; - case 295: -/* Line 1455 of yacc.c */ -#line 906 "parser.y" - { (yyval.type) = type_new_module((yyvsp[(2) - (2)].str)); ;} +/* Line 1464 of yacc.c */ +#line 894 "parser.y" + { (yyval.type) = (yyvsp[(1) - (2)].type); ;} break; case 296: -/* Line 1455 of yacc.c */ -#line 909 "parser.y" +/* Line 1464 of yacc.c */ +#line 898 "parser.y" + { (yyval.type) = (yyvsp[(1) - (2)].type); ;} + break; + + case 297: + +/* Line 1464 of yacc.c */ +#line 899 "parser.y" + { (yyval.type) = (yyvsp[(1) - (2)].type); ;} + break; + + case 298: + +/* Line 1464 of yacc.c */ +#line 902 "parser.y" + { (yyval.type) = type_new_module((yyvsp[(2) - (2)].str)); ;} + break; + + case 299: + +/* Line 1464 of yacc.c */ +#line 903 "parser.y" + { (yyval.type) = type_new_module((yyvsp[(2) - (2)].str)); ;} + break; + + case 300: + +/* Line 1464 of yacc.c */ +#line 906 "parser.y" { (yyval.type) = (yyvsp[(2) - (2)].type); (yyval.type)->attrs = check_module_attrs((yyvsp[(2) - (2)].type)->name, (yyvsp[(1) - (2)].attr_list)); ;} break; - case 297: + case 301: -/* Line 1455 of yacc.c */ -#line 915 "parser.y" +/* Line 1464 of yacc.c */ +#line 912 "parser.y" { (yyval.type) = (yyvsp[(1) - (5)].type); type_module_define((yyval.type), (yyvsp[(3) - (5)].stmt_list)); ;} break; - case 298: - -/* Line 1455 of yacc.c */ -#line 921 "parser.y" - { (yyval.stgclass) = STG_EXTERN; ;} - break; - - case 299: - -/* Line 1455 of yacc.c */ -#line 922 "parser.y" - { (yyval.stgclass) = STG_STATIC; ;} - break; - - case 300: - -/* Line 1455 of yacc.c */ -#line 923 "parser.y" - { (yyval.stgclass) = STG_REGISTER; ;} - break; - - case 301: - -/* Line 1455 of yacc.c */ -#line 927 "parser.y" - { (yyval.attr) = make_attr(ATTR_INLINE); ;} - break; - case 302: -/* Line 1455 of yacc.c */ -#line 931 "parser.y" - { (yyval.attr) = make_attr(ATTR_CONST); ;} +/* Line 1464 of yacc.c */ +#line 918 "parser.y" + { (yyval.stgclass) = STG_EXTERN; ;} break; case 303: -/* Line 1455 of yacc.c */ -#line 934 "parser.y" - { (yyval.attr_list) = NULL; ;} +/* Line 1464 of yacc.c */ +#line 919 "parser.y" + { (yyval.stgclass) = STG_STATIC; ;} break; case 304: -/* Line 1455 of yacc.c */ -#line 935 "parser.y" - { (yyval.attr_list) = append_attr((yyvsp[(1) - (2)].attr_list), (yyvsp[(2) - (2)].attr)); ;} +/* Line 1464 of yacc.c */ +#line 920 "parser.y" + { (yyval.stgclass) = STG_REGISTER; ;} break; case 305: -/* Line 1455 of yacc.c */ -#line 938 "parser.y" - { (yyval.declspec) = make_decl_spec((yyvsp[(1) - (2)].type), (yyvsp[(2) - (2)].declspec), NULL, NULL, STG_NONE); ;} +/* Line 1464 of yacc.c */ +#line 924 "parser.y" + { (yyval.attr) = make_attr(ATTR_INLINE); ;} break; case 306: -/* Line 1455 of yacc.c */ -#line 940 "parser.y" - { (yyval.declspec) = make_decl_spec((yyvsp[(2) - (3)].type), (yyvsp[(1) - (3)].declspec), (yyvsp[(3) - (3)].declspec), NULL, STG_NONE); ;} +/* Line 1464 of yacc.c */ +#line 928 "parser.y" + { (yyval.attr) = make_attr(ATTR_CONST); ;} break; case 307: -/* Line 1455 of yacc.c */ -#line 943 "parser.y" - { (yyval.declspec) = NULL; ;} +/* Line 1464 of yacc.c */ +#line 931 "parser.y" + { (yyval.attr_list) = NULL; ;} + break; + + case 308: + +/* Line 1464 of yacc.c */ +#line 932 "parser.y" + { (yyval.attr_list) = append_attr((yyvsp[(1) - (2)].attr_list), (yyvsp[(2) - (2)].attr)); ;} break; case 309: -/* Line 1455 of yacc.c */ -#line 948 "parser.y" - { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[(2) - (2)].declspec), NULL, (yyvsp[(1) - (2)].attr), STG_NONE); ;} +/* Line 1464 of yacc.c */ +#line 935 "parser.y" + { (yyval.declspec) = make_decl_spec((yyvsp[(1) - (2)].type), (yyvsp[(2) - (2)].declspec), NULL, NULL, STG_NONE); ;} break; case 310: -/* Line 1455 of yacc.c */ -#line 949 "parser.y" - { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[(2) - (2)].declspec), NULL, (yyvsp[(1) - (2)].attr), STG_NONE); ;} +/* Line 1464 of yacc.c */ +#line 937 "parser.y" + { (yyval.declspec) = make_decl_spec((yyvsp[(2) - (3)].type), (yyvsp[(1) - (3)].declspec), (yyvsp[(3) - (3)].declspec), NULL, STG_NONE); ;} break; case 311: -/* Line 1455 of yacc.c */ -#line 950 "parser.y" - { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[(2) - (2)].declspec), NULL, NULL, (yyvsp[(1) - (2)].stgclass)); ;} - break; - - case 312: - -/* Line 1455 of yacc.c */ -#line 955 "parser.y" - { (yyval.declarator) = (yyvsp[(3) - (3)].declarator); (yyval.declarator)->type = append_ptrchain_type((yyval.declarator)->type, type_new_pointer(pointer_default, NULL, (yyvsp[(2) - (3)].attr_list))); ;} +/* Line 1464 of yacc.c */ +#line 940 "parser.y" + { (yyval.declspec) = NULL; ;} break; case 313: -/* Line 1455 of yacc.c */ -#line 956 "parser.y" - { (yyval.declarator) = (yyvsp[(2) - (2)].declarator); if ((yyval.declarator)->func_type) (yyval.declarator)->func_type->attrs = append_attr((yyval.declarator)->func_type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[(1) - (2)].str))); - else if ((yyval.declarator)->type) (yyval.declarator)->type->attrs = append_attr((yyval.declarator)->type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[(1) - (2)].str))); ;} +/* Line 1464 of yacc.c */ +#line 945 "parser.y" + { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[(2) - (2)].declspec), NULL, (yyvsp[(1) - (2)].attr), STG_NONE); ;} + break; + + case 314: + +/* Line 1464 of yacc.c */ +#line 946 "parser.y" + { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[(2) - (2)].declspec), NULL, (yyvsp[(1) - (2)].attr), STG_NONE); ;} break; case 315: -/* Line 1455 of yacc.c */ -#line 962 "parser.y" - { (yyval.declarator) = make_declarator((yyvsp[(1) - (1)].var)); ;} +/* Line 1464 of yacc.c */ +#line 947 "parser.y" + { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[(2) - (2)].declspec), NULL, NULL, (yyvsp[(1) - (2)].stgclass)); ;} break; case 316: -/* Line 1455 of yacc.c */ -#line 963 "parser.y" - { (yyval.declarator) = (yyvsp[(2) - (3)].declarator); ;} +/* Line 1464 of yacc.c */ +#line 952 "parser.y" + { (yyval.declarator) = (yyvsp[(3) - (3)].declarator); (yyval.declarator)->type = append_ptrchain_type((yyval.declarator)->type, type_new_pointer(pointer_default, NULL, (yyvsp[(2) - (3)].attr_list))); ;} break; case 317: -/* Line 1455 of yacc.c */ -#line 964 "parser.y" - { (yyval.declarator) = (yyvsp[(1) - (2)].declarator); (yyval.declarator)->array = append_array((yyval.declarator)->array, (yyvsp[(2) - (2)].expr)); ;} - break; - - case 318: - -/* Line 1455 of yacc.c */ -#line 965 "parser.y" - { (yyval.declarator) = (yyvsp[(1) - (4)].declarator); - (yyval.declarator)->func_type = append_ptrchain_type((yyval.declarator)->type, type_new_function((yyvsp[(3) - (4)].var_list))); - (yyval.declarator)->type = NULL; - ;} +/* Line 1464 of yacc.c */ +#line 953 "parser.y" + { (yyval.declarator) = (yyvsp[(2) - (2)].declarator); if ((yyval.declarator)->func_type) (yyval.declarator)->func_type->attrs = append_attr((yyval.declarator)->func_type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[(1) - (2)].str))); + else if ((yyval.declarator)->type) (yyval.declarator)->type->attrs = append_attr((yyval.declarator)->type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[(1) - (2)].str))); ;} break; case 319: -/* Line 1455 of yacc.c */ -#line 974 "parser.y" - { (yyval.declarator) = (yyvsp[(3) - (3)].declarator); (yyval.declarator)->type = append_ptrchain_type((yyval.declarator)->type, type_new_pointer(pointer_default, NULL, (yyvsp[(2) - (3)].attr_list))); ;} +/* Line 1464 of yacc.c */ +#line 959 "parser.y" + { (yyval.declarator) = make_declarator((yyvsp[(1) - (1)].var)); ;} break; case 320: -/* Line 1455 of yacc.c */ -#line 975 "parser.y" - { (yyval.declarator) = (yyvsp[(2) - (2)].declarator); if ((yyval.declarator)->func_type) (yyval.declarator)->func_type->attrs = append_attr((yyval.declarator)->func_type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[(1) - (2)].str))); - else if ((yyval.declarator)->type) (yyval.declarator)->type->attrs = append_attr((yyval.declarator)->type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[(1) - (2)].str))); ;} +/* Line 1464 of yacc.c */ +#line 960 "parser.y" + { (yyval.declarator) = (yyvsp[(2) - (3)].declarator); ;} + break; + + case 321: + +/* Line 1464 of yacc.c */ +#line 961 "parser.y" + { (yyval.declarator) = (yyvsp[(1) - (2)].declarator); (yyval.declarator)->array = append_array((yyval.declarator)->array, (yyvsp[(2) - (2)].expr)); ;} break; case 322: -/* Line 1455 of yacc.c */ -#line 983 "parser.y" - { (yyval.declarator) = (yyvsp[(3) - (3)].declarator); (yyval.declarator)->type = append_ptrchain_type((yyval.declarator)->type, type_new_pointer(pointer_default, NULL, (yyvsp[(2) - (3)].attr_list))); ;} +/* Line 1464 of yacc.c */ +#line 962 "parser.y" + { (yyval.declarator) = (yyvsp[(1) - (4)].declarator); + (yyval.declarator)->func_type = append_ptrchain_type((yyval.declarator)->type, type_new_function((yyvsp[(3) - (4)].var_list))); + (yyval.declarator)->type = NULL; + ;} break; case 323: -/* Line 1455 of yacc.c */ -#line 984 "parser.y" - { (yyval.declarator) = (yyvsp[(2) - (2)].declarator); if ((yyval.declarator)->func_type) (yyval.declarator)->func_type->attrs = append_attr((yyval.declarator)->func_type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[(1) - (2)].str))); - else if ((yyval.declarator)->type) (yyval.declarator)->type->attrs = append_attr((yyval.declarator)->type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[(1) - (2)].str))); ;} +/* Line 1464 of yacc.c */ +#line 971 "parser.y" + { (yyval.declarator) = (yyvsp[(3) - (3)].declarator); (yyval.declarator)->type = append_ptrchain_type((yyval.declarator)->type, type_new_pointer(pointer_default, NULL, (yyvsp[(2) - (3)].attr_list))); ;} break; case 324: -/* Line 1455 of yacc.c */ -#line 989 "parser.y" - { (yyval.declarator) = make_declarator(NULL); ;} +/* Line 1464 of yacc.c */ +#line 972 "parser.y" + { (yyval.declarator) = (yyvsp[(2) - (2)].declarator); if ((yyval.declarator)->func_type) (yyval.declarator)->func_type->attrs = append_attr((yyval.declarator)->func_type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[(1) - (2)].str))); + else if ((yyval.declarator)->type) (yyval.declarator)->type->attrs = append_attr((yyval.declarator)->type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[(1) - (2)].str))); ;} break; case 326: -/* Line 1455 of yacc.c */ -#line 995 "parser.y" - { (yyval.declarator) = (yyvsp[(2) - (3)].declarator); ;} +/* Line 1464 of yacc.c */ +#line 980 "parser.y" + { (yyval.declarator) = (yyvsp[(3) - (3)].declarator); (yyval.declarator)->type = append_ptrchain_type((yyval.declarator)->type, type_new_pointer(pointer_default, NULL, (yyvsp[(2) - (3)].attr_list))); ;} break; case 327: -/* Line 1455 of yacc.c */ -#line 996 "parser.y" - { (yyval.declarator) = (yyvsp[(1) - (2)].declarator); (yyval.declarator)->array = append_array((yyval.declarator)->array, (yyvsp[(2) - (2)].expr)); ;} +/* Line 1464 of yacc.c */ +#line 981 "parser.y" + { (yyval.declarator) = (yyvsp[(2) - (2)].declarator); if ((yyval.declarator)->func_type) (yyval.declarator)->func_type->attrs = append_attr((yyval.declarator)->func_type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[(1) - (2)].str))); + else if ((yyval.declarator)->type) (yyval.declarator)->type->attrs = append_attr((yyval.declarator)->type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[(1) - (2)].str))); ;} break; case 328: -/* Line 1455 of yacc.c */ -#line 997 "parser.y" - { (yyval.declarator) = make_declarator(NULL); (yyval.declarator)->array = append_array((yyval.declarator)->array, (yyvsp[(1) - (1)].expr)); ;} - break; - - case 329: - -/* Line 1455 of yacc.c */ -#line 999 "parser.y" - { (yyval.declarator) = make_declarator(NULL); - (yyval.declarator)->func_type = append_ptrchain_type((yyval.declarator)->type, type_new_function((yyvsp[(2) - (3)].var_list))); - (yyval.declarator)->type = NULL; - ;} +/* Line 1464 of yacc.c */ +#line 986 "parser.y" + { (yyval.declarator) = make_declarator(NULL); ;} break; case 330: -/* Line 1455 of yacc.c */ -#line 1004 "parser.y" - { (yyval.declarator) = (yyvsp[(1) - (4)].declarator); - (yyval.declarator)->func_type = append_ptrchain_type((yyval.declarator)->type, type_new_function((yyvsp[(3) - (4)].var_list))); - (yyval.declarator)->type = NULL; - ;} +/* Line 1464 of yacc.c */ +#line 992 "parser.y" + { (yyval.declarator) = (yyvsp[(2) - (3)].declarator); ;} break; case 331: -/* Line 1455 of yacc.c */ -#line 1013 "parser.y" - { (yyval.declarator) = (yyvsp[(3) - (3)].declarator); (yyval.declarator)->type = append_ptrchain_type((yyval.declarator)->type, type_new_pointer(pointer_default, NULL, (yyvsp[(2) - (3)].attr_list))); ;} +/* Line 1464 of yacc.c */ +#line 993 "parser.y" + { (yyval.declarator) = (yyvsp[(1) - (2)].declarator); (yyval.declarator)->array = append_array((yyval.declarator)->array, (yyvsp[(2) - (2)].expr)); ;} break; case 332: -/* Line 1455 of yacc.c */ -#line 1014 "parser.y" - { (yyval.declarator) = (yyvsp[(2) - (2)].declarator); (yyval.declarator)->type->attrs = append_attr((yyval.declarator)->type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[(1) - (2)].str))); ;} - break; - - case 334: - -/* Line 1455 of yacc.c */ -#line 1021 "parser.y" - { (yyval.declarator) = (yyvsp[(3) - (3)].declarator); (yyval.declarator)->type = append_ptrchain_type((yyval.declarator)->type, type_new_pointer(pointer_default, NULL, (yyvsp[(2) - (3)].attr_list))); ;} - break; - - case 335: - -/* Line 1455 of yacc.c */ -#line 1022 "parser.y" - { (yyval.declarator) = (yyvsp[(2) - (2)].declarator); (yyval.declarator)->type->attrs = append_attr((yyval.declarator)->type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[(1) - (2)].str))); ;} - break; - - case 336: - -/* Line 1455 of yacc.c */ -#line 1026 "parser.y" - { (yyval.declarator) = make_declarator(NULL); ;} - break; - - case 338: - -/* Line 1455 of yacc.c */ -#line 1034 "parser.y" - { (yyval.declarator) = make_declarator((yyvsp[(1) - (1)].var)); ;} - break; - - case 339: - -/* Line 1455 of yacc.c */ -#line 1035 "parser.y" - { (yyval.declarator) = (yyvsp[(2) - (3)].declarator); ;} - break; - - case 340: - -/* Line 1455 of yacc.c */ -#line 1036 "parser.y" - { (yyval.declarator) = (yyvsp[(1) - (2)].declarator); (yyval.declarator)->array = append_array((yyval.declarator)->array, (yyvsp[(2) - (2)].expr)); ;} - break; - - case 341: - -/* Line 1455 of yacc.c */ -#line 1037 "parser.y" +/* Line 1464 of yacc.c */ +#line 994 "parser.y" { (yyval.declarator) = make_declarator(NULL); (yyval.declarator)->array = append_array((yyval.declarator)->array, (yyvsp[(1) - (1)].expr)); ;} break; - case 342: + case 333: -/* Line 1455 of yacc.c */ -#line 1039 "parser.y" +/* Line 1464 of yacc.c */ +#line 996 "parser.y" { (yyval.declarator) = make_declarator(NULL); (yyval.declarator)->func_type = append_ptrchain_type((yyval.declarator)->type, type_new_function((yyvsp[(2) - (3)].var_list))); (yyval.declarator)->type = NULL; ;} break; - case 343: + case 334: -/* Line 1455 of yacc.c */ -#line 1044 "parser.y" +/* Line 1464 of yacc.c */ +#line 1001 "parser.y" { (yyval.declarator) = (yyvsp[(1) - (4)].declarator); (yyval.declarator)->func_type = append_ptrchain_type((yyval.declarator)->type, type_new_function((yyvsp[(3) - (4)].var_list))); (yyval.declarator)->type = NULL; ;} break; + case 335: + +/* Line 1464 of yacc.c */ +#line 1010 "parser.y" + { (yyval.declarator) = (yyvsp[(3) - (3)].declarator); (yyval.declarator)->type = append_ptrchain_type((yyval.declarator)->type, type_new_pointer(pointer_default, NULL, (yyvsp[(2) - (3)].attr_list))); ;} + break; + + case 336: + +/* Line 1464 of yacc.c */ +#line 1011 "parser.y" + { (yyval.declarator) = (yyvsp[(2) - (2)].declarator); (yyval.declarator)->type->attrs = append_attr((yyval.declarator)->type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[(1) - (2)].str))); ;} + break; + + case 338: + +/* Line 1464 of yacc.c */ +#line 1018 "parser.y" + { (yyval.declarator) = (yyvsp[(3) - (3)].declarator); (yyval.declarator)->type = append_ptrchain_type((yyval.declarator)->type, type_new_pointer(pointer_default, NULL, (yyvsp[(2) - (3)].attr_list))); ;} + break; + + case 339: + +/* Line 1464 of yacc.c */ +#line 1019 "parser.y" + { (yyval.declarator) = (yyvsp[(2) - (2)].declarator); (yyval.declarator)->type->attrs = append_attr((yyval.declarator)->type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[(1) - (2)].str))); ;} + break; + + case 340: + +/* Line 1464 of yacc.c */ +#line 1023 "parser.y" + { (yyval.declarator) = make_declarator(NULL); ;} + break; + + case 342: + +/* Line 1464 of yacc.c */ +#line 1031 "parser.y" + { (yyval.declarator) = make_declarator((yyvsp[(1) - (1)].var)); ;} + break; + + case 343: + +/* Line 1464 of yacc.c */ +#line 1032 "parser.y" + { (yyval.declarator) = (yyvsp[(2) - (3)].declarator); ;} + break; + case 344: -/* Line 1455 of yacc.c */ -#line 1051 "parser.y" - { (yyval.declarator_list) = append_declarator( NULL, (yyvsp[(1) - (1)].declarator) ); ;} +/* Line 1464 of yacc.c */ +#line 1033 "parser.y" + { (yyval.declarator) = (yyvsp[(1) - (2)].declarator); (yyval.declarator)->array = append_array((yyval.declarator)->array, (yyvsp[(2) - (2)].expr)); ;} break; case 345: -/* Line 1455 of yacc.c */ -#line 1052 "parser.y" - { (yyval.declarator_list) = append_declarator( (yyvsp[(1) - (3)].declarator_list), (yyvsp[(3) - (3)].declarator) ); ;} +/* Line 1464 of yacc.c */ +#line 1034 "parser.y" + { (yyval.declarator) = make_declarator(NULL); (yyval.declarator)->array = append_array((yyval.declarator)->array, (yyvsp[(1) - (1)].expr)); ;} break; case 346: -/* Line 1455 of yacc.c */ -#line 1055 "parser.y" - { (yyval.expr) = NULL; ;} +/* Line 1464 of yacc.c */ +#line 1036 "parser.y" + { (yyval.declarator) = make_declarator(NULL); + (yyval.declarator)->func_type = append_ptrchain_type((yyval.declarator)->type, type_new_function((yyvsp[(2) - (3)].var_list))); + (yyval.declarator)->type = NULL; + ;} break; case 347: -/* Line 1455 of yacc.c */ -#line 1056 "parser.y" - { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;} +/* Line 1464 of yacc.c */ +#line 1041 "parser.y" + { (yyval.declarator) = (yyvsp[(1) - (4)].declarator); + (yyval.declarator)->func_type = append_ptrchain_type((yyval.declarator)->type, type_new_function((yyvsp[(3) - (4)].var_list))); + (yyval.declarator)->type = NULL; + ;} break; case 348: -/* Line 1455 of yacc.c */ -#line 1059 "parser.y" +/* Line 1464 of yacc.c */ +#line 1048 "parser.y" + { (yyval.declarator_list) = append_declarator( NULL, (yyvsp[(1) - (1)].declarator) ); ;} + break; + + case 349: + +/* Line 1464 of yacc.c */ +#line 1049 "parser.y" + { (yyval.declarator_list) = append_declarator( (yyvsp[(1) - (3)].declarator_list), (yyvsp[(3) - (3)].declarator) ); ;} + break; + + case 350: + +/* Line 1464 of yacc.c */ +#line 1052 "parser.y" + { (yyval.expr) = NULL; ;} + break; + + case 351: + +/* Line 1464 of yacc.c */ +#line 1053 "parser.y" + { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;} + break; + + case 352: + +/* Line 1464 of yacc.c */ +#line 1056 "parser.y" { (yyval.declarator) = (yyvsp[(1) - (2)].declarator); (yyval.declarator)->bits = (yyvsp[(2) - (2)].expr); if (!(yyval.declarator)->bits && !(yyval.declarator)->var->name) error_loc("unnamed fields are not allowed\n"); ;} break; - case 349: - -/* Line 1455 of yacc.c */ -#line 1066 "parser.y" - { (yyval.declarator_list) = append_declarator( NULL, (yyvsp[(1) - (1)].declarator) ); ;} - break; - - case 350: - -/* Line 1455 of yacc.c */ -#line 1068 "parser.y" - { (yyval.declarator_list) = append_declarator( (yyvsp[(1) - (3)].declarator_list), (yyvsp[(3) - (3)].declarator) ); ;} - break; - - case 351: - -/* Line 1455 of yacc.c */ -#line 1072 "parser.y" - { (yyval.declarator) = (yyvsp[(1) - (1)].declarator); ;} - break; - - case 352: - -/* Line 1455 of yacc.c */ -#line 1073 "parser.y" - { (yyval.declarator) = (yyvsp[(1) - (3)].declarator); (yyvsp[(1) - (3)].declarator)->var->eval = (yyvsp[(3) - (3)].expr); ;} - break; - case 353: -/* Line 1455 of yacc.c */ -#line 1077 "parser.y" - { (yyval.num) = THREADING_APARTMENT; ;} +/* Line 1464 of yacc.c */ +#line 1063 "parser.y" + { (yyval.declarator_list) = append_declarator( NULL, (yyvsp[(1) - (1)].declarator) ); ;} break; case 354: -/* Line 1455 of yacc.c */ -#line 1078 "parser.y" - { (yyval.num) = THREADING_NEUTRAL; ;} +/* Line 1464 of yacc.c */ +#line 1065 "parser.y" + { (yyval.declarator_list) = append_declarator( (yyvsp[(1) - (3)].declarator_list), (yyvsp[(3) - (3)].declarator) ); ;} break; case 355: -/* Line 1455 of yacc.c */ -#line 1079 "parser.y" - { (yyval.num) = THREADING_SINGLE; ;} +/* Line 1464 of yacc.c */ +#line 1069 "parser.y" + { (yyval.declarator) = (yyvsp[(1) - (1)].declarator); ;} break; case 356: -/* Line 1455 of yacc.c */ -#line 1080 "parser.y" - { (yyval.num) = THREADING_FREE; ;} +/* Line 1464 of yacc.c */ +#line 1070 "parser.y" + { (yyval.declarator) = (yyvsp[(1) - (3)].declarator); (yyvsp[(1) - (3)].declarator)->var->eval = (yyvsp[(3) - (3)].expr); ;} break; case 357: -/* Line 1455 of yacc.c */ -#line 1081 "parser.y" - { (yyval.num) = THREADING_BOTH; ;} +/* Line 1464 of yacc.c */ +#line 1074 "parser.y" + { (yyval.num) = THREADING_APARTMENT; ;} break; case 358: -/* Line 1455 of yacc.c */ -#line 1085 "parser.y" - { (yyval.num) = RPC_FC_RP; ;} +/* Line 1464 of yacc.c */ +#line 1075 "parser.y" + { (yyval.num) = THREADING_NEUTRAL; ;} break; case 359: -/* Line 1455 of yacc.c */ -#line 1086 "parser.y" - { (yyval.num) = RPC_FC_UP; ;} +/* Line 1464 of yacc.c */ +#line 1076 "parser.y" + { (yyval.num) = THREADING_SINGLE; ;} break; case 360: -/* Line 1455 of yacc.c */ -#line 1087 "parser.y" - { (yyval.num) = RPC_FC_FP; ;} +/* Line 1464 of yacc.c */ +#line 1077 "parser.y" + { (yyval.num) = THREADING_FREE; ;} break; case 361: -/* Line 1455 of yacc.c */ -#line 1090 "parser.y" - { (yyval.type) = type_new_struct((yyvsp[(2) - (5)].str), TRUE, (yyvsp[(4) - (5)].var_list)); ;} +/* Line 1464 of yacc.c */ +#line 1078 "parser.y" + { (yyval.num) = THREADING_BOTH; ;} break; case 362: -/* Line 1455 of yacc.c */ -#line 1093 "parser.y" - { (yyval.type) = type_new_void(); ;} +/* Line 1464 of yacc.c */ +#line 1082 "parser.y" + { (yyval.num) = RPC_FC_RP; ;} break; case 363: -/* Line 1455 of yacc.c */ -#line 1094 "parser.y" - { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} +/* Line 1464 of yacc.c */ +#line 1083 "parser.y" + { (yyval.num) = RPC_FC_UP; ;} break; case 364: -/* Line 1455 of yacc.c */ -#line 1095 "parser.y" - { (yyval.type) = (yyvsp[(1) - (1)].type); ;} +/* Line 1464 of yacc.c */ +#line 1084 "parser.y" + { (yyval.num) = RPC_FC_FP; ;} break; case 365: -/* Line 1455 of yacc.c */ -#line 1096 "parser.y" - { (yyval.type) = (yyvsp[(1) - (1)].type); ;} +/* Line 1464 of yacc.c */ +#line 1087 "parser.y" + { (yyval.type) = type_new_struct((yyvsp[(2) - (5)].str), TRUE, (yyvsp[(4) - (5)].var_list)); ;} break; case 366: -/* Line 1455 of yacc.c */ -#line 1097 "parser.y" - { (yyval.type) = type_new_enum((yyvsp[(2) - (2)].str), FALSE, NULL); ;} +/* Line 1464 of yacc.c */ +#line 1090 "parser.y" + { (yyval.type) = type_new_void(); ;} break; case 367: -/* Line 1455 of yacc.c */ -#line 1098 "parser.y" - { (yyval.type) = (yyvsp[(1) - (1)].type); ;} +/* Line 1464 of yacc.c */ +#line 1091 "parser.y" + { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} break; case 368: -/* Line 1455 of yacc.c */ -#line 1099 "parser.y" - { (yyval.type) = type_new_struct((yyvsp[(2) - (2)].str), FALSE, NULL); ;} +/* Line 1464 of yacc.c */ +#line 1092 "parser.y" + { (yyval.type) = (yyvsp[(1) - (1)].type); ;} break; case 369: -/* Line 1455 of yacc.c */ -#line 1100 "parser.y" +/* Line 1464 of yacc.c */ +#line 1093 "parser.y" { (yyval.type) = (yyvsp[(1) - (1)].type); ;} break; case 370: -/* Line 1455 of yacc.c */ -#line 1101 "parser.y" - { (yyval.type) = type_new_nonencapsulated_union((yyvsp[(2) - (2)].str), FALSE, NULL); ;} +/* Line 1464 of yacc.c */ +#line 1094 "parser.y" + { (yyval.type) = type_new_enum((yyvsp[(2) - (2)].str), FALSE, NULL); ;} break; case 371: -/* Line 1455 of yacc.c */ -#line 1102 "parser.y" - { (yyval.type) = make_safearray((yyvsp[(3) - (4)].type)); ;} +/* Line 1464 of yacc.c */ +#line 1095 "parser.y" + { (yyval.type) = (yyvsp[(1) - (1)].type); ;} break; case 372: -/* Line 1455 of yacc.c */ -#line 1106 "parser.y" +/* Line 1464 of yacc.c */ +#line 1096 "parser.y" + { (yyval.type) = type_new_struct((yyvsp[(2) - (2)].str), FALSE, NULL); ;} + break; + + case 373: + +/* Line 1464 of yacc.c */ +#line 1097 "parser.y" + { (yyval.type) = (yyvsp[(1) - (1)].type); ;} + break; + + case 374: + +/* Line 1464 of yacc.c */ +#line 1098 "parser.y" + { (yyval.type) = type_new_nonencapsulated_union((yyvsp[(2) - (2)].str), FALSE, NULL); ;} + break; + + case 375: + +/* Line 1464 of yacc.c */ +#line 1099 "parser.y" + { (yyval.type) = make_safearray((yyvsp[(3) - (4)].type)); ;} + break; + + case 376: + +/* Line 1464 of yacc.c */ +#line 1103 "parser.y" { reg_typedefs((yyvsp[(3) - (4)].declspec), (yyvsp[(4) - (4)].declarator_list), check_typedef_attrs((yyvsp[(2) - (4)].attr_list))); (yyval.statement) = make_statement_typedef((yyvsp[(4) - (4)].declarator_list)); ;} break; - case 373: + case 377: -/* Line 1455 of yacc.c */ -#line 1112 "parser.y" +/* Line 1464 of yacc.c */ +#line 1109 "parser.y" { (yyval.type) = type_new_nonencapsulated_union((yyvsp[(2) - (5)].str), TRUE, (yyvsp[(4) - (5)].var_list)); ;} break; - case 374: + case 378: -/* Line 1455 of yacc.c */ -#line 1115 "parser.y" +/* Line 1464 of yacc.c */ +#line 1112 "parser.y" { (yyval.type) = type_new_encapsulated_union((yyvsp[(2) - (10)].str), (yyvsp[(5) - (10)].var), (yyvsp[(7) - (10)].var), (yyvsp[(9) - (10)].var_list)); ;} break; - case 375: + case 379: -/* Line 1455 of yacc.c */ -#line 1119 "parser.y" +/* Line 1464 of yacc.c */ +#line 1116 "parser.y" { (yyval.num) = MAKEVERSION((yyvsp[(1) - (1)].num), 0); ;} break; - case 376: + case 380: -/* Line 1455 of yacc.c */ -#line 1120 "parser.y" +/* Line 1464 of yacc.c */ +#line 1117 "parser.y" { (yyval.num) = MAKEVERSION((yyvsp[(1) - (3)].num), (yyvsp[(3) - (3)].num)); ;} break; -/* Line 1455 of yacc.c */ -#line 5391 "parser.tab.c" +/* Line 1464 of yacc.c */ +#line 5456 "parser.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -5598,8 +5663,8 @@ yyreturn: -/* Line 1675 of yacc.c */ -#line 1123 "parser.y" +/* Line 1684 of yacc.c */ +#line 1120 "parser.y" static void decl_builtin_basic(const char *name, enum type_basic_type type) @@ -6208,7 +6273,6 @@ static typelib_t *make_library(const char *name, const attr_list_t *attrs) { typelib_t *typelib = xmalloc(sizeof(*typelib)); typelib->name = xstrdup(name); - typelib->filename = NULL; typelib->attrs = attrs; list_init( &typelib->importlibs ); return typelib; @@ -6334,12 +6398,6 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at else if (is_attr(attrs, ATTR_UUID) && !is_attr(attrs, ATTR_PUBLIC)) attrs = append_attr( attrs, make_attr(ATTR_PUBLIC) ); - /* Append the SWITCHTYPE attribute to a non-encapsulated union if it does not already have it. */ - if (type_get_type_detect_alias(type) == TYPE_UNION && - is_attr(attrs, ATTR_SWITCHTYPE) && - !is_attr(type->attrs, ATTR_SWITCHTYPE)) - type->attrs = append_attr(type->attrs, make_attrp(ATTR_SWITCHTYPE, get_attrp(attrs, ATTR_SWITCHTYPE))); - LIST_FOR_EACH_ENTRY( decl, decls, const declarator_t, entry ) { @@ -6594,7 +6652,7 @@ struct allowed_attr allowed_attr[] = /* ATTR_UUID */ { 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, "uuid" }, /* ATTR_V1ENUM */ { 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, "v1_enum" }, /* ATTR_VARARG */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "vararg" }, - /* ATTR_VERSION */ { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, "version" }, + /* ATTR_VERSION */ { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, "version" }, /* ATTR_VIPROGID */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "vi_progid" }, /* ATTR_WIREMARSHAL */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, "wire_marshal" }, }; @@ -6613,6 +6671,17 @@ static attr_list_t *check_iface_attrs(const char *name, attr_list_t *attrs) if (!allowed_attr[attr->type].on_interface) error_loc("inapplicable attribute %s for interface %s\n", allowed_attr[attr->type].display_name, name); + if (attr->type == ATTR_IMPLICIT_HANDLE) + { + const var_t *var = attr->u.pval; + if (type_get_type( var->type) == TYPE_BASIC && + type_basic_get_type( var->type ) == TYPE_BASIC_HANDLE) + continue; + if (is_aliaschain_attr( var->type, ATTR_HANDLE )) + continue; + error_loc("attribute %s requires a handle type in interface %s\n", + allowed_attr[attr->type].display_name, name); + } } return attrs; } @@ -7043,11 +7112,15 @@ static void check_remoting_args(const var_t *func) error_loc_info(&arg->loc_info, "out interface pointer \'%s\' of function \'%s\' is not a double pointer\n", arg->name, funcname); break; case TGT_STRING: - if (is_ptr(type) || - (is_array(type) && - (!type_array_has_conformance(type) || - type_array_get_conformance(type)->type == EXPR_VOID))) - error_loc_info(&arg->loc_info, "out parameter \'%s\' of function \'%s\' cannot be an unsized string\n", arg->name, funcname); + if (is_array(type)) + { + /* needs conformance or fixed dimension */ + if (type_array_has_conformance(type) && + type_array_get_conformance(type)->type != EXPR_VOID) break; + if (!type_array_has_conformance(type) && type_array_get_dim(type)) break; + } + if (is_attr( arg->attrs, ATTR_IN )) break; + error_loc_info(&arg->loc_info, "out parameter \'%s\' of function \'%s\' cannot be an unsized string\n", arg->name, funcname); break; case TGT_INVALID: /* already error'd before we get here */ @@ -7073,31 +7146,20 @@ static void check_remoting_args(const var_t *func) } } -static void add_explicit_handle_if_necessary(var_t *func) +static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func) { - const var_t* explicit_handle_var; - const var_t* explicit_generic_handle_var = NULL; - const var_t* context_handle_var = NULL; + unsigned char explicit_fc, implicit_fc; /* check for a defined binding handle */ - explicit_handle_var = get_explicit_handle_var(func); - if (!explicit_handle_var) + if (!get_func_handle_var( iface, func, &explicit_fc, &implicit_fc ) || !explicit_fc) { - explicit_generic_handle_var = get_explicit_generic_handle_var(func); - if (!explicit_generic_handle_var) - { - context_handle_var = get_context_handle_var(func); - if (!context_handle_var) - { - /* no explicit handle specified so add - * "[in] handle_t IDL_handle" as the first parameter to the - * function */ - var_t *idl_handle = make_var(xstrdup("IDL_handle")); - idl_handle->attrs = append_attr(NULL, make_attr(ATTR_IN)); - idl_handle->type = find_type_or_error("handle_t", 0); - type_function_add_head_arg(func->type, idl_handle); - } - } + /* no explicit handle specified so add + * "[in] handle_t IDL_handle" as the first parameter to the + * function */ + var_t *idl_handle = make_var(xstrdup("IDL_handle")); + idl_handle->attrs = append_attr(NULL, make_attr(ATTR_IN)); + idl_handle->type = find_type_or_error("handle_t", 0); + type_function_add_head_arg(func->type, idl_handle); } } @@ -7109,7 +7171,7 @@ static void check_functions(const type_t *iface, int is_inside_library) STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) ) { var_t *func = stmt->u.var; - add_explicit_handle_if_necessary(func); + add_explicit_handle_if_necessary(iface, func); } } if (!is_inside_library && !is_attr(iface->attrs, ATTR_LOCAL)) diff --git a/reactos/tools/widl/parser.tab.h b/reactos/tools/widl/parser.tab.h index b58ed854ed7..d94b58bb108 100644 --- a/reactos/tools/widl/parser.tab.h +++ b/reactos/tools/widl/parser.tab.h @@ -1,10 +1,9 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.4.2. */ /* Skeleton interface for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -229,7 +228,7 @@ typedef union YYSTYPE { -/* Line 1676 of yacc.c */ +/* Line 1685 of yacc.c */ #line 153 "parser.y" attr_t *attr; @@ -259,8 +258,8 @@ typedef union YYSTYPE -/* Line 1676 of yacc.c */ -#line 264 "parser.tab.h" +/* Line 1685 of yacc.c */ +#line 263 "parser.tab.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ diff --git a/reactos/tools/widl/parser.y b/reactos/tools/widl/parser.y index d5f87f98291..5286977529c 100644 --- a/reactos/tools/widl/parser.y +++ b/reactos/tools/widl/parser.y @@ -133,7 +133,7 @@ static attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs); static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs); static attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs); const char *get_attr_display_name(enum attr_type type); -static void add_explicit_handle_if_necessary(var_t *func); +static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func); static void check_def(const type_t *t); static statement_t *make_statement(enum statement_type type); @@ -384,8 +384,11 @@ statement: typedecl: enumdef + | tENUM aIDENTIFIER { $$ = type_new_enum($2, FALSE, NULL); } | structdef + | tSTRUCT aIDENTIFIER { $$ = type_new_struct($2, FALSE, NULL); } | uniondef + | tUNION aIDENTIFIER { $$ = type_new_nonencapsulated_union($2, FALSE, NULL); } | attributes enumdef { $$ = $2; $$->attrs = check_enum_attrs($1); } | attributes structdef { $$ = $2; $$->attrs = check_struct_attrs($1); } | attributes uniondef { $$ = $2; $$->attrs = check_union_attrs($1); } @@ -449,8 +452,12 @@ arg: attributes decl_spec m_any_declarator { if ($2->stgclass != STG_NONE && $ } ; -array: '[' m_expr ']' { $$ = $2; } +array: '[' expr ']' { $$ = $2; + if (!$$->is_const) + error_loc("array dimension is not an integer constant\n"); + } | '[' '*' ']' { $$ = make_expr(EXPR_VOID); } + | '[' ']' { $$ = make_expr(EXPR_VOID); } ; m_attributes: { $$ = NULL; } @@ -515,7 +522,7 @@ attribute: { $$ = NULL; } | tIGNORE { $$ = make_attr(ATTR_IGNORE); } | tIIDIS '(' expr ')' { $$ = make_attrp(ATTR_IIDIS, $3); } | tIMMEDIATEBIND { $$ = make_attr(ATTR_IMMEDIATEBIND); } - | tIMPLICITHANDLE '(' tHANDLET aIDENTIFIER ')' { $$ = make_attrp(ATTR_IMPLICIT_HANDLE, $4); } + | tIMPLICITHANDLE '(' arg ')' { $$ = make_attrp(ATTR_IMPLICIT_HANDLE, $3); } | tIN { $$ = make_attr(ATTR_IN); } | tINPUTSYNC { $$ = make_attr(ATTR_INPUTSYNC); } | tLENGTHIS '(' m_exprs ')' { $$ = make_attrp(ATTR_LENGTHIS, $3); } @@ -581,10 +588,10 @@ uuid_string: $$ = parse_uuid($1); } ; -callconv: tCDECL { $$ = $1; } - | tFASTCALL { $$ = $1; } - | tPASCAL { $$ = $1; } - | tSTDCALL { $$ = $1; } +callconv: tCDECL { $$ = xstrdup("__cdecl"); } + | tFASTCALL { $$ = xstrdup("__fastcall"); } + | tPASCAL { $$ = xstrdup("__pascal"); } + | tSTDCALL { $$ = xstrdup("__stdcall"); } ; cases: { $$ = NULL; } @@ -635,16 +642,6 @@ m_exprs: m_expr { $$ = append_expr( NULL, $1 ); | m_exprs ',' m_expr { $$ = append_expr( $1, $3 ); } ; -/* -exprs: { $$ = make_expr(EXPR_VOID); } - | expr_list - ; - -expr_list: expr - | expr_list ',' expr { LINK($3, $1); $$ = $3; } - ; -*/ - m_expr: { $$ = make_expr(EXPR_VOID); } | expr ; @@ -1728,7 +1725,6 @@ static typelib_t *make_library(const char *name, const attr_list_t *attrs) { typelib_t *typelib = xmalloc(sizeof(*typelib)); typelib->name = xstrdup(name); - typelib->filename = NULL; typelib->attrs = attrs; list_init( &typelib->importlibs ); return typelib; @@ -1854,12 +1850,6 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at else if (is_attr(attrs, ATTR_UUID) && !is_attr(attrs, ATTR_PUBLIC)) attrs = append_attr( attrs, make_attr(ATTR_PUBLIC) ); - /* Append the SWITCHTYPE attribute to a non-encapsulated union if it does not already have it. */ - if (type_get_type_detect_alias(type) == TYPE_UNION && - is_attr(attrs, ATTR_SWITCHTYPE) && - !is_attr(type->attrs, ATTR_SWITCHTYPE)) - type->attrs = append_attr(type->attrs, make_attrp(ATTR_SWITCHTYPE, get_attrp(attrs, ATTR_SWITCHTYPE))); - LIST_FOR_EACH_ENTRY( decl, decls, const declarator_t, entry ) { @@ -2114,7 +2104,7 @@ struct allowed_attr allowed_attr[] = /* ATTR_UUID */ { 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, "uuid" }, /* ATTR_V1ENUM */ { 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, "v1_enum" }, /* ATTR_VARARG */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "vararg" }, - /* ATTR_VERSION */ { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, "version" }, + /* ATTR_VERSION */ { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, "version" }, /* ATTR_VIPROGID */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "vi_progid" }, /* ATTR_WIREMARSHAL */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, "wire_marshal" }, }; @@ -2133,6 +2123,17 @@ static attr_list_t *check_iface_attrs(const char *name, attr_list_t *attrs) if (!allowed_attr[attr->type].on_interface) error_loc("inapplicable attribute %s for interface %s\n", allowed_attr[attr->type].display_name, name); + if (attr->type == ATTR_IMPLICIT_HANDLE) + { + const var_t *var = attr->u.pval; + if (type_get_type( var->type) == TYPE_BASIC && + type_basic_get_type( var->type ) == TYPE_BASIC_HANDLE) + continue; + if (is_aliaschain_attr( var->type, ATTR_HANDLE )) + continue; + error_loc("attribute %s requires a handle type in interface %s\n", + allowed_attr[attr->type].display_name, name); + } } return attrs; } @@ -2563,11 +2564,15 @@ static void check_remoting_args(const var_t *func) error_loc_info(&arg->loc_info, "out interface pointer \'%s\' of function \'%s\' is not a double pointer\n", arg->name, funcname); break; case TGT_STRING: - if (is_ptr(type) || - (is_array(type) && - (!type_array_has_conformance(type) || - type_array_get_conformance(type)->type == EXPR_VOID))) - error_loc_info(&arg->loc_info, "out parameter \'%s\' of function \'%s\' cannot be an unsized string\n", arg->name, funcname); + if (is_array(type)) + { + /* needs conformance or fixed dimension */ + if (type_array_has_conformance(type) && + type_array_get_conformance(type)->type != EXPR_VOID) break; + if (!type_array_has_conformance(type) && type_array_get_dim(type)) break; + } + if (is_attr( arg->attrs, ATTR_IN )) break; + error_loc_info(&arg->loc_info, "out parameter \'%s\' of function \'%s\' cannot be an unsized string\n", arg->name, funcname); break; case TGT_INVALID: /* already error'd before we get here */ @@ -2593,31 +2598,20 @@ static void check_remoting_args(const var_t *func) } } -static void add_explicit_handle_if_necessary(var_t *func) +static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func) { - const var_t* explicit_handle_var; - const var_t* explicit_generic_handle_var = NULL; - const var_t* context_handle_var = NULL; + unsigned char explicit_fc, implicit_fc; /* check for a defined binding handle */ - explicit_handle_var = get_explicit_handle_var(func); - if (!explicit_handle_var) + if (!get_func_handle_var( iface, func, &explicit_fc, &implicit_fc ) || !explicit_fc) { - explicit_generic_handle_var = get_explicit_generic_handle_var(func); - if (!explicit_generic_handle_var) - { - context_handle_var = get_context_handle_var(func); - if (!context_handle_var) - { - /* no explicit handle specified so add - * "[in] handle_t IDL_handle" as the first parameter to the - * function */ - var_t *idl_handle = make_var(xstrdup("IDL_handle")); - idl_handle->attrs = append_attr(NULL, make_attr(ATTR_IN)); - idl_handle->type = find_type_or_error("handle_t", 0); - type_function_add_head_arg(func->type, idl_handle); - } - } + /* no explicit handle specified so add + * "[in] handle_t IDL_handle" as the first parameter to the + * function */ + var_t *idl_handle = make_var(xstrdup("IDL_handle")); + idl_handle->attrs = append_attr(NULL, make_attr(ATTR_IN)); + idl_handle->type = find_type_or_error("handle_t", 0); + type_function_add_head_arg(func->type, idl_handle); } } @@ -2629,7 +2623,7 @@ static void check_functions(const type_t *iface, int is_inside_library) STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) ) { var_t *func = stmt->u.var; - add_explicit_handle_if_necessary(func); + add_explicit_handle_if_necessary(iface, func); } } if (!is_inside_library && !is_attr(iface->attrs, ATTR_LOCAL)) diff --git a/reactos/tools/widl/parser.yy.c b/reactos/tools/widl/parser.yy.c index 2961e3ad2b1..1b7041fafe9 100644 --- a/reactos/tools/widl/parser.yy.c +++ b/reactos/tools/widl/parser.yy.c @@ -1,8 +1,13 @@ +#line 2 "parser.yy.c" + +#line 4 "parser.yy.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + #define yy_create_buffer parser__create_buffer #define yy_delete_buffer parser__delete_buffer -#define yy_scan_buffer parser__scan_buffer -#define yy_scan_string parser__scan_string -#define yy_scan_bytes parser__scan_bytes #define yy_flex_debug parser__flex_debug #define yy_init_buffer parser__init_buffer #define yy_flush_buffer parser__flush_buffer @@ -11,76 +16,118 @@ #define yyin parser_in #define yyleng parser_leng #define yylex parser_lex +#define yylineno parser_lineno #define yyout parser_out #define yyrestart parser_restart #define yytext parser_text #define yywrap parser_wrap - -#line 20 "parser.yy.c" -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ - */ +#define yyalloc parser_alloc +#define yyrealloc parser_realloc +#define yyfree parser_free #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ #include +#include +#include +#include +/* end standard C headers. */ -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 #endif +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ #ifdef __cplusplus -#include -#include - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ -#if __STDC__ +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) -#define YY_USE_PROTOS #define YY_USE_CONST -#endif /* __STDC__ */ +#endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - /* Returned upon end-of-file. */ #define YY_NULL 0 @@ -95,71 +142,78 @@ * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ -#define BEGIN yy_start = 1 + 2 * +#define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ -#define YY_START ((yy_start - 1) / 2) +#define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) +#define YY_NEW_FILE parser_restart(parser_in ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif -extern int yyleng; -extern FILE *yyin, *yyout; +extern int parser_leng; + +extern FILE *parser_in, *parser_out; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ + /* Undo effects of setting up parser_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up parser_text again */ \ } \ while ( 0 ) -#define unput(c) yyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; +#define unput(c) yyunput( c, (yytext_ptr) ) +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; @@ -196,12 +250,16 @@ struct yy_buffer_state */ int yy_at_bol; + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; + #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process @@ -211,99 +269,135 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. + * (via parser_restart()), so that the user can continue scanning by + * just pointing parser_in at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 - }; -static YY_BUFFER_STATE yy_current_buffer = 0; + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". + * + * Returns the top of the stack, or NULL. */ -#define YY_CURRENT_BUFFER yy_current_buffer +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] -/* yy_hold_char holds the character lost when yytext is formed. */ +/* yy_hold_char holds the character lost when parser_text is formed. */ static char yy_hold_char; - static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; +int parser_leng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ +static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... +/* Flag which is used to allow parser_wrap()'s to do buffer switches + * instead of setting up a fresh parser_in. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; -void yyrestart YY_PROTO(( FILE *input_file )); +void parser_restart (FILE *input_file ); +void parser__switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE parser__create_buffer (FILE *file,int size ); +void parser__delete_buffer (YY_BUFFER_STATE b ); +void parser__flush_buffer (YY_BUFFER_STATE b ); +void parser_push_buffer_state (YY_BUFFER_STATE new_buffer ); +void parser_pop_buffer_state (void ); -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) +static void parser_ensure_buffer_stack (void ); +static void parser__load_buffer_state (void ); +static void parser__init_buffer (YY_BUFFER_STATE b,FILE *file ); -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); +#define YY_FLUSH_BUFFER parser__flush_buffer(YY_CURRENT_BUFFER ) -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); +YY_BUFFER_STATE parser__scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE parser__scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE parser__scan_bytes (yyconst char *bytes,int len ); -#define yy_new_buffer yy_create_buffer +void *parser_alloc (yy_size_t ); +void *parser_realloc (void *,yy_size_t ); +void parser_free (void * ); + +#define yy_new_buffer parser__create_buffer #define yy_set_interactive(is_interactive) \ { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ + if ( ! YY_CURRENT_BUFFER ){ \ + parser_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + parser__create_buffer(parser_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ + if ( ! YY_CURRENT_BUFFER ){\ + parser_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + parser__create_buffer(parser_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; -typedef int yy_state_type; -extern char *yytext; -#define yytext_ptr yytext -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); +FILE *parser_in = (FILE *) 0, *parser_out = (FILE *) 0; + +typedef int yy_state_type; + +extern int parser_lineno; + +int parser_lineno = 1; + +extern char *parser_text; +#define yytext_ptr parser_text + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. + * corresponding action - sets up parser_text. */ #define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ + (yytext_ptr) = yy_bp; \ + parser_leng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; + (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 36 #define YY_END_OF_BUFFER 37 -static yyconst short int yy_accept[148] = +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[148] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 37, 35, 24, 23, 35, 3, 35, 7, @@ -323,7 +417,7 @@ static yyconst short int yy_accept[148] = 0, 0, 0, 0, 0, 17, 0 } ; -static yyconst int yy_ec[256] = +static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, @@ -355,7 +449,7 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[37] = +static yyconst flex_int32_t yy_meta[37] = { 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, 1, 3, 3, 3, @@ -363,7 +457,7 @@ static yyconst int yy_meta[37] = 1, 3, 4, 4, 4, 1 } ; -static yyconst short int yy_base[184] = +static yyconst flex_int16_t yy_base[184] = { 0, 0, 35, 35, 39, 40, 43, 61, 45, 262, 261, 46, 47, 263, 481, 481, 481, 246, 481, 254, 481, @@ -387,7 +481,7 @@ static yyconst short int yy_base[184] = 102, 88, 75 } ; -static yyconst short int yy_def[184] = +static yyconst flex_int16_t yy_def[184] = { 0, 147, 1, 148, 148, 148, 148, 1, 7, 149, 149, 148, 148, 147, 147, 147, 147, 147, 147, 147, 147, @@ -411,7 +505,7 @@ static yyconst short int yy_def[184] = 147, 147, 147 } ; -static yyconst short int yy_nxt[518] = +static yyconst flex_int16_t yy_nxt[518] = { 0, 14, 15, 16, 17, 18, 14, 19, 20, 14, 14, 21, 22, 23, 24, 25, 26, 27, 28, 28, 28, @@ -472,7 +566,7 @@ static yyconst short int yy_nxt[518] = 147, 147, 147, 147, 147, 147, 147 } ; -static yyconst short int yy_chk[518] = +static yyconst flex_int16_t yy_chk[518] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -536,6 +630,9 @@ static yyconst short int yy_chk[518] = static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; +extern int parser__flex_debug; +int parser__flex_debug = 0; + /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ @@ -543,9 +640,8 @@ static char *yy_last_accepting_cpos; #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -char *yytext; +char *parser_text; #line 1 "parser.l" -#define INITIAL 0 /* -*-C-*- * IDL Compiler * @@ -565,20 +661,11 @@ char *yytext; * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define YY_STACK_USED 1 #define YY_NO_INPUT 1 -#define YY_NO_UNPUT 1 -#define YY_NO_TOP_STATE 1 -#define YY_NEVER_INTERACTIVE 1 -#define QUOTE 1 -#define WSTRQUOTE 2 -#define ATTR 3 -#define PP_LINE 4 -#define SQUOTE 5 #line 43 "parser.l" @@ -663,7 +750,57 @@ UUID *parse_uuid(const char *u) * The flexer starts here ************************************************************************** */ -#line 667 "parser.yy.c" +#line 754 "parser.yy.c" + +#define INITIAL 0 +#define QUOTE 1 +#define WSTRQUOTE 2 +#define ATTR 3 +#define PP_LINE 4 +#define SQUOTE 5 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int parser_lex_destroy (void ); + +int parser_get_debug (void ); + +void parser_set_debug (int debug_flag ); + +YY_EXTRA_TYPE parser_get_extra (void ); + +void parser_set_extra (YY_EXTRA_TYPE user_defined ); + +FILE *parser_get_in (void ); + +void parser_set_in (FILE * in_str ); + +FILE *parser_get_out (void ); + +void parser_set_out (FILE * out_str ); + +int parser_get_leng (void ); + +char *parser_get_text (void ); + +int parser_get_lineno (void ); + +void parser_set_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -671,79 +808,54 @@ UUID *parse_uuid(const char *u) #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); +extern "C" int parser_wrap (void ); #else -extern int yywrap YY_PROTO(( void )); +extern int parser_wrap (void ); #endif #endif -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - #ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); +static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT + #ifdef __cplusplus -static int yyinput YY_PROTO(( void )); +static int yyinput (void ); #else -static int input YY_PROTO(( void )); -#endif +static int input (void ); #endif -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif #endif + static int yy_start_stack_ptr = 0; + static int yy_start_stack_depth = 0; + static int *yy_start_stack = NULL; + + static void yy_push_state (int new_state ); + + static void yy_pop_state (void ); + /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ - #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( parser_text, parser_leng, 1, parser_out )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -751,21 +863,35 @@ YY_MALLOC_DECL */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ - int c = '*', n; \ + int c = '*'; \ + size_t n; \ for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + (c = getc( parser_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ + if ( c == EOF && ferror( parser_in ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, parser_in))==0 && ferror(parser_in)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(parser_in); \ + } \ + }\ +\ + #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - @@ -786,14 +912,20 @@ YY_MALLOC_DECL #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif +/* end tables serialization structures and prototypes */ + /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif +#define YY_DECL_IS_OURS 1 -/* Code executed at the beginning of each rule, after yytext and yyleng +extern int parser_lex (void); + +#define YY_DECL int parser_lex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after parser_text and parser_leng * have been set up. */ #ifndef YY_USER_ACTION @@ -806,58 +938,62 @@ YY_MALLOC_DECL #endif #define YY_RULE_SETUP \ - if ( yyleng > 0 ) \ - yy_current_buffer->yy_at_bol = \ - (yytext[yyleng - 1] == '\n'); \ + if ( parser_leng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (parser_text[parser_leng - 1] == '\n'); \ YY_USER_ACTION +/** The main scanner function which does all the work. + */ YY_DECL - { +{ register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; - + #line 127 "parser.l" -#line 823 "parser.yy.c" +#line 957 "parser.yy.c" - if ( yy_init ) + if ( !(yy_init) ) { - yy_init = 0; + (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if ( ! parser_in ) + parser_in = stdin; - if ( ! yyout ) - yyout = stdout; + if ( ! parser_out ) + parser_out = stdout; - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); + if ( ! YY_CURRENT_BUFFER ) { + parser_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + parser__create_buffer(parser_in,YY_BUF_SIZE ); + } - yy_load_buffer_state(); + parser__load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { - yy_cp = yy_c_buf_p; + yy_cp = (yy_c_buf_p); - /* Support of yytext. */ - *yy_cp = yy_hold_char; + /* Support of parser_text. */ + *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; - yy_current_state = yy_start; + yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); yy_match: do @@ -865,8 +1001,8 @@ yy_match: register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -877,30 +1013,24 @@ yy_match: yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 481 ); + while ( yy_current_state != 147 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); yy_find_action: yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } YY_DO_BEFORE_ACTION; - do_action: /* This label is used only to access EOF actions. */ - switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: @@ -915,7 +1045,7 @@ YY_RULE_SETUP int lineno; char *cptr, *fname; yy_pop_state(); - lineno = (int)strtol(yytext, &cptr, 10); + lineno = (int)strtol(parser_text, &cptr, 10); if(!lineno) error_loc("Malformed '#...' line-directive; invalid linenumber\n"); fname = strchr(cptr, '"'); @@ -927,18 +1057,17 @@ YY_RULE_SETUP error_loc("Malformed '#...' line-directive; missing terminating \"\n"); *cptr = '\0'; line_number = lineno - 1; /* We didn't read the newline */ - free( input_name ); input_name = xstrdup(fname); } YY_BREAK case 3: YY_RULE_SETUP -#line 148 "parser.l" +#line 147 "parser.l" yy_push_state(QUOTE); cbufidx = 0; YY_BREAK case 4: YY_RULE_SETUP -#line 149 "parser.l" +#line 148 "parser.l" { yy_pop_state(); parser_lval.str = get_buffered_cstring(); @@ -947,12 +1076,12 @@ YY_RULE_SETUP YY_BREAK case 5: YY_RULE_SETUP -#line 154 "parser.l" +#line 153 "parser.l" yy_push_state(WSTRQUOTE); cbufidx = 0; YY_BREAK case 6: YY_RULE_SETUP -#line 155 "parser.l" +#line 154 "parser.l" { yy_pop_state(); parser_lval.str = get_buffered_cstring(); @@ -961,12 +1090,12 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP -#line 160 "parser.l" +#line 159 "parser.l" yy_push_state(SQUOTE); cbufidx = 0; YY_BREAK case 8: YY_RULE_SETUP -#line 161 "parser.l" +#line 160 "parser.l" { yy_pop_state(); parser_lval.str = get_buffered_cstring(); @@ -974,151 +1103,152 @@ YY_RULE_SETUP } YY_BREAK case 9: -#line 167 "parser.l" +#line 166 "parser.l" case 10: YY_RULE_SETUP -#line 167 "parser.l" -addcchar(yytext[1]); +#line 166 "parser.l" +addcchar(parser_text[1]); YY_BREAK case 11: YY_RULE_SETUP -#line 168 "parser.l" -addcchar(yytext[1]); +#line 167 "parser.l" +addcchar(parser_text[1]); YY_BREAK case 12: YY_RULE_SETUP -#line 169 "parser.l" -addcchar('\\'); addcchar(yytext[1]); +#line 168 "parser.l" +addcchar('\\'); addcchar(parser_text[1]); YY_BREAK case 13: YY_RULE_SETUP -#line 170 "parser.l" -addcchar(yytext[0]); +#line 169 "parser.l" +addcchar(parser_text[0]); YY_BREAK case 14: YY_RULE_SETUP -#line 171 "parser.l" +#line 170 "parser.l" yy_push_state(ATTR); return '['; YY_BREAK case 15: YY_RULE_SETUP -#line 172 "parser.l" +#line 171 "parser.l" yy_pop_state(); return ']'; YY_BREAK case 16: YY_RULE_SETUP -#line 173 "parser.l" -return attr_token(yytext); +#line 172 "parser.l" +return attr_token(parser_text); YY_BREAK case 17: YY_RULE_SETUP -#line 174 "parser.l" +#line 173 "parser.l" { - parser_lval.uuid = parse_uuid(yytext); + parser_lval.uuid = parse_uuid(parser_text); return aUUID; } YY_BREAK case 18: YY_RULE_SETUP -#line 178 "parser.l" +#line 177 "parser.l" { - parser_lval.num = xstrtoul(yytext, NULL, 0); + parser_lval.num = xstrtoul(parser_text, NULL, 0); return aHEXNUM; } YY_BREAK case 19: YY_RULE_SETUP -#line 182 "parser.l" +#line 181 "parser.l" { - parser_lval.num = xstrtoul(yytext, NULL, 0); + parser_lval.num = xstrtoul(parser_text, NULL, 0); return aNUM; } YY_BREAK case 20: YY_RULE_SETUP -#line 186 "parser.l" +#line 185 "parser.l" { - parser_lval.dbl = strtod(yytext, NULL); + parser_lval.dbl = strtod(parser_text, NULL); return aDOUBLE; } YY_BREAK case 21: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ +*yy_cp = (yy_hold_char); /* undo effects of setting up parser_text */ +(yy_c_buf_p) = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up parser_text again */ YY_RULE_SETUP -#line 190 "parser.l" +#line 189 "parser.l" return tSAFEARRAY; YY_BREAK case 22: YY_RULE_SETUP -#line 191 "parser.l" -return kw_token(yytext); +#line 190 "parser.l" +return kw_token(parser_text); YY_BREAK case 23: +/* rule 23 can match eol */ YY_RULE_SETUP -#line 192 "parser.l" +#line 191 "parser.l" line_number++; YY_BREAK case 24: YY_RULE_SETUP -#line 193 "parser.l" +#line 192 "parser.l" YY_BREAK case 25: YY_RULE_SETUP -#line 194 "parser.l" +#line 193 "parser.l" return SHL; YY_BREAK case 26: YY_RULE_SETUP -#line 195 "parser.l" +#line 194 "parser.l" return SHR; YY_BREAK case 27: YY_RULE_SETUP -#line 196 "parser.l" +#line 195 "parser.l" return MEMBERPTR; YY_BREAK case 28: YY_RULE_SETUP -#line 197 "parser.l" +#line 196 "parser.l" return EQUALITY; YY_BREAK case 29: YY_RULE_SETUP -#line 198 "parser.l" +#line 197 "parser.l" return INEQUALITY; YY_BREAK case 30: YY_RULE_SETUP -#line 199 "parser.l" +#line 198 "parser.l" return GREATEREQUAL; YY_BREAK case 31: YY_RULE_SETUP -#line 200 "parser.l" +#line 199 "parser.l" return LESSEQUAL; YY_BREAK case 32: YY_RULE_SETUP -#line 201 "parser.l" +#line 200 "parser.l" return LOGICALOR; YY_BREAK case 33: YY_RULE_SETUP -#line 202 "parser.l" +#line 201 "parser.l" return LOGICALAND; YY_BREAK case 34: YY_RULE_SETUP -#line 203 "parser.l" +#line 202 "parser.l" return ELLIPSIS; YY_BREAK case 35: YY_RULE_SETUP -#line 204 "parser.l" -return yytext[0]; +#line 203 "parser.l" +return parser_text[0]; YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(QUOTE): @@ -1126,7 +1256,7 @@ case YY_STATE_EOF(WSTRQUOTE): case YY_STATE_EOF(ATTR): case YY_STATE_EOF(PP_LINE): case YY_STATE_EOF(SQUOTE): -#line 205 "parser.l" +#line 204 "parser.l" { if (import_stack_ptr) return aEOF; @@ -1135,34 +1265,34 @@ case YY_STATE_EOF(SQUOTE): YY_BREAK case 36: YY_RULE_SETUP -#line 210 "parser.l" +#line 209 "parser.l" ECHO; YY_BREAK -#line 1142 "parser.yy.c" +#line 1272 "parser.yy.c" case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; + *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our + * just pointed parser_in at a new source and called + * parser_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = parser_in; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position @@ -1172,13 +1302,13 @@ ECHO; * end-of-buffer state). Contrast this with the test * in input(). */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have @@ -1191,41 +1321,42 @@ ECHO; yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; + yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { - yy_cp = yy_c_buf_p; + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); goto yy_find_action; } } - else switch ( yy_get_next_buffer() ) + else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { - yy_did_buffer_switch_on_eof = 0; + (yy_did_buffer_switch_on_eof) = 0; - if ( yywrap() ) + if ( parser_wrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up - * yytext, we can now set up + * parser_text, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; @@ -1233,30 +1364,30 @@ ECHO; else { - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; @@ -1267,8 +1398,7 @@ ECHO; "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ - } /* end of yylex */ - +} /* end of parser_lex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -1277,21 +1407,20 @@ ECHO; * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); - if ( yy_current_buffer->yy_fill_buffer == 0 ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. @@ -1311,34 +1440,30 @@ static int yy_get_next_buffer() /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); + (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { @@ -1351,8 +1476,7 @@ static int yy_get_next_buffer() b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); + parser_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ @@ -1362,35 +1486,35 @@ static int yy_get_next_buffer() YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - num_to_read = yy_current_buffer->yy_buf_size - + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; -#endif + } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); - yy_current_buffer->yy_n_chars = yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - if ( yy_n_chars == 0 ) + if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); + parser_restart(parser_in ); } else { ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } @@ -1398,33 +1522,40 @@ static int yy_get_next_buffer() else ret_val = EOB_ACT_CONTINUE_SCAN; - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) parser_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} /* yy_get_previous_state - get the state just before the EOB char was reached */ -static yy_state_type yy_get_previous_state() - { + static yy_state_type yy_get_previous_state (void) +{ register yy_state_type yy_current_state; register char *yy_cp; - - yy_current_state = yy_start; + + yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -1436,30 +1567,23 @@ static yy_state_type yy_get_previous_state() } return yy_current_state; - } - +} /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; + register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -1471,80 +1595,36 @@ yy_state_type yy_current_state; yy_is_jam = (yy_current_state == 147); return yy_is_jam ? 0 : yy_current_state; - } - - -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - +} +#ifndef YY_NO_INPUT #ifdef __cplusplus -static int yyinput() + static int yyinput (void) #else -static int input() + static int input (void) #endif - { + +{ int c; + + *(yy_c_buf_p) = (yy_hold_char); - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ - *yy_c_buf_p = '\0'; + *(yy_c_buf_p) = '\0'; else { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); - switch ( yy_get_next_buffer() ) + switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() @@ -1558,16 +1638,16 @@ static int input() */ /* Reset buffer status. */ - yyrestart( yyin ); + parser_restart(parser_in ); - /* fall through */ + /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap() ) + if ( parser_wrap( ) ) return EOF; - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); @@ -1577,173 +1657,167 @@ static int input() } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; + (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve parser_text */ + (yy_hold_char) = *++(yy_c_buf_p); - yy_current_buffer->yy_at_bol = (c == '\n'); + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void parser_restart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + parser_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + parser__create_buffer(parser_in,YY_BUF_SIZE ); } + parser__init_buffer(YY_CURRENT_BUFFER,input_file ); + parser__load_buffer_state( ); +} -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void parser__switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * parser_pop_buffer_state(); + * parser_push_buffer_state(new_buffer); + */ + parser_ensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) return; - if ( yy_current_buffer ) + if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - yy_current_buffer = new_buffer; - yy_load_buffer_state(); + YY_CURRENT_BUFFER_LVALUE = new_buffer; + parser__load_buffer_state( ); /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe + * EOF (parser_wrap()) processing, but the only time this flag + * is looked at is after parser_wrap() is called, so it's safe * to go ahead and always set it. */ - yy_did_buffer_switch_on_eof = 1; - } + (yy_did_buffer_switch_on_eof) = 1; +} +static void parser__load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + parser_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE parser__create_buffer (FILE * file, int size ) +{ YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + + b = (YY_BUFFER_STATE) parser_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in parser__create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) parser_alloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in parser__create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer( b, file ); + parser__init_buffer(b,file ); return b; - } +} - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { +/** Destroy the buffer. + * @param b a buffer created with parser__create_buffer() + * + */ + void parser__delete_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) return; - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); + parser_free((void *) b->yy_ch_buf ); - yy_flex_free( (void *) b ); - } + parser_free((void *) b ); +} +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a parser_restart() or at EOF. + */ + static void parser__init_buffer (YY_BUFFER_STATE b, FILE * file ) -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - - - { - yy_flush_buffer( b ); +{ + int oerrno = errno; + + parser__flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } + /* If b is the current buffer, then parser__init_buffer was _probably_ + * called from parser_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + b->yy_is_interactive = 0; + + errno = oerrno; +} -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - - { - if ( ! b ) +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void parser__flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) return; b->yy_n_chars = 0; @@ -1760,31 +1834,127 @@ YY_BUFFER_STATE b; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == yy_current_buffer ) - yy_load_buffer_state(); + if ( b == YY_CURRENT_BUFFER ) + parser__load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void parser_push_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + parser_ensure_buffer_stack(); + + /* This block is copied from parser__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from parser__switch_to_buffer. */ + parser__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void parser_pop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + parser__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + parser__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void parser_ensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)parser_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in parser_ensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; } + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)parser_realloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in parser_ensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE parser__scan_buffer (char * base, yy_size_t size ) +{ YY_BUFFER_STATE b; - + if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) parser_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in parser__scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; @@ -1796,58 +1966,53 @@ yy_size_t size; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer( b ); + parser__switch_to_buffer(b ); return b; - } -#endif +} +/** Setup the input buffer state to scan a string. The next call to parser_lex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * parser__scan_bytes() instead. + */ +YY_BUFFER_STATE parser__scan_string (yyconst char * yystr ) +{ + + return parser__scan_bytes(yystr,strlen(yystr) ); +} -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { +/** Setup the input buffer state to scan the given bytes. The next call to parser_lex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE parser__scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; - + /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); + n = _yybytes_len + 2; + buf = (char *) parser_alloc(n ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in parser__scan_bytes()" ); - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer( buf, n ); + b = parser__scan_buffer(buf,n ); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in parser__scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -1855,78 +2020,49 @@ int len; b->yy_is_our_buffer = 1; return b; - } -#endif +} - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) + static void yy_push_state (int new_state ) +{ + if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) ) { yy_size_t new_size; - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); + (yy_start_stack_depth) += YY_START_STACK_INCR; + new_size = (yy_start_stack_depth) * sizeof( int ); - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); + if ( ! (yy_start_stack) ) + (yy_start_stack) = (int *) parser_alloc(new_size ); else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); + (yy_start_stack) = (int *) parser_realloc((void *) (yy_start_stack),new_size ); - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); + if ( ! (yy_start_stack) ) + YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } - yy_start_stack[yy_start_stack_ptr++] = YY_START; + (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START; BEGIN(new_state); - } -#endif +} - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) + static void yy_pop_state (void) +{ + if ( --(yy_start_stack_ptr) < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif + BEGIN((yy_start_stack)[(yy_start_stack_ptr)]); +} #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); - } - - +} /* Redefine yyless() so it works in section 3 code. */ @@ -1934,69 +2070,186 @@ char msg[]; #define yyless(n) \ do \ { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ + /* Undo effects of setting up parser_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + parser_text[parser_leng] = (yy_hold_char); \ + (yy_c_buf_p) = parser_text + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + parser_leng = yyless_macro_arg; \ } \ while ( 0 ) +/* Accessor methods (get/set functions) to struct members. */ -/* Internal utility routines. */ +/** Get the current line number. + * + */ +int parser_get_lineno (void) +{ + + return parser_lineno; +} + +/** Get the input stream. + * + */ +FILE *parser_get_in (void) +{ + return parser_in; +} + +/** Get the output stream. + * + */ +FILE *parser_get_out (void) +{ + return parser_out; +} + +/** Get the length of the current token. + * + */ +int parser_get_leng (void) +{ + return parser_leng; +} + +/** Get the current token. + * + */ + +char *parser_get_text (void) +{ + return parser_text; +} + +/** Set the current line number. + * @param line_number + * + */ +void parser_set_lineno (int line_number ) +{ + + parser_lineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see parser__switch_to_buffer + */ +void parser_set_in (FILE * in_str ) +{ + parser_in = in_str ; +} + +void parser_set_out (FILE * out_str ) +{ + parser_out = out_str ; +} + +int parser_get_debug (void) +{ + return parser__flex_debug; +} + +void parser_set_debug (int bdebug ) +{ + parser__flex_debug = bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from parser_lex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + + (yy_start_stack_ptr) = 0; + (yy_start_stack_depth) = 0; + (yy_start_stack) = NULL; + +/* Defined in main.c */ +#ifdef YY_STDINIT + parser_in = stdin; + parser_out = stdout; +#else + parser_in = (FILE *) 0; + parser_out = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * parser_lex_init() + */ + return 0; +} + +/* parser_lex_destroy is for both reentrant and non-reentrant scanners. */ +int parser_lex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + parser__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + parser_pop_buffer_state(); + } + + /* Destroy the stack itself. */ + parser_free((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Destroy the start condition stack. */ + parser_free((yy_start_stack) ); + (yy_start_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * parser_lex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ #ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; - } +} #endif #ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { +static int yy_flex_strlen (yyconst char * s ) +{ register int n; for ( n = 0; s[n]; ++n ) ; return n; - } +} #endif - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { +void *parser_alloc (yy_size_t size ) +{ return (void *) malloc( size ); - } +} -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { +void *parser_realloc (void * ptr, yy_size_t size ) +{ /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -2005,26 +2258,17 @@ yy_size_t size; * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); - } +} -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } +void parser_free (void * ptr ) +{ + free( (char *) ptr ); /* see parser_realloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 209 "parser.l" -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif -#line 210 "parser.l" #ifndef parser_wrap @@ -2276,9 +2520,9 @@ void pop_import(void) { int ptr = import_stack_ptr-1; - fclose(yyin); - yy_delete_buffer( YY_CURRENT_BUFFER ); - yy_switch_to_buffer( import_stack[ptr].state ); + fclose(parser_in); + parser__delete_buffer(YY_CURRENT_BUFFER ); + parser__switch_to_buffer(import_stack[ptr].state ); if (temp_name) { unlink(temp_name); free(temp_name); @@ -2342,7 +2586,7 @@ int do_import(char *fname) error_loc("Unable to open %s\n", temp_name); import_stack[ptr].state = YY_CURRENT_BUFFER; - yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE)); + parser__switch_to_buffer(parser__create_buffer(f,YY_BUF_SIZE)); return 1; } @@ -2353,3 +2597,4 @@ void abort_import(void) for (ptr=0; ptrattrs, ATTR_OUT) && !is_attr(arg->attrs, ATTR_IN)) { - print_proxy( "if(%s)\n", arg->name ); - indent++; - print_proxy( "MIDL_memset( %s, 0, sizeof( *%s ));\n", arg->name, arg->name ); - indent--; - } + if (is_attr(arg->attrs, ATTR_IN)) continue; + if (!is_attr(arg->attrs, ATTR_OUT)) continue; + if (is_ptr(arg->type)) + { + if (type_get_type(type_pointer_get_ref(arg->type)) == TYPE_BASIC) continue; + if (type_get_type(type_pointer_get_ref(arg->type)) == TYPE_ENUM) continue; + } + print_proxy( "if (%s) MIDL_memset( %s, 0, sizeof( *%s ));\n", arg->name, arg->name, arg->name ); } } -int is_var_ptr(const var_t *v) -{ - return is_ptr(v->type); -} - -int cant_be_null(const var_t *v) -{ - switch (typegen_detect_type(v->type, v->attrs, TDT_IGNORE_STRINGS)) - { - case TGT_ARRAY: - case TGT_POINTER: - return (get_pointer_fc(v->type, v->attrs, TRUE) == RPC_FC_RP); - case TGT_CTXT_HANDLE_POINTER: - return TRUE; - default: - return 0; - } - -} - static int need_delegation(const type_t *iface) { - return type_iface_get_inherit(iface) && - type_iface_get_inherit(type_iface_get_inherit(iface)) && - type_iface_get_inherit(iface)->ignore; + const type_t *parent = type_iface_get_inherit( iface ); + return parent && type_iface_get_inherit(parent) && (parent->ignore || is_local( parent->attrs )); } static int get_delegation_indirect(const type_t *iface, const type_t ** delegate_to) @@ -177,39 +146,12 @@ static int need_delegation_indirect(const type_t *iface) return get_delegation_indirect(iface, NULL); } -static void proxy_check_pointers( const var_list_t *args ) -{ - const var_t *arg; - - if (!args) return; - LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry ) - { - if (is_var_ptr(arg) && cant_be_null(arg)) { - print_proxy( "if(!%s)\n", arg->name ); - indent++; - print_proxy( "RpcRaiseException(RPC_X_NULL_REF_POINTER);\n"); - indent--; - } - } -} - static void free_variable( const var_t *arg, const char *local_var_prefix ) { unsigned int type_offset = arg->type->typestring_offset; - expr_t *iid; type_t *type = arg->type; - expr_t *size = get_size_is_expr(type, arg->name); - if (size) - { - print_proxy( "__frame->_StubMsg.MaxCount = " ); - write_expr(proxy, size, 0, 1, NULL, NULL, local_var_prefix); - fprintf(proxy, ";\n\n"); - print_proxy( "NdrClearOutParameters( &__frame->_StubMsg, "); - fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset ); - fprintf(proxy, "(void*)%s );\n", arg->name ); - return; - } + write_parameter_conf_or_var_exprs(proxy, indent, local_var_prefix, PHASE_FREE, arg, FALSE); switch (typegen_detect_type(type, arg->attrs, TDT_IGNORE_STRINGS)) { @@ -223,23 +165,11 @@ static void free_variable( const var_t *arg, const char *local_var_prefix ) break; case TGT_IFACE_POINTER: - iid = get_attrp( arg->attrs, ATTR_IIDIS ); - if( iid ) - { - print_proxy( "__frame->_StubMsg.MaxCount = (ULONG_PTR) " ); - write_expr(proxy, iid, 1, 1, NULL, NULL, local_var_prefix); - print_proxy( ";\n\n" ); - } - /* fall through */ case TGT_POINTER: - if (get_pointer_fc(type, arg->attrs, TRUE) == RPC_FC_FP) - { - print_proxy( "NdrClearOutParameters( &__frame->_StubMsg, "); - fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset ); - fprintf(proxy, "(void*)%s );\n", arg->name ); - } - else - print_proxy("/* FIXME: %s code for %s type %d missing */\n", __FUNCTION__, arg->name, type_get_type(type) ); + case TGT_ARRAY: + print_proxy( "NdrClearOutParameters( &__frame->_StubMsg, "); + fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset ); + fprintf(proxy, "(void *)%s );\n", arg->name ); break; default: @@ -263,12 +193,24 @@ static void proxy_free_variables( var_list_t *args, const char *local_var_prefix static void gen_proxy(type_t *iface, const var_t *func, int idx, unsigned int proc_offset) { - int has_ret = !is_void(type_function_get_rettype(func->type)); + type_t *rettype = type_function_get_rettype(func->type); + int has_ret = !is_void(rettype); int has_full_pointer = is_full_pointer_function(func); const char *callconv = get_attrp(func->type->attrs, ATTR_CALLCONV); + const var_list_t *args = type_get_function_args(func->type); if (!callconv) callconv = "STDMETHODCALLTYPE"; indent = 0; + if (is_interpreted_func( iface, func )) + { + if (get_stub_mode() == MODE_Oif && !is_callas( func->attrs )) return; + write_type_decl_left(proxy, type_function_get_rettype(func->type)); + print_proxy( " %s %s_%s_Proxy(\n", callconv, iface->name, get_name(func)); + write_args(proxy, args, iface->name, 1, TRUE); + print_proxy( ")\n"); + write_client_call_routine( proxy, iface, func, "Object", proc_offset ); + return; + } print_proxy( "static void __finally_%s_%s_Proxy( struct __proxy_frame *__frame )\n", iface->name, get_name(func) ); print_proxy( "{\n"); @@ -279,9 +221,9 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx, print_proxy( "}\n"); print_proxy( "\n"); - write_type_decl_left(proxy, type_function_get_rettype(func->type)); + write_type_decl_left(proxy, rettype); print_proxy( " %s %s_%s_Proxy(\n", callconv, iface->name, get_name(func)); - write_args(proxy, type_get_function_args(func->type), iface->name, 1, TRUE); + write_args(proxy, args, iface->name, 1, TRUE); print_proxy( ")\n"); print_proxy( "{\n"); indent ++; @@ -289,12 +231,12 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx, /* local variables */ if (has_ret) { print_proxy( "%s", "" ); - write_type_decl_left(proxy, type_function_get_rettype(func->type)); + write_type_decl_left(proxy, rettype); print_proxy( " _RetVal;\n"); } print_proxy( "RPC_MESSAGE _RpcMessage;\n" ); if (has_ret) { - if (decl_indirect(type_function_get_rettype(func->type))) + if (decl_indirect(rettype)) print_proxy("void *_p_%s = &%s;\n", "_RetVal", "_RetVal"); } @@ -313,7 +255,7 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx, print_proxy( "{\n" ); indent++; print_proxy( "NdrProxyInitialize(This, &_RpcMessage, &__frame->_StubMsg, &Object_StubDesc, %d);\n", idx); - proxy_check_pointers( type_get_function_args(func->type) ); + write_pointer_checks( proxy, indent, func ); print_proxy( "RpcTryFinally\n" ); print_proxy( "{\n" ); @@ -340,10 +282,9 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx, if (has_ret) { - if (decl_indirect(type_function_get_rettype(func->type))) + if (decl_indirect(rettype)) print_proxy("MIDL_memset(&%s, 0, sizeof(%s));\n", "_RetVal", "_RetVal"); - else if (is_ptr(type_function_get_rettype(func->type)) || - is_array(type_function_get_rettype(func->type))) + else if (is_ptr(rettype) || is_array(rettype)) print_proxy("%s = 0;\n", "_RetVal"); write_remoting_arguments(proxy, indent, func, "", PASS_RETURN, PHASE_UNMARSHAL); } @@ -385,6 +326,8 @@ static void gen_stub(type_t *iface, const var_t *func, const char *cas, int has_ret = !is_void(type_function_get_rettype(func->type)); int has_full_pointer = is_full_pointer_function(func); + if (is_interpreted_func( iface, func )) return; + indent = 0; print_proxy( "struct __frame_%s_%s_Stub\n{\n", iface->name, get_name(func)); indent++; @@ -490,6 +433,32 @@ static void gen_stub(type_t *iface, const var_t *func, const char *cas, print_proxy("\n"); } +static void gen_stub_thunk( type_t *iface, const var_t *func, unsigned int proc_offset ) +{ + int has_ret = !is_void( type_function_get_rettype( func->type )); + const var_t *arg, *callas = is_callas( func->attrs ); + const var_list_t *args = type_get_function_args( func->type ); + + indent = 0; + print_proxy( "void __RPC_API %s_%s_Thunk( PMIDL_STUB_MESSAGE pStubMsg )\n", + iface->name, get_name(func) ); + print_proxy( "{\n"); + indent++; + write_func_param_struct( proxy, iface, func->type, + "*pParamStruct = (struct _PARAM_STRUCT *)pStubMsg->StackTop", has_ret ); + print_proxy( "%s%s_%s_Stub( pParamStruct->This", + has_ret ? "pParamStruct->_RetVal = " : "", iface->name, callas->name ); + indent++; + if (args) LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry ) + { + fprintf( proxy, ",\n%*spParamStruct->%s", 4 * indent, "", arg->name ); + } + fprintf( proxy, " );\n" ); + indent--; + indent--; + print_proxy( "}\n\n"); +} + int count_methods(const type_t *iface) { const statement_t *stmt; @@ -516,6 +485,36 @@ static const statement_t * get_callas_source(const type_t * iface, const var_t * return NULL; } +static void write_proxy_procformatstring_offsets( const type_t *iface, int skip ) +{ + const statement_t *stmt; + + if (type_iface_get_inherit(iface)) + write_proxy_procformatstring_offsets( type_iface_get_inherit(iface), need_delegation(iface)); + else + return; + + STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) ) + { + const var_t *func = stmt->u.var; + int missing = 0; + + if (is_callas(func->attrs)) continue; + if (is_local(func->attrs)) + { + const statement_t * callas_source = get_callas_source(iface, func); + if (!callas_source) + missing = 1; + else + func = callas_source->u.var; + } + if (skip || missing) + print_proxy( "(unsigned short)-1, /* %s::%s */\n", iface->name, get_name(func)); + else + print_proxy( "%u, /* %s::%s */\n", func->procstring_offset, iface->name, get_name(func)); + } +} + static int write_proxy_methods(type_t *iface, int skip) { const statement_t *stmt; @@ -527,12 +526,14 @@ static int write_proxy_methods(type_t *iface, int skip) STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(iface)) { const var_t *func = stmt->u.var; if (!is_callas(func->attrs)) { - if (i != func->type->details.function->idx ) - error("widl internal error: method index mismatch\n"); - if (i) fprintf(proxy, ",\n"); if (skip || (is_local(func->attrs) && !get_callas_source(iface, func))) - print_proxy( "0 /* %s_%s_Proxy */", iface->name, get_name(func)); - else print_proxy( "%s_%s_Proxy", iface->name, get_name(func)); + print_proxy( "0, /* %s::%s */\n", iface->name, get_name(func)); + else if (is_interpreted_func( iface, func ) && + !is_local( func->attrs ) && + type_iface_get_inherit(iface)) + print_proxy( "(void *)-1, /* %s::%s */\n", iface->name, get_name(func)); + else + print_proxy( "%s_%s_Proxy,\n", iface->name, get_name(func)); i++; } } @@ -563,6 +564,8 @@ static int write_stub_methods(type_t *iface, int skip) } if (i) fprintf(proxy,",\n"); if (skip || missing) print_proxy("STUB_FORWARDING_FUNCTION"); + else if (is_interpreted_func( iface, func )) + print_proxy( "(PRPC_STUB_FUNCTION)%s", get_stub_mode() == MODE_Oif ? "NdrStubCall2" : "NdrStubCall" ); else print_proxy( "%s_%s_Stub", iface->name, fname); i++; } @@ -570,13 +573,37 @@ static int write_stub_methods(type_t *iface, int skip) return i; } +static void write_thunk_methods( type_t *iface, int skip ) +{ + const statement_t *stmt; + + if (type_iface_get_inherit( iface )) + write_thunk_methods( type_iface_get_inherit(iface), need_delegation(iface) ); + else + return; /* skip IUnknown */ + + STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) ) + { + var_t *func = stmt->u.var; + const statement_t * callas_source = NULL; + + if (is_callas(func->attrs)) continue; + if (is_local(func->attrs)) callas_source = get_callas_source(iface, func); + + if (!skip && callas_source && is_interpreted_func( iface, func )) + print_proxy( "%s_%s_Thunk,\n", iface->name, get_name(callas_source->u.var) ); + else + print_proxy( "0, /* %s::%s */\n", iface->name, get_name(func) ); + } +} + static void write_proxy(type_t *iface, unsigned int *proc_offset) { int count; const statement_t *stmt; int first_func = 1; - - /* FIXME: check for [oleautomation], shouldn't generate proxies/stubs if specified */ + int needs_stub_thunks = 0; + int needs_inline_stubs = need_inline_stubs( iface ) || need_delegation( iface ); STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(iface)) { var_t *func = stmt->u.var; @@ -604,13 +631,39 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset) func->procstring_offset = *proc_offset; gen_proxy(iface, func, idx, *proc_offset); gen_stub(iface, func, cname, *proc_offset); - *proc_offset += get_size_procformatstring_func( func ); + if (cas && is_interpreted_func( iface, func )) + { + needs_stub_thunks = 1; + gen_stub_thunk(iface, func, *proc_offset); + } + *proc_offset += get_size_procformatstring_func( iface, func ); } } count = count_methods(iface); - write_procformatstring_offsets( proxy, iface ); + print_proxy( "static const unsigned short %s_FormatStringOffsetTable[] =\n", iface->name ); + print_proxy( "{\n" ); + indent++; + write_proxy_procformatstring_offsets( iface, 0 ); + indent--; + print_proxy( "};\n\n" ); + + /* proxy info */ + if (get_stub_mode() == MODE_Oif) + { + print_proxy( "static const MIDL_STUBLESS_PROXY_INFO %s_ProxyInfo =\n", iface->name ); + print_proxy( "{\n" ); + indent++; + print_proxy( "&Object_StubDesc,\n" ); + print_proxy( "__MIDL_ProcFormatString.Format,\n" ); + print_proxy( "&%s_FormatStringOffsetTable[-3],\n", iface->name ); + print_proxy( "0,\n" ); + print_proxy( "0,\n" ); + print_proxy( "0\n" ); + indent--; + print_proxy( "};\n\n" ); + } /* proxy vtable */ print_proxy( "static %sCINTERFACE_PROXY_VTABLE(%d) _%sProxyVtbl =\n", @@ -619,18 +672,29 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset) indent++; print_proxy( "{\n"); indent++; + if (get_stub_mode() == MODE_Oif) print_proxy( "&%s_ProxyInfo,\n", iface->name ); print_proxy( "&IID_%s,\n", iface->name); indent--; print_proxy( "},\n"); print_proxy( "{\n"); indent++; write_proxy_methods(iface, FALSE); - fprintf(proxy, "\n"); indent--; print_proxy( "}\n"); indent--; print_proxy( "};\n\n"); + /* stub thunk table */ + if (needs_stub_thunks) + { + print_proxy( "static const STUB_THUNK %s_StubThunkTable[] =\n", iface->name); + print_proxy( "{\n"); + indent++; + write_thunk_methods( iface, 0 ); + indent--; + print_proxy( "};\n\n"); + } + /* server info */ print_proxy( "static const MIDL_SERVER_INFO %s_ServerInfo =\n", iface->name ); print_proxy( "{\n" ); @@ -639,7 +703,10 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset) print_proxy( "0,\n" ); print_proxy( "__MIDL_ProcFormatString.Format,\n" ); print_proxy( "&%s_FormatStringOffsetTable[-3],\n", iface->name ); - print_proxy( "0,\n" ); + if (needs_stub_thunks) + print_proxy( "&%s_StubThunkTable[-3],\n", iface->name ); + else + print_proxy( "0,\n" ); print_proxy( "0,\n" ); print_proxy( "0,\n" ); print_proxy( "0\n" ); @@ -647,14 +714,16 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset) print_proxy( "};\n\n" ); /* stub vtable */ - print_proxy( "static const PRPC_STUB_FUNCTION %s_table[] =\n", iface->name); - print_proxy( "{\n"); - indent++; - write_stub_methods(iface, FALSE); - fprintf(proxy, "\n"); - indent--; - fprintf(proxy, "};\n"); - print_proxy( "\n"); + if (needs_inline_stubs) + { + print_proxy( "static const PRPC_STUB_FUNCTION %s_table[] =\n", iface->name); + print_proxy( "{\n"); + indent++; + write_stub_methods(iface, FALSE); + fprintf(proxy, "\n"); + indent--; + fprintf(proxy, "};\n\n"); + } print_proxy( "static %sCInterfaceStubVtbl _%sStubVtbl =\n", need_delegation_indirect(iface) ? "" : "const ", iface->name); print_proxy( "{\n"); @@ -664,7 +733,8 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset) print_proxy( "&IID_%s,\n", iface->name); print_proxy( "&%s_ServerInfo,\n", iface->name ); print_proxy( "%d,\n", count); - print_proxy( "&%s_table[-3],\n", iface->name); + if (needs_inline_stubs) print_proxy( "&%s_table[-3]\n", iface->name ); + else print_proxy( "0\n" ); indent--; print_proxy( "},\n"); print_proxy( "{\n"); @@ -701,7 +771,11 @@ static int does_any_iface(const statement_list_t *stmts, type_pred_t pred) int need_proxy(const type_t *iface) { - return is_object(iface) && !is_local(iface->attrs); + if (!is_object( iface )) return 0; + if (is_local( iface->attrs )) return 0; + if (is_attr( iface->attrs, ATTR_OLEAUTOMATION )) return 0; + if (is_attr( iface->attrs, ATTR_DISPINTERFACE )) return 0; + return 1; } int need_stub(const type_t *iface) @@ -714,11 +788,47 @@ int need_proxy_file(const statement_list_t *stmts) return does_any_iface(stmts, need_proxy); } +int need_inline_stubs(const type_t *iface) +{ + const statement_t *stmt; + + if (get_stub_mode() == MODE_Os) return 1; + + STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) ) + { + const var_t *func = stmt->u.var; + if (is_local( func->attrs )) continue; + if (!is_interpreted_func( iface, func )) return 1; + } + return 0; +} + +static int need_proxy_and_inline_stubs(const type_t *iface) +{ + const statement_t *stmt; + + if (!need_proxy( iface )) return 0; + if (get_stub_mode() == MODE_Os) return 1; + + STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) ) + { + const var_t *func = stmt->u.var; + if (is_local( func->attrs )) continue; + if (!is_interpreted_func( iface, func )) return 1; + } + return 0; +} + int need_stub_files(const statement_list_t *stmts) { return does_any_iface(stmts, need_stub); } +int need_inline_stubs_file(const statement_list_t *stmts) +{ + return does_any_iface(stmts, need_inline_stubs); +} + static void write_proxy_stmts(const statement_list_t *stmts, unsigned int *proc_offset) { const statement_t *stmt; @@ -779,25 +889,41 @@ static void write_proxy_routines(const statement_list_t *stmts) int expr_eval_routines; unsigned int proc_offset = 0; char *file_id = proxy_token; - int i, count, have_baseiid; + int i, count, have_baseiid = 0; type_t **interfaces; const type_t * delegate_to; - write_exceptions( proxy ); + print_proxy( "#ifndef __REDQ_RPCPROXY_H_VERSION__\n"); + print_proxy( "#define __REQUIRED_RPCPROXY_H_VERSION__ %u\n", get_stub_mode() == MODE_Oif ? 475 : 440); + print_proxy( "#endif\n"); print_proxy( "\n"); - print_proxy( "struct __proxy_frame\n"); - print_proxy( "{\n"); - print_proxy( " __DECL_EXCEPTION_FRAME\n"); - print_proxy( " MIDL_STUB_MESSAGE _StubMsg;\n"); - print_proxy( " void *This;\n"); - print_proxy( "};\n"); + if (get_stub_mode() == MODE_Oif) print_proxy( "#define USE_STUBLESS_PROXY\n"); + print_proxy( "#include \"rpcproxy.h\"\n"); + print_proxy( "#ifndef __RPCPROXY_H_VERSION__\n"); + print_proxy( "#error This code needs a newer version of rpcproxy.h\n"); + print_proxy( "#endif /* __RPCPROXY_H_VERSION__ */\n"); print_proxy( "\n"); - print_proxy("static int __proxy_filter( struct __proxy_frame *__frame )\n"); - print_proxy( "{\n"); - print_proxy( " return (__frame->_StubMsg.dwStubPhase != PROXY_SENDRECEIVE);\n"); - print_proxy( "}\n"); + print_proxy( "#include \"%s\"\n", header_name); print_proxy( "\n"); + if (does_any_iface(stmts, need_proxy_and_inline_stubs)) + { + write_exceptions( proxy ); + print_proxy( "\n"); + print_proxy( "struct __proxy_frame\n"); + print_proxy( "{\n"); + print_proxy( " __DECL_EXCEPTION_FRAME\n"); + print_proxy( " MIDL_STUB_MESSAGE _StubMsg;\n"); + print_proxy( " void *This;\n"); + print_proxy( "};\n"); + print_proxy( "\n"); + print_proxy("static int __proxy_filter( struct __proxy_frame *__frame )\n"); + print_proxy( "{\n"); + print_proxy( " return (__frame->_StubMsg.dwStubPhase != PROXY_SENDRECEIVE);\n"); + print_proxy( "}\n"); + print_proxy( "\n"); + } + write_formatstringsdecl(proxy, indent, stmts, need_proxy); write_stubdescproto(); write_proxy_stmts(stmts, &proc_offset); @@ -840,7 +966,10 @@ static void write_proxy_routines(const statement_list_t *stmts) fprintf(proxy, "};\n"); fprintf(proxy, "\n"); - if ((have_baseiid = does_any_iface(stmts, need_delegation_indirect))) + for (i = 0; i < count; i++) + if ((have_baseiid = get_delegation_indirect( interfaces[i], NULL ))) break; + + if (have_baseiid) { fprintf(proxy, "static const IID * _%s_BaseIIDList[] =\n", file_id); fprintf(proxy, "{\n"); @@ -881,7 +1010,7 @@ static void write_proxy_routines(const statement_list_t *stmts) else fprintf(proxy, " 0,\n"); fprintf(proxy, " _%s_IID_Lookup,\n", file_id); fprintf(proxy, " %d,\n", count); - fprintf(proxy, " 1,\n"); + fprintf(proxy, " %d,\n", get_stub_mode() == MODE_Oif ? 2 : 1); fprintf(proxy, " 0,\n"); fprintf(proxy, " 0,\n"); fprintf(proxy, " 0,\n"); diff --git a/reactos/tools/widl/register.c b/reactos/tools/widl/register.c index f7092144a0b..c75a6acd88e 100644 --- a/reactos/tools/widl/register.c +++ b/reactos/tools/widl/register.c @@ -61,39 +61,88 @@ static const char *get_coclass_threading( const type_t *class ) return models[get_attrv( class->attrs, ATTR_THREADING )]; } -static int write_interface( const type_t *iface ) +static const type_t *find_ps_factory( const statement_list_t *stmts ) +{ + const statement_t *stmt; + + if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry ) + { + if (stmt->type == STMT_TYPE) + { + const type_t *type = stmt->u.type; + if (type_get_type(type) == TYPE_COCLASS && !strcmp( type->name, "PSFactoryBuffer" )) + return type; + } + } + return NULL; +} + +static void write_interface( const type_t *iface, const type_t *ps_factory ) { const UUID *uuid = get_attrp( iface->attrs, ATTR_UUID ); + const UUID *ps_uuid = get_attrp( ps_factory->attrs, ATTR_UUID ); - if (!uuid) return 0; - if (!is_object( iface )) return 0; + if (!uuid) return; + if (!is_object( iface )) return; if (!type_iface_get_inherit(iface)) /* special case for IUnknown */ { - put_str( indent, "ForceRemove '%s' = s '%s'\n", format_uuid( uuid ), iface->name ); - return 0; + put_str( indent, "'%s' = s '%s'\n", format_uuid( uuid ), iface->name ); + return; } - if (is_local( iface->attrs )) return 0; - put_str( indent, "ForceRemove '%s' = s '%s'\n", format_uuid( uuid ), iface->name ); + if (is_local( iface->attrs )) return; + put_str( indent, "'%s' = s '%s'\n", format_uuid( uuid ), iface->name ); put_str( indent, "{\n" ); indent++; put_str( indent, "NumMethods = s %u\n", count_methods( iface )); - put_str( indent, "ProxyStubClsid32 = s '%%CLSID_PSFactoryBuffer%%'\n" ); + put_str( indent, "ProxyStubClsid32 = s '%s'\n", format_uuid( ps_uuid )); indent--; put_str( indent, "}\n" ); - return 1; } -static int write_interfaces( const statement_list_t *stmts ) +static void write_interfaces( const statement_list_t *stmts, const type_t *ps_factory ) { const statement_t *stmt; - int count = 0; if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry ) { if (stmt->type == STMT_TYPE && type_get_type( stmt->u.type ) == TYPE_INTERFACE) - count += write_interface( stmt->u.type ); + write_interface( stmt->u.type, ps_factory ); + } +} + +static void write_typelib_interface( const type_t *iface, const typelib_t *typelib ) +{ + const UUID *typelib_uuid = get_attrp( typelib->attrs, ATTR_UUID ); + const UUID *uuid = get_attrp( iface->attrs, ATTR_UUID ); + unsigned int version = get_attrv( typelib->attrs, ATTR_VERSION ); + + if (!uuid) return; + if (!is_object( iface )) return; + if (!is_attr( iface->attrs, ATTR_OLEAUTOMATION ) && !is_attr( iface->attrs, ATTR_DISPINTERFACE )) + return; + put_str( indent, "'%s' = s '%s'\n", format_uuid( uuid ), iface->name ); + put_str( indent, "{\n" ); + indent++; + put_str( indent, "ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}'\n" ); + put_str( indent, "ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}'\n" ); + if (version) + put_str( indent, "TypeLib = s '%s' { val Version = s '%u.%u' }\n", + format_uuid( typelib_uuid ), MAJORVERSION(version), MINORVERSION(version) ); + else + put_str( indent, "TypeLib = s '%s'", format_uuid( typelib_uuid )); + indent--; + put_str( indent, "}\n" ); +} + +static void write_typelib_interfaces( const typelib_t *typelib ) +{ + const statement_t *stmt; + + if (typelib->stmts) LIST_FOR_EACH_ENTRY( stmt, typelib->stmts, const statement_t, entry ) + { + if (stmt->type == STMT_TYPE && type_get_type( stmt->u.type ) == TYPE_INTERFACE) + write_typelib_interface( stmt->u.type, typelib ); } - return count; } static int write_coclass( const type_t *class, const typelib_t *typelib ) @@ -103,12 +152,13 @@ static int write_coclass( const type_t *class, const typelib_t *typelib ) const char *progid = get_attrp( class->attrs, ATTR_PROGID ); const char *vi_progid = get_attrp( class->attrs, ATTR_VIPROGID ); const char *threading = get_coclass_threading( class ); + unsigned int version = get_attrv( class->attrs, ATTR_VERSION ); if (!uuid) return 0; - if (typelib && !threading) return 0; + if (typelib && !threading && !progid) return 0; if (!descr) descr = class->name; - put_str( indent, "ForceRemove '%s' = s '%s'\n", format_uuid( uuid ), descr ); + put_str( indent, "'%s' = s '%s'\n", format_uuid( uuid ), descr ); put_str( indent++, "{\n" ); if (threading) put_str( indent, "InprocServer32 = s '%%MODULE%%' { val ThreadingModel = s '%s' }\n", threading ); @@ -116,10 +166,10 @@ static int write_coclass( const type_t *class, const typelib_t *typelib ) if (typelib) { const UUID *typelib_uuid = get_attrp( typelib->attrs, ATTR_UUID ); - const unsigned int version = get_attrv( typelib->attrs, ATTR_VERSION ); put_str( indent, "TypeLib = s '%s'\n", format_uuid( typelib_uuid )); - put_str( indent, "Version = s '%u.%u'\n", MAJORVERSION(version), MINORVERSION(version) ); + if (!version) version = get_attrv( typelib->attrs, ATTR_VERSION ); } + if (version) put_str( indent, "Version = s '%u.%u'\n", MAJORVERSION(version), MINORVERSION(version) ); if (vi_progid) put_str( indent, "VersionIndependentProgId = s '%s'\n", vi_progid ); put_str( --indent, "}\n" ); return 1; @@ -136,11 +186,6 @@ static void write_coclasses( const statement_list_t *stmts, const typelib_t *typ const type_t *type = stmt->u.type; if (type_get_type(type) == TYPE_COCLASS) write_coclass( type, typelib ); } - else if (stmt->type == STMT_LIBRARY) - { - const typelib_t *lib = stmt->u.lib; - write_coclasses( lib->stmts, lib ); - } } } @@ -183,27 +228,12 @@ static void write_progids( const statement_list_t *stmts ) const type_t *type = stmt->u.type; if (type_get_type(type) == TYPE_COCLASS) write_progid( type ); } - else if (stmt->type == STMT_LIBRARY) - { - write_progids( stmt->u.lib->stmts ); - } } } -/* put a string into the resource file */ -static inline void put_string( const char *str ) -{ - while (*str) - { - unsigned char ch = *str++; - put_word( toupper(ch) ); - } - put_word( 0 ); -} - void write_regscript( const statement_list_t *stmts ) { - int count; + const type_t *ps_factory; if (!do_regscript) return; if (do_everything && !need_proxy_file( stmts )) return; @@ -215,18 +245,12 @@ void write_regscript( const statement_list_t *stmts ) put_str( indent, "NoRemove Interface\n" ); put_str( indent++, "{\n" ); - count = write_interfaces( stmts ); + ps_factory = find_ps_factory( stmts ); + if (ps_factory) write_interfaces( stmts, ps_factory ); put_str( --indent, "}\n" ); put_str( indent, "NoRemove CLSID\n" ); put_str( indent++, "{\n" ); - if (count) - { - put_str( indent, "ForceRemove '%%CLSID_PSFactoryBuffer%%' = s 'PSFactoryBuffer'\n" ); - put_str( indent++, "{\n" ); - put_str( indent, "InprocServer32 = s '%%MODULE%%' { val ThreadingModel = s 'Both' }\n" ); - put_str( --indent, "}\n" ); - } write_coclasses( stmts, NULL ); put_str( --indent, "}\n" ); @@ -235,41 +259,8 @@ void write_regscript( const statement_list_t *stmts ) if (strendswith( regscript_name, ".res" )) /* create a binary resource file */ { - unsigned char *data = output_buffer; - size_t data_size = output_buffer_pos; - size_t header_size = 5 * sizeof(unsigned int) + 2 * sizeof(unsigned short); - - header_size += (strlen(regscript_token) + strlen("WINE_REGISTRY") + 2) * sizeof(unsigned short); - - init_output_buffer(); - - put_dword( 0 ); /* ResSize */ - put_dword( 32 ); /* HeaderSize */ - put_word( 0xffff ); /* ResType */ - put_word( 0x0000 ); - put_word( 0xffff ); /* ResName */ - put_word( 0x0000 ); - put_dword( 0 ); /* DataVersion */ - put_word( 0 ); /* Memory options */ - put_word( 0 ); /* Language */ - put_dword( 0 ); /* Version */ - put_dword( 0 ); /* Characteristics */ - - put_dword( data_size ); /* ResSize */ - put_dword( (header_size + 3) & ~3 ); /* HeaderSize */ - put_string( "WINE_REGISTRY" ); /* ResType */ - put_string( regscript_token ); /* ResName */ - align_output( 4 ); - put_dword( 0 ); /* DataVersion */ - put_word( 0 ); /* Memory options */ - put_word( 0 ); /* Language */ - put_dword( 0 ); /* Version */ - put_dword( 0 ); /* Characteristics */ - - put_data( data, data_size ); - free( data ); - align_output( 4 ); - flush_output_buffer( regscript_name ); + add_output_to_resources( "WINE_REGISTRY", regscript_token ); + flush_output_resources( regscript_name ); } else { @@ -281,3 +272,48 @@ void write_regscript( const statement_list_t *stmts ) error( "Failed to write to %s\n", regscript_name ); } } + +void output_typelib_regscript( const typelib_t *typelib ) +{ + const UUID *typelib_uuid = get_attrp( typelib->attrs, ATTR_UUID ); + const char *descr = get_attrp( typelib->attrs, ATTR_HELPSTRING ); + const expr_t *lcid_expr = get_attrp( typelib->attrs, ATTR_LIBLCID ); + unsigned int version = get_attrv( typelib->attrs, ATTR_VERSION ); + unsigned int flags = 0; + + if (is_attr( typelib->attrs, ATTR_RESTRICTED )) flags |= 1; /* LIBFLAG_FRESTRICTED */ + if (is_attr( typelib->attrs, ATTR_CONTROL )) flags |= 2; /* LIBFLAG_FCONTROL */ + if (is_attr( typelib->attrs, ATTR_HIDDEN )) flags |= 4; /* LIBFLAG_FHIDDEN */ + + put_str( indent, "HKCR\n" ); + put_str( indent++, "{\n" ); + + put_str( indent, "NoRemove Typelib\n" ); + put_str( indent++, "{\n" ); + put_str( indent, "NoRemove '%s'\n", format_uuid( typelib_uuid )); + put_str( indent++, "{\n" ); + put_str( indent, "'%u.%u' = s '%s'\n", + MAJORVERSION(version), MINORVERSION(version), descr ? descr : typelib->name ); + put_str( indent++, "{\n" ); + put_str( indent, "'%x' { %s = s '%%MODULE%%' }\n", + lcid_expr ? lcid_expr->cval : 0, typelib_kind == SYS_WIN64 ? "win64" : "win32" ); + put_str( indent, "FLAGS = s '%u'\n", flags ); + put_str( --indent, "}\n" ); + put_str( --indent, "}\n" ); + put_str( --indent, "}\n" ); + + put_str( indent, "NoRemove Interface\n" ); + put_str( indent++, "{\n" ); + write_typelib_interfaces( typelib ); + put_str( --indent, "}\n" ); + + put_str( indent, "NoRemove CLSID\n" ); + put_str( indent++, "{\n" ); + write_coclasses( typelib->stmts, typelib ); + put_str( --indent, "}\n" ); + + write_progids( typelib->stmts ); + put_str( --indent, "}\n" ); + + add_output_to_resources( "WINE_REGISTRY", typelib_name ); +} diff --git a/reactos/tools/widl/server.c b/reactos/tools/widl/server.c index d02ffed66c9..3a8810e05e6 100644 --- a/reactos/tools/widl/server.c +++ b/reactos/tools/widl/server.c @@ -49,202 +49,209 @@ static void print_server(const char *format, ...) va_end(va); } +static void write_function_stub(const type_t *iface, const var_t *func, unsigned int proc_offset) +{ + const var_t *var; + unsigned char explicit_fc, implicit_fc; + int has_full_pointer = is_full_pointer_function(func); + const var_t *handle_var = get_func_handle_var( iface, func, &explicit_fc, &implicit_fc ); + + if (is_interpreted_func( iface, func )) return; + + print_server("struct __frame_%s_%s\n{\n", iface->name, get_name(func)); + indent++; + print_server("__DECL_EXCEPTION_FRAME\n"); + print_server("MIDL_STUB_MESSAGE _StubMsg;\n"); + + /* Declare arguments */ + declare_stub_args(server, indent, func); + + indent--; + print_server("};\n\n"); + + print_server("static void __finally_%s_%s(", iface->name, get_name(func)); + fprintf(server," struct __frame_%s_%s *__frame )\n{\n", iface->name, get_name(func)); + + indent++; + write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_FREE); + + if (!is_void(type_function_get_rettype(func->type))) + write_remoting_arguments(server, indent, func, "__frame->", PASS_RETURN, PHASE_FREE); + + if (has_full_pointer) + write_full_pointer_free(server, indent, func); + + indent--; + print_server("}\n\n"); + + print_server("void __RPC_STUB %s_%s( PRPC_MESSAGE _pRpcMessage )\n", iface->name, get_name(func)); + + /* write the functions body */ + fprintf(server, "{\n"); + indent++; + print_server("struct __frame_%s_%s __f, * const __frame = &__f;\n", iface->name, get_name(func)); + if (has_out_arg_or_return(func)) print_server("RPC_STATUS _Status;\n"); + fprintf(server, "\n"); + + print_server("NdrServerInitializeNew(\n"); + indent++; + print_server("_pRpcMessage,\n"); + print_server("&__frame->_StubMsg,\n"); + print_server("&%s_StubDesc);\n", iface->name); + indent--; + fprintf(server, "\n"); + print_server( "RpcExceptionInit( __server_filter, __finally_%s_%s );\n", iface->name, get_name(func)); + + write_parameters_init(server, indent, func, "__frame->"); + + if (explicit_fc == RPC_FC_BIND_PRIMITIVE) + { + print_server("__frame->%s = _pRpcMessage->Handle;\n", handle_var->name); + fprintf(server, "\n"); + } + + print_server("RpcTryFinally\n"); + print_server("{\n"); + indent++; + print_server("RpcTryExcept\n"); + print_server("{\n"); + indent++; + + if (has_full_pointer) + write_full_pointer_init(server, indent, func, TRUE); + + if (type_get_function_args(func->type)) + { + print_server("if ((_pRpcMessage->DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)\n"); + indent++; + print_server("NdrConvert(&__frame->_StubMsg, (PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);\n", + proc_offset); + indent--; + fprintf(server, "\n"); + + /* unmarshall arguments */ + write_remoting_arguments(server, indent, func, "__frame->", PASS_IN, PHASE_UNMARSHAL); + } + + print_server("if (__frame->_StubMsg.Buffer > __frame->_StubMsg.BufferEnd)\n"); + print_server("{\n"); + indent++; + print_server("RpcRaiseException(RPC_X_BAD_STUB_DATA);\n"); + indent--; + print_server("}\n"); + indent--; + print_server("}\n"); + print_server("RpcExcept(RPC_BAD_STUB_DATA_EXCEPTION_FILTER)\n"); + print_server("{\n"); + indent++; + print_server("RpcRaiseException(RPC_X_BAD_STUB_DATA);\n"); + indent--; + print_server("}\n"); + print_server("RpcEndExcept\n"); + fprintf(server, "\n"); + + /* Assign 'out' arguments */ + assign_stub_out_args(server, indent, func, "__frame->"); + + /* Call the real server function */ + print_server("%s%s%s", + is_void(type_function_get_rettype(func->type)) ? "" : "__frame->_RetVal = ", + prefix_server, get_name(func)); + + if (type_get_function_args(func->type)) + { + int first_arg = 1; + + fprintf(server, "(\n"); + indent++; + LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry ) + { + if (first_arg) + first_arg = 0; + else + fprintf(server, ",\n"); + if (is_context_handle(var->type)) + { + /* if the context_handle attribute appears in the chain of types + * without pointers being followed, then the context handle must + * be direct, otherwise it is a pointer */ + int is_ch_ptr = is_aliaschain_attr(var->type, ATTR_CONTEXTHANDLE) ? FALSE : TRUE; + print_server("("); + write_type_decl_left(server, var->type); + fprintf(server, ")%sNDRSContextValue(__frame->%s)", + is_ch_ptr ? "" : "*", var->name); + } + else + { + print_server("%s__frame->%s", is_array(var->type) && !type_array_is_decl_as_ptr(var->type) ? "*" : "", var->name); + } + } + fprintf(server, ");\n"); + indent--; + } + else + { + fprintf(server, "();\n"); + } + + if (has_out_arg_or_return(func)) + { + write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_BUFFERSIZE); + + if (!is_void(type_function_get_rettype(func->type))) + write_remoting_arguments(server, indent, func, "__frame->", PASS_RETURN, PHASE_BUFFERSIZE); + + print_server("_pRpcMessage->BufferLength = __frame->_StubMsg.BufferLength;\n"); + fprintf(server, "\n"); + print_server("_Status = I_RpcGetBuffer(_pRpcMessage);\n"); + print_server("if (_Status)\n"); + indent++; + print_server("RpcRaiseException(_Status);\n"); + indent--; + fprintf(server, "\n"); + print_server("__frame->_StubMsg.Buffer = _pRpcMessage->Buffer;\n"); + fprintf(server, "\n"); + } + + /* marshall arguments */ + write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_MARSHAL); + + /* marshall the return value */ + if (!is_void(type_function_get_rettype(func->type))) + write_remoting_arguments(server, indent, func, "__frame->", PASS_RETURN, PHASE_MARSHAL); + + indent--; + print_server("}\n"); + print_server("RpcFinally\n"); + print_server("{\n"); + indent++; + print_server("__finally_%s_%s( __frame );\n", iface->name, get_name(func)); + indent--; + print_server("}\n"); + print_server("RpcEndFinally\n"); + + /* calculate buffer length */ + fprintf(server, "\n"); + print_server("_pRpcMessage->BufferLength = __frame->_StubMsg.Buffer - (unsigned char *)_pRpcMessage->Buffer;\n"); + indent--; + fprintf(server, "}\n"); + fprintf(server, "\n"); +} + + static void write_function_stubs(type_t *iface, unsigned int *proc_offset) { const statement_t *stmt; - const var_t *var; - const var_t* explicit_handle_var; STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) ) { var_t *func = stmt->u.var; - int has_full_pointer = is_full_pointer_function(func); - /* check for a defined binding handle */ - explicit_handle_var = get_explicit_handle_var(func); - - print_server("struct __frame_%s_%s\n{\n", iface->name, get_name(func)); - indent++; - print_server("__DECL_EXCEPTION_FRAME\n"); - print_server("MIDL_STUB_MESSAGE _StubMsg;\n"); - - /* Declare arguments */ - declare_stub_args(server, indent, func); - - indent--; - print_server("};\n\n"); - - print_server("static void __finally_%s_%s(", iface->name, get_name(func)); - fprintf(server," struct __frame_%s_%s *__frame )\n{\n", iface->name, get_name(func)); - - indent++; - write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_FREE); - - if (!is_void(type_function_get_rettype(func->type))) - write_remoting_arguments(server, indent, func, "__frame->", PASS_RETURN, PHASE_FREE); - - if (has_full_pointer) - write_full_pointer_free(server, indent, func); - - indent--; - print_server("}\n\n"); - - print_server("void __RPC_STUB %s_%s( PRPC_MESSAGE _pRpcMessage )\n", iface->name, get_name(func)); - - /* write the functions body */ - fprintf(server, "{\n"); - indent++; - print_server("struct __frame_%s_%s __f, * const __frame = &__f;\n", iface->name, get_name(func)); - if (has_out_arg_or_return(func)) print_server("RPC_STATUS _Status;\n"); - fprintf(server, "\n"); - - print_server("NdrServerInitializeNew(\n"); - indent++; - print_server("_pRpcMessage,\n"); - print_server("&__frame->_StubMsg,\n"); - print_server("&%s_StubDesc);\n", iface->name); - indent--; - fprintf(server, "\n"); - print_server( "RpcExceptionInit( __server_filter, __finally_%s_%s );\n", iface->name, get_name(func)); - - write_parameters_init(server, indent, func, "__frame->"); - - if (explicit_handle_var) - { - print_server("__frame->%s = _pRpcMessage->Handle;\n", explicit_handle_var->name); - fprintf(server, "\n"); - } - - print_server("RpcTryFinally\n"); - print_server("{\n"); - indent++; - print_server("RpcTryExcept\n"); - print_server("{\n"); - indent++; - - if (has_full_pointer) - write_full_pointer_init(server, indent, func, TRUE); - - if (type_get_function_args(func->type)) - { - print_server("if ((_pRpcMessage->DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)\n"); - indent++; - print_server("NdrConvert(&__frame->_StubMsg, (PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);\n", - *proc_offset); - indent--; - fprintf(server, "\n"); - - /* unmarshall arguments */ - write_remoting_arguments(server, indent, func, "__frame->", PASS_IN, PHASE_UNMARSHAL); - } - - print_server("if (__frame->_StubMsg.Buffer > __frame->_StubMsg.BufferEnd)\n"); - print_server("{\n"); - indent++; - print_server("RpcRaiseException(RPC_X_BAD_STUB_DATA);\n"); - indent--; - print_server("}\n"); - indent--; - print_server("}\n"); - print_server("RpcExcept(RPC_BAD_STUB_DATA_EXCEPTION_FILTER)\n"); - print_server("{\n"); - indent++; - print_server("RpcRaiseException(RPC_X_BAD_STUB_DATA);\n"); - indent--; - print_server("}\n"); - print_server("RpcEndExcept\n"); - fprintf(server, "\n"); - - /* Assign 'out' arguments */ - assign_stub_out_args(server, indent, func, "__frame->"); - - /* Call the real server function */ - print_server("%s%s%s", - is_void(type_function_get_rettype(func->type)) ? "" : "__frame->_RetVal = ", - prefix_server, get_name(func)); - - if (type_get_function_args(func->type)) - { - int first_arg = 1; - - fprintf(server, "(\n"); - indent++; - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry ) - { - if (first_arg) - first_arg = 0; - else - fprintf(server, ",\n"); - if (is_context_handle(var->type)) - { - /* if the context_handle attribute appears in the chain of types - * without pointers being followed, then the context handle must - * be direct, otherwise it is a pointer */ - int is_ch_ptr = is_aliaschain_attr(var->type, ATTR_CONTEXTHANDLE) ? FALSE : TRUE; - print_server("("); - write_type_decl_left(server, var->type); - fprintf(server, ")%sNDRSContextValue(__frame->%s)", - is_ch_ptr ? "" : "*", var->name); - } - else - { - print_server("%s__frame->%s", is_array(var->type) && !type_array_is_decl_as_ptr(var->type) ? "*" : "", var->name); - } - } - fprintf(server, ");\n"); - indent--; - } - else - { - fprintf(server, "();\n"); - } - - if (has_out_arg_or_return(func)) - { - write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_BUFFERSIZE); - - if (!is_void(type_function_get_rettype(func->type))) - write_remoting_arguments(server, indent, func, "__frame->", PASS_RETURN, PHASE_BUFFERSIZE); - - print_server("_pRpcMessage->BufferLength = __frame->_StubMsg.BufferLength;\n"); - fprintf(server, "\n"); - print_server("_Status = I_RpcGetBuffer(_pRpcMessage);\n"); - print_server("if (_Status)\n"); - indent++; - print_server("RpcRaiseException(_Status);\n"); - indent--; - fprintf(server, "\n"); - print_server("__frame->_StubMsg.Buffer = _pRpcMessage->Buffer;\n"); - fprintf(server, "\n"); - } - - /* marshall arguments */ - write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_MARSHAL); - - /* marshall the return value */ - if (!is_void(type_function_get_rettype(func->type))) - write_remoting_arguments(server, indent, func, "__frame->", PASS_RETURN, PHASE_MARSHAL); - - indent--; - print_server("}\n"); - print_server("RpcFinally\n"); - print_server("{\n"); - indent++; - print_server("__finally_%s_%s( __frame );\n", iface->name, get_name(func)); - indent--; - print_server("}\n"); - print_server("RpcEndFinally\n"); - - /* calculate buffer length */ - fprintf(server, "\n"); - print_server("_pRpcMessage->BufferLength = __frame->_StubMsg.Buffer - (unsigned char *)_pRpcMessage->Buffer;\n"); - indent--; - fprintf(server, "}\n"); - fprintf(server, "\n"); + write_function_stub( iface, func, *proc_offset ); /* update proc_offset */ func->procstring_offset = *proc_offset; - *proc_offset += get_size_procformatstring_func( func ); + *proc_offset += get_size_procformatstring_func( iface, func ); } } @@ -262,7 +269,10 @@ static void write_dispatchtable(type_t *iface) STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) ) { var_t *func = stmt->u.var; - print_server("%s_%s,\n", iface->name, get_name(func)); + if (is_interpreted_func( iface, func )) + print_server("%s,\n", get_stub_mode() == MODE_Oif ? "NdrServerCall2" : "NdrServerCall"); + else + print_server("%s_%s,\n", iface->name, get_name(func)); method_count++; } print_server("0\n"); @@ -290,7 +300,27 @@ static void write_routinetable(type_t *iface) { var_t *func = stmt->u.var; if (is_local( func->attrs )) continue; - print_server( "(SERVER_ROUTINE)%s,\n", func->name ); + print_server( "(SERVER_ROUTINE)%s%s,\n", prefix_server, get_name(func)); + } + indent--; + print_server( "};\n\n" ); +} + + +static void write_rundown_routines(void) +{ + context_handle_t *ch; + int count = list_count( &context_handle_list ); + + if (!count) return; + print_server( "static const NDR_RUNDOWN RundownRoutines[] =\n" ); + print_server( "{\n" ); + indent++; + LIST_FOR_EACH_ENTRY( ch, &context_handle_list, context_handle_t, entry ) + { + print_server( "%s_rundown", ch->name ); + if (--count) fputc( ',', server ); + fputc( '\n', server ); } indent--; print_server( "};\n\n" ); @@ -335,7 +365,10 @@ static void write_stubdescriptor(type_t *iface, int expr_eval_routines) print_server("0,\n"); indent--; print_server("},\n"); - print_server("0,\n"); + if (!list_empty( &context_handle_list )) + print_server("RundownRoutines,\n"); + else + print_server("0,\n"); print_server("0,\n"); if (expr_eval_routines) print_server("ExprEvalRoutines,\n"); @@ -344,7 +377,7 @@ static void write_stubdescriptor(type_t *iface, int expr_eval_routines) print_server("0,\n"); print_server("__MIDL_TypeFormatString.Format,\n"); print_server("1, /* -error bounds_check flag */\n"); - print_server("0x10001, /* Ndr library version */\n"); + print_server("0x%x, /* Ndr library version */\n", get_stub_mode() == MODE_Oif ? 0x50002 : 0x10001); print_server("0,\n"); print_server("0x50100a4, /* MIDL Version 5.1.164 */\n"); print_server("0,\n"); @@ -470,28 +503,32 @@ static void write_server_routines(const statement_list_t *stmts) unsigned int proc_offset = 0; int expr_eval_routines; - write_exceptions( server ); - print_server("\n"); - print_server("struct __server_frame\n"); - print_server("{\n"); - print_server(" __DECL_EXCEPTION_FRAME\n"); - print_server(" MIDL_STUB_MESSAGE _StubMsg;\n"); - print_server("};\n"); - print_server("\n"); - print_server("static int __server_filter( struct __server_frame *__frame )\n"); - print_server( "{\n"); - print_server( " return (__frame->code == STATUS_ACCESS_VIOLATION) ||\n"); - print_server( " (__frame->code == STATUS_DATATYPE_MISALIGNMENT) ||\n"); - print_server( " (__frame->code == RPC_X_BAD_STUB_DATA) ||\n"); - print_server( " (__frame->code == RPC_S_INVALID_BOUND);\n"); - print_server( "}\n"); - print_server( "\n"); + if (need_inline_stubs_file( stmts )) + { + write_exceptions( server ); + print_server("\n"); + print_server("struct __server_frame\n"); + print_server("{\n"); + print_server(" __DECL_EXCEPTION_FRAME\n"); + print_server(" MIDL_STUB_MESSAGE _StubMsg;\n"); + print_server("};\n"); + print_server("\n"); + print_server("static int __server_filter( struct __server_frame *__frame )\n"); + print_server( "{\n"); + print_server( " return (__frame->code == STATUS_ACCESS_VIOLATION) ||\n"); + print_server( " (__frame->code == STATUS_DATATYPE_MISALIGNMENT) ||\n"); + print_server( " (__frame->code == RPC_X_BAD_STUB_DATA) ||\n"); + print_server( " (__frame->code == RPC_S_INVALID_BOUND);\n"); + print_server( "}\n"); + print_server( "\n"); + } write_formatstringsdecl(server, indent, stmts, need_stub); expr_eval_routines = write_expr_eval_routines(server, server_token); if (expr_eval_routines) write_expr_eval_routine_list(server, server_token); write_user_quad_list(server); + write_rundown_routines(); write_server_stmts(stmts, expr_eval_routines, &proc_offset); diff --git a/reactos/tools/widl/typegen.c b/reactos/tools/widl/typegen.c index 244baeafd45..dfc5a505166 100644 --- a/reactos/tools/widl/typegen.c +++ b/reactos/tools/widl/typegen.c @@ -47,14 +47,17 @@ #define ROUNDING(size, alignment) (((alignment) - 1) - (((size) + ((alignment) - 1)) & ((alignment) - 1))) static const type_t *current_structure; +static const var_t *current_func; static const type_t *current_iface; static struct list expr_eval_routines = LIST_INIT(expr_eval_routines); struct expr_eval_routine { - struct list entry; - const type_t *structure; - unsigned int baseoff; + struct list entry; + const type_t *iface; + const type_t *cont_type; + char *name; + unsigned int baseoff; const expr_t *expr; }; @@ -66,6 +69,19 @@ enum type_context TYPE_CONTEXT_CONTAINER_NO_POINTERS, }; +/* parameter flags in Oif mode */ +static const unsigned short MustSize = 0x0001; +static const unsigned short MustFree = 0x0002; +static const unsigned short IsPipe = 0x0004; +static const unsigned short IsIn = 0x0008; +static const unsigned short IsOut = 0x0010; +static const unsigned short IsReturn = 0x0020; +static const unsigned short IsBasetype = 0x0040; +static const unsigned short IsByValue = 0x0080; +static const unsigned short IsSimpleRef = 0x0100; +/* static const unsigned short IsDontCallFreeInst = 0x0200; */ +/* static const unsigned short SaveForAsyncFinish = 0x0400; */ + static unsigned int field_memsize(const type_t *type, unsigned int *offset); static unsigned int fields_memsize(const var_list_t *fields, unsigned int *align); static unsigned int type_memsize_and_alignment(const type_t *t, unsigned int *align); @@ -74,8 +90,12 @@ static int write_embedded_types(FILE *file, const attr_list_t *attrs, type_t *ty const char *name, int write_ptr, unsigned int *tfsoff); static const var_t *find_array_or_string_in_struct(const type_t *type); static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs, - type_t *type, int toplevel_param, - const char *name, unsigned int *typestring_offset); + type_t *type, enum type_context context, + const char *name, unsigned int *typestring_offset); +static unsigned int get_required_buffer_size_type( const type_t *type, const char *name, + const attr_list_t *attrs, int toplevel_param, + unsigned int *alignment ); +static unsigned int get_function_buffer_size( const var_t *func, enum pass pass ); static const char *string_of_type(unsigned char type) { @@ -203,6 +223,28 @@ unsigned char get_basic_fc(const type_t *type) return 0; } +static unsigned char get_basic_fc_signed(const type_t *type) +{ + switch (type_basic_get_type(type)) + { + case TYPE_BASIC_INT8: return RPC_FC_SMALL; + case TYPE_BASIC_INT16: return RPC_FC_SHORT; + case TYPE_BASIC_INT32: return RPC_FC_LONG; + case TYPE_BASIC_INT64: return RPC_FC_HYPER; + case TYPE_BASIC_INT: return RPC_FC_LONG; + case TYPE_BASIC_INT3264: return RPC_FC_INT3264; + case TYPE_BASIC_BYTE: return RPC_FC_BYTE; + case TYPE_BASIC_CHAR: return RPC_FC_CHAR; + case TYPE_BASIC_WCHAR: return RPC_FC_WCHAR; + case TYPE_BASIC_HYPER: return RPC_FC_HYPER; + case TYPE_BASIC_FLOAT: return RPC_FC_FLOAT; + case TYPE_BASIC_DOUBLE: return RPC_FC_DOUBLE; + case TYPE_BASIC_ERROR_STATUS_T: return RPC_FC_ERROR_STATUS_T; + case TYPE_BASIC_HANDLE: return RPC_FC_BIND_PRIMITIVE; + } + return 0; +} + static inline unsigned int clamp_align(unsigned int align) { unsigned int packing = (pointer_size == 4) ? win32_packing : win64_packing; @@ -236,6 +278,18 @@ unsigned char get_pointer_fc(const type_t *type, const attr_list_t *attrs, int t return type_array_get_ptr_default_fc(type); } +static unsigned char get_pointer_fc_context( const type_t *type, const attr_list_t *attrs, + enum type_context context ) +{ + int pointer_fc = get_pointer_fc(type, attrs, context == TYPE_CONTEXT_TOPLEVELPARAM); + + if (pointer_fc == RPC_FC_UP && is_attr( attrs, ATTR_OUT ) && + context == TYPE_CONTEXT_PARAM && is_object( current_iface )) + pointer_fc = RPC_FC_OP; + + return pointer_fc; +} + static unsigned char get_enum_fc(const type_t *type) { assert(type_get_type(type) == TYPE_ENUM); @@ -319,6 +373,23 @@ enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *att return TGT_INVALID; } +static int cant_be_null(const var_t *v) +{ + switch (typegen_detect_type(v->type, v->attrs, TDT_IGNORE_STRINGS)) + { + case TGT_ARRAY: + if (!type_array_is_decl_as_ptr( v->type )) return 0; + /* fall through */ + case TGT_POINTER: + return (get_pointer_fc(v->type, v->attrs, TRUE) == RPC_FC_RP); + case TGT_CTXT_HANDLE_POINTER: + return TRUE; + default: + return 0; + } + +} + static int get_padding(const var_list_t *fields) { unsigned short offset = 0; @@ -342,6 +413,65 @@ static int get_padding(const var_list_t *fields) return ROUNDING(offset, salign); } +static unsigned int get_stack_size( const type_t *type, const attr_list_t *attrs, int *by_value ) +{ + unsigned int stack_size; + int by_val; + + switch (typegen_detect_type( type, attrs, TDT_ALL_TYPES )) + { + case TGT_BASIC: + case TGT_ENUM: + case TGT_RANGE: + case TGT_STRUCT: + case TGT_UNION: + case TGT_USER_TYPE: + stack_size = type_memsize( type ); + by_val = (pointer_size < 8 || stack_size <= pointer_size); /* FIXME: should be platform-specific */ + break; + default: + by_val = 0; + break; + } + if (!by_val) stack_size = pointer_size; + if (by_value) *by_value = by_val; + return ROUND_SIZE( stack_size, pointer_size ); +} + +static unsigned char get_contexthandle_flags( const type_t *iface, const attr_list_t *attrs, + const type_t *type ) +{ + unsigned char flags = 0; + + if (is_attr(iface->attrs, ATTR_STRICTCONTEXTHANDLE)) flags |= NDR_STRICT_CONTEXT_HANDLE; + + if (is_ptr(type) && + !is_attr( type->attrs, ATTR_CONTEXTHANDLE ) && + !is_attr( attrs, ATTR_CONTEXTHANDLE )) + flags |= 0x80; + + if (is_attr(attrs, ATTR_IN)) + { + flags |= 0x40; + if (!is_attr(attrs, ATTR_OUT)) flags |= NDR_CONTEXT_HANDLE_CANNOT_BE_NULL; + } + if (is_attr(attrs, ATTR_OUT)) flags |= 0x20; + + return flags; +} + +static unsigned int get_rpc_flags( const attr_list_t *attrs ) +{ + unsigned int flags = 0; + + if (is_attr( attrs, ATTR_IDEMPOTENT )) flags |= 0x0001; + if (is_attr( attrs, ATTR_BROADCAST )) flags |= 0x0002; + if (is_attr( attrs, ATTR_MAYBE )) flags |= 0x0004; + if (is_attr( attrs, ATTR_MESSAGE )) flags |= 0x0100; + if (is_attr( attrs, ATTR_ASYNC )) flags |= 0x4000; + return flags; +} + unsigned char get_struct_fc(const type_t *type) { int has_pointer = 0; @@ -822,10 +952,230 @@ int decl_indirect(const type_t *t) type_get_type(t) != TYPE_ARRAY); } -static unsigned int write_procformatstring_type(FILE *file, int indent, - const type_t *type, - const attr_list_t *attrs, - int is_return) +static unsigned char get_parameter_fc( const type_t *type, const attr_list_t *attrs, int is_return, + unsigned short *flags, unsigned int *stack_size, + unsigned int *typestring_offset ) +{ + unsigned int alignment, server_size = 0, buffer_size = 0; + unsigned char fc = 0; + int is_byval; + int is_in = is_attr(attrs, ATTR_IN); + int is_out = is_attr(attrs, ATTR_OUT); + + if (is_return) is_out = TRUE; + else if (!is_in && !is_out) is_in = TRUE; + + *flags = 0; + *stack_size = get_stack_size( type, attrs, &is_byval ); + *typestring_offset = type->typestring_offset; + + if (is_in) *flags |= IsIn; + if (is_out) *flags |= IsOut; + if (is_return) *flags |= IsReturn; + + if (!is_string_type( attrs, type )) + buffer_size = get_required_buffer_size_type( type, NULL, attrs, TRUE, &alignment ); + + switch (typegen_detect_type( type, attrs, TDT_ALL_TYPES )) + { + case TGT_BASIC: + *flags |= IsBasetype; + fc = get_basic_fc_signed( type ); + if (fc == RPC_FC_BIND_PRIMITIVE) + { + buffer_size = 4; /* actually 0 but avoids setting MustSize */ + fc = RPC_FC_LONG; + } + break; + case TGT_ENUM: + *flags |= IsBasetype; + fc = get_enum_fc( type ); + break; + case TGT_RANGE: + *flags |= IsByValue; + break; + case TGT_STRUCT: + case TGT_UNION: + case TGT_USER_TYPE: + *flags |= MustFree | (is_byval ? IsByValue : IsSimpleRef); + break; + case TGT_IFACE_POINTER: + *flags |= MustFree; + break; + case TGT_ARRAY: + *flags |= MustFree; + if (type_array_is_decl_as_ptr(type) && type->details.array.ptr_tfsoff && + get_pointer_fc( type, attrs, !is_return ) == RPC_FC_RP) + *flags |= IsSimpleRef; + break; + case TGT_STRING: + *flags |= MustFree; + if (is_declptr( type ) && get_pointer_fc( type, attrs, !is_return ) == RPC_FC_RP) + { + /* skip over pointer description straight to string description */ + if (is_conformant_array( type )) *typestring_offset += 4; + else *typestring_offset += 2; + *flags |= IsSimpleRef; + } + break; + case TGT_CTXT_HANDLE_POINTER: + *flags |= IsSimpleRef; + *typestring_offset += 4; + /* fall through */ + case TGT_CTXT_HANDLE: + buffer_size = 20; + break; + case TGT_POINTER: + if (get_pointer_fc( type, attrs, !is_return ) == RPC_FC_RP) + { + const type_t *ref = type_pointer_get_ref( type ); + + if (!is_string_type( attrs, ref )) + buffer_size = get_required_buffer_size_type( ref, NULL, NULL, TRUE, &alignment ); + + switch (typegen_detect_type( ref, NULL, TDT_ALL_TYPES )) + { + case TGT_BASIC: + *flags |= IsSimpleRef | IsBasetype; + fc = get_basic_fc( ref ); + if (!is_in && is_out) server_size = pointer_size; + break; + case TGT_ENUM: + if ((fc = get_enum_fc( ref )) == RPC_FC_ENUM32) + { + *flags |= IsSimpleRef | IsBasetype; + if (!is_in && is_out) server_size = pointer_size; + } + else + { + server_size = pointer_size; + } + break; + case TGT_UNION: + case TGT_USER_TYPE: + case TGT_RANGE: + *flags |= IsSimpleRef | MustFree; + *typestring_offset = ref->typestring_offset; + if (!is_in && is_out) server_size = type_memsize( ref ); + break; + case TGT_STRING: + case TGT_POINTER: + case TGT_ARRAY: + case TGT_CTXT_HANDLE: + case TGT_CTXT_HANDLE_POINTER: + *flags |= MustFree; + server_size = pointer_size; + break; + case TGT_IFACE_POINTER: + *flags |= MustFree; + if (is_in && is_out) server_size = pointer_size; + break; + case TGT_STRUCT: + *flags |= IsSimpleRef | MustFree; + *typestring_offset = ref->typestring_offset; + switch (get_struct_fc(ref)) + { + case RPC_FC_STRUCT: + case RPC_FC_PSTRUCT: + case RPC_FC_BOGUS_STRUCT: + if (!is_in && is_out) server_size = type_memsize( ref ); + break; + default: + break; + } + break; + case TGT_INVALID: + assert(0); + } + } + else /* not ref pointer */ + { + *flags |= MustFree; + } + break; + case TGT_INVALID: + assert(0); + } + + if (!buffer_size) *flags |= MustSize; + + if (server_size) + { + server_size = (server_size + 7) / 8; + if (server_size < 8) *flags |= server_size << 13; + } + return fc; +} + +static unsigned char get_func_oi2_flags( const var_t *func ) +{ + const var_t *var; + var_list_t *args = type_get_function_args( func->type ); + type_t *ret_type = type_function_get_rettype( func->type ); + unsigned char oi2_flags = 0x40; /* HasExtensions */ + unsigned short flags; + unsigned int stack_size, typestring_offset; + + if (args) LIST_FOR_EACH_ENTRY( var, args, const var_t, entry ) + { + get_parameter_fc( var->type, var->attrs, 0, &flags, &stack_size, &typestring_offset ); + if (flags & MustSize) + { + if (flags & IsIn) oi2_flags |= 0x02; /* ClientMustSize */ + if (flags & IsOut) oi2_flags |= 0x01; /* ServerMustSize */ + } + } + + if (!is_void( ret_type )) + { + oi2_flags |= 0x04; /* HasRet */ + get_parameter_fc( ret_type, NULL, 1, &flags, &stack_size, &typestring_offset ); + if (flags & MustSize) oi2_flags |= 0x01; /* ServerMustSize */ + } + return oi2_flags; +} + +static unsigned int write_new_procformatstring_type(FILE *file, int indent, + const type_t *type, + const attr_list_t *attrs, + int is_return, unsigned int *stack_offset) +{ + char buffer[64]; + unsigned int stack_size, typestring_offset; + unsigned short flags; + unsigned char fc = get_parameter_fc( type, attrs, is_return, &flags, &stack_size, &typestring_offset ); + + strcpy( buffer, "/* flags:" ); + if (flags & MustSize) strcat( buffer, " must size," ); + if (flags & MustFree) strcat( buffer, " must free," ); + if (flags & IsPipe) strcat( buffer, " pipe," ); + if (flags & IsIn) strcat( buffer, " in," ); + if (flags & IsOut) strcat( buffer, " out," ); + if (flags & IsReturn) strcat( buffer, " return," ); + if (flags & IsBasetype) strcat( buffer, " base type," ); + if (flags & IsByValue) strcat( buffer, " by value," ); + if (flags & IsSimpleRef) strcat( buffer, " simple ref," ); + if (flags >> 13) sprintf( buffer + strlen(buffer), " srv size=%u,", (flags >> 13) * 8 ); + strcpy( buffer + strlen( buffer ) - 1, " */" ); + print_file( file, indent, "NdrFcShort(0x%hx),\t%s\n", flags, buffer ); + print_file( file, indent, "NdrFcShort(0x%hx), /* stack offset = %hu */\n", + *stack_offset, *stack_offset ); + if (flags & IsBasetype) + { + print_file( file, indent, "0x%02x, /* %s */\n", fc, string_of_type(fc) ); + print_file( file, indent, "0x0,\n" ); + } + else + print_file( file, indent, "NdrFcShort(0x%x), /* type offset = %u */\n", + typestring_offset, typestring_offset ); + *stack_offset += max( stack_size, pointer_size ); + return 6; +} + +static unsigned int write_old_procformatstring_type(FILE *file, int indent, + const type_t *type, + const attr_list_t *attrs, + int is_return, int is_interpreted) { unsigned int size; @@ -850,7 +1200,7 @@ static unsigned int write_procformatstring_type(FILE *file, int indent, } else { - fc = get_basic_fc(type); + fc = get_basic_fc_signed(type); if (fc == RPC_FC_BIND_PRIMITIVE) fc = RPC_FC_IGNORE; @@ -862,6 +1212,13 @@ static unsigned int write_procformatstring_type(FILE *file, int indent, } else { + unsigned short offset = type->typestring_offset; + + if (is_interpreted && is_array(type) && + type_array_is_decl_as_ptr(type) && + type->details.array.ptr_tfsoff) + offset = type->details.array.ptr_tfsoff; + if (is_return) print_file(file, indent, "0x52, /* FC_RETURN_PARAM */\n"); else if (is_in && is_out) @@ -871,17 +1228,206 @@ static unsigned int write_procformatstring_type(FILE *file, int indent, else print_file(file, indent, "0x4d, /* FC_IN_PARAM */\n"); - print_file(file, indent, "0x01,\n"); - print_file(file, indent, "NdrFcShort(0x%x), /* type offset = %u */\n", - type->typestring_offset, type->typestring_offset); + size = get_stack_size( type, attrs, NULL ); + print_file(file, indent, "0x%02x,\n", size / pointer_size ); + print_file(file, indent, "NdrFcShort(0x%x), /* type offset = %u */\n", offset, offset); size = 4; /* includes param type prefix */ } return size; } -static void write_procformatstring_func( FILE *file, int indent, - const var_t *func, unsigned int *offset ) +int is_interpreted_func( const type_t *iface, const var_t *func ) { + const char *str; + const var_t *var; + const var_list_t *args = type_get_function_args( func->type ); + const type_t *ret_type = type_function_get_rettype( func->type ); + + if (type_get_type( ret_type ) == TYPE_BASIC) + { + switch (type_basic_get_type( ret_type )) + { + case TYPE_BASIC_INT64: + case TYPE_BASIC_HYPER: + /* return value must fit in a long_ptr */ + if (pointer_size < 8) return 0; + break; + case TYPE_BASIC_FLOAT: + case TYPE_BASIC_DOUBLE: + /* floating point values can't be returned */ + return 0; + default: + break; + } + } + if (get_stub_mode() != MODE_Oif && args) + { + LIST_FOR_EACH_ENTRY( var, args, const var_t, entry ) + switch (type_get_type( var->type )) + { + case TYPE_BASIC: + switch (type_basic_get_type( var->type )) + { + /* floating point arguments are not supported in Oi mode */ + case TYPE_BASIC_FLOAT: return 0; + case TYPE_BASIC_DOUBLE: return 0; + default: break; + } + break; + /* unions passed by value are not supported in Oi mode */ + case TYPE_UNION: return 0; + case TYPE_ENCAPSULATED_UNION: return 0; + default: break; + } + } + + if ((str = get_attrp( func->attrs, ATTR_OPTIMIZE ))) return !strcmp( str, "i" ); + if ((str = get_attrp( iface->attrs, ATTR_OPTIMIZE ))) return !strcmp( str, "i" ); + return (get_stub_mode() != MODE_Os); +} + +static void write_proc_func_header( FILE *file, int indent, const type_t *iface, + const var_t *func, unsigned int *offset, + unsigned short num_proc ) +{ + var_t *var; + var_list_t *args = type_get_function_args( func->type ); + unsigned char explicit_fc, implicit_fc; + unsigned char handle_flags; + const var_t *handle_var = get_func_handle_var( iface, func, &explicit_fc, &implicit_fc ); + unsigned char oi_flags = RPC_FC_PROC_OIF_RPCFLAGS | RPC_FC_PROC_OIF_NEWINIT; + unsigned int rpc_flags = get_rpc_flags( func->attrs ); + unsigned int nb_args = 0; + unsigned int stack_size = 0; + unsigned short param_num = 0; + unsigned short handle_stack_offset = 0; + unsigned short handle_param_num = 0; + + if (is_full_pointer_function( func )) oi_flags |= RPC_FC_PROC_OIF_FULLPTR; + if (is_object( iface )) + { + oi_flags |= RPC_FC_PROC_OIF_OBJECT; + if (get_stub_mode() == MODE_Oif) oi_flags |= RPC_FC_PROC_OIF_OBJ_V2; + stack_size += pointer_size; + } + + if (args) LIST_FOR_EACH_ENTRY( var, args, var_t, entry ) + { + if (var == handle_var) + { + handle_stack_offset = stack_size; + handle_param_num = param_num; + } + stack_size += get_stack_size( var->type, var->attrs, NULL ); + param_num++; + nb_args++; + } + if (!is_void( type_function_get_rettype( func->type ))) + { + stack_size += pointer_size; + nb_args++; + } + + print_file( file, 0, "/* %u (procedure %s::%s) */\n", *offset, iface->name, func->name ); + print_file( file, indent, "0x%02x,\t/* %s */\n", implicit_fc, + implicit_fc ? string_of_type(implicit_fc) : "explicit handle" ); + print_file( file, indent, "0x%02x,\n", oi_flags ); + print_file( file, indent, "NdrFcLong(0x%x),\n", rpc_flags ); + print_file( file, indent, "NdrFcShort(0x%hx),\t/* method %hu */\n", num_proc, num_proc ); + print_file( file, indent, "NdrFcShort(0x%hx),\t/* stack size = %hu */\n", stack_size, stack_size ); + *offset += 10; + + if (!implicit_fc) + { + switch (explicit_fc) + { + case RPC_FC_BIND_PRIMITIVE: + handle_flags = 0; + print_file( file, indent, "0x%02x,\t/* %s */\n", explicit_fc, string_of_type(explicit_fc) ); + print_file( file, indent, "0x%02x,\n", handle_flags ); + print_file( file, indent, "NdrFcShort(0x%hx),\t/* stack offset = %hu */\n", + handle_stack_offset, handle_stack_offset ); + *offset += 4; + break; + case RPC_FC_BIND_GENERIC: + handle_flags = type_memsize( handle_var->type ); + print_file( file, indent, "0x%02x,\t/* %s */\n", explicit_fc, string_of_type(explicit_fc) ); + print_file( file, indent, "0x%02x,\n", handle_flags ); + print_file( file, indent, "NdrFcShort(0x%hx),\t/* stack offset = %hu */\n", + handle_stack_offset, handle_stack_offset ); + print_file( file, indent, "0x%02x,\n", get_generic_handle_offset( handle_var->type ) ); + print_file( file, indent, "0x%x,\t/* FC_PAD */\n", RPC_FC_PAD); + *offset += 6; + break; + case RPC_FC_BIND_CONTEXT: + handle_flags = get_contexthandle_flags( iface, handle_var->attrs, handle_var->type ); + print_file( file, indent, "0x%02x,\t/* %s */\n", explicit_fc, string_of_type(explicit_fc) ); + print_file( file, indent, "0x%02x,\n", handle_flags ); + print_file( file, indent, "NdrFcShort(0x%hx),\t/* stack offset = %hu */\n", + handle_stack_offset, handle_stack_offset ); + print_file( file, indent, "0x%02x,\n", get_context_handle_offset( handle_var->type ) ); + print_file( file, indent, "0x%02x,\t/* param %hu */\n", handle_param_num, handle_param_num ); + *offset += 6; + break; + } + } + + if (get_stub_mode() == MODE_Oif) + { + unsigned char oi2_flags = get_func_oi2_flags( func ); + unsigned char ext_flags = 0; + unsigned int size; + + if (is_attr( func->attrs, ATTR_NOTIFY )) ext_flags |= 0x08; /* HasNotify */ + if (is_attr( func->attrs, ATTR_NOTIFYFLAG )) ext_flags |= 0x10; /* HasNotify2 */ + + size = get_function_buffer_size( func, PASS_IN ); + print_file( file, indent, "NdrFcShort(0x%x),\t/* client buffer = %hu */\n", size, size ); + size = get_function_buffer_size( func, PASS_OUT ); + print_file( file, indent, "NdrFcShort(0x%x),\t/* server buffer = %hu */\n", size, size ); + print_file( file, indent, "0x%02x,\n", oi2_flags ); + print_file( file, indent, "0x%02x,\t/* %u params */\n", nb_args, nb_args ); + print_file( file, indent, "0x%02x,\n", pointer_size == 8 ? 10 : 8 ); + print_file( file, indent, "0x%02x,\n", ext_flags ); + print_file( file, indent, "NdrFcShort(0x0),\n" ); /* server corr hint */ + print_file( file, indent, "NdrFcShort(0x0),\n" ); /* client corr hint */ + print_file( file, indent, "NdrFcShort(0x0),\n" ); /* FIXME: notify index */ + *offset += 14; + if (pointer_size == 8) + { + unsigned short pos = 0, fpu_mask = 0; + + if (is_object( iface )) pos += 2; + if (args) LIST_FOR_EACH_ENTRY( var, args, var_t, entry ) + { + if (type_get_type( var->type ) == TYPE_BASIC) + { + switch (type_basic_get_type( var->type )) + { + case TYPE_BASIC_FLOAT: fpu_mask |= 1 << pos; break; + case TYPE_BASIC_DOUBLE: fpu_mask |= 2 << pos; break; + default: break; + } + } + pos += 2; + if (pos >= 16) break; + } + print_file( file, indent, "NdrFcShort(0x%x),\n", fpu_mask ); /* floating point mask */ + *offset += 2; + } + } +} + +static void write_procformatstring_func( FILE *file, int indent, const type_t *iface, + const var_t *func, unsigned int *offset, + unsigned short num_proc ) +{ + unsigned int stack_offset = is_object( iface ) ? pointer_size : 0; + int is_interpreted = is_interpreted_func( iface, func ); + int is_new_style = is_interpreted && (get_stub_mode() == MODE_Oif); + + if (is_interpreted) write_proc_func_header( file, indent, iface, func, offset, num_proc ); + /* emit argument data */ if (type_get_function_args(func->type)) { @@ -889,22 +1435,35 @@ static void write_procformatstring_func( FILE *file, int indent, LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry ) { print_file( file, 0, "/* %u (parameter %s) */\n", *offset, var->name ); - *offset += write_procformatstring_type(file, indent, var->type, var->attrs, FALSE); + if (is_new_style) + *offset += write_new_procformatstring_type(file, indent, var->type, var->attrs, + FALSE, &stack_offset); + else + *offset += write_old_procformatstring_type(file, indent, var->type, var->attrs, + FALSE, is_interpreted); } } /* emit return value data */ if (is_void(type_function_get_rettype(func->type))) { - print_file(file, 0, "/* %u (void) */\n", *offset); - print_file(file, indent, "0x5b, /* FC_END */\n"); - print_file(file, indent, "0x5c, /* FC_PAD */\n"); - *offset += 2; + if (!is_new_style) + { + print_file(file, 0, "/* %u (void) */\n", *offset); + print_file(file, indent, "0x5b, /* FC_END */\n"); + print_file(file, indent, "0x5c, /* FC_PAD */\n"); + *offset += 2; + } } else { print_file( file, 0, "/* %u (return value) */\n", *offset ); - *offset += write_procformatstring_type(file, indent, type_function_get_rettype(func->type), NULL, TRUE); + if (is_new_style) + *offset += write_new_procformatstring_type(file, indent, type_function_get_rettype(func->type), + NULL, TRUE, &stack_offset); + else + *offset += write_old_procformatstring_type(file, indent, type_function_get_rettype(func->type), + NULL, TRUE, is_interpreted); } } @@ -917,13 +1476,16 @@ static void write_procformatstring_stmts(FILE *file, int indent, const statement if (stmt->type == STMT_TYPE && type_get_type(stmt->u.type) == TYPE_INTERFACE) { const statement_t *stmt_func; - if (!pred(stmt->u.type)) - continue; - STATEMENTS_FOR_EACH_FUNC(stmt_func, type_iface_get_stmts(stmt->u.type)) + const type_t *iface = stmt->u.type; + const type_t *parent = type_iface_get_inherit( iface ); + int count = parent ? count_methods( parent ) : 0; + + if (!pred(iface)) continue; + STATEMENTS_FOR_EACH_FUNC(stmt_func, type_iface_get_stmts(iface)) { - const var_t *func = stmt_func->u.var; + var_t *func = stmt_func->u.var; if (is_local(func->attrs)) continue; - write_procformatstring_func( file, indent, func, offset ); + write_procformatstring_func( file, indent, iface, func, offset, count++ ); } } else if (stmt->type == STMT_LIBRARY) @@ -972,47 +1534,33 @@ void write_procformatstring_offsets( FILE *file, const type_t *iface ) print_file( file, indent, "};\n\n" ); } -static int write_base_type(FILE *file, const type_t *type, int convert_to_signed_type, unsigned int *typestring_offset) +static int write_base_type(FILE *file, const type_t *type, unsigned int *typestring_offset) { unsigned char fc; if (type_get_type(type) == TYPE_BASIC) - fc = get_basic_fc(type); + fc = get_basic_fc_signed(type); else if (type_get_type(type) == TYPE_ENUM) fc = get_enum_fc(type); else return 0; - if (convert_to_signed_type) - { - switch(fc) - { - case RPC_FC_USMALL: - fc = RPC_FC_SMALL; - break; - case RPC_FC_USHORT: - fc = RPC_FC_SHORT; - break; - case RPC_FC_ULONG: - fc = RPC_FC_LONG; - break; - } - } - print_file(file, 2, "0x%02x,\t/* %s */\n", fc, string_of_type(fc)); *typestring_offset += 1; return 1; } /* write conformance / variance descriptor */ -static unsigned int write_conf_or_var_desc(FILE *file, const type_t *structure, +static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type, unsigned int baseoff, const type_t *type, const expr_t *expr) { unsigned char operator_type = 0; unsigned char conftype = RPC_FC_NORMAL_CONFORMANCE; - const char *conftype_string = ""; + const char *conftype_string = "field"; const expr_t *subexpr; + const type_t *iface = NULL; + const char *name; if (!expr) { @@ -1035,20 +1583,22 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *structure, return 4; } - if (!structure) + if (!cont_type) /* top-level conformance */ { - /* Top-level conformance calculations are done inline. */ - print_file (file, 2, "0x%x,\t/* Corr desc: parameter */\n", - RPC_FC_TOP_LEVEL_CONFORMANCE); - print_file (file, 2, "0x0,\n"); - print_file (file, 2, "NdrFcShort(0x0),\n"); - return 4; + conftype = RPC_FC_TOP_LEVEL_CONFORMANCE; + conftype_string = "parameter"; + cont_type = current_func->type; + name = current_func->name; + iface = current_iface; } - - if (is_ptr(type) || (is_array(type) && type_array_is_decl_as_ptr(type))) + else { - conftype = RPC_FC_POINTER_CONFORMANCE; - conftype_string = "field pointer, "; + name = cont_type->name; + if (is_ptr(type) || (is_array(type) && type_array_is_decl_as_ptr(type))) + { + conftype = RPC_FC_POINTER_CONFORMANCE; + conftype_string = "field pointer"; + } } subexpr = expr; @@ -1096,23 +1646,45 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *structure, unsigned char param_type = 0; unsigned int offset = 0; const var_t *var; - var_list_t *fields = type_struct_get_fields(structure); + struct expr_loc expr_loc; - if (fields) LIST_FOR_EACH_ENTRY( var, fields, const var_t, entry ) + if (type_get_type(cont_type) == TYPE_FUNCTION) { - unsigned int size = field_memsize( var->type, &offset ); - if (var->name && !strcmp(var->name, subexpr->u.sval)) - { - correlation_variable = var->type; - break; - } - offset += size; - } - if (!correlation_variable) - error("write_conf_or_var_desc: couldn't find variable %s in structure\n", - subexpr->u.sval); + var_list_t *args = type_get_function_args( cont_type ); - correlation_variable = expr_resolve_type(NULL, structure, expr); + if (is_object( iface )) offset += pointer_size; + if (args) LIST_FOR_EACH_ENTRY( var, args, const var_t, entry ) + { + if (var->name && !strcmp(var->name, subexpr->u.sval)) + { + expr_loc.v = var; + correlation_variable = var->type; + break; + } + offset += get_stack_size( var->type, var->attrs, NULL ); + } + } + else + { + var_list_t *fields = type_struct_get_fields( cont_type ); + + if (fields) LIST_FOR_EACH_ENTRY( var, fields, const var_t, entry ) + { + unsigned int size = field_memsize( var->type, &offset ); + if (var->name && !strcmp(var->name, subexpr->u.sval)) + { + expr_loc.v = var; + correlation_variable = var->type; + break; + } + offset += size; + } + } + + if (!correlation_variable) + error("write_conf_or_var_desc: couldn't find variable %s in %s\n", subexpr->u.sval, name); + expr_loc.attr = NULL; + correlation_variable = expr_resolve_type(&expr_loc, cont_type, expr); offset -= baseoff; @@ -1167,14 +1739,14 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *structure, return 0; } - print_file(file, 2, "0x%x, /* Corr desc: %s%s */\n", - conftype | param_type, conftype_string, string_of_type(param_type)); - print_file(file, 2, "0x%x, /* %s */\n", operator_type, + print_file(file, 2, "0x%x,\t/* Corr desc: %s %s, %s */\n", + conftype | param_type, conftype_string, subexpr->u.sval, string_of_type(param_type)); + print_file(file, 2, "0x%x,\t/* %s */\n", operator_type, operator_type ? string_of_type(operator_type) : "no operators"); print_file(file, 2, "NdrFcShort(0x%hx),\t/* offset = %d */\n", (unsigned short)offset, offset); } - else + else if (!iface || is_interpreted_func( iface, current_func )) { unsigned int callback_offset = 0; struct expr_eval_routine *eval; @@ -1182,9 +1754,10 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *structure, LIST_FOR_EACH_ENTRY(eval, &expr_eval_routines, struct expr_eval_routine, entry) { - if (eval->structure == structure || - (eval->structure->name && structure->name && - !strcmp(eval->structure->name, structure->name) && + if (eval->cont_type == cont_type || + (type_get_type( eval->cont_type ) == type_get_type( cont_type ) && + eval->iface == iface && + eval->name && name && !strcmp(eval->name, name) && !compare_expr(eval->expr, expr))) { found = 1; @@ -1196,7 +1769,9 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *structure, if (!found) { eval = xmalloc (sizeof(*eval)); - eval->structure = structure; + eval->iface = iface; + eval->cont_type = cont_type; + eval->name = xstrdup( name ); eval->baseoff = baseoff; eval->expr = expr; list_add_tail (&expr_eval_routines, &eval->entry); @@ -1205,10 +1780,16 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *structure, if (callback_offset > USHRT_MAX) error("Maximum number of callback routines reached\n"); - print_file(file, 2, "0x%x, /* Corr desc: %s */\n", conftype, conftype_string); - print_file(file, 2, "0x%x, /* %s */\n", RPC_FC_CALLBACK, "FC_CALLBACK"); + print_file(file, 2, "0x%x,\t/* Corr desc: %s in %s */\n", conftype, conftype_string, name); + print_file(file, 2, "0x%x,\t/* %s */\n", RPC_FC_CALLBACK, "FC_CALLBACK"); print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", (unsigned short)callback_offset, callback_offset); } + else /* output a dummy corr desc that isn't used */ + { + print_file(file, 2, "0x%x,\t/* Corr desc: unused for %s */\n", conftype, name); + print_file(file, 2, "0x0,\n" ); + print_file(file, 2, "NdrFcShort(0x0),\n" ); + } return 4; } @@ -1301,6 +1882,7 @@ static unsigned int type_memsize_and_alignment(const type_t *t, unsigned int *al break; case RPC_FC_INT3264: case RPC_FC_UINT3264: + case RPC_FC_BIND_PRIMITIVE: assert( pointer_size ); size = pointer_size; if (size > *align) *align = size; @@ -1501,7 +2083,7 @@ void write_full_pointer_free(FILE *file, int indent, const var_t *func) static unsigned int write_nonsimple_pointer(FILE *file, const attr_list_t *attrs, const type_t *type, - int toplevel_param, + enum type_context context, unsigned int offset, unsigned int *typeformat_offset) { @@ -1511,7 +2093,7 @@ static unsigned int write_nonsimple_pointer(FILE *file, const attr_list_t *attrs int pointer_type; unsigned char flags = 0; - pointer_type = get_pointer_fc(type, attrs, toplevel_param); + pointer_type = get_pointer_fc_context(type, attrs, context); in_attr = is_attr(attrs, ATTR_IN); out_attr = is_attr(attrs, ATTR_OUT); @@ -1520,8 +2102,12 @@ static unsigned int write_nonsimple_pointer(FILE *file, const attr_list_t *attrs if (out_attr && !in_attr && pointer_type == RPC_FC_RP) flags |= RPC_FC_P_ONSTACK; - if (is_ptr(type) && is_declptr(type_pointer_get_ref(type))) - flags |= RPC_FC_P_DEREF; + if (is_ptr(type)) + { + type_t *ref = type_pointer_get_ref(type); + if(is_declptr(ref) && !is_user_type(ref)) + flags |= RPC_FC_P_DEREF; + } print_file(file, 2, "0x%x, 0x%x,\t\t/* %s", pointer_type, @@ -1542,7 +2128,8 @@ static unsigned int write_nonsimple_pointer(FILE *file, const attr_list_t *attrs return start_offset; } -static unsigned int write_simple_pointer(FILE *file, const attr_list_t *attrs, const type_t *type, int toplevel_param) +static unsigned int write_simple_pointer(FILE *file, const attr_list_t *attrs, + const type_t *type, enum type_context context) { unsigned char fc; unsigned char pointer_fc; @@ -1556,7 +2143,7 @@ static unsigned int write_simple_pointer(FILE *file, const attr_list_t *attrs, c if (is_string_type(attrs, type)) error("write_simple_pointer: can't handle type %s which is a string type\n", type->name); - pointer_fc = get_pointer_fc(type, attrs, toplevel_param); + pointer_fc = get_pointer_fc_context(type, attrs, context); ref = type_pointer_get_ref(type); if (type_get_type(ref) == TYPE_ENUM) @@ -1584,7 +2171,7 @@ static void print_start_tfs_comment(FILE *file, type_t *t, unsigned int tfsoff) static unsigned int write_pointer_tfs(FILE *file, const attr_list_t *attrs, type_t *type, unsigned int ref_offset, - int toplevel_param, + enum type_context context, unsigned int *typestring_offset) { unsigned int offset = *typestring_offset; @@ -1597,15 +2184,11 @@ static unsigned int write_pointer_tfs(FILE *file, const attr_list_t *attrs, { case TGT_BASIC: case TGT_ENUM: - *typestring_offset += write_simple_pointer(file, attrs, type, - toplevel_param); + *typestring_offset += write_simple_pointer(file, attrs, type, context); break; default: if (ref_offset) - write_nonsimple_pointer(file, attrs, type, - toplevel_param, - ref_offset, - typestring_offset); + write_nonsimple_pointer(file, attrs, type, context, ref_offset, typestring_offset); break; } @@ -1637,7 +2220,7 @@ static int user_type_has_variable_size(const type_t *t) return FALSE; } -static void write_user_tfs(FILE *file, type_t *type, unsigned int *tfsoff) +static unsigned int write_user_tfs(FILE *file, type_t *type, unsigned int *tfsoff) { unsigned int start, absoff, flags; const char *name = NULL; @@ -1648,6 +2231,8 @@ static void write_user_tfs(FILE *file, type_t *type, unsigned int *tfsoff) unsigned short funoff = user_type_offset(name); short reloff; + if (processed(type)) return type->typestring_offset; + guard_rec(type); if(user_type_has_variable_size(utype)) usize = 0; @@ -1695,6 +2280,7 @@ static void write_user_tfs(FILE *file, type_t *type, unsigned int *tfsoff) reloff = absoff - *tfsoff; print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%u) */\n", reloff, reloff, absoff); *tfsoff += 2; + return start; } static void write_member_type(FILE *file, const type_t *cont, @@ -1733,7 +2319,7 @@ static void write_member_type(FILE *file, const type_t *cont, print_file(file, 2, "0x%x,\t/* %s */\n", fc, string_of_type(fc)); *tfsoff += 1; } - else if (!write_base_type(file, type, TRUE, tfsoff)) + else if (!write_base_type(file, type, tfsoff)) error("Unsupported member type %d\n", type_get_type(type)); } @@ -1748,13 +2334,14 @@ static void write_array_element_type(FILE *file, const type_t *type, if (processed(ref)) { - write_nonsimple_pointer(file, NULL, elem, FALSE, ref->typestring_offset, tfsoff); + write_nonsimple_pointer(file, NULL, elem, TYPE_CONTEXT_CONTAINER, + ref->typestring_offset, tfsoff); return; } if (!is_string_type(NULL, elem) && (type_get_type(ref) == TYPE_BASIC || type_get_type(ref) == TYPE_ENUM)) { - *tfsoff += write_simple_pointer(file, NULL, elem, FALSE); + *tfsoff += write_simple_pointer(file, NULL, elem, TYPE_CONTEXT_CONTAINER); return; } } @@ -1837,11 +2424,12 @@ static int write_pointer_description_offsets( type_t *ref = type_pointer_get_ref(type); if (is_string_type(attrs, type)) - write_string_tfs(file, attrs, type, FALSE, NULL, typestring_offset); + write_string_tfs(file, attrs, type, TYPE_CONTEXT_CONTAINER, NULL, typestring_offset); else if (processed(ref)) - write_nonsimple_pointer(file, attrs, type, FALSE, ref->typestring_offset, typestring_offset); + write_nonsimple_pointer(file, attrs, type, TYPE_CONTEXT_CONTAINER, + ref->typestring_offset, typestring_offset); else if (type_get_type(ref) == TYPE_BASIC || type_get_type(ref) == TYPE_ENUM) - *typestring_offset += write_simple_pointer(file, attrs, type, FALSE); + *typestring_offset += write_simple_pointer(file, attrs, type, TYPE_CONTEXT_CONTAINER); else error("write_pointer_description_offsets: type format string unknown\n"); } @@ -1852,7 +2440,7 @@ static int write_pointer_description_offsets( * pointer has to be written in-place here */ if (is_string_type(attrs, type)) offset += 4; - write_nonsimple_pointer(file, attrs, type, FALSE, offset, typestring_offset); + write_nonsimple_pointer(file, attrs, type, TYPE_CONTEXT_CONTAINER, offset, typestring_offset); } return 1; @@ -2194,20 +2782,20 @@ int is_declptr(const type_t *t) } static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs, - type_t *type, int toplevel_param, + type_t *type, enum type_context context, const char *name, unsigned int *typestring_offset) { unsigned int start_offset; unsigned char rtype; type_t *elem_type; + int is_processed = processed(type); start_offset = *typestring_offset; - update_tfsoff(type, start_offset, file); if (is_declptr(type)) { unsigned char flag = is_conformant_array(type) ? 0 : RPC_FC_P_SIMPLEPOINTER; - int pointer_type = get_pointer_fc(type, attrs, toplevel_param); + int pointer_type = get_pointer_fc_context(type, attrs, context); if (!pointer_type) pointer_type = RPC_FC_RP; print_start_tfs_comment(file, type, *typestring_offset); @@ -2220,6 +2808,7 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs, print_file(file, 2, "NdrFcShort(0x2),\n"); *typestring_offset += 2; } + is_processed = FALSE; } if (is_array(type)) @@ -2244,6 +2833,8 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs, { unsigned int dim = type_array_get_dim(type); + if (is_processed) return start_offset; + /* FIXME: multi-dimensional array */ if (0xffffu < dim) error("array size for parameter %s exceeds %u bytes by %u bytes\n", @@ -2259,6 +2850,7 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs, print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", (unsigned short)dim, dim); *typestring_offset += 2; + update_tfsoff(type, start_offset, file); return start_offset; } else if (is_conformant_array(type)) @@ -2277,10 +2869,13 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs, : 0), type, type_array_get_conformance(type)); + update_tfsoff(type, start_offset, file); return start_offset; } else { + if (is_processed) return start_offset; + if (rtype == RPC_FC_WCHAR) WRITE_FCTYPE(file, FC_C_WSTRING, *typestring_offset); else @@ -2288,6 +2883,7 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs, print_file(file, 2, "0x%x, /* FC_PAD */\n", RPC_FC_PAD); *typestring_offset += 2; + update_tfsoff(type, start_offset, file); return start_offset; } } @@ -2493,6 +3089,8 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type, unsigned char fc = get_struct_fc(type); var_list_t *fields = type_struct_get_fields(type); + if (processed(type)) return type->typestring_offset; + guard_rec(type); current_structure = type; @@ -2509,7 +3107,7 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type, if (array && !processed(array->type)) { if(is_string_type(array->attrs, array->type)) - write_string_tfs(file, array->attrs, array->type, FALSE, array->name, tfsoff); + write_string_tfs(file, array->attrs, array->type, TYPE_CONTEXT_CONTAINER, array->name, tfsoff); else write_array_tfs(file, array->attrs, array->type, array->name, tfsoff); } @@ -2578,11 +3176,11 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type, { case TGT_POINTER: if (is_string_type(f->attrs, ft)) - write_string_tfs(file, f->attrs, ft, FALSE, f->name, tfsoff); + write_string_tfs(file, f->attrs, ft, TYPE_CONTEXT_CONTAINER, f->name, tfsoff); else write_pointer_tfs(file, f->attrs, ft, type_pointer_get_ref(ft)->typestring_offset, - FALSE, tfsoff); + TYPE_CONTEXT_CONTAINER, tfsoff); break; case TGT_ARRAY: if (type_array_is_decl_as_ptr(ft)) @@ -2596,7 +3194,7 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type, * pointer has to be written in-place here */ if (is_string_type(f->attrs, ft)) offset += 4; - write_nonsimple_pointer(file, f->attrs, ft, FALSE, offset, tfsoff); + write_nonsimple_pointer(file, f->attrs, ft, TYPE_CONTEXT_CONTAINER, offset, tfsoff); } break; default: @@ -2642,7 +3240,8 @@ static void write_branch_type(FILE *file, const type_t *t, unsigned int *tfsoff) *tfsoff += 2; } -static unsigned int write_union_tfs(FILE *file, type_t *type, unsigned int *tfsoff) +static unsigned int write_union_tfs(FILE *file, const attr_list_t *attrs, + type_t *type, unsigned int *tfsoff) { unsigned int start_offset; unsigned int size; @@ -2652,6 +3251,10 @@ static unsigned int write_union_tfs(FILE *file, type_t *type, unsigned int *tfso short nodeftype = 0xffff; var_t *f; + if (processed(type) && + (type_get_type(type) == TYPE_ENCAPSULATED_UNION || !is_attr(type->attrs, ATTR_SWITCHTYPE))) + return type->typestring_offset; + guard_rec(type); size = type_memsize(type); @@ -2678,7 +3281,8 @@ static unsigned int write_union_tfs(FILE *file, type_t *type, unsigned int *tfso if (type_get_type(st) == TYPE_BASIC) { - switch (get_basic_fc(st)) + fc = get_basic_fc(st); + switch (fc) { case RPC_FC_CHAR: case RPC_FC_SMALL: @@ -2689,7 +3293,6 @@ static unsigned int write_union_tfs(FILE *file, type_t *type, unsigned int *tfso case RPC_FC_USHORT: case RPC_FC_LONG: case RPC_FC_ULONG: - fc = get_basic_fc(st); break; default: fc = 0; @@ -2708,13 +3311,14 @@ static unsigned int write_union_tfs(FILE *file, type_t *type, unsigned int *tfso } else if (is_attr(type->attrs, ATTR_SWITCHTYPE)) { - static const expr_t dummy_expr; /* FIXME */ + const expr_t *switch_is = get_attrp(attrs, ATTR_SWITCHIS); const type_t *st = get_attrp(type->attrs, ATTR_SWITCHTYPE); unsigned char fc; if (type_get_type(st) == TYPE_BASIC) { - switch (get_basic_fc(st)) + fc = get_basic_fc(st); + switch (fc) { case RPC_FC_CHAR: case RPC_FC_SMALL: @@ -2725,7 +3329,6 @@ static unsigned int write_union_tfs(FILE *file, type_t *type, unsigned int *tfso case RPC_FC_ULONG: case RPC_FC_ENUM16: case RPC_FC_ENUM32: - fc = get_basic_fc(st); break; default: fc = 0; @@ -2741,8 +3344,7 @@ static unsigned int write_union_tfs(FILE *file, type_t *type, unsigned int *tfso print_file(file, 2, "0x%x,\t/* Switch type= %s */\n", fc, string_of_type(fc)); *tfsoff += 2; - - *tfsoff += write_conf_or_var_desc(file, NULL, *tfsoff, st, &dummy_expr ); + *tfsoff += write_conf_or_var_desc(file, current_structure, 0, st, switch_is ); print_file(file, 2, "NdrFcShort(0x2),\t/* Offset= 2 (%u) */\n", *tfsoff + 2); *tfsoff += 2; print_file(file, 0, "/* %u */\n", *tfsoff); @@ -2802,7 +3404,10 @@ static unsigned int write_ip_tfs(FILE *file, const attr_list_t *attrs, type_t *t unsigned int start_offset = *typeformat_offset; expr_t *iid = get_attrp(attrs, ATTR_IIDIS); + if (!iid && processed(type)) return type->typestring_offset; + print_start_tfs_comment(file, type, start_offset); + update_tfsoff(type, start_offset, file); if (iid) { @@ -2819,7 +3424,6 @@ static unsigned int write_ip_tfs(FILE *file, const attr_list_t *attrs, type_t *t if (! uuid) error("%s: interface %s missing UUID\n", __FUNCTION__, base->name); - update_tfsoff(type, start_offset, file); print_file(file, 2, "0x2f,\t/* FC_IP */\n"); print_file(file, 2, "0x5a,\t/* FC_CONSTANT_IID */\n"); print_file(file, 2, "NdrFcLong(0x%08x),\n", uuid->Data1); @@ -2838,27 +3442,26 @@ static unsigned int write_ip_tfs(FILE *file, const attr_list_t *attrs, type_t *t static unsigned int write_contexthandle_tfs(FILE *file, const attr_list_t *attrs, - const type_t *type, + type_t *type, + int toplevel_param, unsigned int *typeformat_offset) { unsigned int start_offset = *typeformat_offset; - unsigned char flags = 0; + unsigned char flags = get_contexthandle_flags( current_iface, attrs, type ); - if (is_attr(current_iface->attrs, ATTR_STRICTCONTEXTHANDLE)) - flags |= NDR_STRICT_CONTEXT_HANDLE; + print_start_tfs_comment(file, type, start_offset); - if (is_ptr(type)) - flags |= 0x80; - if (is_attr(attrs, ATTR_IN)) + if (flags & 0x80) /* via ptr */ { - flags |= 0x40; - if (!is_attr(attrs, ATTR_OUT)) - flags |= NDR_CONTEXT_HANDLE_CANNOT_BE_NULL; + int pointer_type = get_pointer_fc( type, attrs, toplevel_param ); + if (!pointer_type) pointer_type = RPC_FC_RP; + *typeformat_offset += 4; + print_file(file, 2,"0x%x, 0x0,\t/* %s */\n", pointer_type, string_of_type(pointer_type) ); + print_file(file, 2, "NdrFcShort(0x2),\t /* Offset= 2 (%u) */\n", *typeformat_offset); + print_file(file, 0, "/* %2u */\n", *typeformat_offset); } - if (is_attr(attrs, ATTR_OUT)) - flags |= 0x20; - WRITE_FCTYPE(file, FC_BIND_CONTEXT, *typeformat_offset); + print_file(file, 2, "0x%02x,\t/* FC_BIND_CONTEXT */\n", RPC_FC_BIND_CONTEXT); print_file(file, 2, "0x%x,\t/* Context flags: ", flags); /* return and can't be null values overlap */ if (((flags & 0x21) != 0x21) && (flags & NDR_CONTEXT_HANDLE_CANNOT_BE_NULL)) @@ -2878,10 +3481,11 @@ static unsigned int write_contexthandle_tfs(FILE *file, if (flags & 0x80) print_file(file, 0, "via ptr, "); print_file(file, 0, "*/\n"); - print_file(file, 2, "0, /* FIXME: rundown routine index*/\n"); + print_file(file, 2, "0x%x,\t/* rundown routine */\n", get_context_handle_offset( type )); print_file(file, 2, "0, /* FIXME: param num */\n"); *typeformat_offset += 4; + update_tfsoff( type, start_offset, file ); return start_offset; } @@ -2907,6 +3511,7 @@ static unsigned int write_range_tfs(FILE *file, const attr_list_t *attrs, print_file(file, 2, "0x%x,\t/* %s */\n", fc, string_of_type(fc)); print_file(file, 2, "NdrFcLong(0x%x),\t/* %u */\n", range_min->cval, range_min->cval); print_file(file, 2, "NdrFcLong(0x%x),\t/* %u */\n", range_max->cval, range_max->cval); + update_tfsoff( type, start_offset, file ); *typeformat_offset += 10; return start_offset; @@ -2924,14 +3529,12 @@ static unsigned int write_type_tfs(FILE *file, int indent, { case TGT_CTXT_HANDLE: case TGT_CTXT_HANDLE_POINTER: - return write_contexthandle_tfs(file, attrs, type, typeformat_offset); + return write_contexthandle_tfs(file, attrs, type, + context == TYPE_CONTEXT_TOPLEVELPARAM, typeformat_offset); case TGT_USER_TYPE: - write_user_tfs(file, type, typeformat_offset); - return type->typestring_offset; + return write_user_tfs(file, type, typeformat_offset); case TGT_STRING: - return write_string_tfs(file, attrs, type, - context == TYPE_CONTEXT_TOPLEVELPARAM, - name, typeformat_offset); + return write_string_tfs(file, attrs, type, context, name, typeformat_offset); case TGT_ARRAY: { unsigned int off; @@ -2948,7 +3551,7 @@ static unsigned int write_type_tfs(FILE *file, int indent, int ptr_type; ptr_type = get_pointer_fc(type, attrs, context == TYPE_CONTEXT_TOPLEVELPARAM); - if (ptr_type != RPC_FC_RP) + if (ptr_type != RPC_FC_RP || type_array_is_decl_as_ptr(type)) { unsigned int absoff = type->typestring_offset; short reloff = absoff - (*typeformat_offset + 2); @@ -2958,17 +3561,17 @@ static unsigned int write_type_tfs(FILE *file, int indent, string_of_type(ptr_type)); print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%u) */\n", reloff, reloff, absoff); + if (ptr_type != RPC_FC_RP) update_tfsoff( type, off, file ); *typeformat_offset += 4; } + type->details.array.ptr_tfsoff = off; } return off; } case TGT_STRUCT: - if (processed(type)) return type->typestring_offset; return write_struct_tfs(file, type, name, typeformat_offset); case TGT_UNION: - if (processed(type)) return type->typestring_offset; - return write_union_tfs(file, type, typeformat_offset); + return write_union_tfs(file, attrs, type, typeformat_offset); case TGT_ENUM: case TGT_BASIC: /* nothing to do */ @@ -2983,27 +3586,20 @@ static unsigned int write_type_tfs(FILE *file, int indent, case TGT_IFACE_POINTER: return write_ip_tfs(file, attrs, type, typeformat_offset); case TGT_POINTER: - if (processed(type_pointer_get_ref(type))) - offset = type_pointer_get_ref(type)->typestring_offset; + { + enum type_context ref_context; + if (context == TYPE_CONTEXT_TOPLEVELPARAM) + ref_context = TYPE_CONTEXT_PARAM; + else if (context == TYPE_CONTEXT_CONTAINER_NO_POINTERS) + ref_context = TYPE_CONTEXT_CONTAINER; else - { - enum type_context ref_context; - if (context == TYPE_CONTEXT_TOPLEVELPARAM) - ref_context = TYPE_CONTEXT_PARAM; - else if (context == TYPE_CONTEXT_CONTAINER_NO_POINTERS) - ref_context = TYPE_CONTEXT_CONTAINER; - else - ref_context = context; - offset = write_type_tfs( - file, indent, attrs, type_pointer_get_ref(type), name, - ref_context, typeformat_offset); - } + ref_context = context; + offset = write_type_tfs( file, indent, attrs, type_pointer_get_ref(type), name, + ref_context, typeformat_offset); if (context == TYPE_CONTEXT_CONTAINER_NO_POINTERS) return 0; - else - return write_pointer_tfs(file, attrs, type, offset, - context == TYPE_CONTEXT_TOPLEVELPARAM, - typeformat_offset); + return write_pointer_tfs(file, attrs, type, offset, context, typeformat_offset); + } case TGT_INVALID: break; } @@ -3044,28 +3640,19 @@ static unsigned int process_tfs_stmts(FILE *file, const statement_list_t *stmts, STATEMENTS_FOR_EACH_FUNC( stmt_func, type_iface_get_stmts(iface) ) { const var_t *func = stmt_func->u.var; - if (is_local(func->attrs)) continue; + current_func = func; + if (is_local(func->attrs)) continue; - if (!is_void(type_function_get_rettype(func->type))) - { - update_tfsoff(type_function_get_rettype(func->type), - write_type_tfs( - file, 2, func->attrs, - type_function_get_rettype(func->type), - func->name, TYPE_CONTEXT_PARAM, - typeformat_offset), - file); - } + if (!is_void(type_function_get_rettype(func->type))) + { + write_type_tfs( file, 2, func->attrs, type_function_get_rettype(func->type), + func->name, TYPE_CONTEXT_PARAM, typeformat_offset); + } - if (type_get_function_args(func->type)) - LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry ) - update_tfsoff( - var->type, - write_type_tfs( - file, 2, var->attrs, var->type, var->name, - TYPE_CONTEXT_TOPLEVELPARAM, - typeformat_offset), - file); + if (type_get_function_args(func->type)) + LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry ) + write_type_tfs( file, 2, var->attrs, var->type, var->name, + TYPE_CONTEXT_TOPLEVELPARAM, typeformat_offset ); } } @@ -3107,7 +3694,7 @@ static unsigned int get_required_buffer_size_type( const type_t *type, const char *name, const attr_list_t *attrs, int toplevel_param, unsigned int *alignment) { *alignment = 0; - switch (typegen_detect_type(type, NULL, TDT_IGNORE_STRINGS|TDT_IGNORE_RANGES)) + switch (typegen_detect_type(type, NULL, TDT_IGNORE_RANGES)) { case TGT_USER_TYPE: { @@ -3181,38 +3768,33 @@ static unsigned int get_required_buffer_size_type( break; case TGT_POINTER: - if (get_pointer_fc(type, attrs, toplevel_param) == RPC_FC_RP) { + unsigned int size, align; const type_t *ref = type_pointer_get_ref(type); - switch (typegen_detect_type(ref, NULL, TDT_ALL_TYPES)) + if (is_string_type( attrs, ref )) break; + if (!(size = get_required_buffer_size_type( ref, name, NULL, FALSE, &align ))) break; + if (get_pointer_fc(type, attrs, toplevel_param) != RPC_FC_RP) { - case TGT_BASIC: - case TGT_ENUM: - case TGT_RANGE: - return get_required_buffer_size_type( ref, name, NULL, FALSE, alignment ); - case TGT_STRUCT: - if (get_struct_fc(ref) == RPC_FC_STRUCT) - return get_required_buffer_size_type( ref, name, NULL, FALSE, alignment ); - break; - case TGT_USER_TYPE: - case TGT_CTXT_HANDLE: - case TGT_CTXT_HANDLE_POINTER: - case TGT_STRING: - case TGT_POINTER: - case TGT_ARRAY: - case TGT_IFACE_POINTER: - case TGT_UNION: - case TGT_INVALID: - break; + size += 4 + align; + align = 4; } + *alignment = align; + return size; } - break; case TGT_ARRAY: if (get_pointer_fc(type, attrs, toplevel_param) == RPC_FC_RP) - return type_array_get_dim(type) * - get_required_buffer_size_type(type_array_get_element(type), name, - NULL, FALSE, alignment); + { + switch (get_array_fc(type)) + { + case RPC_FC_SMFARRAY: + case RPC_FC_LGFARRAY: + return type_array_get_dim(type) * + get_required_buffer_size_type(type_array_get_element(type), name, + NULL, FALSE, alignment); + } + } + break; default: break; @@ -3453,8 +4035,8 @@ expr_t *get_size_is_expr(const type_t *t, const char *name) return x; } -static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char *local_var_prefix, - enum remoting_phase phase, const var_t *var) +void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char *local_var_prefix, + enum remoting_phase phase, const var_t *var, int valid_variance) { const type_t *type = var->type; /* get fundamental type for the argument */ @@ -3475,9 +4057,14 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char if (type_array_has_variance(type)) { print_file(file, indent, "__frame->_StubMsg.Offset = 0;\n"); /* FIXME */ - print_file(file, indent, "__frame->_StubMsg.ActualCount = (ULONG_PTR)"); - write_expr(file, type_array_get_variance(type), 1, 1, NULL, NULL, local_var_prefix); - fprintf(file, ";\n\n"); + if (valid_variance) + { + print_file(file, indent, "__frame->_StubMsg.ActualCount = (ULONG_PTR)"); + write_expr(file, type_array_get_variance(type), 1, 1, NULL, NULL, local_var_prefix); + fprintf(file, ";\n\n"); + } + else + print_file(file, indent, "__frame->_StubMsg.ActualCount = __frame->_StubMsg.MaxCount;\n\n"); } } break; @@ -3524,8 +4111,9 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const enum pass pass, enum remoting_phase phase, const var_t *var) { int in_attr, out_attr, pointer_type; + const char *type_str = NULL; const type_t *type = var->type; - unsigned int start_offset = type->typestring_offset; + unsigned int alignment, start_offset = type->typestring_offset; if (is_ptr(type) || is_array(type)) pointer_type = get_pointer_fc(type, var->attrs, pass != PASS_RETURN); @@ -3550,7 +4138,9 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const break; } - write_parameter_conf_or_var_exprs(file, indent, local_var_prefix, phase, var); + if (phase == PHASE_BUFFERSIZE && get_required_buffer_size( var, &alignment, pass )) return; + + write_parameter_conf_or_var_exprs(file, indent, local_var_prefix, phase, var, TRUE); switch (typegen_detect_type(type, var->attrs, TDT_ALL_TYPES)) { @@ -3604,19 +4194,18 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const if (phase == PHASE_FREE || pass == PASS_RETURN || pointer_type != RPC_FC_RP) { - if (pointer_type == RPC_FC_RP && phase == PHASE_FREE && + /* strings returned are assumed to be global and hence don't + * need freeing */ + if (is_declptr(type) && !(phase == PHASE_FREE && pass == PASS_RETURN)) + print_phase_function(file, indent, "Pointer", local_var_prefix, + phase, var, start_offset); + else if (pointer_type == RPC_FC_RP && phase == PHASE_FREE && !in_attr && is_conformant_array(type)) { print_file(file, indent, "if (%s%s)\n", local_var_prefix, var->name); indent++; print_file(file, indent, "__frame->_StubMsg.pfnFree(%s%s);\n", local_var_prefix, var->name); } - /* strings returned are assumed to be global and hence don't - * need freeing */ - else if (is_declptr(type) && - !(phase == PHASE_FREE && pass == PASS_RETURN)) - print_phase_function(file, indent, "Pointer", local_var_prefix, - phase, var, start_offset); } else { @@ -3672,7 +4261,7 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const } if (pointer_type != RPC_FC_RP) array_type = "Pointer"; - print_phase_function(file, indent, array_type, local_var_prefix, phase, var, start_offset); + if (phase == PHASE_FREE && pointer_type == RPC_FC_RP) { /* these are all unmarshalled by allocating memory */ @@ -3681,11 +4270,20 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const ((tc == RPC_FC_SMVARRAY || tc == RPC_FC_LGVARRAY) && in_attr) || (tc == RPC_FC_CARRAY && !in_attr)) { + if (type_array_is_decl_as_ptr(type) && type->details.array.ptr_tfsoff) + { + print_phase_function(file, indent, "Pointer", local_var_prefix, phase, var, + type->details.array.ptr_tfsoff); + break; + } + print_phase_function(file, indent, array_type, local_var_prefix, phase, var, start_offset); print_file(file, indent, "if (%s%s)\n", local_var_prefix, var->name); indent++; print_file(file, indent, "__frame->_StubMsg.pfnFree(%s%s);\n", local_var_prefix, var->name); + break; } } + print_phase_function(file, indent, array_type, local_var_prefix, phase, var, start_offset); break; } case TGT_BASIC: @@ -3771,8 +4369,6 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const print_phase_function(file, indent, "Pointer", local_var_prefix, phase, var, start_offset); break; case TGT_STRUCT: - { - const char *struct_type = NULL; switch (get_struct_fc(ref)) { case RPC_FC_STRUCT: @@ -3780,7 +4376,7 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const * pass and don't have any memory to free and so don't * need a freeing pass */ if (phase == PHASE_MARSHAL || phase == PHASE_UNMARSHAL) - struct_type = "SimpleStruct"; + type_str = "SimpleStruct"; else if (phase == PHASE_FREE && pass == PASS_RETURN) { print_file(file, indent, "if (%s%s)\n", local_var_prefix, var->name); @@ -3790,57 +4386,62 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const } break; case RPC_FC_PSTRUCT: - struct_type = "SimpleStruct"; + type_str = "SimpleStruct"; break; case RPC_FC_CSTRUCT: case RPC_FC_CPSTRUCT: - struct_type = "ConformantStruct"; + type_str = "ConformantStruct"; break; case RPC_FC_CVSTRUCT: - struct_type = "ConformantVaryingStruct"; + type_str = "ConformantVaryingStruct"; break; case RPC_FC_BOGUS_STRUCT: - struct_type = "ComplexStruct"; + type_str = "ComplexStruct"; break; default: error("write_remoting_arguments: Unsupported type: %s (0x%02x)\n", var->name, get_struct_fc(ref)); } - if (struct_type) + if (type_str) { if (phase == PHASE_FREE) - struct_type = "Pointer"; + type_str = "Pointer"; else start_offset = ref->typestring_offset; - print_phase_function(file, indent, struct_type, local_var_prefix, phase, var, start_offset); + print_phase_function(file, indent, type_str, local_var_prefix, phase, var, start_offset); } break; - } case TGT_UNION: - { - const char *union_type = NULL; if (phase == PHASE_FREE) - union_type = "Pointer"; + type_str = "Pointer"; else { if (type_get_type(ref) == TYPE_UNION) - union_type = "NonEncapsulatedUnion"; + type_str = "NonEncapsulatedUnion"; else if (type_get_type(ref) == TYPE_ENCAPSULATED_UNION) - union_type = "EncapsulatedUnion"; + type_str = "EncapsulatedUnion"; start_offset = ref->typestring_offset; } - print_phase_function(file, indent, union_type, local_var_prefix, + print_phase_function(file, indent, type_str, local_var_prefix, phase, var, start_offset); break; - } + case TGT_USER_TYPE: + if (phase != PHASE_FREE) + { + type_str = "UserMarshal"; + start_offset = ref->typestring_offset; + } + else type_str = "Pointer"; + + print_phase_function(file, indent, type_str, local_var_prefix, phase, var, start_offset); + break; case TGT_STRING: case TGT_POINTER: case TGT_ARRAY: case TGT_RANGE: case TGT_IFACE_POINTER: - case TGT_USER_TYPE: case TGT_CTXT_HANDLE: case TGT_CTXT_HANDLE_POINTER: print_phase_function(file, indent, "Pointer", local_var_prefix, phase, var, start_offset); @@ -3892,10 +4493,10 @@ void write_remoting_arguments(FILE *file, int indent, const var_t *func, const c } -unsigned int get_size_procformatstring_func(const var_t *func) +unsigned int get_size_procformatstring_func(const type_t *iface, const var_t *func) { unsigned int offset = 0; - write_procformatstring_func( NULL, 0, func, &offset ); + write_procformatstring_func( NULL, 0, iface, func, &offset, 0 ); return offset; } @@ -3925,7 +4526,7 @@ unsigned int get_size_procformatstring(const statement_list_t *stmts, type_pred_ { const var_t *func = stmt_func->u.var; if (!is_local(func->attrs)) - size += get_size_procformatstring_func( func ); + size += get_size_procformatstring_func( iface, func ); } } return size; @@ -4030,10 +4631,22 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char if (type_array_has_conformance(var->type)) { unsigned int size; - type_t *type = var->type; + type_t *type; fprintf(file, " = NdrAllocate(&__frame->_StubMsg, "); - for ( ; + for (type = var->type; + is_array(type) && type_array_has_conformance(type); + type = type_array_get_element(type)) + { + write_expr(file, type_array_get_conformance(type), TRUE, + TRUE, NULL, NULL, local_var_prefix); + fprintf(file, " * "); + } + size = type_memsize(type); + fprintf(file, "%u);\n", size); + + print_file(file, indent, "memset(%s%s, 0, ", local_var_prefix, var->name); + for (type = var->type; is_array(type) && type_array_has_conformance(type); type = type_array_get_element(type)) { @@ -4055,12 +4668,15 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char case TGT_ENUM: case TGT_POINTER: case TGT_RANGE: + case TGT_IFACE_POINTER: print_file(file, indent, "%s_W%u = 0;\n", local_var_prefix, i); break; + case TGT_USER_TYPE: + print_file(file, indent, "memset(&%s_W%u, 0, sizeof(%s_W%u));\n", + local_var_prefix, i, local_var_prefix, i); + break; case TGT_STRUCT: case TGT_UNION: - case TGT_USER_TYPE: - case TGT_IFACE_POINTER: case TGT_ARRAY: case TGT_CTXT_HANDLE: case TGT_CTXT_HANDLE_POINTER: @@ -4083,6 +4699,69 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char } +void write_func_param_struct( FILE *file, const type_t *iface, const type_t *func, + const char *var_decl, int add_retval ) +{ + type_t *rettype = type_function_get_rettype( func ); + const var_list_t *args = type_get_function_args( func ); + const var_t *arg; + int needs_packing; + unsigned int align = 0; + + if (args) + LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry ) + if (!is_array( arg->type )) type_memsize_and_alignment( arg->type, &align ); + + needs_packing = (align > pointer_size); + + if (needs_packing) print_file( file, 0, "#include \n", pointer_size ); + print_file(file, 1, "struct _PARAM_STRUCT\n" ); + print_file(file, 1, "{\n" ); + if (is_object( iface )) print_file(file, 2, "%s *This;\n", iface->name ); + + if (args) LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry ) + { + print_file(file, 2, "%s", ""); + write_type_left( file, (type_t *)arg->type, TRUE ); + if (needs_space_after( arg->type )) fputc( ' ', file ); + if (is_array( arg->type ) && !type_array_is_decl_as_ptr( arg->type )) fputc( '*', file ); + + /* FIXME: should check for large args being passed by pointer */ + align = 0; + if (is_array( arg->type ) || is_ptr( arg->type )) align = pointer_size; + else type_memsize_and_alignment( arg->type, &align ); + + if (align >= pointer_size) + fprintf( file, "%s;\n", arg->name ); + else + fprintf( file, "%s DECLSPEC_ALIGN(%u);\n", arg->name, pointer_size ); + } + if (add_retval && !is_void( rettype )) + { + print_file(file, 2, "%s", ""); + write_type_decl( file, rettype, "_RetVal" ); + if (is_array( rettype ) || is_ptr( rettype ) || type_memsize( rettype ) == pointer_size) + fprintf( file, ";\n" ); + else + fprintf( file, " DECLSPEC_ALIGN(%u);\n", pointer_size ); + } + print_file(file, 1, "} %s;\n", var_decl ); + if (needs_packing) print_file( file, 0, "#include \n" ); + print_file( file, 0, "\n" ); +} + +void write_pointer_checks( FILE *file, int indent, const var_t *func ) +{ + const var_list_t *args = type_get_function_args( func->type ); + const var_t *var; + + if (!args) return; + + LIST_FOR_EACH_ENTRY( var, args, const var_t, entry ) + if (cant_be_null( var )) + print_file( file, indent, "if (!%s) RpcRaiseException(RPC_X_NULL_REF_POINTER);\n", var->name ); +} + int write_expr_eval_routines(FILE *file, const char *iface) { static const char *var_name = "pS"; @@ -4093,20 +4772,28 @@ int write_expr_eval_routines(FILE *file, const char *iface) LIST_FOR_EACH_ENTRY(eval, &expr_eval_routines, struct expr_eval_routine, entry) { - const char *name = eval->structure->name; + const char *name = eval->name; result = 1; print_file(file, 0, "static void __RPC_USER %s_%sExprEval_%04u(PMIDL_STUB_MESSAGE pStubMsg)\n", - iface, name, callback_offset); + eval->iface ? eval->iface->name : iface, name, callback_offset); print_file(file, 0, "{\n"); - print_file(file, 1, "%s", ""); - write_type_left(file, (type_t *)eval->structure, TRUE); - fprintf(file, " *%s = (", var_name); - write_type_left(file, (type_t *)eval->structure, TRUE); - fprintf(file, " *)(pStubMsg->StackTop - %u);\n", eval->baseoff); + if (type_get_type( eval->cont_type ) == TYPE_FUNCTION) + { + write_func_param_struct( file, eval->iface, eval->cont_type, + "*pS = (struct _PARAM_STRUCT *)pStubMsg->StackTop", FALSE ); + } + else + { + print_file(file, 1, "%s", ""); + write_type_left(file, (type_t *)eval->cont_type, TRUE); + fprintf(file, " *%s = (", var_name); + write_type_left(file, (type_t *)eval->cont_type, TRUE); + fprintf(file, " *)(pStubMsg->StackTop - %u);\n", eval->baseoff); + } print_file(file, 1, "pStubMsg->Offset = 0;\n"); /* FIXME */ print_file(file, 1, "pStubMsg->MaxCount = (ULONG_PTR)"); - write_expr(file, eval->expr, 1, 1, var_name_expr, eval->structure, ""); + write_expr(file, eval->expr, 1, 1, var_name_expr, eval->cont_type, ""); fprintf(file, ";\n"); print_file(file, 0, "}\n\n"); callback_offset++; @@ -4125,10 +4812,11 @@ void write_expr_eval_routine_list(FILE *file, const char *iface) LIST_FOR_EACH_ENTRY_SAFE(eval, cursor, &expr_eval_routines, struct expr_eval_routine, entry) { - const char *name = eval->structure->name; - print_file(file, 1, "%s_%sExprEval_%04u,\n", iface, name, callback_offset); + print_file(file, 1, "%s_%sExprEval_%04u,\n", + eval->iface ? eval->iface->name : iface, eval->name, callback_offset); callback_offset++; list_remove(&eval->entry); + free(eval->name); free(eval); } @@ -4191,6 +4879,65 @@ error: error("Invalid endpoint syntax '%s'\n", endpoint->str); } +void write_client_call_routine( FILE *file, const type_t *iface, const var_t *func, + const char *prefix, unsigned int proc_offset ) +{ + type_t *rettype = type_function_get_rettype( func->type ); + int has_ret = !is_void( rettype ); + const var_list_t *args = type_get_function_args( func->type ); + const var_t *arg; + int len, needs_params = 0; + + /* we need a param structure if we have more than one arg */ + if (pointer_size == 4 && args) needs_params = is_object( iface ) || list_count( args ) > 1; + + print_file( file, 0, "{\n"); + if (needs_params) + { + if (has_ret) print_file( file, 1, "%s", "CLIENT_CALL_RETURN _RetVal;\n" ); + write_func_param_struct( file, iface, func->type, "__params", FALSE ); + if (is_object( iface )) print_file( file, 1, "__params.This = This;\n" ); + if (args) + LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry ) + print_file( file, 1, "__params.%s = %s;\n", arg->name, arg->name ); + } + else if (has_ret) print_file( file, 1, "%s", "CLIENT_CALL_RETURN _RetVal;\n\n" ); + + len = fprintf( file, " %s%s( ", + has_ret ? "_RetVal = " : "", + get_stub_mode() == MODE_Oif ? "NdrClientCall2" : "NdrClientCall" ); + fprintf( file, "&%s_StubDesc,", prefix ); + fprintf( file, "\n%*s&__MIDL_ProcFormatString.Format[%u]", len, "", proc_offset ); + if (needs_params) + { + fprintf( file, ",\n%*s&__params", len, "" ); + } + else if (pointer_size == 8) + { + if (is_object( iface )) fprintf( file, ",\n%*sThis", len, "" ); + if (args) + LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry ) + fprintf( file, ",\n%*s%s", len, "", arg->name ); + } + else + { + if (is_object( iface )) fprintf( file, ",\n%*s&This", len, "" ); + else if (args) + { + arg = LIST_ENTRY( list_head(args), const var_t, entry ); + fprintf( file, ",\n%*s&%s", len, "", arg->name ); + } + } + fprintf( file, " );\n" ); + if (has_ret) + { + print_file( file, 1, "return (" ); + write_type_decl_left(file, rettype); + fprintf( file, ")%s;\n", pointer_size == 8 ? "_RetVal.Simple" : "*(LONG_PTR *)&_RetVal" ); + } + print_file( file, 0, "}\n\n"); +} + void write_exceptions( FILE *file ) { fprintf( file, "#ifndef USE_COMPILER_EXCEPTIONS\n"); diff --git a/reactos/tools/widl/typegen.h b/reactos/tools/widl/typegen.h index 5d46614d166..b6540e28c41 100644 --- a/reactos/tools/widl/typegen.h +++ b/reactos/tools/widl/typegen.h @@ -68,20 +68,28 @@ void write_typeformatstring(FILE *file, const statement_list_t *stmts, type_pred void write_procformatstring_offsets( FILE *file, const type_t *iface ); void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix, enum remoting_phase phase, enum pass pass, const var_t *var, const char *varname); +void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char *local_var_prefix, + enum remoting_phase phase, const var_t *var, int valid_variance); void write_remoting_arguments(FILE *file, int indent, const var_t *func, const char *local_var_prefix, enum pass pass, enum remoting_phase phase); -unsigned int get_size_procformatstring_func(const var_t *func); +unsigned int get_size_procformatstring_func(const type_t *iface, const var_t *func); unsigned int get_size_procformatstring(const statement_list_t *stmts, type_pred_t pred); unsigned int get_size_typeformatstring(const statement_list_t *stmts, type_pred_t pred); void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char *local_var_prefix ); void declare_stub_args( FILE *file, int indent, const var_t *func ); +void write_func_param_struct( FILE *file, const type_t *iface, const type_t *func, + const char *var_decl, int add_retval ); +void write_pointer_checks( FILE *file, int indent, const var_t *func ); int write_expr_eval_routines(FILE *file, const char *iface); void write_expr_eval_routine_list(FILE *file, const char *iface); void write_user_quad_list(FILE *file); void write_endpoints( FILE *f, const char *prefix, const str_list_t *list ); +void write_client_call_routine( FILE *file, const type_t *iface, const var_t *func, + const char *prefix, unsigned int proc_offset ); void write_exceptions( FILE *file ); unsigned int type_memsize(const type_t *t); int decl_indirect(const type_t *t); +int is_interpreted_func(const type_t *iface, const var_t *func); void write_parameters_init(FILE *file, int indent, const var_t *func, const char *local_var_prefix); void print(FILE *file, int indent, const char *format, va_list ap); expr_t *get_size_is_expr(const type_t *t, const char *name); diff --git a/reactos/tools/widl/typelib.c b/reactos/tools/widl/typelib.c index c9f9355ecb0..e3fc0b97c41 100644 --- a/reactos/tools/widl/typelib.c +++ b/reactos/tools/widl/typelib.c @@ -35,7 +35,8 @@ #define NONAMELESSUNION #define NONAMELESSSTRUCT -#include +#include "windef.h" +#include "winbase.h" #include "widl.h" #include "utils.h" @@ -254,9 +255,7 @@ unsigned short get_type_vt(type_t *t) void start_typelib(typelib_t *typelib_type) { if (!do_typelib) return; - typelib = typelib_type; - typelib->filename = xstrdup(typelib_name); } void end_typelib(void) diff --git a/reactos/tools/widl/typelib_struct.h b/reactos/tools/widl/typelib_struct.h index 95d174e6e1f..79b86b91216 100644 --- a/reactos/tools/widl/typelib_struct.h +++ b/reactos/tools/widl/typelib_struct.h @@ -302,7 +302,7 @@ typedef struct { * */ -#include +#include "pshpack1.h" typedef struct { /*00*/ DWORD SLTG_magic; /* 0x47544c53 == "SLTG" */ @@ -599,7 +599,7 @@ WORD offset from start of block to SAFEARRAY WORD typeofarray */ -#include +#include "poppack.h" /*---------------------------END--------------------------------------------*/ #endif diff --git a/reactos/tools/widl/utils.c b/reactos/tools/widl/utils.c index b025c9a4e8f..dc77ae87438 100644 --- a/reactos/tools/widl/utils.c +++ b/reactos/tools/widl/utils.c @@ -253,6 +253,13 @@ unsigned char *output_buffer; size_t output_buffer_pos; size_t output_buffer_size; +static struct resource +{ + unsigned char *data; + size_t size; +} resources[16]; +static unsigned int nb_resources; + static void check_output_buffer_space( size_t size ) { if (output_buffer_pos + size >= output_buffer_size) @@ -279,6 +286,93 @@ void flush_output_buffer( const char *name ) free( output_buffer ); } +static inline void put_resource_id( const char *str ) +{ + if (str[0] != '#') + { + while (*str) + { + unsigned char ch = *str++; + put_word( toupper(ch) ); + } + put_word( 0 ); + } + else + { + put_word( 0xffff ); + put_word( atoi( str + 1 )); + } +} + +void add_output_to_resources( const char *type, const char *name ) +{ + size_t data_size = output_buffer_pos; + size_t header_size = 5 * sizeof(unsigned int) + 2 * sizeof(unsigned short); + + assert( nb_resources < sizeof(resources)/sizeof(resources[0]) ); + + if (type[0] != '#') header_size += (strlen( type ) + 1) * sizeof(unsigned short); + else header_size += 2 * sizeof(unsigned short); + if (name[0] != '#') header_size += (strlen( name ) + 1) * sizeof(unsigned short); + else header_size += 2 * sizeof(unsigned short); + + header_size = (header_size + 3) & ~3; + align_output( 4 ); + check_output_buffer_space( header_size ); + resources[nb_resources].size = header_size + output_buffer_pos; + memmove( output_buffer + header_size, output_buffer, output_buffer_pos ); + + output_buffer_pos = 0; + put_dword( data_size ); /* ResSize */ + put_dword( header_size ); /* HeaderSize */ + put_resource_id( type ); /* ResType */ + put_resource_id( name ); /* ResName */ + align_output( 4 ); + put_dword( 0 ); /* DataVersion */ + put_word( 0 ); /* Memory options */ + put_word( 0 ); /* Language */ + put_dword( 0 ); /* Version */ + put_dword( 0 ); /* Characteristics */ + + resources[nb_resources++].data = output_buffer; + init_output_buffer(); +} + +void flush_output_resources( const char *name ) +{ + int fd; + unsigned int i; + + /* all output must have been saved with add_output_to_resources() first */ + assert( !output_buffer_pos ); + + put_dword( 0 ); /* ResSize */ + put_dword( 32 ); /* HeaderSize */ + put_word( 0xffff ); /* ResType */ + put_word( 0x0000 ); + put_word( 0xffff ); /* ResName */ + put_word( 0x0000 ); + put_dword( 0 ); /* DataVersion */ + put_word( 0 ); /* Memory options */ + put_word( 0 ); /* Language */ + put_dword( 0 ); /* Version */ + put_dword( 0 ); /* Characteristics */ + + fd = open( name, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666 ); + if (fd == -1) error( "Error creating %s\n", name ); + if (write( fd, output_buffer, output_buffer_pos ) != output_buffer_pos) + error( "Error writing to %s\n", name ); + for (i = 0; i < nb_resources; i++) + { + if (write( fd, resources[i].data, resources[i].size ) != resources[i].size) + error( "Error writing to %s\n", name ); + free( resources[i].data ); + } + close( fd ); + nb_resources = 0; + free( output_buffer ); +} + void put_data( const void *data, size_t size ) { check_output_buffer_space( size ); diff --git a/reactos/tools/widl/utils.h b/reactos/tools/widl/utils.h index 5b44aace3f6..ec02fc7c372 100644 --- a/reactos/tools/widl/utils.h +++ b/reactos/tools/widl/utils.h @@ -58,6 +58,8 @@ extern size_t output_buffer_size; extern void init_output_buffer(void); extern void flush_output_buffer( const char *name ); +extern void add_output_to_resources( const char *type, const char *name ); +extern void flush_output_resources( const char *name ); extern void put_data( const void *data, size_t size ); extern void put_byte( unsigned char val ); extern void put_word( unsigned short val ); diff --git a/reactos/tools/widl/widl.c b/reactos/tools/widl/widl.c index dc5c165e0bb..88d2d78b940 100644 --- a/reactos/tools/widl/widl.c +++ b/reactos/tools/widl/widl.c @@ -46,7 +46,6 @@ /* future options to reserve characters for: */ /* A = ACF input filename */ /* J = do not search standard include path */ -/* O = generate interpreted stubs */ /* w = select win16/win32 output (?) */ static const char usage[] = @@ -65,6 +64,7 @@ static const char usage[] = " -N Do not preprocess input\n" " --oldnames Use old naming conventions\n" " -o, --output=NAME Set the output file name\n" +" -Otype Type of stubs to generate (-Os, -Oi, -Oif)\n" " -p Generate proxy\n" " --prefix-all=p Prefix names of client stubs / server functions with 'p'\n" " --prefix-client=p Prefix names of client stubs with 'p'\n" @@ -111,6 +111,7 @@ int do_win32 = 1; int do_win64 = 1; int win32_packing = 8; int win64_packing = 8; +static enum stub_mode stub_mode = MODE_Os; char *input_name; char *header_name; @@ -136,7 +137,7 @@ int line_number = 1; static FILE *idfile; -size_t pointer_size = 0; +unsigned int pointer_size = 0; syskind_t typelib_kind = sizeof(void*) == 8 ? SYS_WIN64 : SYS_WIN32; time_t now; @@ -156,7 +157,7 @@ enum { }; static const char short_options[] = - "b:cC:d:D:EhH:I:m:No:pP:rsS:tT:uU:VW"; + "b:cC:d:D:EhH:I:m:No:O:pP:rsS:tT:uU:VW"; static const struct option long_options[] = { { "dlldata", 1, NULL, DLLDATA_OPTION }, { "dlldata-only", 0, NULL, DLLDATA_ONLY_OPTION }, @@ -175,6 +176,13 @@ static const struct option long_options[] = { static void rm_tempfile(void); +enum stub_mode get_stub_mode(void) +{ + /* old-style interpreted stubs are not supported on 64-bit */ + if (stub_mode == MODE_Oi && pointer_size == 8) return MODE_Oif; + return stub_mode; +} + static char *make_token(const char *name) { char *token; @@ -482,8 +490,6 @@ void write_id_data(const statement_list_t *stmts) int main(int argc,char *argv[]) { - extern char* optarg; - extern int optind; int optc; int ret = 0; int opti = 0; @@ -582,6 +588,14 @@ int main(int argc,char *argv[]) case 'o': output_name = xstrdup(optarg); break; + case 'O': + if (!strcmp( optarg, "s" )) stub_mode = MODE_Os; + else if (!strcmp( optarg, "i" )) stub_mode = MODE_Oi; + else if (!strcmp( optarg, "ic" )) stub_mode = MODE_Oif; + else if (!strcmp( optarg, "if" )) stub_mode = MODE_Oif; + else if (!strcmp( optarg, "icf" )) stub_mode = MODE_Oif; + else error( "Invalid argument '-O%s'\n", optarg ); + break; case 'p': do_everything = 0; do_proxies = 1; diff --git a/reactos/tools/widl/widl.h b/reactos/tools/widl/widl.h index 515e122e41f..6551fa07fbe 100644 --- a/reactos/tools/widl/widl.h +++ b/reactos/tools/widl/widl.h @@ -66,18 +66,27 @@ extern char *regscript_name; extern char *regscript_token; extern const char *prefix_client; extern const char *prefix_server; -extern size_t pointer_size; +extern unsigned int pointer_size; extern time_t now; extern int line_number; extern int char_number; +enum stub_mode +{ + MODE_Os, /* inline stubs */ + MODE_Oi, /* old-style interpreted stubs */ + MODE_Oif /* new-style fully interpreted stubs */ +}; +extern enum stub_mode get_stub_mode(void); + extern void write_header(const statement_list_t *stmts); extern void write_id_data(const statement_list_t *stmts); extern void write_proxies(const statement_list_t *stmts); extern void write_client(const statement_list_t *stmts); extern void write_server(const statement_list_t *stmts); extern void write_regscript(const statement_list_t *stmts); +extern void output_typelib_regscript( const typelib_t *typelib ); extern void write_local_stubs(const statement_list_t *stmts); extern void write_dlldata(const statement_list_t *stmts); diff --git a/reactos/tools/widl/widl.rbuild b/reactos/tools/widl/widl.rbuild index 3e1382827f4..8e070b5eab8 100644 --- a/reactos/tools/widl/widl.rbuild +++ b/reactos/tools/widl/widl.rbuild @@ -2,7 +2,6 @@ SHORT - 1 . wpp client.c diff --git a/reactos/tools/widl/widltypes.h b/reactos/tools/widl/widltypes.h index d56cecac28a..d1066bd23e8 100644 --- a/reactos/tools/widl/widltypes.h +++ b/reactos/tools/widl/widltypes.h @@ -21,13 +21,6 @@ #ifndef __WIDL_WIDLTYPES_H #define __WIDL_WIDLTYPES_H -#define S_OK 0 -#define S_FALSE 1 -#define E_OUTOFMEMORY ((HRESULT)0x8007000EL) -#define TYPE_E_IOERROR ((HRESULT)0x80028CA2L) - -#define max(a, b) ((a) > (b) ? a : b) - #include #include #include "guiddef.h" @@ -39,9 +32,7 @@ typedef GUID UUID; #endif -#ifndef TRUE #define TRUE 1 -#endif #define FALSE 0 typedef struct _loc_info_t loc_info_t; @@ -57,6 +48,7 @@ typedef struct _importinfo_t importinfo_t; typedef struct _typelib_t typelib_t; typedef struct _user_type_t user_type_t; typedef struct _user_type_t context_handle_t; +typedef struct _user_type_t generic_handle_t; typedef struct _type_list_t type_list_t; typedef struct _statement_t statement_t; @@ -69,6 +61,7 @@ typedef struct list ifref_list_t; typedef struct list array_dims_t; typedef struct list user_type_list_t; typedef struct list context_handle_list_t; +typedef struct list generic_handle_list_t; typedef struct list statement_list_t; enum attr_type @@ -361,6 +354,7 @@ struct array_details unsigned int dim; unsigned char ptr_def_fc; unsigned char declptr; /* if declared as a pointer */ + unsigned short ptr_tfsoff; /* offset of pointer definition for declptr */ }; struct coclass_details @@ -500,7 +494,6 @@ struct _importlib_t { struct _typelib_t { char *name; - char *filename; const attr_list_t *attrs; struct list importlibs; statement_list_t *stmts; @@ -539,6 +532,8 @@ typedef enum { extern syskind_t typelib_kind; extern user_type_list_t user_type_list; +extern context_handle_list_t context_handle_list; +extern generic_handle_list_t generic_handle_list; void check_for_additional_prototype_types(const var_list_t *list); void init_types(void); @@ -548,8 +543,6 @@ void clear_all_offsets(void); int is_ptr(const type_t *t); int is_array(const type_t *t); -int is_var_ptr(const var_t *v); -int cant_be_null(const var_t *v); #define tsENUM 1 #define tsSTRUCT 2 diff --git a/reactos/tools/widl/write_msft.c b/reactos/tools/widl/write_msft.c index 6e7098a0415..416f81d2f73 100644 --- a/reactos/tools/widl/write_msft.c +++ b/reactos/tools/widl/write_msft.c @@ -40,8 +40,10 @@ #define NONAMELESSUNION #define NONAMELESSSTRUCT -#include -#include +#include "winerror.h" +#include "windef.h" +#include "winbase.h" +#include "winnls.h" #include "widl.h" #include "typelib.h" @@ -82,7 +84,7 @@ typedef struct _msft_typelib_t typelib_t *typelib; MSFT_Header typelib_header; MSFT_pSeg typelib_segdir[MSFT_SEG_MAX]; - char *typelib_segment_data[MSFT_SEG_MAX]; + unsigned char *typelib_segment_data[MSFT_SEG_MAX]; int typelib_segment_block_length[MSFT_SEG_MAX]; INT typelib_typeinfo_offsets[0x200]; /* Hope that's enough. */ @@ -397,7 +399,7 @@ static int ctl2_alloc_segment( } while ((typelib->typelib_segdir[segment].length + size) > typelib->typelib_segment_block_length[segment]) { - char *block; + unsigned char *block; block_size = typelib->typelib_segment_block_length[segment]; block = xrealloc(typelib->typelib_segment_data[segment], block_size << 1); @@ -407,7 +409,7 @@ static int ctl2_alloc_segment( msft_typeinfo_t *typeinfo; for (typeinfo = typelib->typeinfos; typeinfo; typeinfo = typeinfo->next_typeinfo) { - typeinfo->typeinfo = (void *)&block[((char *)typeinfo->typeinfo) - typelib->typelib_segment_data[segment]]; + typeinfo->typeinfo = (void *)&block[((unsigned char *)typeinfo->typeinfo) - typelib->typelib_segment_data[segment]]; } } @@ -568,14 +570,14 @@ static int ctl2_alloc_string( { int length; int offset; - char *string_space; + unsigned char *string_space; char *encoded_string; length = ctl2_encode_string(string, &encoded_string); for (offset = 0; offset < typelib->typelib_segdir[MSFT_SEG_STRING].length; - offset += ((((typelib->typelib_segment_data[MSFT_SEG_STRING][offset + 1] << 8) & 0xff) - | (typelib->typelib_segment_data[MSFT_SEG_STRING][offset + 0] & 0xff)) + 5) & ~3) { + offset += (((typelib->typelib_segment_data[MSFT_SEG_STRING][offset + 1] << 8) | + typelib->typelib_segment_data[MSFT_SEG_STRING][offset + 0]) + 5) & ~3) { if (!memcmp(encoded_string, typelib->typelib_segment_data[MSFT_SEG_STRING] + offset, length)) return offset; } @@ -651,8 +653,8 @@ static int alloc_importfile( encoded_string[0] |= 1; for (offset = 0; offset < typelib->typelib_segdir[MSFT_SEG_IMPORTFILES].length; - offset += ((((typelib->typelib_segment_data[MSFT_SEG_IMPORTFILES][offset + 0xd] << 8) & 0xff) - | (typelib->typelib_segment_data[MSFT_SEG_IMPORTFILES][offset + 0xc] & 0xff)) >> 2) + 0xc) { + offset += (((typelib->typelib_segment_data[MSFT_SEG_IMPORTFILES][offset + 0xd] << 8) | + typelib->typelib_segment_data[MSFT_SEG_IMPORTFILES][offset + 0xc]) >> 2) + 0xc) { if (!memcmp(encoded_string, typelib->typelib_segment_data[MSFT_SEG_IMPORTFILES] + offset + 0xc, length)) return offset; } @@ -909,7 +911,7 @@ static int encode_type( if (typeoffset == typelib->typelib_segdir[MSFT_SEG_TYPEDESC].length) { int mix_field; - + if (target_type & 0x80000000) { mix_field = ((target_type >> 16) & 0x3fff) | VT_BYREF; } else { @@ -947,7 +949,7 @@ static int encode_type( if (typeoffset == typelib->typelib_segdir[MSFT_SEG_TYPEDESC].length) { int mix_field; - + if (target_type & 0x80000000) { mix_field = ((target_type >> 16) & VT_TYPEMASK) | VT_ARRAY; } else { @@ -1129,7 +1131,7 @@ static int encode_var( if (typeoffset == typelib->typelib_segdir[MSFT_SEG_TYPEDESC].length) { int mix_field; - + if (target_type & 0x80000000) { mix_field = ((target_type >> 16) & 0x3fff) | VT_BYREF; } else { @@ -1265,7 +1267,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index) int decoded_size, extra_attr = 0; int num_params = 0, num_optional = 0, num_defaults = 0; var_t *arg; - char *namedata; + unsigned char *namedata; const attr_t *attr; unsigned int funcflags = 0, callconv = 4 /* CC_STDCALL */; unsigned int funckind, invokekind = 1 /* INVOKE_FUNC */; @@ -1548,7 +1550,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index) } /* update the index data */ - typeinfo->func_indices[typeinfo->typeinfo->cElement & 0xffff] = id; + typeinfo->func_indices[typeinfo->typeinfo->cElement & 0xffff] = id; typeinfo->func_offsets[typeinfo->typeinfo->cElement & 0xffff] = offset; typeinfo->func_names[typeinfo->typeinfo->cElement & 0xffff] = name_offset; @@ -1605,11 +1607,11 @@ static HRESULT add_var_desc(msft_typeinfo_t *typeinfo, UINT index, var_t* var) INT *typedata; int var_datawidth; int var_alignment; - int var_type_size, var_kind = 0 /* VAR_PERINSTANCE */; + int var_type_size, var_kind = 0 /* VAR_PERINSTANCE */; int alignment; int varflags = 0; const attr_t *attr; - char *namedata; + unsigned char *namedata; int var_num = (typeinfo->typeinfo->cElement >> 16) & 0xffff; chat("add_var_desc(%d, %s)\n", index, var->name); @@ -2540,7 +2542,14 @@ static void save_all_changes(msft_typelib_t *typelib) ctl2_write_segment( typelib, MSFT_SEG_CUSTDATAGUID ); ctl2_write_typeinfos(typelib); - flush_output_buffer( typelib->typelib->filename ); + + if (strendswith( typelib_name, ".res" )) /* create a binary resource file */ + { + add_output_to_resources( "TYPELIB", "#1" ); + output_typelib_regscript( typelib->typelib ); + flush_output_resources( typelib_name ); + } + else flush_output_buffer( typelib_name ); } int create_msft_typelib(typelib_t *typelib) @@ -2551,8 +2560,8 @@ int create_msft_typelib(typelib_t *typelib) time_t cur_time; char *time_override; unsigned int version = 5 << 24 | 1 << 16 | 164; /* 5.01.0164 */ - GUID midl_time_guid = {0xde77ba63,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}}; - GUID midl_version_guid = {0xde77ba64,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}}; + GUID midl_time_guid = {0xde77ba63,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}}; + GUID midl_version_guid = {0xde77ba64,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}}; pointer_size = (typelib_kind == SYS_WIN64) ? 8 : 4; @@ -2594,7 +2603,7 @@ int create_msft_typelib(typelib_t *typelib) set_help_context(msft); set_help_string_dll(msft); set_help_string_context(msft); - + /* midl adds two sets of custom data to the library: the current unix time and midl's version number */ time_override = getenv( "WIDL_TIME_OVERRIDE"); diff --git a/reactos/tools/wpp/lex.yy.c b/reactos/tools/wpp/lex.yy.c index d213332f431..7a93ad74415 100644 --- a/reactos/tools/wpp/lex.yy.c +++ b/reactos/tools/wpp/lex.yy.c @@ -1,8 +1,18 @@ +#line 2 "lex.yy.c" +#line 125 "ppl.l" +#include "config.h" +#include "wine/port.h" + + + +#line 9 "lex.yy.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + #define yy_create_buffer ppy__create_buffer #define yy_delete_buffer ppy__delete_buffer -#define yy_scan_buffer ppy__scan_buffer -#define yy_scan_string ppy__scan_string -#define yy_scan_bytes ppy__scan_bytes #define yy_flex_debug ppy__flex_debug #define yy_init_buffer ppy__init_buffer #define yy_flush_buffer ppy__flush_buffer @@ -11,76 +21,118 @@ #define yyin ppy_in #define yyleng ppy_leng #define yylex ppy_lex +#define yylineno ppy_lineno #define yyout ppy_out #define yyrestart ppy_restart #define yytext ppy_text #define yywrap ppy_wrap - -#line 20 "lex.yy.c" -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ - */ +#define yyalloc ppy_alloc +#define yyrealloc ppy_realloc +#define yyfree ppy_free #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ #include +#include +#include +#include +/* end standard C headers. */ -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 #endif +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ #ifdef __cplusplus -#include -#include - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ -#if __STDC__ +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) -#define YY_USE_PROTOS #define YY_USE_CONST -#endif /* __STDC__ */ +#endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - /* Returned upon end-of-file. */ #define YY_NULL 0 @@ -95,71 +147,78 @@ * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ -#define BEGIN yy_start = 1 + 2 * +#define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ -#define YY_START ((yy_start - 1) / 2) +#define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) +#define YY_NEW_FILE ppy_restart(ppy_in ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif -extern int yyleng; -extern FILE *yyin, *yyout; +extern int ppy_leng; + +extern FILE *ppy_in, *ppy_out; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ + /* Undo effects of setting up ppy_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up ppy_text again */ \ } \ while ( 0 ) -#define unput(c) yyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; +#define unput(c) yyunput( c, (yytext_ptr) ) +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; @@ -196,12 +255,16 @@ struct yy_buffer_state */ int yy_at_bol; + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; + #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process @@ -211,99 +274,135 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. + * (via ppy_restart()), so that the user can continue scanning by + * just pointing ppy_in at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 - }; -static YY_BUFFER_STATE yy_current_buffer = 0; + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". + * + * Returns the top of the stack, or NULL. */ -#define YY_CURRENT_BUFFER yy_current_buffer +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] -/* yy_hold_char holds the character lost when yytext is formed. */ +/* yy_hold_char holds the character lost when ppy_text is formed. */ static char yy_hold_char; - static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; +int ppy_leng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ +static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... +/* Flag which is used to allow ppy_wrap()'s to do buffer switches + * instead of setting up a fresh ppy_in. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; -void yyrestart YY_PROTO(( FILE *input_file )); +void ppy_restart (FILE *input_file ); +void ppy__switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE ppy__create_buffer (FILE *file,int size ); +void ppy__delete_buffer (YY_BUFFER_STATE b ); +void ppy__flush_buffer (YY_BUFFER_STATE b ); +void ppy_push_buffer_state (YY_BUFFER_STATE new_buffer ); +void ppy_pop_buffer_state (void ); -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) +static void ppy_ensure_buffer_stack (void ); +static void ppy__load_buffer_state (void ); +static void ppy__init_buffer (YY_BUFFER_STATE b,FILE *file ); -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); +#define YY_FLUSH_BUFFER ppy__flush_buffer(YY_CURRENT_BUFFER ) -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); +YY_BUFFER_STATE ppy__scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE ppy__scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE ppy__scan_bytes (yyconst char *bytes,int len ); -#define yy_new_buffer yy_create_buffer +void *ppy_alloc (yy_size_t ); +void *ppy_realloc (void *,yy_size_t ); +void ppy_free (void * ); + +#define yy_new_buffer ppy__create_buffer #define yy_set_interactive(is_interactive) \ { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ + if ( ! YY_CURRENT_BUFFER ){ \ + ppy_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + ppy__create_buffer(ppy_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ + if ( ! YY_CURRENT_BUFFER ){\ + ppy_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + ppy__create_buffer(ppy_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; -typedef int yy_state_type; -extern char *yytext; -#define yytext_ptr yytext -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); +FILE *ppy_in = (FILE *) 0, *ppy_out = (FILE *) 0; + +typedef int yy_state_type; + +extern int ppy_lineno; + +int ppy_lineno = 1; + +extern char *ppy_text; +#define yytext_ptr ppy_text + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. + * corresponding action - sets up ppy_text. */ #define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ + (yytext_ptr) = yy_bp; \ + ppy_leng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; + (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 143 #define YY_END_OF_BUFFER 144 -static yyconst short int yy_accept[415] = +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[416] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 0, 0, 0, 0, @@ -333,27 +432,27 @@ static yyconst short int yy_accept[415] = 69, 70, 72, 70, 25, 27, 28, 123, 130, 129, 130, 125, 127, 117, 117, 117, 119, 75, 73, 74, 76, 77, 78, 79, 81, 79, 86, 85, 90, 87, - 91, 90, 92, 94, 97, 96, 93, 99, 97, 92, - 106, 104, 103, 106, 105, 106, 114, 114, 112, 115, - 114, 133, 138, 138, 50, 44, 41, 33, 34, 33, - 33, 37, 35, 35, 35, 39, 45, 43, 46, 40, + 91, 90, 92, 94, 97, 96, 96, 93, 99, 97, + 92, 106, 104, 103, 106, 105, 106, 114, 114, 112, + 115, 114, 133, 138, 138, 50, 44, 41, 33, 34, + 33, 33, 37, 35, 35, 35, 39, 45, 43, 46, - 48, 49, 132, 42, 55, 54, 57, 58, 59, 61, - 0, 22, 64, 63, 67, 66, 67, 29, 31, 32, - 29, 140, 139, 120, 120, 17, 17, 17, 17, 17, - 17, 11, 17, 17, 17, 17, 17, 17, 17, 69, - 80, 89, 98, 34, 34, 33, 33, 33, 36, 35, - 35, 35, 132, 120, 17, 12, 13, 17, 17, 17, - 17, 17, 17, 15, 17, 17, 17, 34, 34, 34, - 33, 36, 36, 35, 132, 17, 12, 13, 14, 4, - 7, 9, 17, 17, 15, 17, 8, 17, 34, 36, - 36, 36, 132, 3, 14, 4, 7, 9, 10, 17, + 40, 48, 49, 132, 42, 55, 54, 57, 58, 59, + 61, 0, 22, 64, 63, 67, 66, 67, 29, 31, + 32, 29, 140, 139, 120, 120, 17, 17, 17, 17, + 17, 17, 11, 17, 17, 17, 17, 17, 17, 17, + 69, 80, 89, 98, 34, 34, 33, 33, 33, 36, + 35, 35, 35, 132, 120, 17, 12, 13, 17, 17, + 17, 17, 17, 17, 15, 17, 17, 17, 34, 34, + 34, 33, 36, 36, 35, 132, 17, 12, 13, 14, + 4, 7, 9, 17, 17, 15, 17, 8, 17, 34, + 36, 36, 36, 132, 3, 14, 4, 7, 9, 10, - 6, 8, 17, 36, 132, 3, 10, 2, 6, 5, - 38, 2, 5, 0 + 17, 6, 8, 17, 36, 132, 3, 10, 2, 6, + 5, 38, 2, 5, 0 } ; -static yyconst int yy_ec[256] = +static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 4, 1, 1, 1, 1, 1, 1, 1, @@ -385,7 +484,7 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[50] = +static yyconst flex_int32_t yy_meta[50] = { 0, 1, 2, 3, 2, 1, 4, 5, 1, 6, 7, 8, 9, 8, 10, 11, 12, 12, 12, 1, 1, @@ -394,136 +493,136 @@ static yyconst int yy_meta[50] = 15, 15, 15, 15, 15, 15, 15, 15, 1 } ; -static yyconst short int yy_base[458] = +static yyconst flex_int16_t yy_base[460] = { 0, 0, 48, 55, 0, 102, 103, 130, 0, 177, 178, 179, 182, 186, 187, 104, 107, 214, 0, 261, 262, 289, 0, 338, 0, 386, 389, 414, 439, 466, 0, 515, 0, 564, 0, 399, 403, 612, 638, 665, 0, - 428, 618, 714, 763, 1132, 0, 49, 1771, 1771, 1771, - 1771, 96, 0, 109, 118, 1771, 1771, 811, 1771, 1128, - 111, 111, 858, 1097, 154, 161, 1092, 1085, 1087, 1097, - 0, 1771, 184, 124, 1771, 196, 1771, 1771, 254, 1771, - 0, 199, 0, 1771, 1771, 269, 0, 1771, 1122, 0, - 1771, 0, 1771, 263, 1771, 208, 1771, 267, 1114, 277, + 428, 618, 714, 763, 1130, 0, 49, 1886, 1886, 1886, + 1886, 96, 0, 109, 118, 1886, 1886, 811, 1886, 1126, + 111, 111, 858, 1095, 154, 161, 1090, 1083, 1085, 1095, + 0, 1886, 184, 124, 1886, 196, 1886, 1886, 254, 1886, + 0, 199, 0, 1886, 1886, 269, 0, 1886, 1120, 0, + 1886, 0, 1886, 263, 1886, 208, 1886, 267, 1112, 277, - 0, 1771, 1771, 1771, 271, 281, 1771, 393, 1771, 396, - 1771, 1109, 396, 0, 406, 0, 1771, 1771, 1115, 1771, - 400, 0, 0, 418, 905, 1771, 430, 1771, 1771, 433, - 0, 1771, 1771, 1771, 1771, 1771, 1771, 432, 435, 0, - 449, 1771, 1771, 1771, 1771, 444, 0, 954, 1771, 456, - 1771, 1101, 1771, 1112, 1771, 449, 988, 714, 443, 1099, - 603, 0, 623, 1085, 1068, 1771, 615, 1771, 619, 0, - 632, 1771, 644, 1771, 635, 634, 635, 1771, 655, 1771, - 1771, 646, 0, 659, 0, 1771, 1771, 725, 738, 741, - 1771, 742, 1771, 1771, 0, 735, 0, 747, 741, 1771, + 0, 1886, 1886, 1886, 271, 281, 1886, 393, 1886, 396, + 1886, 1107, 396, 0, 406, 0, 1886, 1886, 1113, 1886, + 400, 905, 0, 418, 954, 1886, 430, 1886, 1886, 433, + 0, 1886, 1886, 1886, 1886, 1886, 1886, 432, 435, 0, + 449, 1886, 1886, 1886, 1886, 444, 0, 1003, 1886, 456, + 1886, 1099, 1886, 1110, 1886, 449, 1037, 714, 443, 1097, + 603, 0, 623, 1083, 1066, 1886, 615, 1886, 619, 0, + 632, 1886, 644, 1886, 635, 634, 635, 1886, 655, 1886, + 1886, 646, 0, 659, 0, 1886, 1886, 725, 738, 741, + 1886, 742, 1886, 1886, 0, 735, 0, 747, 741, 1886, - 0, 0, 1771, 1113, 755, 1771, 0, 0, 1082, 747, - 754, 1077, 1070, 1072, 1082, 1771, 1771, 1107, 1075, 717, - 1076, 1064, 1070, 777, 1071, 1061, 1071, 1067, 1045, 0, - 0, 1771, 1771, 1081, 787, 1771, 1080, 0, 1771, 1771, - 1079, 0, 0, 0, 743, 765, 1771, 791, 1771, 1071, - 1771, 1077, 0, 1771, 794, 1076, 795, 798, 1064, 0, - 1771, 1074, 0, 1771, 789, 0, 0, 801, 1073, 0, - 804, 1771, 1771, 807, 1771, 1072, 0, 804, 1771, 1771, - 1071, 806, 1771, 0, 818, 1771, 1771, 847, 843, 874, - 799, 0, 905, 903, 800, 1771, 1771, 1771, 1771, 1771, + 0, 0, 1886, 1111, 755, 1886, 0, 0, 1079, 747, + 754, 1074, 1067, 1069, 1079, 1886, 1886, 1104, 1069, 717, + 1070, 1058, 1067, 777, 1063, 1052, 1062, 1056, 1041, 0, + 0, 1886, 1886, 1079, 787, 1886, 1078, 0, 1886, 1886, + 1077, 0, 0, 0, 743, 765, 1886, 791, 1886, 1069, + 1886, 1075, 0, 1886, 794, 1074, 795, 798, 1062, 0, + 1886, 1071, 0, 1886, 789, 0, 1085, 0, 801, 1070, + 0, 804, 1886, 1886, 807, 1886, 1069, 0, 804, 1886, + 1886, 1068, 806, 1886, 0, 818, 1886, 1886, 847, 843, + 874, 799, 0, 905, 903, 800, 1886, 1886, 1886, 1886, - 1771, 1051, 1005, 1771, 823, 0, 1771, 1029, 824, 1771, - 1021, 816, 871, 0, 1771, 1771, 1018, 0, 1771, 1013, - 872, 876, 0, 1036, 0, 974, 948, 917, 910, 903, - 874, 880, 875, 871, 864, 844, 835, 833, 799, 0, - 884, 1771, 890, 907, 845, 618, 863, 873, 910, 911, - 914, 922, 799, 1085, 795, 935, 938, 796, 786, 747, - 702, 695, 614, 974, 610, 598, 428, 938, 942, 945, - 1771, 961, 953, 1771, 406, 395, 977, 985, 986, 990, - 991, 994, 385, 372, 998, 365, 1006, 247, 1771, 972, - 977, 985, 241, 1015, 1018, 1023, 1026, 1027, 1031, 153, + 1886, 1886, 1066, 1026, 1886, 823, 0, 1886, 1048, 824, + 1886, 1047, 816, 871, 0, 1886, 1886, 1027, 0, 1886, + 1006, 872, 876, 0, 1134, 0, 969, 971, 948, 943, + 906, 897, 880, 875, 871, 864, 844, 835, 833, 799, + 0, 884, 1886, 890, 907, 845, 618, 863, 873, 914, + 889, 910, 912, 799, 1183, 795, 938, 942, 796, 786, + 747, 702, 695, 614, 959, 610, 598, 428, 932, 945, + 946, 1886, 947, 952, 1886, 406, 395, 975, 984, 985, + 990, 993, 994, 385, 372, 997, 365, 998, 247, 1886, + 966, 991, 994, 241, 1023, 1024, 1029, 1032, 1033, 1036, - 1048, 1049, 74, 1771, 22, 1056, 1057, 1060, 1061, 1064, - 0, 1065, 1068, 1771, 1134, 1151, 1168, 1185, 1202, 1219, - 1236, 1253, 1270, 1287, 1304, 1321, 1338, 1351, 1353, 1370, - 1387, 1404, 1421, 1438, 1455, 1472, 1489, 1500, 1517, 1534, - 1540, 1557, 1574, 1591, 1597, 1614, 1631, 1648, 1654, 1660, - 1677, 1694, 1702, 1719, 1736, 1059, 1753 + 153, 1037, 1040, 74, 1886, 22, 1041, 1044, 1045, 1054, + 1055, 0, 1062, 1063, 1886, 1232, 1249, 1266, 1283, 1300, + 1317, 1334, 1351, 1368, 1385, 1402, 1419, 1436, 1449, 1451, + 1468, 1485, 1502, 1519, 1536, 1553, 1570, 1587, 1598, 1615, + 1632, 1638, 1655, 1672, 1689, 1695, 1712, 1729, 1746, 1752, + 1758, 1775, 1792, 1800, 1817, 1834, 1851, 1056, 1868 } ; -static yyconst short int yy_def[458] = +static yyconst flex_int16_t yy_def[460] = { 0, - 414, 1, 414, 3, 415, 415, 414, 7, 416, 416, - 417, 417, 418, 418, 419, 419, 414, 17, 420, 420, - 414, 21, 414, 23, 421, 421, 422, 422, 414, 29, - 414, 31, 414, 33, 423, 423, 424, 424, 414, 39, - 425, 425, 426, 426, 414, 427, 414, 414, 414, 414, - 414, 428, 429, 428, 414, 414, 414, 414, 414, 58, - 414, 414, 58, 63, 63, 63, 63, 63, 63, 63, - 430, 414, 431, 414, 414, 414, 414, 414, 414, 414, - 429, 414, 432, 414, 414, 433, 434, 414, 433, 435, - 414, 436, 414, 437, 414, 414, 414, 414, 438, 414, + 415, 1, 415, 3, 416, 416, 415, 7, 417, 417, + 418, 418, 419, 419, 420, 420, 415, 17, 421, 421, + 415, 21, 415, 23, 422, 422, 423, 423, 415, 29, + 415, 31, 415, 33, 424, 424, 425, 425, 415, 39, + 426, 426, 427, 427, 415, 428, 415, 415, 415, 415, + 415, 429, 430, 429, 415, 415, 415, 415, 415, 58, + 415, 415, 58, 63, 63, 63, 63, 63, 63, 63, + 431, 415, 432, 415, 415, 415, 415, 415, 415, 415, + 430, 415, 433, 415, 415, 434, 435, 415, 434, 436, + 415, 437, 415, 438, 415, 415, 415, 415, 439, 415, - 439, 414, 414, 414, 440, 414, 414, 414, 414, 414, - 414, 414, 414, 441, 414, 442, 414, 414, 414, 414, - 443, 444, 445, 414, 445, 414, 414, 414, 414, 414, - 446, 414, 414, 414, 414, 414, 414, 447, 414, 427, - 414, 414, 414, 414, 414, 428, 429, 448, 414, 414, - 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, - 414, 429, 414, 429, 414, 414, 414, 414, 414, 449, - 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, - 414, 414, 450, 451, 452, 414, 414, 414, 414, 452, - 414, 414, 414, 414, 453, 453, 427, 414, 428, 414, + 440, 415, 415, 415, 441, 415, 415, 415, 415, 415, + 415, 415, 415, 442, 415, 443, 415, 415, 415, 415, + 444, 445, 446, 415, 446, 415, 415, 415, 415, 415, + 447, 415, 415, 415, 415, 415, 415, 448, 415, 428, + 415, 415, 415, 415, 415, 429, 430, 449, 415, 415, + 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, + 415, 430, 415, 430, 415, 415, 415, 415, 415, 450, + 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, + 415, 415, 451, 452, 453, 415, 415, 415, 415, 453, + 415, 415, 415, 415, 454, 454, 428, 415, 429, 415, - 454, 429, 414, 414, 414, 414, 58, 63, 63, 63, - 63, 63, 63, 63, 63, 414, 414, 414, 63, 63, - 63, 63, 63, 63, 63, 63, 63, 63, 63, 430, - 455, 414, 414, 414, 414, 414, 414, 432, 414, 414, - 414, 434, 435, 436, 437, 437, 414, 414, 414, 438, - 414, 414, 439, 414, 414, 414, 414, 414, 414, 441, - 414, 414, 442, 414, 443, 444, 445, 414, 414, 125, - 414, 414, 414, 414, 414, 414, 446, 447, 414, 414, - 414, 428, 414, 448, 414, 414, 414, 414, 414, 414, - 414, 456, 414, 414, 414, 414, 414, 414, 414, 414, + 455, 430, 415, 415, 415, 415, 58, 63, 63, 63, + 63, 63, 63, 63, 63, 415, 415, 415, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 431, + 456, 415, 415, 415, 415, 415, 415, 433, 415, 415, + 415, 435, 436, 437, 438, 438, 415, 415, 415, 439, + 415, 415, 440, 415, 415, 415, 415, 415, 415, 442, + 415, 415, 443, 415, 444, 457, 445, 446, 415, 415, + 125, 415, 415, 415, 415, 415, 415, 447, 448, 415, + 415, 415, 429, 415, 449, 415, 415, 415, 415, 415, + 415, 415, 458, 415, 415, 415, 415, 415, 415, 415, - 414, 414, 429, 414, 414, 449, 414, 414, 414, 414, - 414, 414, 414, 450, 414, 414, 414, 452, 414, 414, - 452, 414, 453, 457, 454, 63, 63, 63, 63, 63, - 63, 414, 63, 63, 63, 63, 63, 63, 63, 455, - 414, 414, 414, 414, 414, 414, 414, 414, 456, 414, - 414, 414, 429, 457, 63, 63, 63, 63, 63, 63, - 63, 63, 63, 63, 63, 63, 63, 414, 414, 414, - 414, 414, 414, 414, 429, 63, 414, 414, 63, 63, - 63, 63, 63, 63, 414, 63, 63, 63, 414, 414, - 414, 414, 429, 63, 414, 414, 414, 414, 63, 63, + 415, 415, 415, 430, 415, 415, 450, 415, 415, 415, + 415, 415, 415, 415, 451, 415, 415, 415, 453, 415, + 415, 453, 415, 454, 459, 455, 63, 63, 63, 63, + 63, 63, 415, 63, 63, 63, 63, 63, 63, 63, + 456, 415, 415, 415, 415, 415, 415, 415, 415, 458, + 415, 415, 415, 430, 459, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 415, 415, + 415, 415, 415, 415, 415, 430, 63, 415, 415, 63, + 63, 63, 63, 63, 63, 415, 63, 63, 63, 415, + 415, 415, 415, 430, 63, 415, 415, 415, 415, 63, - 63, 414, 63, 414, 429, 414, 414, 63, 414, 63, - 429, 414, 414, 0, 414, 414, 414, 414, 414, 414, - 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, - 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, - 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, - 414, 414, 414, 414, 414, 414, 414 + 63, 63, 415, 63, 415, 430, 415, 415, 63, 415, + 63, 430, 415, 415, 0, 415, 415, 415, 415, 415, + 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, + 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, + 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, + 415, 415, 415, 415, 415, 415, 415, 415, 415 } ; -static yyconst short int yy_nxt[1821] = +static yyconst flex_int16_t yy_nxt[1936] = { 0, 46, 47, 48, 47, 46, 49, 50, 46, 51, 46, 46, 46, 46, 46, 52, 46, 46, 46, 46, 46, 46, 53, 53, 53, 53, 53, 54, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 46, 55, - 198, 55, 198, 411, 56, 57, 58, 59, 60, 57, + 198, 55, 198, 412, 56, 57, 58, 59, 60, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 61, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 62, 57, 63, 63, 63, 64, 65, 63, 63, 63, 66, 67, 63, 63, 63, 68, 63, 63, 63, - 69, 70, 63, 57, 72, 72, 93, 200, 410, 93, + 69, 70, 63, 57, 72, 72, 93, 200, 411, 93, 201, 203, 204, 217, 218, 94, 73, 73, 94, 205, - 414, 205, 200, 414, 206, 201, 233, 234, 74, 74, + 415, 205, 200, 415, 206, 201, 233, 234, 74, 74, 75, 76, 77, 76, 75, 78, 75, 75, 75, 75, 75, 75, 75, 75, 79, 75, 75, 75, 80, 75, 75, 81, 81, 81, 81, 81, 82, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 75, 84, - 84, 84, 85, 85, 84, 408, 232, 88, 84, 84, + 84, 84, 85, 85, 84, 409, 232, 88, 84, 84, 88, 220, 223, 221, 224, 200, 222, 235, 201, 235, 225, 236, 237, 86, 86, 89, 91, 91, 89, 248, @@ -533,8 +632,8 @@ static yyconst short int yy_nxt[1821] = 100, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 95, 102, 102, 200, 103, 103, 201, 104, - 104, 240, 241, 405, 246, 105, 105, 247, 200, 251, - 252, 201, 200, 255, 256, 201, 403, 106, 106, 107, + 104, 240, 241, 406, 246, 105, 105, 247, 200, 251, + 252, 201, 200, 255, 256, 201, 404, 106, 106, 107, 108, 109, 108, 107, 107, 107, 107, 107, 107, 110, 107, 111, 112, 113, 107, 107, 107, 107, 107, 107, @@ -546,15 +645,15 @@ static yyconst short int yy_nxt[1821] = 123, 123, 123, 123, 124, 125, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 116, 127, 128, 127, - 127, 128, 127, 401, 257, 129, 257, 258, 129, 258, + 127, 128, 127, 402, 257, 129, 257, 258, 129, 258, - 173, 174, 173, 400, 173, 174, 173, 200, 261, 262, - 201, 200, 130, 175, 201, 130, 132, 175, 399, 133, - 268, 269, 134, 135, 136, 176, 137, 394, 138, 176, - 186, 271, 272, 271, 187, 275, 276, 280, 281, 273, - 139, 132, 188, 279, 133, 393, 201, 134, 135, 136, - 198, 137, 198, 138, 189, 414, 274, 285, 414, 285, - 200, 296, 297, 201, 388, 139, 140, 141, 142, 141, + 173, 174, 173, 401, 173, 174, 173, 200, 261, 262, + 201, 200, 130, 175, 201, 130, 132, 175, 400, 133, + 269, 270, 134, 135, 136, 176, 137, 395, 138, 176, + 186, 272, 273, 272, 187, 276, 277, 281, 282, 274, + 139, 132, 188, 280, 133, 394, 201, 134, 135, 136, + 198, 137, 198, 138, 189, 415, 275, 286, 415, 286, + 200, 297, 298, 201, 389, 139, 140, 141, 142, 141, 140, 143, 144, 140, 145, 140, 140, 140, 140, 140, 146, 140, 140, 140, 140, 140, 140, 147, 147, 147, 147, 147, 148, 147, 147, 147, 147, 147, 147, 147, @@ -571,155 +670,168 @@ static yyconst short int yy_nxt[1821] = 171, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 166, 76, 77, 76, 305, 78, 305, 190, - 186, 190, 299, 300, 191, 301, 302, 177, 177, 177, - 200, 387, 188, 201, 307, 308, 310, 311, 82, 76, - 77, 76, 371, 78, 189, 309, 200, 309, 386, 201, - 312, 312, 312, 177, 177, 177, 313, 200, 313, 384, - 201, 316, 317, 371, 82, 178, 179, 180, 179, 178, + 170, 170, 166, 76, 77, 76, 306, 78, 306, 190, + 186, 190, 300, 301, 191, 302, 303, 177, 177, 177, + 200, 388, 188, 201, 308, 309, 311, 312, 82, 76, + 77, 76, 372, 78, 189, 310, 200, 310, 387, 201, + 313, 313, 313, 177, 177, 177, 314, 200, 314, 385, + 201, 317, 318, 372, 82, 178, 179, 180, 179, 178, 178, 178, 178, 178, 181, 181, 178, 178, 178, 182, 178, 178, 178, 178, 178, 178, 183, 183, 183, 183, 183, 184, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 178, 50, 192, 193, 192, 50, 194, - 50, 50, 50, 50, 50, 50, 50, 383, 196, 293, - 293, 293, 50, 50, 50, 382, 200, 294, 295, 201, - 319, 320, 321, 322, 321, 322, 200, 206, 198, 324, - 198, 294, 414, 327, 414, 414, 205, 414, 205, 295, - 328, 206, 50, 50, 192, 193, 192, 50, 194, 50, - 50, 50, 50, 50, 50, 50, 246, 196, 332, 247, - 332, 50, 50, 50, 220, 223, 221, 224, 235, 222, - 235, 381, 248, 225, 248, 341, 257, 341, 257, 258, + 50, 50, 50, 50, 50, 50, 50, 384, 196, 294, + 294, 294, 50, 50, 50, 383, 200, 295, 296, 201, + 320, 321, 322, 323, 322, 323, 200, 206, 198, 325, + 198, 295, 415, 328, 415, 415, 205, 415, 205, 296, + 329, 206, 50, 50, 192, 193, 192, 50, 194, 50, + 50, 50, 50, 50, 50, 50, 246, 196, 333, 247, + 333, 50, 50, 50, 220, 223, 221, 224, 235, 222, + 235, 382, 248, 225, 248, 342, 257, 342, 257, 258, - 414, 258, 343, 414, 343, 271, 272, 271, 333, 275, - 276, 50, 207, 273, 207, 414, 334, 414, 414, 285, - 414, 285, 348, 352, 305, 309, 305, 309, 380, 379, - 274, 312, 312, 312, 376, 375, 348, 352, 367, 208, + 415, 258, 344, 415, 344, 272, 273, 272, 334, 276, + 277, 50, 207, 274, 207, 415, 335, 415, 415, 286, + 415, 286, 349, 353, 306, 310, 306, 310, 381, 380, + 275, 313, 313, 313, 377, 376, 349, 353, 368, 208, 208, 208, 209, 210, 208, 208, 208, 211, 212, 208, - 208, 208, 213, 208, 208, 208, 214, 215, 208, 414, - 289, 414, 288, 288, 289, 366, 344, 345, 370, 365, - 290, 291, 313, 321, 313, 321, 364, 322, 206, 322, - 344, 332, 370, 332, 290, 341, 371, 341, 345, 208, - 208, 343, 291, 343, 208, 208, 371, 346, 347, 208, + 208, 208, 213, 208, 208, 208, 214, 215, 208, 415, + 290, 415, 289, 289, 290, 367, 345, 346, 371, 366, + 291, 292, 314, 322, 314, 322, 365, 323, 206, 323, + 345, 333, 371, 333, 291, 342, 372, 342, 346, 208, + 208, 344, 292, 344, 208, 208, 372, 347, 348, 208, - 371, 363, 362, 208, 208, 263, 263, 361, 263, 263, - 371, 346, 263, 360, 263, 263, 263, 263, 263, 347, - 293, 293, 293, 263, 263, 263, 350, 351, 294, 295, - 368, 369, 270, 372, 373, 374, 377, 374, 377, 378, - 350, 378, 294, 359, 368, 374, 358, 372, 351, 357, - 295, 374, 369, 263, 282, 373, 374, 284, 282, 374, - 282, 282, 389, 282, 282, 389, 282, 282, 389, 282, - 282, 282, 282, 282, 282, 385, 392, 385, 377, 389, - 377, 356, 389, 389, 390, 391, 378, 395, 378, 395, - 392, 396, 397, 396, 397, 398, 404, 398, 390, 385, + 372, 364, 363, 208, 208, 266, 266, 362, 266, 266, + 372, 347, 266, 375, 266, 266, 266, 266, 266, 348, + 294, 294, 294, 266, 266, 266, 351, 352, 295, 296, + 369, 370, 266, 375, 375, 375, 361, 373, 374, 378, + 351, 378, 295, 379, 369, 379, 360, 375, 352, 375, + 296, 373, 370, 266, 263, 263, 390, 263, 263, 374, + 386, 263, 386, 263, 263, 263, 263, 263, 390, 390, + 391, 392, 263, 263, 263, 393, 378, 390, 378, 359, + 358, 271, 390, 390, 391, 379, 396, 379, 396, 393, + 405, 397, 392, 397, 398, 399, 398, 399, 386, 403, - 404, 385, 282, 288, 288, 289, 391, 402, 404, 402, - 355, 290, 291, 292, 404, 319, 406, 404, 406, 395, - 316, 395, 404, 310, 396, 290, 396, 397, 398, 397, - 398, 307, 407, 291, 407, 292, 325, 325, 353, 325, - 325, 325, 325, 325, 325, 325, 325, 325, 325, 409, - 402, 409, 402, 301, 325, 325, 325, 406, 407, 406, - 407, 412, 409, 412, 409, 413, 412, 413, 412, 413, - 349, 413, 349, 280, 275, 268, 261, 342, 255, 251, - 249, 240, 236, 233, 325, 325, 325, 339, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, 338, 337, + 386, 403, 263, 283, 357, 356, 285, 283, 320, 283, + 283, 405, 283, 283, 405, 283, 283, 405, 283, 283, + 283, 283, 283, 283, 407, 396, 407, 396, 405, 317, + 397, 405, 397, 398, 399, 398, 399, 408, 410, 408, + 410, 403, 407, 403, 407, 408, 413, 408, 413, 311, + 308, 283, 289, 289, 290, 410, 414, 410, 414, 354, + 291, 292, 293, 413, 414, 413, 414, 350, 302, 350, + 281, 276, 269, 261, 291, 343, 255, 251, 249, 240, + 236, 233, 292, 340, 293, 266, 266, 339, 266, 266, + 338, 337, 266, 336, 266, 266, 266, 266, 266, 332, - 336, 335, 331, 325, 325, 325, 330, 329, 326, 217, - 229, 228, 227, 226, 219, 203, 304, 303, 298, 287, - 286, 264, 259, 249, 414, 229, 228, 227, 226, 219, - 216, 414, 414, 325, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, - 71, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 87, 87, + 331, 330, 327, 266, 266, 266, 217, 229, 228, 227, + 226, 219, 266, 203, 305, 304, 299, 288, 287, 264, + 259, 249, 415, 229, 228, 227, 226, 219, 216, 415, + 415, 415, 415, 266, 326, 326, 415, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 415, 415, 415, + 415, 415, 326, 326, 326, 415, 415, 415, 415, 415, + 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, + 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, + 415, 415, 326, 326, 326, 415, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 415, 415, 415, 415, + + 415, 326, 326, 326, 415, 415, 415, 415, 415, 415, + 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, + 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, + 415, 326, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, - 87, 87, 87, 87, 87, 90, 90, 90, 90, 90, + 87, 87, 87, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 101, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 92, 92, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, - 101, 101, 101, 101, 101, 101, 126, 126, 126, 126, + 101, 101, 101, 101, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 131, 131, 131, 131, 131, 131, 131, - 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 126, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 75, 75, 75, + 172, 172, 172, 172, 172, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 185, 185, 185, 185, 185, 185, - 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, - 185, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 197, 414, - 414, 414, 414, 414, 197, 197, 197, 197, 414, 197, - 197, 199, 414, 414, 414, 199, 414, 199, 199, 199, - 199, 199, 199, 199, 202, 414, 202, 202, 414, 202, - 230, 230, 414, 230, 230, 230, 230, 230, 230, 230, - 414, 230, 230, 230, 230, 414, 230, 231, 231, 231, + 75, 75, 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, 185, 195, + 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, + 195, 195, 195, 195, 195, 195, 197, 415, 415, 415, + 415, 415, 197, 197, 197, 197, 415, 197, 197, 199, + 415, 415, 415, 199, 415, 199, 199, 199, 199, 199, + 199, 199, 202, 415, 202, 202, 415, 202, 230, 230, + 415, 230, 230, 230, 230, 230, 230, 230, 415, 230, + 230, 230, 230, 415, 230, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, - 231, 231, 231, 231, 238, 238, 414, 414, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 414, - 238, 239, 239, 239, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 239, 239, 239, 239, 242, 242, - 414, 242, 242, 414, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 414, 242, 243, 243, 414, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 414, 243, 243, - 414, 243, 244, 244, 414, 244, 244, 244, 244, 244, - 414, 244, 244, 244, 244, 244, 244, 244, 244, 245, - 245, 414, 245, 245, 245, 245, 245, 245, 245, 245, + 231, 231, 238, 238, 415, 415, 238, 238, 238, 238, + 238, 238, 238, 238, 238, 238, 238, 415, 238, 239, + 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, + 239, 239, 239, 239, 239, 239, 242, 242, 415, 242, + 242, 415, 242, 242, 242, 242, 242, 242, 242, 242, + 242, 415, 242, 243, 243, 415, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 415, 243, 243, 415, 243, + 244, 244, 415, 244, 244, 244, 244, 244, 415, 244, + 244, 244, 244, 244, 244, 244, 244, 245, 245, 415, + 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, - 245, 245, 245, 245, 245, 245, 250, 414, 414, 414, - 414, 250, 414, 250, 250, 414, 250, 253, 253, 414, - 414, 253, 414, 253, 253, 253, 253, 414, 253, 253, - 253, 253, 414, 253, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 260, 414, 260, 260, 414, 260, 263, 263, 414, - 414, 414, 414, 263, 263, 263, 263, 414, 414, 263, - 414, 414, 414, 263, 265, 265, 414, 414, 414, 414, - 265, 265, 265, 265, 265, 265, 265, 265, 265, 414, - 265, 266, 266, 414, 414, 414, 414, 266, 266, 266, + 245, 245, 245, 245, 250, 415, 415, 415, 415, 250, + 415, 250, 250, 415, 250, 253, 253, 415, 415, 253, + 415, 253, 253, 253, 253, 415, 253, 253, 253, 253, + 415, 253, 254, 254, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, 254, 260, + 415, 260, 260, 415, 260, 263, 263, 415, 415, 415, + 415, 263, 263, 263, 263, 415, 415, 263, 415, 415, + 415, 263, 265, 265, 415, 415, 415, 415, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 415, 265, 267, + 267, 415, 415, 415, 415, 267, 267, 267, 267, 415, - 266, 414, 266, 266, 266, 266, 414, 266, 267, 414, - 267, 267, 414, 267, 277, 277, 414, 414, 277, 414, - 414, 414, 277, 277, 414, 277, 277, 277, 277, 414, - 277, 278, 278, 414, 414, 278, 414, 414, 414, 278, - 278, 278, 278, 278, 278, 278, 414, 278, 283, 283, - 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, - 283, 283, 283, 283, 283, 306, 414, 306, 306, 414, - 306, 314, 414, 314, 314, 414, 314, 315, 315, 315, - 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - 315, 315, 315, 315, 318, 318, 414, 318, 414, 318, + 267, 267, 267, 267, 415, 267, 268, 415, 268, 268, + 415, 268, 278, 278, 415, 415, 278, 415, 415, 415, + 278, 278, 415, 278, 278, 278, 278, 415, 278, 279, + 279, 415, 415, 279, 415, 415, 415, 279, 279, 279, + 279, 279, 279, 279, 415, 279, 284, 284, 284, 284, + 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, + 284, 284, 284, 307, 415, 307, 307, 415, 307, 315, + 415, 315, 315, 415, 315, 316, 316, 316, 316, 316, + 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + 316, 316, 319, 319, 415, 319, 415, 319, 319, 319, - 318, 318, 318, 318, 414, 318, 318, 318, 318, 414, - 318, 323, 323, 323, 414, 323, 323, 323, 323, 325, - 325, 414, 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 340, 340, 414, 340, - 340, 340, 340, 340, 414, 340, 414, 340, 340, 340, - 340, 414, 340, 354, 354, 414, 354, 354, 354, 354, - 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, - 45, 414, 414, 414, 414, 414, 414, 414, 414, 414, - 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, - 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, + 319, 319, 415, 319, 319, 319, 319, 415, 319, 324, + 324, 324, 415, 324, 324, 324, 324, 326, 326, 415, + 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 341, 341, 415, 341, 341, 341, + 341, 341, 415, 341, 415, 341, 341, 341, 341, 415, + 341, 266, 266, 415, 415, 415, 415, 266, 266, 266, + 266, 415, 415, 266, 415, 415, 415, 266, 355, 355, + 415, 355, 355, 355, 355, 355, 355, 355, 355, 355, + 355, 355, 355, 355, 355, 45, 415, 415, 415, 415, + 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, - 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, - 414, 414, 414, 414, 414, 414, 414, 414, 414, 414 + 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, + 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, + 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, + 415, 415, 415, 415, 415 } ; -static yyconst short int yy_chk[1821] = +static yyconst flex_int16_t yy_chk[1936] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 47, 2, 47, 405, 2, 3, 3, 3, 3, 3, + 47, 2, 47, 406, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 5, 6, 15, 52, 403, 16, + 3, 3, 3, 3, 5, 6, 15, 52, 404, 16, 52, 54, 54, 62, 62, 15, 5, 6, 16, 55, 54, 55, 61, 54, 55, 61, 74, 74, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, @@ -727,7 +839,7 @@ static yyconst short int yy_chk[1821] = 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 9, - 10, 11, 9, 10, 12, 400, 73, 11, 13, 14, + 10, 11, 9, 10, 12, 401, 73, 11, 13, 14, 12, 65, 66, 65, 66, 73, 65, 76, 73, 76, 66, 82, 82, 9, 10, 11, 13, 14, 12, 96, @@ -737,8 +849,8 @@ static yyconst short int yy_chk[1821] = 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 19, 20, 79, 19, 20, 79, 19, - 20, 86, 86, 393, 94, 19, 20, 94, 98, 100, - 100, 98, 105, 106, 106, 105, 388, 19, 20, 21, + 20, 86, 86, 394, 94, 19, 20, 94, 98, 100, + 100, 98, 105, 106, 106, 105, 389, 19, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, @@ -750,15 +862,15 @@ static yyconst short int yy_chk[1821] = 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 25, 25, 25, - 26, 26, 26, 386, 108, 25, 108, 110, 26, 110, + 26, 26, 26, 387, 108, 25, 108, 110, 26, 110, - 35, 35, 35, 384, 36, 36, 36, 113, 115, 115, - 113, 121, 25, 35, 121, 26, 27, 36, 383, 27, - 124, 124, 27, 27, 27, 35, 27, 376, 27, 36, + 35, 35, 35, 385, 36, 36, 36, 113, 115, 115, + 113, 121, 25, 35, 121, 26, 27, 36, 384, 27, + 124, 124, 27, 27, 27, 35, 27, 377, 27, 36, 41, 127, 127, 127, 41, 130, 130, 139, 139, 127, - 27, 28, 41, 138, 28, 375, 138, 28, 28, 28, + 27, 28, 41, 138, 28, 376, 138, 28, 28, 28, 141, 28, 141, 28, 41, 146, 127, 150, 146, 150, - 156, 159, 159, 156, 367, 28, 29, 29, 29, 29, + 156, 159, 159, 156, 368, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, @@ -777,142 +889,158 @@ static yyconst short int yy_chk[1821] = 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 37, 37, 37, 167, 37, 167, 42, 42, 42, 161, 161, 42, 163, 163, 37, 37, 37, - 169, 366, 42, 169, 171, 171, 176, 176, 37, 38, - 38, 38, 346, 38, 42, 173, 175, 173, 365, 175, - 177, 177, 177, 38, 38, 38, 179, 182, 179, 363, - 182, 184, 184, 346, 38, 39, 39, 39, 39, 39, + 169, 367, 42, 169, 171, 171, 176, 176, 37, 38, + 38, 38, 347, 38, 42, 173, 175, 173, 366, 175, + 177, 177, 177, 38, 38, 38, 179, 182, 179, 364, + 182, 184, 184, 347, 38, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 362, 43, 158, - 158, 158, 43, 43, 43, 361, 188, 158, 158, 188, + 43, 43, 43, 43, 43, 43, 43, 363, 43, 158, + 158, 158, 43, 43, 43, 362, 188, 158, 158, 188, 189, 189, 190, 192, 190, 192, 196, 190, 198, 196, 198, 158, 199, 220, 245, 199, 205, 245, 205, 158, 220, 205, 43, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 246, 44, 224, 246, 224, 44, 44, 44, 210, 211, 210, 211, 235, 210, - 235, 360, 248, 211, 248, 255, 257, 255, 257, 258, + 235, 361, 248, 211, 248, 255, 257, 255, 257, 258, - 265, 258, 268, 265, 268, 271, 271, 271, 224, 274, - 274, 44, 58, 271, 58, 278, 224, 282, 278, 285, - 282, 285, 291, 295, 305, 309, 305, 309, 359, 358, - 271, 312, 312, 312, 355, 353, 291, 295, 339, 58, + 265, 258, 269, 265, 269, 272, 272, 272, 224, 275, + 275, 44, 58, 272, 58, 279, 224, 283, 279, 286, + 283, 286, 292, 296, 306, 310, 306, 310, 360, 359, + 272, 313, 313, 313, 356, 354, 292, 296, 340, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 63, - 289, 63, 288, 288, 288, 338, 289, 289, 345, 337, - 288, 288, 313, 321, 313, 321, 336, 322, 321, 322, - 289, 332, 345, 332, 288, 341, 347, 341, 289, 63, - 63, 343, 288, 343, 63, 63, 348, 290, 290, 63, + 290, 63, 289, 289, 289, 339, 290, 290, 346, 338, + 289, 289, 314, 322, 314, 322, 337, 323, 322, 323, + 290, 333, 346, 333, 289, 342, 348, 342, 290, 63, + 63, 344, 289, 344, 63, 63, 349, 291, 291, 63, - 347, 335, 334, 63, 63, 125, 125, 333, 125, 125, - 348, 290, 125, 331, 125, 125, 125, 125, 125, 290, - 293, 293, 293, 125, 125, 125, 294, 294, 293, 293, - 344, 344, 125, 349, 349, 350, 356, 351, 356, 357, - 294, 357, 293, 330, 344, 352, 329, 349, 294, 328, - 293, 351, 344, 125, 148, 349, 350, 148, 148, 352, - 148, 148, 368, 148, 148, 369, 148, 148, 370, 148, - 148, 148, 148, 148, 148, 364, 373, 364, 377, 369, - 377, 327, 370, 368, 372, 372, 378, 379, 378, 379, - 373, 380, 381, 380, 381, 382, 390, 382, 372, 385, + 348, 336, 335, 63, 63, 122, 122, 334, 122, 122, + 349, 291, 122, 351, 122, 122, 122, 122, 122, 291, + 294, 294, 294, 122, 122, 122, 295, 295, 294, 294, + 345, 345, 122, 352, 351, 353, 332, 350, 350, 357, + 295, 357, 294, 358, 345, 358, 331, 352, 295, 353, + 294, 350, 345, 122, 125, 125, 369, 125, 125, 350, + 365, 125, 365, 125, 125, 125, 125, 125, 370, 371, + 373, 373, 125, 125, 125, 374, 378, 369, 378, 330, + 329, 125, 370, 371, 373, 379, 380, 379, 380, 374, + 391, 381, 373, 381, 382, 383, 382, 383, 386, 388, - 391, 385, 148, 157, 157, 157, 372, 387, 392, 387, - 326, 157, 157, 157, 391, 320, 394, 390, 394, 395, - 317, 395, 392, 311, 396, 157, 396, 397, 398, 397, - 398, 308, 399, 157, 399, 157, 324, 324, 303, 324, - 324, 324, 324, 324, 324, 324, 324, 324, 324, 401, - 402, 401, 402, 302, 324, 324, 324, 406, 407, 406, - 407, 408, 409, 408, 409, 410, 412, 410, 412, 413, - 456, 413, 456, 281, 276, 269, 262, 259, 256, 252, - 250, 241, 237, 234, 324, 354, 354, 229, 354, 354, - 354, 354, 354, 354, 354, 354, 354, 354, 228, 227, + 386, 388, 125, 148, 328, 327, 148, 148, 321, 148, + 148, 391, 148, 148, 392, 148, 148, 393, 148, 148, + 148, 148, 148, 148, 395, 396, 395, 396, 392, 318, + 397, 393, 397, 398, 399, 398, 399, 400, 402, 400, + 402, 403, 407, 403, 407, 408, 409, 408, 409, 312, + 309, 148, 157, 157, 157, 410, 411, 410, 411, 304, + 157, 157, 157, 413, 414, 413, 414, 458, 303, 458, + 282, 277, 270, 262, 157, 259, 256, 252, 250, 241, + 237, 234, 157, 229, 157, 267, 267, 228, 267, 267, + 227, 226, 267, 225, 267, 267, 267, 267, 267, 223, - 226, 225, 223, 354, 354, 354, 222, 221, 219, 218, - 215, 214, 213, 212, 209, 204, 165, 164, 160, 154, - 152, 119, 112, 99, 89, 70, 69, 68, 67, 64, - 60, 45, 0, 354, 415, 415, 415, 415, 415, 415, - 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, - 415, 416, 416, 416, 416, 416, 416, 416, 416, 416, - 416, 416, 416, 416, 416, 416, 416, 416, 417, 417, + 222, 221, 219, 267, 267, 267, 218, 215, 214, 213, + 212, 209, 267, 204, 165, 164, 160, 154, 152, 119, + 112, 99, 89, 70, 69, 68, 67, 64, 60, 45, + 0, 0, 0, 267, 325, 325, 0, 325, 325, 325, + 325, 325, 325, 325, 325, 325, 325, 0, 0, 0, + 0, 0, 325, 325, 325, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 325, 355, 355, 0, 355, 355, 355, 355, + 355, 355, 355, 355, 355, 355, 0, 0, 0, 0, + + 0, 355, 355, 355, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 355, 416, 416, 416, 416, 416, 416, 416, 416, + 416, 416, 416, 416, 416, 416, 416, 416, 416, 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 418, 418, 418, 418, 418, + 417, 417, 417, 417, 417, 417, 418, 418, 418, 418, 418, 418, 418, 418, 418, 418, 418, 418, 418, 418, + 418, 418, 418, 419, 419, 419, 419, 419, 419, 419, + 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, - 418, 418, 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, 419, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, - 420, 420, 420, 420, 420, 420, 421, 421, 421, 421, + 420, 420, 420, 420, 420, 420, 420, 421, 421, 421, 421, 421, 421, 421, 421, 421, 421, 421, 421, 421, - 421, 421, 421, 422, 422, 422, 422, 422, 422, 422, + 421, 421, 421, 421, 422, 422, 422, 422, 422, 422, 422, 422, 422, 422, 422, 422, 422, 422, 422, 422, - 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, - 423, 423, 423, 423, 423, 423, 423, 424, 424, 424, + 422, 423, 423, 423, 423, 423, 423, 423, 423, 423, + 423, 423, 423, 423, 423, 423, 423, 423, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, - - 424, 424, 424, 424, 425, 425, 425, 425, 425, 425, + 424, 424, 424, 424, 424, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, - 425, 426, 426, 426, 426, 426, 426, 426, 426, 426, - 426, 426, 426, 426, 426, 426, 426, 426, 427, 0, - 0, 0, 0, 0, 427, 427, 427, 427, 0, 427, - 427, 428, 0, 0, 0, 428, 0, 428, 428, 428, - 428, 428, 428, 428, 429, 0, 429, 429, 0, 429, - 430, 430, 0, 430, 430, 430, 430, 430, 430, 430, - 0, 430, 430, 430, 430, 0, 430, 431, 431, 431, - 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, - 431, 431, 431, 431, 432, 432, 0, 0, 432, 432, - 432, 432, 432, 432, 432, 432, 432, 432, 432, 0, - 432, 433, 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, 434, 434, - 0, 434, 434, 0, 434, 434, 434, 434, 434, 434, - 434, 434, 434, 0, 434, 435, 435, 0, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 0, 435, 435, - 0, 435, 436, 436, 0, 436, 436, 436, 436, 436, - 0, 436, 436, 436, 436, 436, 436, 436, 436, 437, - 437, 0, 437, 437, 437, 437, 437, 437, 437, 437, + 425, 425, 426, 426, 426, 426, 426, 426, 426, 426, + 426, 426, 426, 426, 426, 426, 426, 426, 426, 427, + 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, + 427, 427, 427, 427, 427, 427, 428, 0, 0, 0, + 0, 0, 428, 428, 428, 428, 0, 428, 428, 429, + 0, 0, 0, 429, 0, 429, 429, 429, 429, 429, + 429, 429, 430, 0, 430, 430, 0, 430, 431, 431, + 0, 431, 431, 431, 431, 431, 431, 431, 0, 431, + 431, 431, 431, 0, 431, 432, 432, 432, 432, 432, + 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - 437, 437, 437, 437, 437, 437, 438, 0, 0, 0, - 0, 438, 0, 438, 438, 0, 438, 439, 439, 0, - 0, 439, 0, 439, 439, 439, 439, 0, 439, 439, - 439, 439, 0, 439, 440, 440, 440, 440, 440, 440, - 440, 440, 440, 440, 440, 440, 440, 440, 440, 440, - 440, 441, 0, 441, 441, 0, 441, 442, 442, 0, - 0, 0, 0, 442, 442, 442, 442, 0, 0, 442, - 0, 0, 0, 442, 443, 443, 0, 0, 0, 0, - 443, 443, 443, 443, 443, 443, 443, 443, 443, 0, - 443, 444, 444, 0, 0, 0, 0, 444, 444, 444, + 432, 432, 433, 433, 0, 0, 433, 433, 433, 433, + 433, 433, 433, 433, 433, 433, 433, 0, 433, 434, + 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, + 434, 434, 434, 434, 434, 434, 435, 435, 0, 435, + 435, 0, 435, 435, 435, 435, 435, 435, 435, 435, + 435, 0, 435, 436, 436, 0, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 0, 436, 436, 0, 436, + 437, 437, 0, 437, 437, 437, 437, 437, 0, 437, + 437, 437, 437, 437, 437, 437, 437, 438, 438, 0, + 438, 438, 438, 438, 438, 438, 438, 438, 438, 438, - 444, 0, 444, 444, 444, 444, 0, 444, 445, 0, - 445, 445, 0, 445, 446, 446, 0, 0, 446, 0, - 0, 0, 446, 446, 0, 446, 446, 446, 446, 0, - 446, 447, 447, 0, 0, 447, 0, 0, 0, 447, - 447, 447, 447, 447, 447, 447, 0, 447, 448, 448, - 448, 448, 448, 448, 448, 448, 448, 448, 448, 448, - 448, 448, 448, 448, 448, 449, 0, 449, 449, 0, - 449, 450, 0, 450, 450, 0, 450, 451, 451, 451, - 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, - 451, 451, 451, 451, 452, 452, 0, 452, 0, 452, + 438, 438, 438, 438, 439, 0, 0, 0, 0, 439, + 0, 439, 439, 0, 439, 440, 440, 0, 0, 440, + 0, 440, 440, 440, 440, 0, 440, 440, 440, 440, + 0, 440, 441, 441, 441, 441, 441, 441, 441, 441, + 441, 441, 441, 441, 441, 441, 441, 441, 441, 442, + 0, 442, 442, 0, 442, 443, 443, 0, 0, 0, + 0, 443, 443, 443, 443, 0, 0, 443, 0, 0, + 0, 443, 444, 444, 0, 0, 0, 0, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 0, 444, 445, + 445, 0, 0, 0, 0, 445, 445, 445, 445, 0, - 452, 452, 452, 452, 0, 452, 452, 452, 452, 0, - 452, 453, 453, 453, 0, 453, 453, 453, 453, 454, - 454, 0, 454, 454, 454, 454, 454, 454, 454, 454, - 454, 454, 454, 454, 454, 454, 455, 455, 0, 455, - 455, 455, 455, 455, 0, 455, 0, 455, 455, 455, - 455, 0, 455, 457, 457, 0, 457, 457, 457, 457, - 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, - 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, - 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, - 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, + 445, 445, 445, 445, 0, 445, 446, 0, 446, 446, + 0, 446, 447, 447, 0, 0, 447, 0, 0, 0, + 447, 447, 0, 447, 447, 447, 447, 0, 447, 448, + 448, 0, 0, 448, 0, 0, 0, 448, 448, 448, + 448, 448, 448, 448, 0, 448, 449, 449, 449, 449, + 449, 449, 449, 449, 449, 449, 449, 449, 449, 449, + 449, 449, 449, 450, 0, 450, 450, 0, 450, 451, + 0, 451, 451, 0, 451, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 453, 453, 0, 453, 0, 453, 453, 453, - 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, - 414, 414, 414, 414, 414, 414, 414, 414, 414, 414 + 453, 453, 0, 453, 453, 453, 453, 0, 453, 454, + 454, 454, 0, 454, 454, 454, 454, 455, 455, 0, + 455, 455, 455, 455, 455, 455, 455, 455, 455, 455, + 455, 455, 455, 455, 456, 456, 0, 456, 456, 456, + 456, 456, 0, 456, 0, 456, 456, 456, 456, 0, + 456, 457, 457, 0, 0, 0, 0, 457, 457, 457, + 457, 0, 0, 457, 0, 0, 0, 457, 459, 459, + 0, 459, 459, 459, 459, 459, 459, 459, 459, 459, + 459, 459, 459, 459, 459, 415, 415, 415, 415, 415, + 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, + + 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, + 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, + 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, + 415, 415, 415, 415, 415 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; +extern int ppy__flex_debug; +int ppy__flex_debug = 0; + /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ @@ -920,9 +1048,8 @@ static char *yy_last_accepting_cpos; #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -char *yytext; +char *ppy_text; #line 1 "ppl.l" -#define INITIAL 0 /* -*-C-*- * Wrc preprocessor lexical analysis * @@ -1045,58 +1172,33 @@ char *yytext; * its turn improves the real resource scanner/parser. * */ + /* * Special flex options and exclusive scanner start-conditions */ -#define YY_STACK_USED 1 -#define YY_NEVER_INTERACTIVE 1 #define YY_NO_INPUT 1 -#define YY_NO_UNPUT 1 -#define pp_pp 1 -#define pp_eol 2 -#define pp_inc 3 -#define pp_dqs 4 -#define pp_sqs 5 -#define pp_iqs 6 -#define pp_comment 7 -#define pp_def 8 -#define pp_define 9 -#define pp_macro 10 -#define pp_mbody 11 -#define pp_macign 12 -#define pp_macscan 13 -#define pp_macexp 14 -#define pp_if 15 -#define pp_ifd 16 -#define pp_endif 17 -#define pp_line 18 -#define pp_defined 19 -#define pp_ignore 20 -#define RCINCL 21 -#line 159 "ppl.l" -#include "config.h" -#include "wine/port.h" +#line 164 "ppl.l" #include #include #include @@ -1117,6 +1219,7 @@ char *yytext; #define YY_NO_UNISTD_H #endif +#include "wine/wpp.h" #include "wpp_private.h" #include "ppy.tab.h" @@ -1144,6 +1247,7 @@ char *yytext; typedef struct bufferstackentry { YY_BUFFER_STATE bufferstate; /* Buffer to switch back to */ + void *filehandle; /* Handle to be used with wpp_callbacks->read */ pp_entry_t *define; /* Points to expanding define or NULL if handling includes */ int line_number; /* Line that we were handling */ int char_number; /* The current position on that line */ @@ -1237,12 +1341,128 @@ include_state_t pp_incl_state = includelogicentry_t *pp_includelogiclist = NULL; +#define YY_INPUT(buf,result,max_size) \ + { \ + result = wpp_callbacks->read(pp_status.file, buf, max_size); \ + } + +#define BUFFERINITIALCAPACITY 256 + +void pp_writestring(const char *format, ...) +{ + va_list valist; + int len; + static char *buffer; + static int buffercapacity; + char *new_buffer; + + if(buffercapacity == 0) + { + buffer = pp_xmalloc(BUFFERINITIALCAPACITY); + if(buffer == NULL) + return; + buffercapacity = BUFFERINITIALCAPACITY; + } + + va_start(valist, format); + len = vsnprintf(buffer, buffercapacity, + format, valist); + /* If the string is longer than buffersize, vsnprintf returns + * the string length with glibc >= 2.1, -1 with glibc < 2.1 */ + while(len > buffercapacity || len < 0) + { + do + { + buffercapacity *= 2; + } while(len > buffercapacity); + + new_buffer = pp_xrealloc(buffer, buffercapacity); + if(new_buffer == NULL) + { + va_end(valist); + return; + } + buffer = new_buffer; + len = vsnprintf(buffer, buffercapacity, + format, valist); + } + va_end(valist); + + wpp_callbacks->write(buffer, len); +} + /* ************************************************************************** * The scanner starts here ************************************************************************** */ -#line 1246 "lex.yy.c" +#line 1400 "lex.yy.c" + +#define INITIAL 0 +#define pp_pp 1 +#define pp_eol 2 +#define pp_inc 3 +#define pp_dqs 4 +#define pp_sqs 5 +#define pp_iqs 6 +#define pp_comment 7 +#define pp_def 8 +#define pp_define 9 +#define pp_macro 10 +#define pp_mbody 11 +#define pp_macign 12 +#define pp_macscan 13 +#define pp_macexp 14 +#define pp_if 15 +#define pp_ifd 16 +#define pp_endif 17 +#define pp_line 18 +#define pp_defined 19 +#define pp_ignore 20 +#define RCINCL 21 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int ppy_lex_destroy (void ); + +int ppy_get_debug (void ); + +void ppy_set_debug (int debug_flag ); + +YY_EXTRA_TYPE ppy_get_extra (void ); + +void ppy_set_extra (YY_EXTRA_TYPE user_defined ); + +FILE *ppy_get_in (void ); + +void ppy_set_in (FILE * in_str ); + +FILE *ppy_get_out (void ); + +void ppy_set_out (FILE * out_str ); + +int ppy_get_leng (void ); + +char *ppy_get_text (void ); + +int ppy_get_lineno (void ); + +void ppy_set_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1250,79 +1470,56 @@ includelogicentry_t *pp_includelogiclist = NULL; #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); +extern "C" int ppy_wrap (void ); #else -extern int yywrap YY_PROTO(( void )); +extern int ppy_wrap (void ); #endif #endif -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - #ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); +static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT + #ifdef __cplusplus -static int yyinput YY_PROTO(( void )); +static int yyinput (void ); #else -static int input YY_PROTO(( void )); -#endif +static int input (void ); #endif -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif #endif + static int yy_start_stack_ptr = 0; + static int yy_start_stack_depth = 0; + static int *yy_start_stack = NULL; + + static void yy_push_state (int new_state ); + + static void yy_pop_state (void ); + + static int yy_top_state (void ); + /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ - #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( ppy_text, ppy_leng, 1, ppy_out )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1330,21 +1527,35 @@ YY_MALLOC_DECL */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ - int c = '*', n; \ + int c = '*'; \ + size_t n; \ for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + (c = getc( ppy_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ + if ( c == EOF && ferror( ppy_in ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, ppy_in))==0 && ferror(ppy_in)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(ppy_in); \ + } \ + }\ +\ + #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - @@ -1365,14 +1576,20 @@ YY_MALLOC_DECL #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif +/* end tables serialization structures and prototypes */ + /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif +#define YY_DECL_IS_OURS 1 -/* Code executed at the beginning of each rule, after yytext and yyleng +extern int ppy_lex (void); + +#define YY_DECL int ppy_lex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after ppy_text and ppy_leng * have been set up. */ #ifndef YY_USER_ACTION @@ -1385,18 +1602,20 @@ YY_MALLOC_DECL #endif #define YY_RULE_SETUP \ - if ( yyleng > 0 ) \ - yy_current_buffer->yy_at_bol = \ - (yytext[yyleng - 1] == '\n'); \ + if ( ppy_leng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (ppy_text[ppy_leng - 1] == '\n'); \ YY_USER_ACTION +/** The main scanner function which does all the work. + */ YY_DECL - { +{ register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; - -#line 309 "ppl.l" + +#line 364 "ppl.l" /* * Catch line-continuations. @@ -1410,45 +1629,47 @@ YY_DECL /* * Detect the leading # of a preprocessor directive. */ -#line 1414 "lex.yy.c" +#line 1633 "lex.yy.c" - if ( yy_init ) + if ( !(yy_init) ) { - yy_init = 0; + (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if ( ! ppy_in ) + ppy_in = stdin; - if ( ! yyout ) - yyout = stdout; + if ( ! ppy_out ) + ppy_out = stdout; - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); + if ( ! YY_CURRENT_BUFFER ) { + ppy_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + ppy__create_buffer(ppy_in,YY_BUF_SIZE ); + } - yy_load_buffer_state(); + ppy__load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { - yy_cp = yy_c_buf_p; + yy_cp = (yy_c_buf_p); - /* Support of yytext. */ - *yy_cp = yy_hold_char; + /* Support of ppy_text. */ + *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; - yy_current_state = yy_start; + yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); yy_match: do @@ -1456,47 +1677,41 @@ yy_match: register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 415 ) + if ( yy_current_state >= 416 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 1771 ); + while ( yy_current_state != 415 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); yy_find_action: yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } YY_DO_BEFORE_ACTION; - do_action: /* This label is used only to access EOF actions. */ - switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP -#line 322 "ppl.l" +#line 377 "ppl.l" pp_incl_state.seen_junk++; yy_push_state(pp_pp); YY_BREAK /* @@ -1504,102 +1719,104 @@ pp_incl_state.seen_junk++; yy_push_state(pp_pp); */ case 2: YY_RULE_SETUP -#line 327 "ppl.l" +#line 382 "ppl.l" if(yy_top_state() != pp_ignore) {yy_pp_state(pp_inc); return tINCLUDE;} else {yy_pp_state(pp_eol);} YY_BREAK case 3: YY_RULE_SETUP -#line 328 "ppl.l" +#line 383 "ppl.l" yy_pp_state(yy_current_state() != pp_ignore ? pp_def : pp_eol); YY_BREAK case 4: YY_RULE_SETUP -#line 329 "ppl.l" +#line 384 "ppl.l" yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tERROR; YY_BREAK case 5: YY_RULE_SETUP -#line 330 "ppl.l" +#line 385 "ppl.l" yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tWARNING; YY_BREAK case 6: YY_RULE_SETUP -#line 331 "ppl.l" +#line 386 "ppl.l" yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tPRAGMA; YY_BREAK case 7: YY_RULE_SETUP -#line 332 "ppl.l" +#line 387 "ppl.l" yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tPPIDENT; YY_BREAK case 8: YY_RULE_SETUP -#line 333 "ppl.l" +#line 388 "ppl.l" if(yy_top_state() != pp_ignore) {yy_pp_state(pp_ifd); return tUNDEF;} else {yy_pp_state(pp_eol);} YY_BREAK case 9: YY_RULE_SETUP -#line 334 "ppl.l" +#line 389 "ppl.l" yy_pp_state(pp_ifd); return tIFDEF; YY_BREAK case 10: YY_RULE_SETUP -#line 335 "ppl.l" +#line 390 "ppl.l" pp_incl_state.seen_junk--; yy_pp_state(pp_ifd); return tIFNDEF; YY_BREAK case 11: YY_RULE_SETUP -#line 336 "ppl.l" +#line 391 "ppl.l" yy_pp_state(pp_if); return tIF; YY_BREAK case 12: YY_RULE_SETUP -#line 337 "ppl.l" +#line 392 "ppl.l" yy_pp_state(pp_if); return tELIF; YY_BREAK case 13: YY_RULE_SETUP -#line 338 "ppl.l" +#line 393 "ppl.l" yy_pp_state(pp_endif); return tELSE; YY_BREAK case 14: YY_RULE_SETUP -#line 339 "ppl.l" +#line 394 "ppl.l" yy_pp_state(pp_endif); return tENDIF; YY_BREAK case 15: YY_RULE_SETUP -#line 340 "ppl.l" +#line 395 "ppl.l" if(yy_top_state() != pp_ignore) {yy_pp_state(pp_line); return tLINE;} else {yy_pp_state(pp_eol);} YY_BREAK case 16: YY_RULE_SETUP -#line 341 "ppl.l" +#line 396 "ppl.l" if(yy_top_state() != pp_ignore) {yy_pp_state(pp_line); return tGCCLINE;} else {yy_pp_state(pp_eol);} YY_BREAK case 17: YY_RULE_SETUP -#line 342 "ppl.l" +#line 397 "ppl.l" ppy_error("Invalid preprocessor token '%s'", ppy_text); YY_BREAK case 18: +/* rule 18 can match eol */ YY_RULE_SETUP -#line 343 "ppl.l" +#line 398 "ppl.l" newline(1); yy_pop_state(); return tNL; /* This could be the null-token */ YY_BREAK case 19: +/* rule 19 can match eol */ YY_RULE_SETUP -#line 344 "ppl.l" +#line 399 "ppl.l" newline(0); YY_BREAK case 20: YY_RULE_SETUP -#line 345 "ppl.l" +#line 400 "ppl.l" ppy_error("Preprocessor junk '%s'", ppy_text); YY_BREAK case 21: YY_RULE_SETUP -#line 346 "ppl.l" +#line 401 "ppl.l" return *ppy_text; YY_BREAK /* @@ -1607,37 +1824,39 @@ return *ppy_text; */ case 22: YY_RULE_SETUP -#line 351 "ppl.l" +#line 406 "ppl.l" return make_number(10, &ppy_lval, ppy_text, ppy_leng); YY_BREAK case 23: YY_RULE_SETUP -#line 352 "ppl.l" +#line 407 "ppl.l" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_iqs); YY_BREAK case 24: YY_RULE_SETUP -#line 353 "ppl.l" +#line 408 "ppl.l" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); YY_BREAK case 25: YY_RULE_SETUP -#line 354 "ppl.l" +#line 409 "ppl.l" ; YY_BREAK case 26: +/* rule 26 can match eol */ YY_RULE_SETUP -#line 355 "ppl.l" +#line 410 "ppl.l" newline(1); yy_pop_state(); return tNL; YY_BREAK case 27: +/* rule 27 can match eol */ YY_RULE_SETUP -#line 356 "ppl.l" +#line 411 "ppl.l" newline(0); YY_BREAK case 28: YY_RULE_SETUP -#line 357 "ppl.l" +#line 412 "ppl.l" ppy_error(yy_current_state() == pp_inc ? "Trailing junk in #include" : "Trailing junk in #line"); YY_BREAK /* @@ -1645,22 +1864,24 @@ ppy_error(yy_current_state() == pp_inc ? "Trailing junk in #include" : "Trailing */ case 29: YY_RULE_SETUP -#line 362 "ppl.l" +#line 417 "ppl.l" ; YY_BREAK case 30: +/* rule 30 can match eol */ YY_RULE_SETUP -#line 363 "ppl.l" +#line 418 "ppl.l" newline(1); YY_BREAK case 31: +/* rule 31 can match eol */ YY_RULE_SETUP -#line 364 "ppl.l" +#line 419 "ppl.l" newline(0); YY_BREAK case 32: YY_RULE_SETUP -#line 365 "ppl.l" +#line 420 "ppl.l" ; YY_BREAK /* @@ -1671,107 +1892,109 @@ YY_RULE_SETUP */ case 33: YY_RULE_SETUP -#line 374 "ppl.l" +#line 429 "ppl.l" return make_number(8, &ppy_lval, ppy_text, ppy_leng); YY_BREAK case 34: YY_RULE_SETUP -#line 375 "ppl.l" +#line 430 "ppl.l" ppy_error("Invalid octal digit"); YY_BREAK case 35: YY_RULE_SETUP -#line 376 "ppl.l" +#line 431 "ppl.l" return make_number(10, &ppy_lval, ppy_text, ppy_leng); YY_BREAK case 36: YY_RULE_SETUP -#line 377 "ppl.l" +#line 432 "ppl.l" return make_number(16, &ppy_lval, ppy_text, ppy_leng); YY_BREAK case 37: YY_RULE_SETUP -#line 378 "ppl.l" +#line 433 "ppl.l" ppy_error("Invalid hex number"); YY_BREAK case 38: YY_RULE_SETUP -#line 379 "ppl.l" +#line 434 "ppl.l" yy_push_state(pp_defined); return tDEFINED; YY_BREAK case 39: YY_RULE_SETUP -#line 380 "ppl.l" +#line 435 "ppl.l" return tLSHIFT; YY_BREAK case 40: YY_RULE_SETUP -#line 381 "ppl.l" +#line 436 "ppl.l" return tRSHIFT; YY_BREAK case 41: YY_RULE_SETUP -#line 382 "ppl.l" +#line 437 "ppl.l" return tLOGAND; YY_BREAK case 42: YY_RULE_SETUP -#line 383 "ppl.l" +#line 438 "ppl.l" return tLOGOR; YY_BREAK case 43: YY_RULE_SETUP -#line 384 "ppl.l" +#line 439 "ppl.l" return tEQ; YY_BREAK case 44: YY_RULE_SETUP -#line 385 "ppl.l" +#line 440 "ppl.l" return tNE; YY_BREAK case 45: YY_RULE_SETUP -#line 386 "ppl.l" +#line 441 "ppl.l" return tLTE; YY_BREAK case 46: YY_RULE_SETUP -#line 387 "ppl.l" +#line 442 "ppl.l" return tGTE; YY_BREAK case 47: +/* rule 47 can match eol */ YY_RULE_SETUP -#line 388 "ppl.l" +#line 443 "ppl.l" newline(1); yy_pop_state(); return tNL; YY_BREAK case 48: +/* rule 48 can match eol */ YY_RULE_SETUP -#line 389 "ppl.l" +#line 444 "ppl.l" newline(0); YY_BREAK case 49: YY_RULE_SETUP -#line 390 "ppl.l" +#line 445 "ppl.l" ppy_error("Junk in conditional expression"); YY_BREAK case 50: YY_RULE_SETUP -#line 391 "ppl.l" +#line 446 "ppl.l" ; YY_BREAK case 51: YY_RULE_SETUP -#line 392 "ppl.l" +#line 447 "ppl.l" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs); YY_BREAK case 52: YY_RULE_SETUP -#line 393 "ppl.l" +#line 448 "ppl.l" ppy_error("String constants not allowed in conditionals"); YY_BREAK case 53: YY_RULE_SETUP -#line 394 "ppl.l" +#line 449 "ppl.l" return *ppy_text; YY_BREAK /* @@ -1780,27 +2003,29 @@ return *ppy_text; */ case 54: YY_RULE_SETUP -#line 400 "ppl.l" +#line 455 "ppl.l" ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT; YY_BREAK case 55: YY_RULE_SETUP -#line 401 "ppl.l" +#line 456 "ppl.l" ; YY_BREAK case 56: +/* rule 56 can match eol */ YY_RULE_SETUP -#line 402 "ppl.l" +#line 457 "ppl.l" newline(1); yy_pop_state(); return tNL; YY_BREAK case 57: +/* rule 57 can match eol */ YY_RULE_SETUP -#line 403 "ppl.l" +#line 458 "ppl.l" newline(0); YY_BREAK case 58: YY_RULE_SETUP -#line 404 "ppl.l" +#line 459 "ppl.l" ppy_error("Identifier expected"); YY_BREAK /* @@ -1808,22 +2033,24 @@ ppy_error("Identifier expected"); */ case 59: YY_RULE_SETUP -#line 409 "ppl.l" +#line 464 "ppl.l" ; YY_BREAK case 60: +/* rule 60 can match eol */ YY_RULE_SETUP -#line 410 "ppl.l" +#line 465 "ppl.l" newline(1); yy_pop_state(); return tNL; YY_BREAK case 61: +/* rule 61 can match eol */ YY_RULE_SETUP -#line 411 "ppl.l" +#line 466 "ppl.l" newline(0); YY_BREAK case 62: YY_RULE_SETUP -#line 412 "ppl.l" +#line 467 "ppl.l" ppy_error("Garbage after #else or #endif."); YY_BREAK /* @@ -1833,27 +2060,29 @@ ppy_error("Garbage after #else or #endif."); */ case 63: YY_RULE_SETUP -#line 419 "ppl.l" +#line 474 "ppl.l" yy_pop_state(); ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT; YY_BREAK case 64: YY_RULE_SETUP -#line 420 "ppl.l" +#line 475 "ppl.l" ; YY_BREAK case 65: YY_RULE_SETUP -#line 421 "ppl.l" +#line 476 "ppl.l" return *ppy_text; YY_BREAK case 66: +/* rule 66 can match eol */ YY_RULE_SETUP -#line 422 "ppl.l" +#line 477 "ppl.l" newline(0); YY_BREAK case 67: +/* rule 67 can match eol */ YY_RULE_SETUP -#line 423 "ppl.l" +#line 478 "ppl.l" ppy_error("Identifier expected"); YY_BREAK /* @@ -1864,27 +2093,30 @@ ppy_error("Identifier expected"); */ case 68: YY_RULE_SETUP -#line 431 "ppl.l" +#line 486 "ppl.l" if(yy_top_state() != pp_ignore) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; } YY_BREAK case 69: YY_RULE_SETUP -#line 432 "ppl.l" +#line 487 "ppl.l" if(yy_top_state() != pp_ignore) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; } YY_BREAK case 70: +/* rule 70 can match eol */ YY_RULE_SETUP -#line 433 "ppl.l" +#line 488 "ppl.l" if(yy_top_state() != pp_ignore) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; } YY_BREAK case 71: +/* rule 71 can match eol */ YY_RULE_SETUP -#line 434 "ppl.l" +#line 489 "ppl.l" newline(1); yy_pop_state(); if(yy_current_state() != pp_ignore) { return tNL; } YY_BREAK case 72: +/* rule 72 can match eol */ YY_RULE_SETUP -#line 435 "ppl.l" +#line 490 "ppl.l" newline(0); YY_BREAK /* @@ -1892,27 +2124,29 @@ newline(0); */ case 73: YY_RULE_SETUP -#line 440 "ppl.l" -ppy_lval.cptr = pp_xstrdup(ppy_text); ppy_lval.cptr[ppy_leng-1] = '\0'; yy_pp_state(pp_macro); return tMACRO; +#line 495 "ppl.l" +ppy_lval.cptr = pp_xstrdup(ppy_text); if(ppy_lval.cptr) ppy_lval.cptr[ppy_leng-1] = '\0'; yy_pp_state(pp_macro); return tMACRO; YY_BREAK case 74: YY_RULE_SETUP -#line 441 "ppl.l" +#line 496 "ppl.l" ppy_lval.cptr = pp_xstrdup(ppy_text); yy_pp_state(pp_define); return tDEFINE; YY_BREAK case 75: YY_RULE_SETUP -#line 442 "ppl.l" +#line 497 "ppl.l" ; YY_BREAK case 76: +/* rule 76 can match eol */ YY_RULE_SETUP -#line 443 "ppl.l" +#line 498 "ppl.l" newline(0); YY_BREAK case 77: +/* rule 77 can match eol */ YY_RULE_SETUP -#line 444 "ppl.l" +#line 499 "ppl.l" perror("Identifier expected"); YY_BREAK /* @@ -1920,37 +2154,41 @@ perror("Identifier expected"); */ case 78: YY_RULE_SETUP -#line 449 "ppl.l" +#line 504 "ppl.l" ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; YY_BREAK case 79: +/* rule 79 can match eol */ YY_RULE_SETUP -#line 450 "ppl.l" +#line 505 "ppl.l" ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; YY_BREAK case 80: +/* rule 80 can match eol */ YY_RULE_SETUP -#line 451 "ppl.l" +#line 506 "ppl.l" newline(0); ppy_lval.cptr = pp_xstrdup(" "); return tLITERAL; YY_BREAK case 81: +/* rule 81 can match eol */ YY_RULE_SETUP -#line 452 "ppl.l" +#line 507 "ppl.l" newline(0); YY_BREAK case 82: +/* rule 82 can match eol */ YY_RULE_SETUP -#line 453 "ppl.l" +#line 508 "ppl.l" newline(1); yy_pop_state(); return tNL; YY_BREAK case 83: YY_RULE_SETUP -#line 454 "ppl.l" +#line 509 "ppl.l" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs); YY_BREAK case 84: YY_RULE_SETUP -#line 455 "ppl.l" +#line 510 "ppl.l" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); YY_BREAK /* @@ -1958,37 +2196,39 @@ new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); */ case 85: YY_RULE_SETUP -#line 460 "ppl.l" +#line 515 "ppl.l" yy_pp_state(pp_mbody); return tMACROEND; YY_BREAK case 86: YY_RULE_SETUP -#line 461 "ppl.l" +#line 516 "ppl.l" ; YY_BREAK case 87: YY_RULE_SETUP -#line 462 "ppl.l" +#line 517 "ppl.l" ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT; YY_BREAK case 88: YY_RULE_SETUP -#line 463 "ppl.l" +#line 518 "ppl.l" return ','; YY_BREAK case 89: YY_RULE_SETUP -#line 464 "ppl.l" +#line 519 "ppl.l" return tELIPSIS; YY_BREAK case 90: +/* rule 90 can match eol */ YY_RULE_SETUP -#line 465 "ppl.l" +#line 520 "ppl.l" ppy_error("Argument identifier expected"); YY_BREAK case 91: +/* rule 91 can match eol */ YY_RULE_SETUP -#line 466 "ppl.l" +#line 521 "ppl.l" newline(0); YY_BREAK /* @@ -1996,57 +2236,60 @@ newline(0); */ case 92: YY_RULE_SETUP -#line 471 "ppl.l" +#line 526 "ppl.l" ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; YY_BREAK case 93: YY_RULE_SETUP -#line 472 "ppl.l" +#line 527 "ppl.l" ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT; YY_BREAK case 94: YY_RULE_SETUP -#line 473 "ppl.l" +#line 528 "ppl.l" return tCONCAT; YY_BREAK case 95: YY_RULE_SETUP -#line 474 "ppl.l" +#line 529 "ppl.l" return tSTRINGIZE; YY_BREAK case 96: YY_RULE_SETUP -#line 475 "ppl.l" +#line 530 "ppl.l" ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; YY_BREAK case 97: YY_RULE_SETUP -#line 476 "ppl.l" +#line 531 "ppl.l" ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; YY_BREAK case 98: +/* rule 98 can match eol */ YY_RULE_SETUP -#line 477 "ppl.l" +#line 532 "ppl.l" newline(0); ppy_lval.cptr = pp_xstrdup(" "); return tLITERAL; YY_BREAK case 99: +/* rule 99 can match eol */ YY_RULE_SETUP -#line 478 "ppl.l" +#line 533 "ppl.l" newline(0); YY_BREAK case 100: +/* rule 100 can match eol */ YY_RULE_SETUP -#line 479 "ppl.l" +#line 534 "ppl.l" newline(1); yy_pop_state(); return tNL; YY_BREAK case 101: YY_RULE_SETUP -#line 480 "ppl.l" +#line 535 "ppl.l" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs); YY_BREAK case 102: YY_RULE_SETUP -#line 481 "ppl.l" +#line 536 "ppl.l" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); YY_BREAK /* @@ -2059,29 +2302,31 @@ new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); * a false alarm. We just continue with a nose-bleed... */ case 103: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ +*yy_cp = (yy_hold_char); /* undo effects of setting up ppy_text */ +(yy_c_buf_p) = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up ppy_text again */ YY_RULE_SETUP -#line 492 "ppl.l" +#line 547 "ppl.l" yy_pp_state(pp_macscan); YY_BREAK case 104: +/* rule 104 can match eol */ YY_RULE_SETUP -#line 493 "ppl.l" +#line 548 "ppl.l" { if(yy_top_state() != pp_macscan) newline(0); } YY_BREAK case 105: +/* rule 105 can match eol */ YY_RULE_SETUP -#line 497 "ppl.l" +#line 552 "ppl.l" newline(0); YY_BREAK case 106: YY_RULE_SETUP -#line 498 "ppl.l" +#line 553 "ppl.l" { macexpstackentry_t *mac = pop_macro(); yy_pop_state(); @@ -2096,7 +2341,7 @@ YY_RULE_SETUP */ case 107: YY_RULE_SETUP -#line 510 "ppl.l" +#line 565 "ppl.l" { if(++MACROPARENTHESES() > 1) add_text_to_macro(ppy_text, ppy_leng); @@ -2104,7 +2349,7 @@ YY_RULE_SETUP YY_BREAK case 108: YY_RULE_SETUP -#line 514 "ppl.l" +#line 569 "ppl.l" { if(--MACROPARENTHESES() == 0) { @@ -2117,7 +2362,7 @@ YY_RULE_SETUP YY_BREAK case 109: YY_RULE_SETUP -#line 523 "ppl.l" +#line 578 "ppl.l" { if(MACROPARENTHESES() > 1) add_text_to_macro(ppy_text, ppy_leng); @@ -2127,32 +2372,34 @@ YY_RULE_SETUP YY_BREAK case 110: YY_RULE_SETUP -#line 529 "ppl.l" +#line 584 "ppl.l" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); YY_BREAK case 111: YY_RULE_SETUP -#line 530 "ppl.l" +#line 585 "ppl.l" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs); YY_BREAK case 112: YY_RULE_SETUP -#line 531 "ppl.l" +#line 586 "ppl.l" yy_push_state(pp_comment); add_text_to_macro(" ", 1); YY_BREAK case 113: +/* rule 113 can match eol */ YY_RULE_SETUP -#line 532 "ppl.l" +#line 587 "ppl.l" pp_status.line_number++; pp_status.char_number = 1; add_text_to_macro(ppy_text, ppy_leng); YY_BREAK case 114: YY_RULE_SETUP -#line 533 "ppl.l" +#line 588 "ppl.l" add_text_to_macro(ppy_text, ppy_leng); YY_BREAK case 115: +/* rule 115 can match eol */ YY_RULE_SETUP -#line 534 "ppl.l" +#line 589 "ppl.l" newline(0); YY_BREAK /* @@ -2160,22 +2407,23 @@ newline(0); */ case 116: YY_RULE_SETUP -#line 539 "ppl.l" +#line 594 "ppl.l" yy_push_state(pp_comment); YY_BREAK case 117: YY_RULE_SETUP -#line 540 "ppl.l" +#line 595 "ppl.l" ; YY_BREAK case 118: +/* rule 118 can match eol */ YY_RULE_SETUP -#line 541 "ppl.l" +#line 596 "ppl.l" newline(0); YY_BREAK case 119: YY_RULE_SETUP -#line 542 "ppl.l" +#line 597 "ppl.l" yy_pop_state(); YY_BREAK /* @@ -2183,7 +2431,7 @@ yy_pop_state(); */ case 120: YY_RULE_SETUP -#line 547 "ppl.l" +#line 602 "ppl.l" { if(ppy_text[ppy_leng-1] == '\\') ppy_warning("C++ style comment ends with an escaped newline (escape ignored)"); @@ -2194,22 +2442,22 @@ YY_RULE_SETUP */ case 121: YY_RULE_SETUP -#line 555 "ppl.l" +#line 610 "ppl.l" pp_incl_state.seen_junk++; new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); YY_BREAK case 122: YY_RULE_SETUP -#line 556 "ppl.l" +#line 611 "ppl.l" pp_incl_state.seen_junk++; new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs); YY_BREAK case 123: YY_RULE_SETUP -#line 557 "ppl.l" +#line 612 "ppl.l" add_string(ppy_text, ppy_leng); YY_BREAK case 124: YY_RULE_SETUP -#line 558 "ppl.l" +#line 613 "ppl.l" { add_string(ppy_text, ppy_leng); yy_pop_state(); @@ -2233,12 +2481,12 @@ YY_RULE_SETUP YY_BREAK case 125: YY_RULE_SETUP -#line 578 "ppl.l" +#line 633 "ppl.l" add_string(ppy_text, ppy_leng); YY_BREAK case 126: YY_RULE_SETUP -#line 579 "ppl.l" +#line 634 "ppl.l" { add_string(ppy_text, ppy_leng); yy_pop_state(); @@ -2256,12 +2504,12 @@ YY_RULE_SETUP YY_BREAK case 127: YY_RULE_SETUP -#line 593 "ppl.l" +#line 648 "ppl.l" add_string(ppy_text, ppy_leng); YY_BREAK case 128: YY_RULE_SETUP -#line 594 "ppl.l" +#line 649 "ppl.l" { add_string(ppy_text, ppy_leng); yy_pop_state(); @@ -2270,8 +2518,9 @@ YY_RULE_SETUP } YY_BREAK case 129: +/* rule 129 can match eol */ YY_RULE_SETUP -#line 600 "ppl.l" +#line 655 "ppl.l" { /* * This is tricky; we need to remove the line-continuation @@ -2299,12 +2548,13 @@ YY_RULE_SETUP YY_BREAK case 130: YY_RULE_SETUP -#line 624 "ppl.l" +#line 679 "ppl.l" add_string(ppy_text, ppy_leng); YY_BREAK case 131: +/* rule 131 can match eol */ YY_RULE_SETUP -#line 625 "ppl.l" +#line 680 "ppl.l" { newline(1); add_string(ppy_text, ppy_leng); @@ -2316,7 +2566,7 @@ YY_RULE_SETUP */ case 132: YY_RULE_SETUP -#line 634 "ppl.l" +#line 689 "ppl.l" { pp_entry_t *ppp; pp_incl_state.seen_junk++; @@ -2325,7 +2575,7 @@ YY_RULE_SETUP if(yy_current_state() == pp_inc) ppy_error("Expected include filename"); - if(yy_current_state() == pp_if) + else if(yy_current_state() == pp_if) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT; @@ -2365,27 +2615,29 @@ YY_RULE_SETUP */ case 133: YY_RULE_SETUP -#line 680 "ppl.l" +#line 735 "ppl.l" pp_incl_state.seen_junk++; put_buffer(ppy_text, ppy_leng); YY_BREAK case 134: YY_RULE_SETUP -#line 681 "ppl.l" +#line 736 "ppl.l" put_buffer(ppy_text, ppy_leng); YY_BREAK case 135: +/* rule 135 can match eol */ YY_RULE_SETUP -#line 682 "ppl.l" +#line 737 "ppl.l" newline(1); YY_BREAK case 136: +/* rule 136 can match eol */ YY_RULE_SETUP -#line 683 "ppl.l" +#line 738 "ppl.l" newline(0); YY_BREAK case 137: YY_RULE_SETUP -#line 684 "ppl.l" +#line 739 "ppl.l" pp_incl_state.seen_junk++; put_buffer(ppy_text, ppy_leng); YY_BREAK /* @@ -2393,13 +2645,14 @@ pp_incl_state.seen_junk++; put_buffer(ppy_text, ppy_leng); * newlines to propagate to the output or admin. */ case 138: +/* rule 138 can match eol */ YY_RULE_SETUP -#line 690 "ppl.l" +#line 745 "ppl.l" put_buffer(ppy_text, ppy_leng); YY_BREAK case 139: YY_RULE_SETUP -#line 692 "ppl.l" +#line 747 "ppl.l" { ppy_lval.cptr=pp_xstrdup(ppy_text); yy_pop_state(); @@ -2408,12 +2661,12 @@ YY_RULE_SETUP YY_BREAK case 140: YY_RULE_SETUP -#line 698 "ppl.l" +#line 753 "ppl.l" ; YY_BREAK case 141: YY_RULE_SETUP -#line 700 "ppl.l" +#line 755 "ppl.l" { new_string(); add_string(ppy_text,ppy_leng);yy_push_state(pp_dqs); } @@ -2424,7 +2677,7 @@ YY_RULE_SETUP */ case 142: YY_RULE_SETUP -#line 708 "ppl.l" +#line 763 "ppl.l" pp_incl_state.seen_junk++; ppy_warning("Unmatched text '%c' (0x%02x); please report\n", isprint(*ppy_text & 0xff) ? *ppy_text : ' ', *ppy_text); YY_BREAK case YY_STATE_EOF(INITIAL): @@ -2449,7 +2702,7 @@ case YY_STATE_EOF(pp_line): case YY_STATE_EOF(pp_defined): case YY_STATE_EOF(pp_ignore): case YY_STATE_EOF(RCINCL): -#line 710 "ppl.l" +#line 765 "ppl.l" { YY_BUFFER_STATE b = YY_CURRENT_BUFFER; bufferstackentry_t *bep = pop_buffer(); @@ -2474,34 +2727,34 @@ case YY_STATE_EOF(RCINCL): YY_BREAK case 143: YY_RULE_SETUP -#line 732 "ppl.l" +#line 787 "ppl.l" ECHO; YY_BREAK -#line 2481 "lex.yy.c" +#line 2734 "lex.yy.c" case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; + *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our + * just pointed ppy_in at a new source and called + * ppy_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = ppy_in; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position @@ -2511,13 +2764,13 @@ ECHO; * end-of-buffer state). Contrast this with the test * in input(). */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have @@ -2530,41 +2783,42 @@ ECHO; yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; + yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { - yy_cp = yy_c_buf_p; + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); goto yy_find_action; } } - else switch ( yy_get_next_buffer() ) + else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { - yy_did_buffer_switch_on_eof = 0; + (yy_did_buffer_switch_on_eof) = 0; - if ( yywrap() ) + if ( ppy_wrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up - * yytext, we can now set up + * ppy_text, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; @@ -2572,30 +2826,30 @@ ECHO; else { - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; @@ -2606,8 +2860,7 @@ ECHO; "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ - } /* end of yylex */ - +} /* end of ppy_lex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -2616,21 +2869,20 @@ ECHO; * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); - if ( yy_current_buffer->yy_fill_buffer == 0 ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. @@ -2650,34 +2902,30 @@ static int yy_get_next_buffer() /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); + (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { @@ -2690,8 +2938,7 @@ static int yy_get_next_buffer() b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); + ppy_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ @@ -2701,35 +2948,35 @@ static int yy_get_next_buffer() YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - num_to_read = yy_current_buffer->yy_buf_size - + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; -#endif + } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); - yy_current_buffer->yy_n_chars = yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - if ( yy_n_chars == 0 ) + if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); + ppy_restart(ppy_in ); } else { ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } @@ -2737,153 +2984,109 @@ static int yy_get_next_buffer() else ret_val = EOB_ACT_CONTINUE_SCAN; - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ppy_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} /* yy_get_previous_state - get the state just before the EOB char was reached */ -static yy_state_type yy_get_previous_state() - { + static yy_state_type yy_get_previous_state (void) +{ register yy_state_type yy_current_state; register char *yy_cp; - - yy_current_state = yy_start; + + yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 415 ) + if ( yy_current_state >= 416 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; - } - +} /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; + register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 415 ) + if ( yy_current_state >= 416 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 414); + yy_is_jam = (yy_current_state == 415); return yy_is_jam ? 0 : yy_current_state; - } - - -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - +} +#ifndef YY_NO_INPUT #ifdef __cplusplus -static int yyinput() + static int yyinput (void) #else -static int input() + static int input (void) #endif - { + +{ int c; + + *(yy_c_buf_p) = (yy_hold_char); - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ - *yy_c_buf_p = '\0'; + *(yy_c_buf_p) = '\0'; else { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); - switch ( yy_get_next_buffer() ) + switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() @@ -2897,16 +3100,16 @@ static int input() */ /* Reset buffer status. */ - yyrestart( yyin ); + ppy_restart(ppy_in ); - /* fall through */ + /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap() ) + if ( ppy_wrap( ) ) return EOF; - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); @@ -2916,173 +3119,167 @@ static int input() } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; + (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve ppy_text */ + (yy_hold_char) = *++(yy_c_buf_p); - yy_current_buffer->yy_at_bol = (c == '\n'); + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void ppy_restart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + ppy_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + ppy__create_buffer(ppy_in,YY_BUF_SIZE ); } + ppy__init_buffer(YY_CURRENT_BUFFER,input_file ); + ppy__load_buffer_state( ); +} -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void ppy__switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * ppy_pop_buffer_state(); + * ppy_push_buffer_state(new_buffer); + */ + ppy_ensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) return; - if ( yy_current_buffer ) + if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - yy_current_buffer = new_buffer; - yy_load_buffer_state(); + YY_CURRENT_BUFFER_LVALUE = new_buffer; + ppy__load_buffer_state( ); /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe + * EOF (ppy_wrap()) processing, but the only time this flag + * is looked at is after ppy_wrap() is called, so it's safe * to go ahead and always set it. */ - yy_did_buffer_switch_on_eof = 1; - } + (yy_did_buffer_switch_on_eof) = 1; +} +static void ppy__load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + ppy_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE ppy__create_buffer (FILE * file, int size ) +{ YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + + b = (YY_BUFFER_STATE) ppy_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in ppy__create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) ppy_alloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in ppy__create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer( b, file ); + ppy__init_buffer(b,file ); return b; - } +} - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { +/** Destroy the buffer. + * @param b a buffer created with ppy__create_buffer() + * + */ + void ppy__delete_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) return; - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); + ppy_free((void *) b->yy_ch_buf ); - yy_flex_free( (void *) b ); - } + ppy_free((void *) b ); +} +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a ppy_restart() or at EOF. + */ + static void ppy__init_buffer (YY_BUFFER_STATE b, FILE * file ) -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - - - { - yy_flush_buffer( b ); +{ + int oerrno = errno; + + ppy__flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } + /* If b is the current buffer, then ppy__init_buffer was _probably_ + * called from ppy_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + b->yy_is_interactive = 0; + + errno = oerrno; +} -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - - { - if ( ! b ) +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void ppy__flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) return; b->yy_n_chars = 0; @@ -3099,31 +3296,127 @@ YY_BUFFER_STATE b; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == yy_current_buffer ) - yy_load_buffer_state(); + if ( b == YY_CURRENT_BUFFER ) + ppy__load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void ppy_push_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + ppy_ensure_buffer_stack(); + + /* This block is copied from ppy__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from ppy__switch_to_buffer. */ + ppy__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void ppy_pop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + ppy__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + ppy__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void ppy_ensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)ppy_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in ppy_ensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; } + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)ppy_realloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in ppy_ensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE ppy__scan_buffer (char * base, yy_size_t size ) +{ YY_BUFFER_STATE b; - + if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) ppy_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in ppy__scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; @@ -3135,58 +3428,53 @@ yy_size_t size; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer( b ); + ppy__switch_to_buffer(b ); return b; - } -#endif +} +/** Setup the input buffer state to scan a string. The next call to ppy_lex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * ppy__scan_bytes() instead. + */ +YY_BUFFER_STATE ppy__scan_string (yyconst char * yystr ) +{ + + return ppy__scan_bytes(yystr,strlen(yystr) ); +} -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { +/** Setup the input buffer state to scan the given bytes. The next call to ppy_lex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE ppy__scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; - + /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); + n = _yybytes_len + 2; + buf = (char *) ppy_alloc(n ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in ppy__scan_bytes()" ); - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer( buf, n ); + b = ppy__scan_buffer(buf,n ); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in ppy__scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -3194,78 +3482,54 @@ int len; b->yy_is_our_buffer = 1; return b; - } -#endif +} - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) + static void yy_push_state (int new_state ) +{ + if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) ) { yy_size_t new_size; - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); + (yy_start_stack_depth) += YY_START_STACK_INCR; + new_size = (yy_start_stack_depth) * sizeof( int ); - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); + if ( ! (yy_start_stack) ) + (yy_start_stack) = (int *) ppy_alloc(new_size ); else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); + (yy_start_stack) = (int *) ppy_realloc((void *) (yy_start_stack),new_size ); - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); + if ( ! (yy_start_stack) ) + YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } - yy_start_stack[yy_start_stack_ptr++] = YY_START; + (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START; BEGIN(new_state); - } -#endif +} - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) + static void yy_pop_state (void) +{ + if ( --(yy_start_stack_ptr) < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif + BEGIN((yy_start_stack)[(yy_start_stack_ptr)]); +} - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif + static int yy_top_state (void) +{ + return (yy_start_stack)[(yy_start_stack_ptr) - 1]; +} #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); - } - - +} /* Redefine yyless() so it works in section 3 code. */ @@ -3273,69 +3537,186 @@ char msg[]; #define yyless(n) \ do \ { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ + /* Undo effects of setting up ppy_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + ppy_text[ppy_leng] = (yy_hold_char); \ + (yy_c_buf_p) = ppy_text + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + ppy_leng = yyless_macro_arg; \ } \ while ( 0 ) +/* Accessor methods (get/set functions) to struct members. */ -/* Internal utility routines. */ +/** Get the current line number. + * + */ +int ppy_get_lineno (void) +{ + + return ppy_lineno; +} + +/** Get the input stream. + * + */ +FILE *ppy_get_in (void) +{ + return ppy_in; +} + +/** Get the output stream. + * + */ +FILE *ppy_get_out (void) +{ + return ppy_out; +} + +/** Get the length of the current token. + * + */ +int ppy_get_leng (void) +{ + return ppy_leng; +} + +/** Get the current token. + * + */ + +char *ppy_get_text (void) +{ + return ppy_text; +} + +/** Set the current line number. + * @param line_number + * + */ +void ppy_set_lineno (int line_number ) +{ + + ppy_lineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see ppy__switch_to_buffer + */ +void ppy_set_in (FILE * in_str ) +{ + ppy_in = in_str ; +} + +void ppy_set_out (FILE * out_str ) +{ + ppy_out = out_str ; +} + +int ppy_get_debug (void) +{ + return ppy__flex_debug; +} + +void ppy_set_debug (int bdebug ) +{ + ppy__flex_debug = bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from ppy_lex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + + (yy_start_stack_ptr) = 0; + (yy_start_stack_depth) = 0; + (yy_start_stack) = NULL; + +/* Defined in main.c */ +#ifdef YY_STDINIT + ppy_in = stdin; + ppy_out = stdout; +#else + ppy_in = (FILE *) 0; + ppy_out = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * ppy_lex_init() + */ + return 0; +} + +/* ppy_lex_destroy is for both reentrant and non-reentrant scanners. */ +int ppy_lex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + ppy__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + ppy_pop_buffer_state(); + } + + /* Destroy the stack itself. */ + ppy_free((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Destroy the start condition stack. */ + ppy_free((yy_start_stack) ); + (yy_start_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * ppy_lex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ #ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; - } +} #endif #ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { +static int yy_flex_strlen (yyconst char * s ) +{ register int n; for ( n = 0; s[n]; ++n ) ; return n; - } +} #endif - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { +void *ppy_alloc (yy_size_t size ) +{ return (void *) malloc( size ); - } +} -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { +void *ppy_realloc (void * ptr, yy_size_t size ) +{ /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -3344,26 +3725,17 @@ yy_size_t size; * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); - } +} -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } +void ppy_free (void * ptr ) +{ + free( (char *) ptr ); /* see ppy_realloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 787 "ppl.l" -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif -#line 732 "ppl.l" /* ************************************************************************** @@ -3443,7 +3815,10 @@ static int make_number(int radix, YYSTYPE *val, const char *str, int len) ext[0] = len > 2 ? toupper(str[len-3]) : ' '; if(!strcmp(ext, "LUL")) + { ppy_error("Invalid constant suffix"); + return 0; + } else if(!strcmp(ext, "LLU") || !strcmp(ext, "ULL")) { is_ll++; @@ -3538,21 +3913,25 @@ static int make_number(int radix, YYSTYPE *val, const char *str, int len) */ static void expand_special(pp_entry_t *ppp) { - const char *dbgtext = "?"; static char *buf = NULL; + char *new_buf; assert(ppp->type == def_special); if(!strcmp(ppp->ident, "__LINE__")) { - dbgtext = "def_special(__LINE__)"; - buf = pp_xrealloc(buf, 32); + new_buf = pp_xrealloc(buf, 32); + if(!new_buf) + return; + buf = new_buf; sprintf(buf, "%d", pp_status.line_number); } else if(!strcmp(ppp->ident, "__FILE__")) { - dbgtext = "def_special(__FILE__)"; - buf = pp_xrealloc(buf, strlen(pp_status.input) + 3); + new_buf = pp_xrealloc(buf, strlen(pp_status.input) + 3); + if(!new_buf) + return; + buf = new_buf; sprintf(buf, "\"%s\"", pp_status.input); } else @@ -3569,7 +3948,7 @@ static void expand_special(pp_entry_t *ppp) if(buf && buf[0]) { push_buffer(ppp, NULL, NULL, 0); - yy_scan_string(buf); + ppy__scan_string(buf); } } @@ -3587,7 +3966,7 @@ static void expand_define(pp_entry_t *ppp) if(ppp->subst.text && ppp->subst.text[0]) { push_buffer(ppp, NULL, NULL, 0); - yy_scan_string(ppp->subst.text); + ppy__scan_string(ppp->subst.text); } } @@ -3597,12 +3976,19 @@ static char *curdef_text = NULL; static void add_text(const char *str, int len) { + int new_alloc; + char *new_text; + if(len == 0) return; if(curdef_idx >= curdef_alloc || curdef_alloc - curdef_idx < len) { - curdef_alloc += (len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1); - curdef_text = pp_xrealloc(curdef_text, curdef_alloc * sizeof(curdef_text[0])); + new_alloc = curdef_alloc + ((len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1)); + new_text = pp_xrealloc(curdef_text, new_alloc * sizeof(curdef_text[0])); + if(!new_text) + return; + curdef_text = new_text; + curdef_alloc = new_alloc; if(curdef_alloc > 65536) ppy_warning("Reallocating macro-expansion buffer larger than 64kB"); } @@ -3720,7 +4106,10 @@ static void expand_macro(macexpstackentry_t *mep) assert(ppp->expanding == 0); if((ppp->nargs >= 0 && nargs != ppp->nargs) || (ppp->nargs < 0 && nargs < -ppp->nargs)) + { ppy_error("Too %s macro arguments (%d)", nargs < abs(ppp->nargs) ? "few" : "many", nargs); + return; + } for(n = 0; n < nargs; n++) nnl += mep->nnls[n]; @@ -3775,8 +4164,8 @@ static void expand_macro(macexpstackentry_t *mep) if(pp_flex_debug) fprintf(stderr, "expand_text: '%s'\n", curdef_text + n); push_buffer(ppp, NULL, NULL, 0); - /*yy_scan_bytes(curdef_text + n, k - n);*/ - yy_scan_string(curdef_text + n); + /*ppy__scan_bytes(curdef_text + n,k - n);*/ + ppy__scan_string(curdef_text + n); } } @@ -3797,12 +4186,19 @@ static void new_string(void) static void add_string(const char *str, int len) { + int new_alloc; + char *new_buffer; + if(len == 0) return; if(strbuf_idx >= strbuf_alloc || strbuf_alloc - strbuf_idx < len) { - strbuf_alloc += (len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1); - strbuffer = pp_xrealloc(strbuffer, strbuf_alloc * sizeof(strbuffer[0])); + new_alloc = strbuf_alloc + ((len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1)); + new_buffer = pp_xrealloc(strbuffer, new_alloc * sizeof(strbuffer[0])); + if(!new_buffer) + return; + strbuffer = new_buffer; + strbuf_alloc = new_alloc; if(strbuf_alloc > 65536) ppy_warning("Reallocating string buffer larger than 64kB"); } @@ -3813,6 +4209,8 @@ static void add_string(const char *str, int len) static char *get_string(void) { char *str = pp_xmalloc(strbuf_idx + 1); + if(!str) + return NULL; memcpy(str, strbuffer, strbuf_idx); str[strbuf_idx] = '\0'; #ifdef DEBUG @@ -3849,6 +4247,7 @@ static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop) memset(&bufferstack[bufferstackidx], 0, sizeof(bufferstack[0])); bufferstack[bufferstackidx].bufferstate = YY_CURRENT_BUFFER; + bufferstack[bufferstackidx].filehandle = pp_status.file; bufferstack[bufferstackidx].define = ppp; bufferstack[bufferstackidx].line_number = pp_status.line_number; bufferstack[bufferstackidx].char_number = pp_status.char_number; @@ -3888,14 +4287,10 @@ static bufferstackentry_t *pop_buffer(void) bufferstack[bufferstackidx].define->expanding = 0; else { - pp_status.line_number = bufferstack[bufferstackidx].line_number; - pp_status.char_number = bufferstack[bufferstackidx].char_number; - pp_status.input = bufferstack[bufferstackidx].filename; - ncontinuations = bufferstack[bufferstackidx].ncontinuations; if(!bufferstack[bufferstackidx].should_pop) { - fclose(ppy_in); - fprintf(ppy_out, "# %d \"%s\" 2\n", pp_status.line_number, pp_status.input); + wpp_callbacks->close(pp_status.file); + pp_writestring("# %d \"%s\" 2\n", bufferstack[bufferstackidx].line_number, bufferstack[bufferstackidx].filename); /* We have EOF, check the include logic */ if(pp_incl_state.state == 2 && !pp_incl_state.seen_junk && pp_incl_state.ppp) @@ -3904,6 +4299,9 @@ static bufferstackentry_t *pop_buffer(void) if(ppp) { includelogicentry_t *iep = pp_xmalloc(sizeof(includelogicentry_t)); + if(!iep) + return NULL; + iep->ppp = ppp; ppp->iep = iep; iep->filename = bufferstack[bufferstackidx].include_filename; @@ -3913,7 +4311,7 @@ static bufferstackentry_t *pop_buffer(void) iep->next->prev = iep; pp_includelogiclist = iep; if(pp_status.debug) - fprintf(stderr, "pop_buffer: %s:%d: includelogic added, include_ppp='%s', file='%s'\n", pp_status.input, pp_status.line_number, pp_incl_state.ppp, iep->filename); + fprintf(stderr, "pop_buffer: %s:%d: includelogic added, include_ppp='%s', file='%s'\n", bufferstack[bufferstackidx].filename, bufferstack[bufferstackidx].line_number, pp_incl_state.ppp, iep->filename); } else free(bufferstack[bufferstackidx].include_filename); @@ -3922,6 +4320,10 @@ static bufferstackentry_t *pop_buffer(void) pp_incl_state = bufferstack[bufferstackidx].incl; } + pp_status.line_number = bufferstack[bufferstackidx].line_number; + pp_status.char_number = bufferstack[bufferstackidx].char_number; + pp_status.input = bufferstack[bufferstackidx].filename; + ncontinuations = bufferstack[bufferstackidx].ncontinuations; } if(ppy_debug) @@ -3935,7 +4337,8 @@ static bufferstackentry_t *pop_buffer(void) bufferstack[bufferstackidx].filename, bufferstack[bufferstackidx].should_pop); - ppy__switch_to_buffer(bufferstack[bufferstackidx].bufferstate); + pp_status.file = bufferstack[bufferstackidx].filehandle; + ppy__switch_to_buffer(bufferstack[bufferstackidx].bufferstate); if(bufferstack[bufferstackidx].should_pop) { @@ -3958,9 +4361,14 @@ static bufferstackentry_t *pop_buffer(void) static void push_macro(pp_entry_t *ppp) { if(macexpstackidx >= MAXMACEXPSTACK) + { ppy_error("Too many nested macros"); + return; + } macexpstack[macexpstackidx] = pp_xmalloc(sizeof(macexpstack[0][0])); + if(!macexpstack[macexpstackidx]) + return; memset( macexpstack[macexpstackidx], 0, sizeof(macexpstack[0][0])); macexpstack[macexpstackidx]->ppp = ppp; macexpstackidx++; @@ -3998,8 +4406,13 @@ static void add_text_to_macro(const char *text, int len) if(mep->curargalloc - mep->curargsize <= len+1) /* +1 for '\0' */ { - mep->curargalloc += (ALLOCBLOCKSIZE > len+1) ? ALLOCBLOCKSIZE : len+1; - mep->curarg = pp_xrealloc(mep->curarg, mep->curargalloc * sizeof(mep->curarg[0])); + char *new_curarg; + int new_alloc = mep->curargalloc + ((ALLOCBLOCKSIZE > len+1) ? ALLOCBLOCKSIZE : len+1); + new_curarg = pp_xrealloc(mep->curarg, new_alloc * sizeof(mep->curarg[0])); + if(!new_curarg) + return; + mep->curarg = new_curarg; + mep->curargalloc = new_alloc; } memcpy(mep->curarg + mep->curargsize, text, len); mep->curargsize += len; @@ -4010,14 +4423,30 @@ static void macro_add_arg(int last) { int nnl = 0; char *cptr; + char **new_args, **new_ppargs; + int *new_nnls; macexpstackentry_t *mep = top_macro(); assert(mep->ppp->expanding == 0); - mep->args = pp_xrealloc(mep->args, (mep->nargs+1) * sizeof(mep->args[0])); - mep->ppargs = pp_xrealloc(mep->ppargs, (mep->nargs+1) * sizeof(mep->ppargs[0])); - mep->nnls = pp_xrealloc(mep->nnls, (mep->nargs+1) * sizeof(mep->nnls[0])); + new_args = pp_xrealloc(mep->args, (mep->nargs+1) * sizeof(mep->args[0])); + if(!new_args) + return; + mep->args = new_args; + + new_ppargs = pp_xrealloc(mep->ppargs, (mep->nargs+1) * sizeof(mep->ppargs[0])); + if(!new_ppargs) + return; + mep->ppargs = new_ppargs; + + new_nnls = pp_xrealloc(mep->nnls, (mep->nargs+1) * sizeof(mep->nnls[0])); + if(!new_nnls) + return; + mep->nnls = new_nnls; + mep->args[mep->nargs] = pp_xstrdup(mep->curarg ? mep->curarg : ""); + if(!mep->args[mep->nargs]) + return; cptr = mep->args[mep->nargs]-1; while((cptr = strchr(cptr+1, '\n'))) { @@ -4041,7 +4470,7 @@ static void macro_add_arg(int last) { yy_push_state(pp_macexp); push_buffer(NULL, NULL, NULL, last ? 2 : 1); - yy_scan_string(mep->args[mep->nargs-1]); + ppy__scan_string(mep->args[mep->nargs-1]); /*mep->bufferstackidx = bufferstackidx; But not nested! */ } } @@ -4062,7 +4491,7 @@ static void macro_add_expansion(void) pp_status.input, pp_status.line_number, mep->nargs-1, - mep->ppargs[mep->nargs-1]); + mep->ppargs[mep->nargs-1] ? mep->ppargs[mep->nargs-1] : ""); } @@ -4076,7 +4505,7 @@ static void put_buffer(const char *s, int len) if(top_macro()) add_text_to_macro(s, len); else - fwrite(s, 1, len, ppy_out); + wpp_callbacks->write(s, len); } @@ -4090,6 +4519,10 @@ void pp_do_include(char *fname, int type) char *newpath; int n; includelogicentry_t *iep; + void *fp; + + if(!fname) + return; for(iep = pp_includelogiclist; iep; iep = iep->next) { @@ -4107,13 +4540,19 @@ void pp_do_include(char *fname, int type) n = strlen(fname); if(n <= 2) + { ppy_error("Empty include filename"); + return; + } /* Undo the effect of the quotation */ fname[n-1] = '\0'; - if((ppy_in = pp_open_include(fname+1, type ? pp_status.input : NULL, &newpath)) == NULL) + if((fp = pp_open_include(fname+1, type ? pp_status.input : NULL, &newpath)) == NULL) + { ppy_error("Unable to open include file %s", fname+1); + return; + } fname[n-1] = *fname; /* Redo the quotes */ push_buffer(NULL, newpath, fname, 0); @@ -4124,9 +4563,10 @@ void pp_do_include(char *fname, int type) if(pp_status.debug) fprintf(stderr, "pp_do_include: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d\n", pp_status.input, pp_status.line_number, pp_incl_state.state, pp_incl_state.ppp, pp_incl_state.ifdepth); - ppy__switch_to_buffer(ppy__create_buffer(ppy_in, YY_BUF_SIZE)); + pp_status.file = fp; + ppy__switch_to_buffer(ppy__create_buffer(NULL, YY_BUF_SIZE)); - fprintf(ppy_out, "# 1 \"%s\" 1%s\n", newpath, type ? "" : " 3"); + pp_writestring("# 1 \"%s\" 1%s\n", newpath, type ? "" : " 3"); } /* @@ -4144,3 +4584,4 @@ void pp_pop_ignore_state(void) { yy_pop_state(); } + diff --git a/reactos/tools/wpp/ppl.l b/reactos/tools/wpp/ppl.l index e71bf6ecf20..0588e5d9f3f 100644 --- a/reactos/tools/wpp/ppl.l +++ b/reactos/tools/wpp/ppl.l @@ -121,6 +121,11 @@ * */ +%top{ +#include "config.h" +#include "wine/port.h" +} + /* * Special flex options and exclusive scanner start-conditions */ @@ -156,8 +161,6 @@ cident [a-zA-Z_][0-9a-zA-Z_]* ul [uUlL]|[uUlL][lL]|[lL][uU]|[lL][lL][uU]|[uU][lL][lL]|[lL][uU][lL] %{ -#include "config.h" -#include "wine/port.h" #include #include #include @@ -178,6 +181,7 @@ ul [uUlL]|[uUlL][lL]|[lL][uU]|[lL][lL][uU]|[uU][lL][lL]|[lL][uU][lL] #define YY_NO_UNISTD_H #endif +#include "wine/wpp.h" #include "wpp_private.h" #include "ppy.tab.h" @@ -205,6 +209,7 @@ ul [uUlL]|[uUlL][lL]|[lL][uU]|[lL][lL][uU]|[uU][lL][lL]|[lL][uU][lL] typedef struct bufferstackentry { YY_BUFFER_STATE bufferstate; /* Buffer to switch back to */ + void *filehandle; /* Handle to be used with wpp_callbacks->read */ pp_entry_t *define; /* Points to expanding define or NULL if handling includes */ int line_number; /* Line that we were handling */ int char_number; /* The current position on that line */ @@ -298,6 +303,56 @@ include_state_t pp_incl_state = includelogicentry_t *pp_includelogiclist = NULL; +#define YY_INPUT(buf,result,max_size) \ + { \ + result = wpp_callbacks->read(pp_status.file, buf, max_size); \ + } + +#define BUFFERINITIALCAPACITY 256 + +void pp_writestring(const char *format, ...) +{ + va_list valist; + int len; + static char *buffer; + static int buffercapacity; + char *new_buffer; + + if(buffercapacity == 0) + { + buffer = pp_xmalloc(BUFFERINITIALCAPACITY); + if(buffer == NULL) + return; + buffercapacity = BUFFERINITIALCAPACITY; + } + + va_start(valist, format); + len = vsnprintf(buffer, buffercapacity, + format, valist); + /* If the string is longer than buffersize, vsnprintf returns + * the string length with glibc >= 2.1, -1 with glibc < 2.1 */ + while(len > buffercapacity || len < 0) + { + do + { + buffercapacity *= 2; + } while(len > buffercapacity); + + new_buffer = pp_xrealloc(buffer, buffercapacity); + if(new_buffer == NULL) + { + va_end(valist); + return; + } + buffer = new_buffer; + len = vsnprintf(buffer, buffercapacity, + format, valist); + } + va_end(valist); + + wpp_callbacks->write(buffer, len); +} + %} /* @@ -437,7 +492,7 @@ includelogicentry_t *pp_includelogiclist = NULL; /* * Handle left side of #define */ -{cident}\( ppy_lval.cptr = pp_xstrdup(ppy_text); ppy_lval.cptr[ppy_leng-1] = '\0'; yy_pp_state(pp_macro); return tMACRO; +{cident}\( ppy_lval.cptr = pp_xstrdup(ppy_text); if(ppy_lval.cptr) ppy_lval.cptr[ppy_leng-1] = '\0'; yy_pp_state(pp_macro); return tMACRO; {cident} ppy_lval.cptr = pp_xstrdup(ppy_text); yy_pp_state(pp_define); return tDEFINE; {ws}+ ; \\\r?\n newline(0); @@ -472,7 +527,7 @@ includelogicentry_t *pp_includelogiclist = NULL; {cident} ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT; \#\# return tCONCAT; \# return tSTRINGIZE; -[0-9][^'"#/\\\n]* ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; +[0-9][a-zA-Z0-9]*[^a-zA-Z0-9'"#/\\\n]* ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; (\\\r?)|(\/[^/*'"#\\\n]*) ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; \\\r?\n{ws}+ newline(0); ppy_lval.cptr = pp_xstrdup(" "); return tLITERAL; \\\r?\n newline(0); @@ -639,7 +694,7 @@ includelogicentry_t *pp_includelogiclist = NULL; if(yy_current_state() == pp_inc) ppy_error("Expected include filename"); - if(yy_current_state() == pp_if) + else if(yy_current_state() == pp_if) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT; @@ -808,7 +863,10 @@ static int make_number(int radix, YYSTYPE *val, const char *str, int len) ext[0] = len > 2 ? toupper(str[len-3]) : ' '; if(!strcmp(ext, "LUL")) + { ppy_error("Invalid constant suffix"); + return 0; + } else if(!strcmp(ext, "LLU") || !strcmp(ext, "ULL")) { is_ll++; @@ -903,21 +961,25 @@ static int make_number(int radix, YYSTYPE *val, const char *str, int len) */ static void expand_special(pp_entry_t *ppp) { - const char *dbgtext = "?"; static char *buf = NULL; + char *new_buf; assert(ppp->type == def_special); if(!strcmp(ppp->ident, "__LINE__")) { - dbgtext = "def_special(__LINE__)"; - buf = pp_xrealloc(buf, 32); + new_buf = pp_xrealloc(buf, 32); + if(!new_buf) + return; + buf = new_buf; sprintf(buf, "%d", pp_status.line_number); } else if(!strcmp(ppp->ident, "__FILE__")) { - dbgtext = "def_special(__FILE__)"; - buf = pp_xrealloc(buf, strlen(pp_status.input) + 3); + new_buf = pp_xrealloc(buf, strlen(pp_status.input) + 3); + if(!new_buf) + return; + buf = new_buf; sprintf(buf, "\"%s\"", pp_status.input); } else @@ -962,12 +1024,19 @@ static char *curdef_text = NULL; static void add_text(const char *str, int len) { + int new_alloc; + char *new_text; + if(len == 0) return; if(curdef_idx >= curdef_alloc || curdef_alloc - curdef_idx < len) { - curdef_alloc += (len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1); - curdef_text = pp_xrealloc(curdef_text, curdef_alloc * sizeof(curdef_text[0])); + new_alloc = curdef_alloc + ((len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1)); + new_text = pp_xrealloc(curdef_text, new_alloc * sizeof(curdef_text[0])); + if(!new_text) + return; + curdef_text = new_text; + curdef_alloc = new_alloc; if(curdef_alloc > 65536) ppy_warning("Reallocating macro-expansion buffer larger than 64kB"); } @@ -1085,7 +1154,10 @@ static void expand_macro(macexpstackentry_t *mep) assert(ppp->expanding == 0); if((ppp->nargs >= 0 && nargs != ppp->nargs) || (ppp->nargs < 0 && nargs < -ppp->nargs)) + { ppy_error("Too %s macro arguments (%d)", nargs < abs(ppp->nargs) ? "few" : "many", nargs); + return; + } for(n = 0; n < nargs; n++) nnl += mep->nnls[n]; @@ -1162,12 +1234,19 @@ static void new_string(void) static void add_string(const char *str, int len) { + int new_alloc; + char *new_buffer; + if(len == 0) return; if(strbuf_idx >= strbuf_alloc || strbuf_alloc - strbuf_idx < len) { - strbuf_alloc += (len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1); - strbuffer = pp_xrealloc(strbuffer, strbuf_alloc * sizeof(strbuffer[0])); + new_alloc = strbuf_alloc + ((len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1)); + new_buffer = pp_xrealloc(strbuffer, new_alloc * sizeof(strbuffer[0])); + if(!new_buffer) + return; + strbuffer = new_buffer; + strbuf_alloc = new_alloc; if(strbuf_alloc > 65536) ppy_warning("Reallocating string buffer larger than 64kB"); } @@ -1178,6 +1257,8 @@ static void add_string(const char *str, int len) static char *get_string(void) { char *str = pp_xmalloc(strbuf_idx + 1); + if(!str) + return NULL; memcpy(str, strbuffer, strbuf_idx); str[strbuf_idx] = '\0'; #ifdef DEBUG @@ -1214,6 +1295,7 @@ static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop) memset(&bufferstack[bufferstackidx], 0, sizeof(bufferstack[0])); bufferstack[bufferstackidx].bufferstate = YY_CURRENT_BUFFER; + bufferstack[bufferstackidx].filehandle = pp_status.file; bufferstack[bufferstackidx].define = ppp; bufferstack[bufferstackidx].line_number = pp_status.line_number; bufferstack[bufferstackidx].char_number = pp_status.char_number; @@ -1253,14 +1335,10 @@ static bufferstackentry_t *pop_buffer(void) bufferstack[bufferstackidx].define->expanding = 0; else { - pp_status.line_number = bufferstack[bufferstackidx].line_number; - pp_status.char_number = bufferstack[bufferstackidx].char_number; - pp_status.input = bufferstack[bufferstackidx].filename; - ncontinuations = bufferstack[bufferstackidx].ncontinuations; if(!bufferstack[bufferstackidx].should_pop) { - fclose(ppy_in); - fprintf(ppy_out, "# %d \"%s\" 2\n", pp_status.line_number, pp_status.input); + wpp_callbacks->close(pp_status.file); + pp_writestring("# %d \"%s\" 2\n", bufferstack[bufferstackidx].line_number, bufferstack[bufferstackidx].filename); /* We have EOF, check the include logic */ if(pp_incl_state.state == 2 && !pp_incl_state.seen_junk && pp_incl_state.ppp) @@ -1269,6 +1347,9 @@ static bufferstackentry_t *pop_buffer(void) if(ppp) { includelogicentry_t *iep = pp_xmalloc(sizeof(includelogicentry_t)); + if(!iep) + return NULL; + iep->ppp = ppp; ppp->iep = iep; iep->filename = bufferstack[bufferstackidx].include_filename; @@ -1278,7 +1359,7 @@ static bufferstackentry_t *pop_buffer(void) iep->next->prev = iep; pp_includelogiclist = iep; if(pp_status.debug) - fprintf(stderr, "pop_buffer: %s:%d: includelogic added, include_ppp='%s', file='%s'\n", pp_status.input, pp_status.line_number, pp_incl_state.ppp, iep->filename); + fprintf(stderr, "pop_buffer: %s:%d: includelogic added, include_ppp='%s', file='%s'\n", bufferstack[bufferstackidx].filename, bufferstack[bufferstackidx].line_number, pp_incl_state.ppp, iep->filename); } else free(bufferstack[bufferstackidx].include_filename); @@ -1287,6 +1368,10 @@ static bufferstackentry_t *pop_buffer(void) pp_incl_state = bufferstack[bufferstackidx].incl; } + pp_status.line_number = bufferstack[bufferstackidx].line_number; + pp_status.char_number = bufferstack[bufferstackidx].char_number; + pp_status.input = bufferstack[bufferstackidx].filename; + ncontinuations = bufferstack[bufferstackidx].ncontinuations; } if(ppy_debug) @@ -1300,7 +1385,8 @@ static bufferstackentry_t *pop_buffer(void) bufferstack[bufferstackidx].filename, bufferstack[bufferstackidx].should_pop); - ppy__switch_to_buffer(bufferstack[bufferstackidx].bufferstate); + pp_status.file = bufferstack[bufferstackidx].filehandle; + ppy__switch_to_buffer(bufferstack[bufferstackidx].bufferstate); if(bufferstack[bufferstackidx].should_pop) { @@ -1323,9 +1409,14 @@ static bufferstackentry_t *pop_buffer(void) static void push_macro(pp_entry_t *ppp) { if(macexpstackidx >= MAXMACEXPSTACK) + { ppy_error("Too many nested macros"); + return; + } macexpstack[macexpstackidx] = pp_xmalloc(sizeof(macexpstack[0][0])); + if(!macexpstack[macexpstackidx]) + return; memset( macexpstack[macexpstackidx], 0, sizeof(macexpstack[0][0])); macexpstack[macexpstackidx]->ppp = ppp; macexpstackidx++; @@ -1363,8 +1454,13 @@ static void add_text_to_macro(const char *text, int len) if(mep->curargalloc - mep->curargsize <= len+1) /* +1 for '\0' */ { - mep->curargalloc += (ALLOCBLOCKSIZE > len+1) ? ALLOCBLOCKSIZE : len+1; - mep->curarg = pp_xrealloc(mep->curarg, mep->curargalloc * sizeof(mep->curarg[0])); + char *new_curarg; + int new_alloc = mep->curargalloc + ((ALLOCBLOCKSIZE > len+1) ? ALLOCBLOCKSIZE : len+1); + new_curarg = pp_xrealloc(mep->curarg, new_alloc * sizeof(mep->curarg[0])); + if(!new_curarg) + return; + mep->curarg = new_curarg; + mep->curargalloc = new_alloc; } memcpy(mep->curarg + mep->curargsize, text, len); mep->curargsize += len; @@ -1375,14 +1471,30 @@ static void macro_add_arg(int last) { int nnl = 0; char *cptr; + char **new_args, **new_ppargs; + int *new_nnls; macexpstackentry_t *mep = top_macro(); assert(mep->ppp->expanding == 0); - mep->args = pp_xrealloc(mep->args, (mep->nargs+1) * sizeof(mep->args[0])); - mep->ppargs = pp_xrealloc(mep->ppargs, (mep->nargs+1) * sizeof(mep->ppargs[0])); - mep->nnls = pp_xrealloc(mep->nnls, (mep->nargs+1) * sizeof(mep->nnls[0])); + new_args = pp_xrealloc(mep->args, (mep->nargs+1) * sizeof(mep->args[0])); + if(!new_args) + return; + mep->args = new_args; + + new_ppargs = pp_xrealloc(mep->ppargs, (mep->nargs+1) * sizeof(mep->ppargs[0])); + if(!new_ppargs) + return; + mep->ppargs = new_ppargs; + + new_nnls = pp_xrealloc(mep->nnls, (mep->nargs+1) * sizeof(mep->nnls[0])); + if(!new_nnls) + return; + mep->nnls = new_nnls; + mep->args[mep->nargs] = pp_xstrdup(mep->curarg ? mep->curarg : ""); + if(!mep->args[mep->nargs]) + return; cptr = mep->args[mep->nargs]-1; while((cptr = strchr(cptr+1, '\n'))) { @@ -1427,7 +1539,7 @@ static void macro_add_expansion(void) pp_status.input, pp_status.line_number, mep->nargs-1, - mep->ppargs[mep->nargs-1]); + mep->ppargs[mep->nargs-1] ? mep->ppargs[mep->nargs-1] : ""); } @@ -1441,7 +1553,7 @@ static void put_buffer(const char *s, int len) if(top_macro()) add_text_to_macro(s, len); else - fwrite(s, 1, len, ppy_out); + wpp_callbacks->write(s, len); } @@ -1455,6 +1567,10 @@ void pp_do_include(char *fname, int type) char *newpath; int n; includelogicentry_t *iep; + void *fp; + + if(!fname) + return; for(iep = pp_includelogiclist; iep; iep = iep->next) { @@ -1472,13 +1588,19 @@ void pp_do_include(char *fname, int type) n = strlen(fname); if(n <= 2) + { ppy_error("Empty include filename"); + return; + } /* Undo the effect of the quotation */ fname[n-1] = '\0'; - if((ppy_in = pp_open_include(fname+1, type ? pp_status.input : NULL, &newpath)) == NULL) + if((fp = pp_open_include(fname+1, type ? pp_status.input : NULL, &newpath)) == NULL) + { ppy_error("Unable to open include file %s", fname+1); + return; + } fname[n-1] = *fname; /* Redo the quotes */ push_buffer(NULL, newpath, fname, 0); @@ -1489,9 +1611,10 @@ void pp_do_include(char *fname, int type) if(pp_status.debug) fprintf(stderr, "pp_do_include: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d\n", pp_status.input, pp_status.line_number, pp_incl_state.state, pp_incl_state.ppp, pp_incl_state.ifdepth); - ppy__switch_to_buffer(ppy__create_buffer(ppy_in, YY_BUF_SIZE)); + pp_status.file = fp; + ppy__switch_to_buffer(ppy__create_buffer(NULL, YY_BUF_SIZE)); - fprintf(ppy_out, "# 1 \"%s\" 1%s\n", newpath, type ? "" : " 3"); + pp_writestring("# 1 \"%s\" 1%s\n", newpath, type ? "" : " 3"); } /* diff --git a/reactos/tools/wpp/ppy.tab.c b/reactos/tools/wpp/ppy.tab.c index 116821d2d35..53dc231772c 100644 --- a/reactos/tools/wpp/ppy.tab.c +++ b/reactos/tools/wpp/ppy.tab.c @@ -1,30 +1,38 @@ -/* A Bison parser, made by GNU Bison 2.1. */ +/* A Bison parser, made by GNU Bison 2.4.2. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software + Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ -/* Written by Richard Stallman by simplifying the original so called - ``semantic'' parser. */ +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local @@ -37,7 +45,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.1" +#define YYBISON_VERSION "2.4.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -45,17 +53,145 @@ /* Pure parsers. */ #define YYPURE 0 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ -#define yyparse ppy_parse -#define yylex ppy_lex -#define yyerror ppy_error -#define yylval ppy_lval -#define yychar ppy_char -#define yydebug ppy_debug -#define yynerrs ppy_nerrs +#define yyparse ppy_parse +#define yylex ppy_lex +#define yyerror ppy_error +#define yylval ppy_lval +#define yychar ppy_char +#define yydebug ppy_debug +#define yynerrs ppy_nerrs + + +/* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ +#line 30 "ppy.y" + +#include "config.h" +#include "wine/port.h" + +#include +#include +#include +#include +#include +#include + +#include "wpp_private.h" + + +#define UNARY_OP(r, v, OP) \ + switch(v.type) \ + { \ + case cv_sint: r.val.si = OP v.val.si; break; \ + case cv_uint: r.val.ui = OP v.val.ui; break; \ + case cv_slong: r.val.sl = OP v.val.sl; break; \ + case cv_ulong: r.val.ul = OP v.val.ul; break; \ + case cv_sll: r.val.sll = OP v.val.sll; break; \ + case cv_ull: r.val.ull = OP v.val.ull; break; \ + } + +#define cv_signed(v) ((v.type & FLAG_SIGNED) != 0) + +#define BIN_OP_INT(r, v1, v2, OP) \ + r.type = v1.type; \ + if(cv_signed(v1) && cv_signed(v2)) \ + r.val.si = v1.val.si OP v2.val.si; \ + else if(cv_signed(v1) && !cv_signed(v2)) \ + r.val.si = v1.val.si OP (signed) v2.val.ui; \ + else if(!cv_signed(v1) && cv_signed(v2)) \ + r.val.si = (signed) v1.val.ui OP v2.val.si; \ + else \ + r.val.ui = v1.val.ui OP v2.val.ui; + +#define BIN_OP_LONG(r, v1, v2, OP) \ + r.type = v1.type; \ + if(cv_signed(v1) && cv_signed(v2)) \ + r.val.sl = v1.val.sl OP v2.val.sl; \ + else if(cv_signed(v1) && !cv_signed(v2)) \ + r.val.sl = v1.val.sl OP (signed long) v2.val.ul; \ + else if(!cv_signed(v1) && cv_signed(v2)) \ + r.val.sl = (signed long) v1.val.ul OP v2.val.sl; \ + else \ + r.val.ul = v1.val.ul OP v2.val.ul; + +#define BIN_OP_LONGLONG(r, v1, v2, OP) \ + r.type = v1.type; \ + if(cv_signed(v1) && cv_signed(v2)) \ + r.val.sll = v1.val.sll OP v2.val.sll; \ + else if(cv_signed(v1) && !cv_signed(v2)) \ + r.val.sll = v1.val.sll OP (wrc_sll_t) v2.val.ull; \ + else if(!cv_signed(v1) && cv_signed(v2)) \ + r.val.sll = (wrc_sll_t) v1.val.ull OP v2.val.sll; \ + else \ + r.val.ull = v1.val.ull OP v2.val.ull; + +#define BIN_OP(r, v1, v2, OP) \ + switch(v1.type & SIZE_MASK) \ + { \ + case SIZE_INT: BIN_OP_INT(r, v1, v2, OP); break; \ + case SIZE_LONG: BIN_OP_LONG(r, v1, v2, OP); break; \ + case SIZE_LONGLONG: BIN_OP_LONGLONG(r, v1, v2, OP); break; \ + default: pp_internal_error(__FILE__, __LINE__, "Invalid type indicator (0x%04x)", v1.type); \ + } + + +/* + * Prototypes + */ +static int boolean(cval_t *v); +static void promote_equal_size(cval_t *v1, cval_t *v2); +static void cast_to_sint(cval_t *v); +static void cast_to_uint(cval_t *v); +static void cast_to_slong(cval_t *v); +static void cast_to_ulong(cval_t *v); +static void cast_to_sll(cval_t *v); +static void cast_to_ull(cval_t *v); +static marg_t *new_marg(char *str, def_arg_t type); +static marg_t *add_new_marg(char *str, def_arg_t type); +static int marg_index(char *id); +static mtext_t *new_mtext(char *str, int idx, def_exp_t type); +static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp); +static char *merge_text(char *s1, char *s2); + +/* + * Local variables + */ +static marg_t **macro_args; /* Macro parameters array while parsing */ +static int nmacro_args; + + + +/* Line 189 of yacc.c */ +#line 177 "ppy.tab.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif /* Tokens. */ @@ -109,173 +245,16 @@ tLSHIFT = 300 }; #endif -/* Tokens. */ -#define tRCINCLUDE 258 -#define tIF 259 -#define tIFDEF 260 -#define tIFNDEF 261 -#define tELSE 262 -#define tELIF 263 -#define tENDIF 264 -#define tDEFINED 265 -#define tNL 266 -#define tINCLUDE 267 -#define tLINE 268 -#define tGCCLINE 269 -#define tERROR 270 -#define tWARNING 271 -#define tPRAGMA 272 -#define tPPIDENT 273 -#define tUNDEF 274 -#define tMACROEND 275 -#define tCONCAT 276 -#define tELIPSIS 277 -#define tSTRINGIZE 278 -#define tIDENT 279 -#define tLITERAL 280 -#define tMACRO 281 -#define tDEFINE 282 -#define tDQSTRING 283 -#define tSQSTRING 284 -#define tIQSTRING 285 -#define tUINT 286 -#define tSINT 287 -#define tULONG 288 -#define tSLONG 289 -#define tULONGLONG 290 -#define tSLONGLONG 291 -#define tRCINCLUDEPATH 292 -#define tLOGOR 293 -#define tLOGAND 294 -#define tNE 295 -#define tEQ 296 -#define tGTE 297 -#define tLTE 298 -#define tRSHIFT 299 -#define tLSHIFT 300 +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ -/* Copy the first part of user declarations. */ -#line 30 "ppy.y" - -#include "config.h" -#include "wine/port.h" - -#include -#include -#include -#include -#include -#include - -#include "wpp_private.h" - - -#define UNARY_OP(r, v, OP) \ - switch(v.type) \ - { \ - case cv_sint: r.val.si = OP v.val.si; break; \ - case cv_uint: r.val.ui = OP v.val.ui; break; \ - case cv_slong: r.val.sl = OP v.val.sl; break; \ - case cv_ulong: r.val.ul = OP v.val.ul; break; \ - case cv_sll: r.val.sll = OP v.val.sll; break; \ - case cv_ull: r.val.ull = OP v.val.ull; break; \ - } - -#define cv_signed(v) ((v.type & FLAG_SIGNED) != 0) - -#define BIN_OP_INT(r, v1, v2, OP) \ - r.type = v1.type; \ - if(cv_signed(v1) && cv_signed(v2)) \ - r.val.si = v1.val.si OP v2.val.si; \ - else if(cv_signed(v1) && !cv_signed(v2)) \ - r.val.si = v1.val.si OP v2.val.ui; \ - else if(!cv_signed(v1) && cv_signed(v2)) \ - r.val.ui = v1.val.ui OP v2.val.si; \ - else \ - r.val.ui = v1.val.ui OP v2.val.ui; - -#define BIN_OP_LONG(r, v1, v2, OP) \ - r.type = v1.type; \ - if(cv_signed(v1) && cv_signed(v2)) \ - r.val.sl = v1.val.sl OP v2.val.sl; \ - else if(cv_signed(v1) && !cv_signed(v2)) \ - r.val.sl = v1.val.sl OP v2.val.ul; \ - else if(!cv_signed(v1) && cv_signed(v2)) \ - r.val.ul = v1.val.ul OP v2.val.sl; \ - else \ - r.val.ul = v1.val.ul OP v2.val.ul; - -#define BIN_OP_LONGLONG(r, v1, v2, OP) \ - r.type = v1.type; \ - if(cv_signed(v1) && cv_signed(v2)) \ - r.val.sll = v1.val.sll OP v2.val.sll; \ - else if(cv_signed(v1) && !cv_signed(v2)) \ - r.val.sll = v1.val.sll OP v2.val.ull; \ - else if(!cv_signed(v1) && cv_signed(v2)) \ - r.val.ull = v1.val.ull OP v2.val.sll; \ - else \ - r.val.ull = v1.val.ull OP v2.val.ull; - -#define BIN_OP(r, v1, v2, OP) \ - switch(v1.type & SIZE_MASK) \ - { \ - case SIZE_INT: BIN_OP_INT(r, v1, v2, OP); break; \ - case SIZE_LONG: BIN_OP_LONG(r, v1, v2, OP); break; \ - case SIZE_LONGLONG: BIN_OP_LONGLONG(r, v1, v2, OP); break; \ - default: pp_internal_error(__FILE__, __LINE__, "Invalid type indicator (0x%04x)", v1.type); \ - } - - -/* - * Prototypes - */ -static int boolean(cval_t *v); -static void promote_equal_size(cval_t *v1, cval_t *v2); -static void cast_to_sint(cval_t *v); -static void cast_to_uint(cval_t *v); -static void cast_to_slong(cval_t *v); -static void cast_to_ulong(cval_t *v); -static void cast_to_sll(cval_t *v); -static void cast_to_ull(cval_t *v); -static marg_t *new_marg(char *str, def_arg_t type); -static marg_t *add_new_marg(char *str, def_arg_t type); -static int marg_index(char *id); -static mtext_t *new_mtext(char *str, int idx, def_exp_t type); -static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp); -static char *merge_text(char *s1, char *s2); - -/* - * Local variables - */ -static marg_t **macro_args; /* Macro parameters array while parsing */ -static int nmacro_args; - - - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif - -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +/* Line 214 of yacc.c */ #line 126 "ppy.y" -typedef union YYSTYPE { + int sint; unsigned int uint; long slong; @@ -287,38 +266,73 @@ typedef union YYSTYPE { cval_t cval; marg_t *marg; mtext_t *mtext; + + + +/* Line 214 of yacc.c */ +#line 274 "ppy.tab.c" } YYSTYPE; -/* Line 196 of yacc.c. */ -#line 293 "ppy.tab.c" +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif - /* Copy the second part of user declarations. */ -/* Line 219 of yacc.c. */ -#line 305 "ppy.tab.c" +/* Line 264 of yacc.c */ +#line 286 "ppy.tab.c" -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ +#ifdef short +# undef short #endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; #endif -#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; #endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; #endif +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -329,7 +343,32 @@ typedef union YYSTYPE { # endif #endif -#if ! defined (yyoverflow) || YYERROR_VERBOSE +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -337,66 +376,78 @@ typedef union YYSTYPE { # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if defined (__STDC__) || defined (__cplusplus) +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ -# define YYINCLUDED_STDLIB_H +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# ifdef __cplusplus -extern "C" { +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ - && (defined (__STDC__) || defined (__cplusplus))) +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ - && (defined (__STDC__) || defined (__cplusplus))) +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif -# ifdef __cplusplus -} -# endif # endif -#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ -#if (! defined (yyoverflow) \ - && (! defined (__cplusplus) \ - || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - short int yyss; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -404,13 +455,13 @@ union yyalloc /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY -# if defined (__GNUC__) && 1 < __GNUC__ +# if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else @@ -421,7 +472,7 @@ union yyalloc for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ - while (0) + while (YYID (0)) # endif # endif @@ -430,37 +481,31 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ - while (0) + while (YYID (0)) #endif -#if defined (__STDC__) || defined (__cplusplus) - typedef signed char yysigned_char; -#else - typedef short int yysigned_char; -#endif - -/* YYFINAL -- State number of the termination state. */ +/* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 303 -/* YYNTOKENS -- Number of terminals. */ +/* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 62 -/* YYNNTS -- Number of nonterminals. */ +/* YYNNTS -- Number of nonterminals. */ #define YYNNTS 13 -/* YYNRULES -- Number of rules. */ +/* YYNRULES -- Number of rules. */ #define YYNRULES 84 -/* YYNRULES -- Number of states. */ +/* YYNRULES -- Number of states. */ #define YYNSTATES 153 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ @@ -471,7 +516,7 @@ union yyalloc ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const unsigned char yytranslate[] = +static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -509,7 +554,7 @@ static const unsigned char yytranslate[] = #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const unsigned short int yyprhs[] = +static const yytype_uint16 yyprhs[] = { 0, 0, 3, 4, 7, 11, 15, 19, 23, 27, 31, 34, 37, 41, 45, 52, 57, 62, 68, 75, @@ -522,8 +567,8 @@ static const unsigned short int yyprhs[] = 265, 268, 271, 274, 278 }; -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yysigned_char yyrhs[] = +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = { 63, 0, -1, -1, 63, 64, -1, 12, 28, 11, -1, 12, 30, 11, -1, 4, 74, 11, -1, 5, @@ -557,23 +602,23 @@ static const yysigned_char yyrhs[] = }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short int yyrline[] = +static const yytype_uint16 yyrline[] = { 0, 181, 181, 182, 186, 187, 188, 189, 190, 210, - 231, 254, 269, 270, 271, 274, 275, 276, 278, 280, - 282, 284, 285, 286, 287, 288, 289, 296, 302, 303, - 306, 307, 308, 309, 310, 311, 314, 317, 318, 321, - 322, 325, 326, 330, 331, 337, 338, 341, 342, 343, - 344, 345, 351, 360, 361, 362, 363, 364, 365, 366, - 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, 391 + 234, 260, 277, 278, 279, 282, 283, 284, 286, 288, + 290, 292, 293, 294, 295, 296, 297, 310, 316, 317, + 320, 321, 322, 323, 324, 325, 328, 331, 332, 335, + 336, 339, 340, 344, 345, 351, 352, 355, 356, 357, + 358, 359, 366, 375, 376, 377, 378, 379, 380, 381, + 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "tRCINCLUDE", "tIF", "tIFDEF", "tIFNDEF", @@ -593,7 +638,7 @@ static const char *const yytname[] = # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const unsigned short int yytoknum[] = +static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -606,7 +651,7 @@ static const unsigned short int yytoknum[] = # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const unsigned char yyr1[] = +static const yytype_uint8 yyr1[] = { 0, 62, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, @@ -620,7 +665,7 @@ static const unsigned char yyr1[] = }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const unsigned char yyr2[] = +static const yytype_uint8 yyr2[] = { 0, 2, 0, 2, 3, 3, 3, 3, 3, 3, 2, 2, 3, 3, 6, 4, 4, 5, 6, 7, @@ -636,7 +681,7 @@ static const unsigned char yyr2[] = /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ -static const unsigned char yydefact[] = +static const yytype_uint8 yydefact[] = { 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 28, 28, 28, 0, 36, 28, @@ -656,8 +701,8 @@ static const unsigned char yydefact[] = 19, 0, 20 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const short int yydefgoto[] = +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = { -1, 1, 20, 50, 51, 56, 100, 101, 102, 139, 140, 141, 36 @@ -666,7 +711,7 @@ static const short int yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -27 -static const short int yypact[] = +static const yytype_int16 yypact[] = { -27, 142, -27, -26, -3, -12, -2, 30, -3, 41, 91, 21, 2, -19, -19, -19, -19, 32, -27, -19, @@ -687,7 +732,7 @@ static const short int yypact[] = }; /* YYPGOTO[NTERM-NUM]. */ -static const short int yypgoto[] = +static const yytype_int16 yypgoto[] = { -27, -27, -27, -11, -27, -27, -27, -27, -27, -27, -27, 163, -8 @@ -698,7 +743,7 @@ static const short int yypgoto[] = number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 -static const unsigned char yytable[] = +static const yytype_uint8 yytable[] = { 40, 58, 21, 52, 53, 54, 47, 23, 57, 48, 49, 22, 37, 45, 125, 131, 92, 145, 150, 93, @@ -733,7 +778,7 @@ static const unsigned char yytable[] = 147, 148, 152, 149 }; -static const unsigned char yycheck[] = +static const yytype_uint8 yycheck[] = { 8, 24, 28, 14, 15, 16, 25, 10, 19, 28, 29, 37, 24, 11, 11, 11, 25, 11, 11, 28, @@ -770,7 +815,7 @@ static const unsigned char yycheck[] = /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const unsigned char yystos[] = +static const yytype_uint8 yystos[] = { 0, 63, 0, 3, 4, 5, 6, 7, 8, 9, 12, 13, 14, 15, 16, 17, 18, 19, 26, 27, @@ -802,9 +847,18 @@ static const unsigned char yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ #define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif #define YYRECOVERING() (!!yyerrstatus) @@ -815,7 +869,7 @@ do \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ + YYPOPSTACK (1); \ goto yybackup; \ } \ else \ @@ -823,7 +877,7 @@ do \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ -while (0) +while (YYID (0)) #define YYTERROR 1 @@ -838,7 +892,7 @@ while (0) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ - if (N) \ + if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ @@ -852,7 +906,7 @@ while (0) (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ - while (0) + while (YYID (0)) #endif @@ -861,11 +915,11 @@ while (0) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif @@ -892,37 +946,100 @@ while (0) do { \ if (yydebug) \ YYFPRINTF Args; \ -} while (0) +} while (YYID (0)) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yysymprint (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (short int *bottom, short int *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - short int *bottom; - short int *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (/* Nothing. */; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -930,37 +1047,45 @@ yy_stack_print (bottom, top) do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ -} while (0) +} while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (int yyrule) +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void -yy_reduce_print (yyrule) +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; int yyrule; #endif { + int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", - yyrule - 1, yylno); - /* Print the symbols being reduced, and their result. */ - for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) - YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); - YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ - yy_reduce_print (Rule); \ -} while (0) + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -994,42 +1119,44 @@ int yydebug; #if YYERROR_VERBOSE # ifndef yystrlen -# if defined (__GLIBC__) && defined (_STRING_H) +# if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static YYSIZE_T -# if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) -# else +#else +static YYSIZE_T yystrlen (yystr) - const char *yystr; -# endif + const char *yystr; +#endif { - const char *yys = yystr; - - while (*yys++ != '\0') + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) continue; - - return yys - yystr - 1; + return yylen; } # endif # endif # ifndef yystpcpy -# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static char * -# if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) -# else +#else +static char * yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -# endif + char *yydest; + const char *yysrc; +#endif { char *yyd = yydest; const char *yys = yysrc; @@ -1055,7 +1182,7 @@ yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { - size_t yyn = 0; + YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) @@ -1090,53 +1217,123 @@ yytnamerr (char *yyres, const char *yystr) } # endif -#endif /* YYERROR_VERBOSE */ +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ -#if YYDEBUG -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if defined (__STDC__) || defined (__cplusplus) -static void -yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) -#else -static void -yysymprint (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE *yyvaluep; -#endif -{ - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; - - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - switch (yytype) - { - default: - break; - } - YYFPRINTF (yyoutput, ")"); -} - -#endif /* ! YYDEBUG */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else @@ -1147,8 +1344,7 @@ yydestruct (yymsg, yytype, yyvaluep) YYSTYPE *yyvaluep; #endif { - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; + YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; @@ -1158,21 +1354,19 @@ yydestruct (yymsg, yytype, yyvaluep) { default: - break; + break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) +#if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); -# else +#else int yyparse (); -# endif +#endif #else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) +#if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); @@ -1180,11 +1374,10 @@ int yyparse (); #endif /* ! YYPARSE_PARAM */ - -/* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ @@ -1192,82 +1385,94 @@ int yynerrs; -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -int yyparse (void *YYPARSE_PARAM) -# else -int yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -# endif +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif #else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () - ; + #endif #endif { - - int yystate; + + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + int yyn; int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - short int yyssa[YYINITDEPTH]; - short int *yyss = yyssa; - short int *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - - - -#define YYPOPSTACK (yyvsp--, yyssp--) - - YYSIZE_T yystacksize = YYINITDEPTH; - + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif - /* When reducing, the number of symbols on the RHS of the reduced - rule. */ - int yylen; +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; @@ -1278,8 +1483,7 @@ yyparse () `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. - */ + have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: @@ -1292,12 +1496,11 @@ yyparse () #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of + /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - short int *yyss1 = yyss; - + yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a @@ -1306,7 +1509,6 @@ yyparse () yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); yyss = yyss1; @@ -1324,14 +1526,13 @@ yyparse () yystacksize = YYMAXDEPTH; { - short int *yyss1 = yyss; + yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1342,7 +1543,6 @@ yyparse () yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -1352,6 +1552,9 @@ yyparse () YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -1359,19 +1562,17 @@ yyparse () `-----------*/ yybackup: -/* Do appropriate processing given the current state. */ -/* Read a look-ahead token if we need one and don't already have one. */ -/* yyresume: */ - - /* First try to decide what to do without reference to look-ahead token. */ + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1403,25 +1604,20 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - - /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - *++yyvsp = yylval; - - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + yystate = yyn; + *++yyvsp = yylval; + goto yynewstate; @@ -1457,42 +1653,52 @@ yyreduce: switch (yyn) { case 4: + +/* Line 1464 of yacc.c */ #line 186 "ppy.y" - { pp_do_include((yyvsp[-1].cptr), 1); ;} + { pp_do_include((yyvsp[(2) - (3)].cptr), 1); ;} break; case 5: + +/* Line 1464 of yacc.c */ #line 187 "ppy.y" - { pp_do_include((yyvsp[-1].cptr), 0); ;} + { pp_do_include((yyvsp[(2) - (3)].cptr), 0); ;} break; case 6: + +/* Line 1464 of yacc.c */ #line 188 "ppy.y" - { pp_next_if_state(boolean(&(yyvsp[-1].cval))); ;} + { pp_next_if_state(boolean(&(yyvsp[(2) - (3)].cval))); ;} break; case 7: + +/* Line 1464 of yacc.c */ #line 189 "ppy.y" - { pp_next_if_state(pplookup((yyvsp[-1].cptr)) != NULL); free((yyvsp[-1].cptr)); ;} + { pp_next_if_state(pplookup((yyvsp[(2) - (3)].cptr)) != NULL); free((yyvsp[(2) - (3)].cptr)); ;} break; case 8: + +/* Line 1464 of yacc.c */ #line 190 "ppy.y" { - int t = pplookup((yyvsp[-1].cptr)) == NULL; + int t = pplookup((yyvsp[(2) - (3)].cptr)) == NULL; if(pp_incl_state.state == 0 && t && !pp_incl_state.seen_junk) { pp_incl_state.state = 1; - pp_incl_state.ppp = (yyvsp[-1].cptr); + pp_incl_state.ppp = (yyvsp[(2) - (3)].cptr); pp_incl_state.ifdepth = pp_get_if_depth(); } else if(pp_incl_state.state != 1) { pp_incl_state.state = -1; - free((yyvsp[-1].cptr)); + free((yyvsp[(2) - (3)].cptr)); } else - free((yyvsp[-1].cptr)); + free((yyvsp[(2) - (3)].cptr)); pp_next_if_state(t); if(pp_status.debug) fprintf(stderr, "tIFNDEF: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d\n", @@ -1501,6 +1707,8 @@ yyreduce: break; case 9: + +/* Line 1464 of yacc.c */ #line 210 "ppy.y" { pp_if_state_t s = pp_pop_if(); @@ -1511,7 +1719,7 @@ yyreduce: pp_push_if(if_elif); break; case if_false: - pp_push_if(boolean(&(yyvsp[-1].cval)) ? if_true : if_false); + pp_push_if(boolean(&(yyvsp[(2) - (3)].cval)) ? if_true : if_false); break; case if_ignore: pp_push_if(if_ignore); @@ -1519,6 +1727,9 @@ yyreduce: case if_elsetrue: case if_elsefalse: ppy_error("#elif cannot follow #else"); + break; + case if_error: + break; default: pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #elif directive", s); } @@ -1526,7 +1737,9 @@ yyreduce: break; case 10: -#line 231 "ppy.y" + +/* Line 1464 of yacc.c */ +#line 234 "ppy.y" { pp_if_state_t s = pp_pop_if(); switch(s) @@ -1546,6 +1759,9 @@ yyreduce: case if_elsetrue: case if_elsefalse: ppy_error("#else clause already defined"); + break; + case if_error: + break; default: pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #else directive", s); } @@ -1553,424 +1769,577 @@ yyreduce: break; case 11: -#line 254 "ppy.y" + +/* Line 1464 of yacc.c */ +#line 260 "ppy.y" { - pp_pop_if(); - if(pp_incl_state.ifdepth == pp_get_if_depth() && pp_incl_state.state == 1) + if(pp_pop_if() != if_error) { - pp_incl_state.state = 2; - pp_incl_state.seen_junk = 0; + if(pp_incl_state.ifdepth == pp_get_if_depth() && pp_incl_state.state == 1) + { + pp_incl_state.state = 2; + pp_incl_state.seen_junk = 0; + } + else if(pp_incl_state.state != 1) + { + pp_incl_state.state = -1; + } + if(pp_status.debug) + fprintf(stderr, "tENDIF: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d\n", + pp_status.input, pp_status.line_number, pp_incl_state.state, pp_incl_state.ppp, pp_incl_state.ifdepth); } - else if(pp_incl_state.state != 1) - { - pp_incl_state.state = -1; - } - if(pp_status.debug) - fprintf(stderr, "tENDIF: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d\n", - pp_status.input, pp_status.line_number, pp_incl_state.state, pp_incl_state.ppp, pp_incl_state.ifdepth); ;} break; case 12: -#line 269 "ppy.y" - { pp_del_define((yyvsp[-1].cptr)); free((yyvsp[-1].cptr)); ;} + +/* Line 1464 of yacc.c */ +#line 277 "ppy.y" + { pp_del_define((yyvsp[(2) - (3)].cptr)); free((yyvsp[(2) - (3)].cptr)); ;} break; case 13: -#line 270 "ppy.y" - { pp_add_define((yyvsp[-2].cptr), (yyvsp[-1].cptr)); ;} + +/* Line 1464 of yacc.c */ +#line 278 "ppy.y" + { pp_add_define((yyvsp[(1) - (3)].cptr), (yyvsp[(2) - (3)].cptr)); free((yyvsp[(1) - (3)].cptr)); free((yyvsp[(2) - (3)].cptr)); ;} break; case 14: -#line 271 "ppy.y" + +/* Line 1464 of yacc.c */ +#line 279 "ppy.y" { - pp_add_macro((yyvsp[-5].cptr), macro_args, nmacro_args, (yyvsp[-1].mtext)); + pp_add_macro((yyvsp[(1) - (6)].cptr), macro_args, nmacro_args, (yyvsp[(5) - (6)].mtext)); ;} break; case 15: -#line 274 "ppy.y" - { fprintf(ppy_out, "# %d %s\n", (yyvsp[-2].sint) , (yyvsp[-1].cptr)); free((yyvsp[-1].cptr)); ;} + +/* Line 1464 of yacc.c */ +#line 282 "ppy.y" + { if((yyvsp[(3) - (4)].cptr)) pp_writestring("# %d %s\n", (yyvsp[(2) - (4)].sint) , (yyvsp[(3) - (4)].cptr)); free((yyvsp[(3) - (4)].cptr)); ;} break; case 16: -#line 275 "ppy.y" - { fprintf(ppy_out, "# %d %s\n", (yyvsp[-2].sint) , (yyvsp[-1].cptr)); free((yyvsp[-1].cptr)); ;} + +/* Line 1464 of yacc.c */ +#line 283 "ppy.y" + { if((yyvsp[(3) - (4)].cptr)) pp_writestring("# %d %s\n", (yyvsp[(2) - (4)].sint) , (yyvsp[(3) - (4)].cptr)); free((yyvsp[(3) - (4)].cptr)); ;} break; case 17: -#line 277 "ppy.y" - { fprintf(ppy_out, "# %d %s %d\n", (yyvsp[-3].sint), (yyvsp[-2].cptr), (yyvsp[-1].sint)); free((yyvsp[-2].cptr)); ;} + +/* Line 1464 of yacc.c */ +#line 285 "ppy.y" + { if((yyvsp[(3) - (5)].cptr)) pp_writestring("# %d %s %d\n", (yyvsp[(2) - (5)].sint), (yyvsp[(3) - (5)].cptr), (yyvsp[(4) - (5)].sint)); free((yyvsp[(3) - (5)].cptr)); ;} break; case 18: -#line 279 "ppy.y" - { fprintf(ppy_out, "# %d %s %d %d\n", (yyvsp[-4].sint) ,(yyvsp[-3].cptr), (yyvsp[-2].sint), (yyvsp[-1].sint)); free((yyvsp[-3].cptr)); ;} + +/* Line 1464 of yacc.c */ +#line 287 "ppy.y" + { if((yyvsp[(3) - (6)].cptr)) pp_writestring("# %d %s %d %d\n", (yyvsp[(2) - (6)].sint) ,(yyvsp[(3) - (6)].cptr), (yyvsp[(4) - (6)].sint), (yyvsp[(5) - (6)].sint)); free((yyvsp[(3) - (6)].cptr)); ;} break; case 19: -#line 281 "ppy.y" - { fprintf(ppy_out, "# %d %s %d %d %d\n", (yyvsp[-5].sint) ,(yyvsp[-4].cptr) ,(yyvsp[-3].sint) ,(yyvsp[-2].sint), (yyvsp[-1].sint)); free((yyvsp[-4].cptr)); ;} + +/* Line 1464 of yacc.c */ +#line 289 "ppy.y" + { if((yyvsp[(3) - (7)].cptr)) pp_writestring("# %d %s %d %d %d\n", (yyvsp[(2) - (7)].sint) ,(yyvsp[(3) - (7)].cptr) ,(yyvsp[(4) - (7)].sint) ,(yyvsp[(5) - (7)].sint), (yyvsp[(6) - (7)].sint)); free((yyvsp[(3) - (7)].cptr)); ;} break; case 20: -#line 283 "ppy.y" - { fprintf(ppy_out, "# %d %s %d %d %d %d\n", (yyvsp[-6].sint) ,(yyvsp[-5].cptr) ,(yyvsp[-4].sint) ,(yyvsp[-3].sint), (yyvsp[-2].sint), (yyvsp[-1].sint)); free((yyvsp[-5].cptr)); ;} + +/* Line 1464 of yacc.c */ +#line 291 "ppy.y" + { if((yyvsp[(3) - (8)].cptr)) pp_writestring("# %d %s %d %d %d %d\n", (yyvsp[(2) - (8)].sint) ,(yyvsp[(3) - (8)].cptr) ,(yyvsp[(4) - (8)].sint) ,(yyvsp[(5) - (8)].sint), (yyvsp[(6) - (8)].sint), (yyvsp[(7) - (8)].sint)); free((yyvsp[(3) - (8)].cptr)); ;} break; case 22: -#line 285 "ppy.y" - { ppy_error("#error directive: '%s'", (yyvsp[-1].cptr)); free((yyvsp[-1].cptr)); ;} + +/* Line 1464 of yacc.c */ +#line 293 "ppy.y" + { ppy_error("#error directive: '%s'", (yyvsp[(2) - (3)].cptr)); free((yyvsp[(2) - (3)].cptr)); ;} break; case 23: -#line 286 "ppy.y" - { ppy_warning("#warning directive: '%s'", (yyvsp[-1].cptr)); free((yyvsp[-1].cptr)); ;} + +/* Line 1464 of yacc.c */ +#line 294 "ppy.y" + { ppy_warning("#warning directive: '%s'", (yyvsp[(2) - (3)].cptr)); free((yyvsp[(2) - (3)].cptr)); ;} break; case 24: -#line 287 "ppy.y" - { fprintf(ppy_out, "#pragma %s\n", (yyvsp[-1].cptr) ? (yyvsp[-1].cptr) : ""); free((yyvsp[-1].cptr)); ;} + +/* Line 1464 of yacc.c */ +#line 295 "ppy.y" + { pp_writestring("#pragma %s\n", (yyvsp[(2) - (3)].cptr) ? (yyvsp[(2) - (3)].cptr) : ""); free((yyvsp[(2) - (3)].cptr)); ;} break; case 25: -#line 288 "ppy.y" - { if(pp_status.pedantic) ppy_warning("#ident ignored (arg: '%s')", (yyvsp[-1].cptr)); free((yyvsp[-1].cptr)); ;} + +/* Line 1464 of yacc.c */ +#line 296 "ppy.y" + { if(pp_status.pedantic) ppy_warning("#ident ignored (arg: '%s')", (yyvsp[(2) - (3)].cptr)); free((yyvsp[(2) - (3)].cptr)); ;} break; case 26: -#line 289 "ppy.y" + +/* Line 1464 of yacc.c */ +#line 297 "ppy.y" { - int nl=strlen((yyvsp[0].cptr)) +3; - char *fn=pp_xmalloc(nl); - sprintf(fn,"\"%s\"",(yyvsp[0].cptr)); - free((yyvsp[0].cptr)); - pp_do_include(fn,1); + if((yyvsp[(2) - (2)].cptr)) + { + int nl=strlen((yyvsp[(2) - (2)].cptr)) +3; + char *fn=pp_xmalloc(nl); + if(fn) + { + sprintf(fn,"\"%s\"",(yyvsp[(2) - (2)].cptr)); + pp_do_include(fn,1); + } + free((yyvsp[(2) - (2)].cptr)); + } ;} break; case 27: -#line 296 "ppy.y" + +/* Line 1464 of yacc.c */ +#line 310 "ppy.y" { - pp_do_include((yyvsp[0].cptr),1); + pp_do_include((yyvsp[(2) - (2)].cptr),1); ;} break; case 28: -#line 302 "ppy.y" + +/* Line 1464 of yacc.c */ +#line 316 "ppy.y" { (yyval.cptr) = NULL; ;} break; case 29: -#line 303 "ppy.y" - { (yyval.cptr) = (yyvsp[0].cptr); ;} + +/* Line 1464 of yacc.c */ +#line 317 "ppy.y" + { (yyval.cptr) = (yyvsp[(1) - (1)].cptr); ;} break; case 30: -#line 306 "ppy.y" - { (yyval.cptr) = (yyvsp[0].cptr); ;} + +/* Line 1464 of yacc.c */ +#line 320 "ppy.y" + { (yyval.cptr) = (yyvsp[(1) - (1)].cptr); ;} break; case 31: -#line 307 "ppy.y" - { (yyval.cptr) = (yyvsp[0].cptr); ;} + +/* Line 1464 of yacc.c */ +#line 321 "ppy.y" + { (yyval.cptr) = (yyvsp[(1) - (1)].cptr); ;} break; case 32: -#line 308 "ppy.y" - { (yyval.cptr) = (yyvsp[0].cptr); ;} + +/* Line 1464 of yacc.c */ +#line 322 "ppy.y" + { (yyval.cptr) = (yyvsp[(1) - (1)].cptr); ;} break; case 33: -#line 309 "ppy.y" - { (yyval.cptr) = merge_text((yyvsp[-1].cptr), (yyvsp[0].cptr)); ;} + +/* Line 1464 of yacc.c */ +#line 323 "ppy.y" + { (yyval.cptr) = merge_text((yyvsp[(1) - (2)].cptr), (yyvsp[(2) - (2)].cptr)); ;} break; case 34: -#line 310 "ppy.y" - { (yyval.cptr) = merge_text((yyvsp[-1].cptr), (yyvsp[0].cptr)); ;} + +/* Line 1464 of yacc.c */ +#line 324 "ppy.y" + { (yyval.cptr) = merge_text((yyvsp[(1) - (2)].cptr), (yyvsp[(2) - (2)].cptr)); ;} break; case 35: -#line 311 "ppy.y" - { (yyval.cptr) = merge_text((yyvsp[-1].cptr), (yyvsp[0].cptr)); ;} + +/* Line 1464 of yacc.c */ +#line 325 "ppy.y" + { (yyval.cptr) = merge_text((yyvsp[(1) - (2)].cptr), (yyvsp[(2) - (2)].cptr)); ;} break; case 36: -#line 314 "ppy.y" + +/* Line 1464 of yacc.c */ +#line 328 "ppy.y" { macro_args = NULL; nmacro_args = 0; ;} break; case 37: -#line 317 "ppy.y" + +/* Line 1464 of yacc.c */ +#line 331 "ppy.y" { (yyval.sint) = 0; macro_args = NULL; nmacro_args = 0; ;} break; case 38: -#line 318 "ppy.y" + +/* Line 1464 of yacc.c */ +#line 332 "ppy.y" { (yyval.sint) = nmacro_args; ;} break; case 39: -#line 321 "ppy.y" - { (yyval.marg) = (yyvsp[0].marg); ;} + +/* Line 1464 of yacc.c */ +#line 335 "ppy.y" + { (yyval.marg) = (yyvsp[(1) - (1)].marg); ;} break; case 40: -#line 322 "ppy.y" + +/* Line 1464 of yacc.c */ +#line 336 "ppy.y" { (yyval.marg) = add_new_marg(NULL, arg_list); nmacro_args *= -1; ;} break; case 41: -#line 325 "ppy.y" - { (yyval.marg) = add_new_marg((yyvsp[0].cptr), arg_single); ;} + +/* Line 1464 of yacc.c */ +#line 339 "ppy.y" + { (yyval.marg) = add_new_marg((yyvsp[(3) - (3)].cptr), arg_single); ;} break; case 42: -#line 326 "ppy.y" - { (yyval.marg) = add_new_marg((yyvsp[0].cptr), arg_single); ;} + +/* Line 1464 of yacc.c */ +#line 340 "ppy.y" + { (yyval.marg) = add_new_marg((yyvsp[(1) - (1)].cptr), arg_single); ;} break; case 43: -#line 330 "ppy.y" + +/* Line 1464 of yacc.c */ +#line 344 "ppy.y" { (yyval.mtext) = NULL; ;} break; case 44: -#line 331 "ppy.y" + +/* Line 1464 of yacc.c */ +#line 345 "ppy.y" { - for((yyval.mtext) = (yyvsp[0].mtext); (yyval.mtext) && (yyval.mtext)->prev; (yyval.mtext) = (yyval.mtext)->prev) + for((yyval.mtext) = (yyvsp[(1) - (1)].mtext); (yyval.mtext) && (yyval.mtext)->prev; (yyval.mtext) = (yyval.mtext)->prev) ; ;} break; case 45: -#line 337 "ppy.y" - { (yyval.mtext) = (yyvsp[0].mtext); ;} + +/* Line 1464 of yacc.c */ +#line 351 "ppy.y" + { (yyval.mtext) = (yyvsp[(1) - (1)].mtext); ;} break; case 46: -#line 338 "ppy.y" - { (yyval.mtext) = combine_mtext((yyvsp[-1].mtext), (yyvsp[0].mtext)); ;} + +/* Line 1464 of yacc.c */ +#line 352 "ppy.y" + { (yyval.mtext) = combine_mtext((yyvsp[(1) - (2)].mtext), (yyvsp[(2) - (2)].mtext)); ;} break; case 47: -#line 341 "ppy.y" - { (yyval.mtext) = new_mtext((yyvsp[0].cptr), 0, exp_text); ;} + +/* Line 1464 of yacc.c */ +#line 355 "ppy.y" + { (yyval.mtext) = new_mtext((yyvsp[(1) - (1)].cptr), 0, exp_text); ;} break; case 48: -#line 342 "ppy.y" - { (yyval.mtext) = new_mtext((yyvsp[0].cptr), 0, exp_text); ;} + +/* Line 1464 of yacc.c */ +#line 356 "ppy.y" + { (yyval.mtext) = new_mtext((yyvsp[(1) - (1)].cptr), 0, exp_text); ;} break; case 49: -#line 343 "ppy.y" - { (yyval.mtext) = new_mtext((yyvsp[0].cptr), 0, exp_text); ;} + +/* Line 1464 of yacc.c */ +#line 357 "ppy.y" + { (yyval.mtext) = new_mtext((yyvsp[(1) - (1)].cptr), 0, exp_text); ;} break; case 50: -#line 344 "ppy.y" + +/* Line 1464 of yacc.c */ +#line 358 "ppy.y" { (yyval.mtext) = new_mtext(NULL, 0, exp_concat); ;} break; case 51: -#line 345 "ppy.y" + +/* Line 1464 of yacc.c */ +#line 359 "ppy.y" { - int mat = marg_index((yyvsp[0].cptr)); + int mat = marg_index((yyvsp[(2) - (2)].cptr)); if(mat < 0) ppy_error("Stringification identifier must be an argument parameter"); - (yyval.mtext) = new_mtext(NULL, mat, exp_stringize); + else + (yyval.mtext) = new_mtext(NULL, mat, exp_stringize); ;} break; case 52: -#line 351 "ppy.y" + +/* Line 1464 of yacc.c */ +#line 366 "ppy.y" { - int mat = marg_index((yyvsp[0].cptr)); + int mat = marg_index((yyvsp[(1) - (1)].cptr)); if(mat >= 0) (yyval.mtext) = new_mtext(NULL, mat, exp_subst); - else - (yyval.mtext) = new_mtext((yyvsp[0].cptr), 0, exp_text); + else if((yyvsp[(1) - (1)].cptr)) + (yyval.mtext) = new_mtext((yyvsp[(1) - (1)].cptr), 0, exp_text); ;} break; case 53: -#line 360 "ppy.y" - { (yyval.cval).type = cv_sint; (yyval.cval).val.si = (yyvsp[0].sint); ;} + +/* Line 1464 of yacc.c */ +#line 375 "ppy.y" + { (yyval.cval).type = cv_sint; (yyval.cval).val.si = (yyvsp[(1) - (1)].sint); ;} break; case 54: -#line 361 "ppy.y" - { (yyval.cval).type = cv_uint; (yyval.cval).val.ui = (yyvsp[0].uint); ;} + +/* Line 1464 of yacc.c */ +#line 376 "ppy.y" + { (yyval.cval).type = cv_uint; (yyval.cval).val.ui = (yyvsp[(1) - (1)].uint); ;} break; case 55: -#line 362 "ppy.y" - { (yyval.cval).type = cv_slong; (yyval.cval).val.sl = (yyvsp[0].slong); ;} + +/* Line 1464 of yacc.c */ +#line 377 "ppy.y" + { (yyval.cval).type = cv_slong; (yyval.cval).val.sl = (yyvsp[(1) - (1)].slong); ;} break; case 56: -#line 363 "ppy.y" - { (yyval.cval).type = cv_ulong; (yyval.cval).val.ul = (yyvsp[0].ulong); ;} + +/* Line 1464 of yacc.c */ +#line 378 "ppy.y" + { (yyval.cval).type = cv_ulong; (yyval.cval).val.ul = (yyvsp[(1) - (1)].ulong); ;} break; case 57: -#line 364 "ppy.y" - { (yyval.cval).type = cv_sll; (yyval.cval).val.sll = (yyvsp[0].sll); ;} + +/* Line 1464 of yacc.c */ +#line 379 "ppy.y" + { (yyval.cval).type = cv_sll; (yyval.cval).val.sll = (yyvsp[(1) - (1)].sll); ;} break; case 58: -#line 365 "ppy.y" - { (yyval.cval).type = cv_ull; (yyval.cval).val.ull = (yyvsp[0].ull); ;} + +/* Line 1464 of yacc.c */ +#line 380 "ppy.y" + { (yyval.cval).type = cv_ull; (yyval.cval).val.ull = (yyvsp[(1) - (1)].ull); ;} break; case 59: -#line 366 "ppy.y" - { (yyval.cval).type = cv_sint; (yyval.cval).val.si = pplookup((yyvsp[0].cptr)) != NULL; ;} + +/* Line 1464 of yacc.c */ +#line 381 "ppy.y" + { (yyval.cval).type = cv_sint; (yyval.cval).val.si = pplookup((yyvsp[(2) - (2)].cptr)) != NULL; ;} break; case 60: -#line 367 "ppy.y" - { (yyval.cval).type = cv_sint; (yyval.cval).val.si = pplookup((yyvsp[-1].cptr)) != NULL; ;} + +/* Line 1464 of yacc.c */ +#line 382 "ppy.y" + { (yyval.cval).type = cv_sint; (yyval.cval).val.si = pplookup((yyvsp[(3) - (4)].cptr)) != NULL; ;} break; case 61: -#line 368 "ppy.y" + +/* Line 1464 of yacc.c */ +#line 383 "ppy.y" { (yyval.cval).type = cv_sint; (yyval.cval).val.si = 0; ;} break; case 62: -#line 369 "ppy.y" - { (yyval.cval).type = cv_sint; (yyval.cval).val.si = boolean(&(yyvsp[-2].cval)) || boolean(&(yyvsp[0].cval)); ;} + +/* Line 1464 of yacc.c */ +#line 384 "ppy.y" + { (yyval.cval).type = cv_sint; (yyval.cval).val.si = boolean(&(yyvsp[(1) - (3)].cval)) || boolean(&(yyvsp[(3) - (3)].cval)); ;} break; case 63: -#line 370 "ppy.y" - { (yyval.cval).type = cv_sint; (yyval.cval).val.si = boolean(&(yyvsp[-2].cval)) && boolean(&(yyvsp[0].cval)); ;} + +/* Line 1464 of yacc.c */ +#line 385 "ppy.y" + { (yyval.cval).type = cv_sint; (yyval.cval).val.si = boolean(&(yyvsp[(1) - (3)].cval)) && boolean(&(yyvsp[(3) - (3)].cval)); ;} break; case 64: -#line 371 "ppy.y" - { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), ==) ;} + +/* Line 1464 of yacc.c */ +#line 386 "ppy.y" + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), ==) ;} break; case 65: -#line 372 "ppy.y" - { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), !=) ;} + +/* Line 1464 of yacc.c */ +#line 387 "ppy.y" + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), !=) ;} break; case 66: -#line 373 "ppy.y" - { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), <) ;} + +/* Line 1464 of yacc.c */ +#line 388 "ppy.y" + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), <) ;} break; case 67: -#line 374 "ppy.y" - { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), >) ;} + +/* Line 1464 of yacc.c */ +#line 389 "ppy.y" + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), >) ;} break; case 68: -#line 375 "ppy.y" - { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), <=) ;} + +/* Line 1464 of yacc.c */ +#line 390 "ppy.y" + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), <=) ;} break; case 69: -#line 376 "ppy.y" - { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), >=) ;} + +/* Line 1464 of yacc.c */ +#line 391 "ppy.y" + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), >=) ;} break; case 70: -#line 377 "ppy.y" - { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), +) ;} + +/* Line 1464 of yacc.c */ +#line 392 "ppy.y" + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), +) ;} break; case 71: -#line 378 "ppy.y" - { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), -) ;} + +/* Line 1464 of yacc.c */ +#line 393 "ppy.y" + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), -) ;} break; case 72: -#line 379 "ppy.y" - { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), ^) ;} + +/* Line 1464 of yacc.c */ +#line 394 "ppy.y" + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), ^) ;} break; case 73: -#line 380 "ppy.y" - { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), &) ;} + +/* Line 1464 of yacc.c */ +#line 395 "ppy.y" + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), &) ;} break; case 74: -#line 381 "ppy.y" - { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), |) ;} + +/* Line 1464 of yacc.c */ +#line 396 "ppy.y" + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), |) ;} break; case 75: -#line 382 "ppy.y" - { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), *) ;} + +/* Line 1464 of yacc.c */ +#line 397 "ppy.y" + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), *) ;} break; case 76: -#line 383 "ppy.y" - { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), /) ;} + +/* Line 1464 of yacc.c */ +#line 398 "ppy.y" + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), /) ;} break; case 77: -#line 384 "ppy.y" - { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), <<) ;} + +/* Line 1464 of yacc.c */ +#line 399 "ppy.y" + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), <<) ;} break; case 78: -#line 385 "ppy.y" - { promote_equal_size(&(yyvsp[-2].cval), &(yyvsp[0].cval)); BIN_OP((yyval.cval), (yyvsp[-2].cval), (yyvsp[0].cval), >>) ;} + +/* Line 1464 of yacc.c */ +#line 400 "ppy.y" + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), >>) ;} break; case 79: -#line 386 "ppy.y" - { (yyval.cval) = (yyvsp[0].cval); ;} + +/* Line 1464 of yacc.c */ +#line 401 "ppy.y" + { (yyval.cval) = (yyvsp[(2) - (2)].cval); ;} break; case 80: -#line 387 "ppy.y" - { UNARY_OP((yyval.cval), (yyvsp[0].cval), -) ;} + +/* Line 1464 of yacc.c */ +#line 402 "ppy.y" + { UNARY_OP((yyval.cval), (yyvsp[(2) - (2)].cval), -) ;} break; case 81: -#line 388 "ppy.y" - { UNARY_OP((yyval.cval), (yyvsp[0].cval), ~) ;} + +/* Line 1464 of yacc.c */ +#line 403 "ppy.y" + { UNARY_OP((yyval.cval), (yyvsp[(2) - (2)].cval), ~) ;} break; case 82: -#line 389 "ppy.y" - { (yyval.cval).type = cv_sint; (yyval.cval).val.si = !boolean(&(yyvsp[0].cval)); ;} + +/* Line 1464 of yacc.c */ +#line 404 "ppy.y" + { (yyval.cval).type = cv_sint; (yyval.cval).val.si = !boolean(&(yyvsp[(2) - (2)].cval)); ;} break; case 83: -#line 390 "ppy.y" - { (yyval.cval) = (yyvsp[-1].cval); ;} + +/* Line 1464 of yacc.c */ +#line 405 "ppy.y" + { (yyval.cval) = (yyvsp[(2) - (3)].cval); ;} break; case 84: -#line 391 "ppy.y" - { (yyval.cval) = boolean(&(yyvsp[-4].cval)) ? (yyvsp[-2].cval) : (yyvsp[0].cval); ;} + +/* Line 1464 of yacc.c */ +#line 406 "ppy.y" + { (yyval.cval) = boolean(&(yyvsp[(1) - (5)].cval)) ? (yyvsp[(3) - (5)].cval) : (yyvsp[(5) - (5)].cval); ;} break; + +/* Line 1464 of yacc.c */ +#line 2333 "ppy.tab.c" default: break; } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); -/* Line 1126 of yacc.c. */ -#line 1964 "ppy.tab.c" - - yyvsp -= yylen; - yyssp -= yylen; - - + YYPOPSTACK (yylen); + yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -1994,133 +2363,65 @@ yyerrlab: if (!yyerrstatus) { ++yynerrs; -#if YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (YYPACT_NINF < yyn && yyn < YYLAST) - { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - char *yymsg = 0; -# define YYERROR_VERBOSE_ARGS_MAXIMUM 5 - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -#if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -#endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= yysize1 < yysize; - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= yysize1 < yysize; - yysize = yysize1; - - if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yymsg; - int yyi = 0; - while ((*yyp = *yyf)) - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - yyerror (yymsg); +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); - } - else - { - yyerror (YY_("syntax error")); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) goto yyexhaustedlab; - } - } - else -#endif /* YYERROR_VERBOSE */ - yyerror (YY_("syntax error")); + } + } +#endif } if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) - { + { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; - } + } else { - yydestruct ("Error: discarding", yytoken, &yylval); + yydestruct ("Error: discarding", + yytoken, &yylval); yychar = YYEMPTY; } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -2133,11 +2434,14 @@ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ - if (0) + if (/*CONSTCOND*/ 0) goto yyerrorlab; -yyvsp -= yylen; - yyssp -= yylen; + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; @@ -2167,19 +2471,17 @@ yyerrlab1: YYABORT; - yydestruct ("Error: popping", yystos[yystate], yyvsp); - YYPOPSTACK; + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; - /* Shift the error token. */ + /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; @@ -2200,7 +2502,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2211,24 +2513,35 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); - YYPOPSTACK; + YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif - return yyresult; +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); } -#line 394 "ppy.y" + +/* Line 1684 of yacc.c */ +#line 409 "ppy.y" /* @@ -2375,6 +2688,8 @@ static int boolean(cval_t *v) static marg_t *new_marg(char *str, def_arg_t type) { marg_t *ma = pp_xmalloc(sizeof(marg_t)); + if(!ma) + return NULL; ma->arg = str; ma->type = type; ma->nnl = 0; @@ -2383,16 +2698,27 @@ static marg_t *new_marg(char *str, def_arg_t type) static marg_t *add_new_marg(char *str, def_arg_t type) { - marg_t *ma = new_marg(str, type); + marg_t **new_macro_args; + marg_t *ma; + if(!str) + return NULL; + new_macro_args = pp_xrealloc(macro_args, (nmacro_args+1) * sizeof(macro_args[0])); + if(!new_macro_args) + return NULL; + macro_args = new_macro_args; + ma = new_marg(str, type); + if(!ma) + return NULL; + macro_args[nmacro_args] = ma; nmacro_args++; - macro_args = pp_xrealloc(macro_args, nmacro_args * sizeof(macro_args[0])); - macro_args[nmacro_args-1] = ma; return ma; } static int marg_index(char *id) { int t; + if(!id) + return -1; for(t = 0; t < nmacro_args; t++) { if(!strcmp(id, macro_args[t]->arg)) @@ -2404,6 +2730,8 @@ static int marg_index(char *id) static mtext_t *new_mtext(char *str, int idx, def_exp_t type) { mtext_t *mt = pp_xmalloc(sizeof(mtext_t)); + if(!mt) + return NULL; if(str == NULL) mt->subst.argidx = idx; else @@ -2423,7 +2751,11 @@ static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp) if(tail->type == exp_text && mtp->type == exp_text) { - tail->subst.text = pp_xrealloc(tail->subst.text, strlen(tail->subst.text)+strlen(mtp->subst.text)+1); + char *new_text; + new_text = pp_xrealloc(tail->subst.text, strlen(tail->subst.text)+strlen(mtp->subst.text)+1); + if(!new_text) + return mtp; + tail->subst.text = new_text; strcat(tail->subst.text, mtp->subst.text); free(mtp->subst.text); free(mtp); @@ -2487,9 +2819,22 @@ static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp) static char *merge_text(char *s1, char *s2) { - int l1 = strlen(s1); - int l2 = strlen(s2); - s1 = pp_xrealloc(s1, l1+l2+1); + int l1; + int l2; + char *snew; + if(!s1) + return s2; + if(!s2) + return s1; + l1 = strlen(s1); + l2 = strlen(s2); + snew = pp_xrealloc(s1, l1+l2+1); + if(!snew) + { + free(s2); + return s1; + } + s1 = snew; memcpy(s1+l1, s2, l2+1); free(s2); return s1; diff --git a/reactos/tools/wpp/ppy.tab.h b/reactos/tools/wpp/ppy.tab.h index 4a503f1a1f1..5225bed741d 100644 --- a/reactos/tools/wpp/ppy.tab.h +++ b/reactos/tools/wpp/ppy.tab.h @@ -1,27 +1,36 @@ -/* A Bison parser, made by GNU Bison 2.1. */ +/* A Bison parser, made by GNU Bison 2.4.2. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software + Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE @@ -74,57 +83,16 @@ tLSHIFT = 300 }; #endif -/* Tokens. */ -#define tRCINCLUDE 258 -#define tIF 259 -#define tIFDEF 260 -#define tIFNDEF 261 -#define tELSE 262 -#define tELIF 263 -#define tENDIF 264 -#define tDEFINED 265 -#define tNL 266 -#define tINCLUDE 267 -#define tLINE 268 -#define tGCCLINE 269 -#define tERROR 270 -#define tWARNING 271 -#define tPRAGMA 272 -#define tPPIDENT 273 -#define tUNDEF 274 -#define tMACROEND 275 -#define tCONCAT 276 -#define tELIPSIS 277 -#define tSTRINGIZE 278 -#define tIDENT 279 -#define tLITERAL 280 -#define tMACRO 281 -#define tDEFINE 282 -#define tDQSTRING 283 -#define tSQSTRING 284 -#define tIQSTRING 285 -#define tUINT 286 -#define tSINT 287 -#define tULONG 288 -#define tSLONG 289 -#define tULONGLONG 290 -#define tSLONGLONG 291 -#define tRCINCLUDEPATH 292 -#define tLOGOR 293 -#define tLOGAND 294 -#define tNE 295 -#define tEQ 296 -#define tGTE 297 -#define tLTE 298 -#define tRSHIFT 299 -#define tLSHIFT 300 +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +/* Line 1685 of yacc.c */ #line 126 "ppy.y" -typedef union YYSTYPE { + int sint; unsigned int uint; long slong; @@ -136,15 +104,17 @@ typedef union YYSTYPE { cval_t cval; marg_t *marg; mtext_t *mtext; + + + +/* Line 1685 of yacc.c */ +#line 112 "ppy.tab.h" } YYSTYPE; -/* Line 1447 of yacc.c. */ -#line 142 "ppy.tab.h" +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif extern YYSTYPE ppy_lval; - diff --git a/reactos/tools/wpp/ppy.y b/reactos/tools/wpp/ppy.y index fc94bb54aca..f2805e1247a 100644 --- a/reactos/tools/wpp/ppy.y +++ b/reactos/tools/wpp/ppy.y @@ -59,9 +59,9 @@ if(cv_signed(v1) && cv_signed(v2)) \ r.val.si = v1.val.si OP v2.val.si; \ else if(cv_signed(v1) && !cv_signed(v2)) \ - r.val.si = v1.val.si OP v2.val.ui; \ + r.val.si = v1.val.si OP (signed) v2.val.ui; \ else if(!cv_signed(v1) && cv_signed(v2)) \ - r.val.ui = v1.val.ui OP v2.val.si; \ + r.val.si = (signed) v1.val.ui OP v2.val.si; \ else \ r.val.ui = v1.val.ui OP v2.val.ui; @@ -70,9 +70,9 @@ if(cv_signed(v1) && cv_signed(v2)) \ r.val.sl = v1.val.sl OP v2.val.sl; \ else if(cv_signed(v1) && !cv_signed(v2)) \ - r.val.sl = v1.val.sl OP v2.val.ul; \ + r.val.sl = v1.val.sl OP (signed long) v2.val.ul; \ else if(!cv_signed(v1) && cv_signed(v2)) \ - r.val.ul = v1.val.ul OP v2.val.sl; \ + r.val.sl = (signed long) v1.val.ul OP v2.val.sl; \ else \ r.val.ul = v1.val.ul OP v2.val.ul; @@ -81,9 +81,9 @@ if(cv_signed(v1) && cv_signed(v2)) \ r.val.sll = v1.val.sll OP v2.val.sll; \ else if(cv_signed(v1) && !cv_signed(v2)) \ - r.val.sll = v1.val.sll OP v2.val.ull; \ + r.val.sll = v1.val.sll OP (wrc_sll_t) v2.val.ull; \ else if(!cv_signed(v1) && cv_signed(v2)) \ - r.val.ull = v1.val.ull OP v2.val.sll; \ + r.val.sll = (wrc_sll_t) v1.val.ull OP v2.val.sll; \ else \ r.val.ull = v1.val.ull OP v2.val.ull; @@ -224,6 +224,9 @@ preprocessor case if_elsetrue: case if_elsefalse: ppy_error("#elif cannot follow #else"); + break; + case if_error: + break; default: pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #elif directive", s); } @@ -247,51 +250,62 @@ preprocessor case if_elsetrue: case if_elsefalse: ppy_error("#else clause already defined"); + break; + case if_error: + break; default: pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #else directive", s); } } | tENDIF tNL { - pp_pop_if(); - if(pp_incl_state.ifdepth == pp_get_if_depth() && pp_incl_state.state == 1) + if(pp_pop_if() != if_error) { - pp_incl_state.state = 2; - pp_incl_state.seen_junk = 0; + if(pp_incl_state.ifdepth == pp_get_if_depth() && pp_incl_state.state == 1) + { + pp_incl_state.state = 2; + pp_incl_state.seen_junk = 0; + } + else if(pp_incl_state.state != 1) + { + pp_incl_state.state = -1; + } + if(pp_status.debug) + fprintf(stderr, "tENDIF: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d\n", + pp_status.input, pp_status.line_number, pp_incl_state.state, pp_incl_state.ppp, pp_incl_state.ifdepth); } - else if(pp_incl_state.state != 1) - { - pp_incl_state.state = -1; - } - if(pp_status.debug) - fprintf(stderr, "tENDIF: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d\n", - pp_status.input, pp_status.line_number, pp_incl_state.state, pp_incl_state.ppp, pp_incl_state.ifdepth); } | tUNDEF tIDENT tNL { pp_del_define($2); free($2); } - | tDEFINE opt_text tNL { pp_add_define($1, $2); } + | tDEFINE opt_text tNL { pp_add_define($1, $2); free($1); free($2); } | tMACRO res_arg allmargs tMACROEND opt_mtexts tNL { pp_add_macro($1, macro_args, nmacro_args, $5); } - | tLINE tSINT tDQSTRING tNL { fprintf(ppy_out, "# %d %s\n", $2 , $3); free($3); } - | tGCCLINE tSINT tDQSTRING tNL { fprintf(ppy_out, "# %d %s\n", $2 , $3); free($3); } + | tLINE tSINT tDQSTRING tNL { if($3) pp_writestring("# %d %s\n", $2 , $3); free($3); } + | tGCCLINE tSINT tDQSTRING tNL { if($3) pp_writestring("# %d %s\n", $2 , $3); free($3); } | tGCCLINE tSINT tDQSTRING tSINT tNL - { fprintf(ppy_out, "# %d %s %d\n", $2, $3, $4); free($3); } + { if($3) pp_writestring("# %d %s %d\n", $2, $3, $4); free($3); } | tGCCLINE tSINT tDQSTRING tSINT tSINT tNL - { fprintf(ppy_out, "# %d %s %d %d\n", $2 ,$3, $4, $5); free($3); } + { if($3) pp_writestring("# %d %s %d %d\n", $2 ,$3, $4, $5); free($3); } | tGCCLINE tSINT tDQSTRING tSINT tSINT tSINT tNL - { fprintf(ppy_out, "# %d %s %d %d %d\n", $2 ,$3 ,$4 ,$5, $6); free($3); } + { if($3) pp_writestring("# %d %s %d %d %d\n", $2 ,$3 ,$4 ,$5, $6); free($3); } | tGCCLINE tSINT tDQSTRING tSINT tSINT tSINT tSINT tNL - { fprintf(ppy_out, "# %d %s %d %d %d %d\n", $2 ,$3 ,$4 ,$5, $6, $7); free($3); } + { if($3) pp_writestring("# %d %s %d %d %d %d\n", $2 ,$3 ,$4 ,$5, $6, $7); free($3); } | tGCCLINE tNL /* The null-token */ | tERROR opt_text tNL { ppy_error("#error directive: '%s'", $2); free($2); } | tWARNING opt_text tNL { ppy_warning("#warning directive: '%s'", $2); free($2); } - | tPRAGMA opt_text tNL { fprintf(ppy_out, "#pragma %s\n", $2 ? $2 : ""); free($2); } + | tPRAGMA opt_text tNL { pp_writestring("#pragma %s\n", $2 ? $2 : ""); free($2); } | tPPIDENT opt_text tNL { if(pp_status.pedantic) ppy_warning("#ident ignored (arg: '%s')", $2); free($2); } | tRCINCLUDE tRCINCLUDEPATH { - int nl=strlen($2) +3; - char *fn=pp_xmalloc(nl); - sprintf(fn,"\"%s\"",$2); - free($2); - pp_do_include(fn,1); + if($2) + { + int nl=strlen($2) +3; + char *fn=pp_xmalloc(nl); + if(fn) + { + sprintf(fn,"\"%s\"",$2); + pp_do_include(fn,1); + } + free($2); + } } | tRCINCLUDE tDQSTRING { pp_do_include($2,1); @@ -346,13 +360,14 @@ mtext : tLITERAL { $$ = new_mtext($1, 0, exp_text); } int mat = marg_index($2); if(mat < 0) ppy_error("Stringification identifier must be an argument parameter"); - $$ = new_mtext(NULL, mat, exp_stringize); + else + $$ = new_mtext(NULL, mat, exp_stringize); } | tIDENT { int mat = marg_index($1); if(mat >= 0) $$ = new_mtext(NULL, mat, exp_subst); - else + else if($1) $$ = new_mtext($1, 0, exp_text); } ; @@ -537,6 +552,8 @@ static int boolean(cval_t *v) static marg_t *new_marg(char *str, def_arg_t type) { marg_t *ma = pp_xmalloc(sizeof(marg_t)); + if(!ma) + return NULL; ma->arg = str; ma->type = type; ma->nnl = 0; @@ -545,16 +562,27 @@ static marg_t *new_marg(char *str, def_arg_t type) static marg_t *add_new_marg(char *str, def_arg_t type) { - marg_t *ma = new_marg(str, type); + marg_t **new_macro_args; + marg_t *ma; + if(!str) + return NULL; + new_macro_args = pp_xrealloc(macro_args, (nmacro_args+1) * sizeof(macro_args[0])); + if(!new_macro_args) + return NULL; + macro_args = new_macro_args; + ma = new_marg(str, type); + if(!ma) + return NULL; + macro_args[nmacro_args] = ma; nmacro_args++; - macro_args = pp_xrealloc(macro_args, nmacro_args * sizeof(macro_args[0])); - macro_args[nmacro_args-1] = ma; return ma; } static int marg_index(char *id) { int t; + if(!id) + return -1; for(t = 0; t < nmacro_args; t++) { if(!strcmp(id, macro_args[t]->arg)) @@ -566,6 +594,8 @@ static int marg_index(char *id) static mtext_t *new_mtext(char *str, int idx, def_exp_t type) { mtext_t *mt = pp_xmalloc(sizeof(mtext_t)); + if(!mt) + return NULL; if(str == NULL) mt->subst.argidx = idx; else @@ -585,7 +615,11 @@ static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp) if(tail->type == exp_text && mtp->type == exp_text) { - tail->subst.text = pp_xrealloc(tail->subst.text, strlen(tail->subst.text)+strlen(mtp->subst.text)+1); + char *new_text; + new_text = pp_xrealloc(tail->subst.text, strlen(tail->subst.text)+strlen(mtp->subst.text)+1); + if(!new_text) + return mtp; + tail->subst.text = new_text; strcat(tail->subst.text, mtp->subst.text); free(mtp->subst.text); free(mtp); @@ -649,9 +683,22 @@ static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp) static char *merge_text(char *s1, char *s2) { - int l1 = strlen(s1); - int l2 = strlen(s2); - s1 = pp_xrealloc(s1, l1+l2+1); + int l1; + int l2; + char *snew; + if(!s1) + return s2; + if(!s2) + return s1; + l1 = strlen(s1); + l2 = strlen(s2); + snew = pp_xrealloc(s1, l1+l2+1); + if(!snew) + { + free(s2); + return s1; + } + s1 = snew; memcpy(s1+l1, s2, l2+1); free(s2); return s1; diff --git a/reactos/tools/wpp/preproc.c b/reactos/tools/wpp/preproc.c index 52548332292..7937740f880 100644 --- a/reactos/tools/wpp/preproc.c +++ b/reactos/tools/wpp/preproc.c @@ -20,6 +20,7 @@ #include "wine/port.h" #include +#include #include #include #include @@ -81,8 +82,8 @@ void *pp_xmalloc(size_t size) res = malloc(size); if(res == NULL) { - fprintf(stderr, "Virtual memory exhausted.\n"); - exit(2); + /* Set the error flag */ + pp_status.state = 1; } return res; } @@ -95,8 +96,8 @@ void *pp_xrealloc(void *p, size_t size) res = realloc(p, size); if(res == NULL) { - fprintf(stderr, "Virtual memory exhausted.\n"); - exit(2); + /* Set the error flag */ + pp_status.state = 1; } return res; } @@ -109,9 +110,105 @@ char *pp_xstrdup(const char *str) assert(str != NULL); len = strlen(str)+1; s = pp_xmalloc(len); + if(!s) + return NULL; return memcpy(s, str, len); } +static char *wpp_default_lookup(const char *name, const char *parent_name, + char **include_path, int include_path_count) +{ + char *cpy; + char *cptr; + char *path; + const char *ccptr; + int i, fd; + + cpy = pp_xmalloc(strlen(name)+1); + if(!cpy) + return NULL; + cptr = cpy; + + for(ccptr = name; *ccptr; ccptr++) + { + /* Convert to forward slash */ + if(*ccptr == '\\') { + /* kill double backslash */ + if(ccptr[1] == '\\') + ccptr++; + *cptr = '/'; + }else { + *cptr = *ccptr; + } + cptr++; + } + *cptr = '\0'; + + if(parent_name) + { + /* Search directory of parent include and then -I path */ + const char *p; + + if ((p = strrchr( parent_name, '/' ))) p++; + else p = parent_name; + path = pp_xmalloc( (p - parent_name) + strlen(cpy) + 1 ); + if(!path) + { + free(cpy); + return NULL; + } + memcpy( path, parent_name, p - parent_name ); + strcpy( path + (p - parent_name), cpy ); + fd = open( path, O_RDONLY ); + if (fd != -1) + { + close( fd ); + free( cpy ); + return path; + } + free( path ); + } + /* Search -I path */ + for(i = 0; i < include_path_count; i++) + { + path = pp_xmalloc(strlen(include_path[i]) + strlen(cpy) + 2); + if(!path) + { + free(cpy); + return NULL; + } + strcpy(path, include_path[i]); + strcat(path, "/"); + strcat(path, cpy); + fd = open( path, O_RDONLY ); + if (fd != -1) + { + close( fd ); + free( cpy ); + return path; + } + free( path ); + } + free( cpy ); + return NULL; +} + +static void *wpp_default_open(const char *filename, int type) { + return fopen(filename,"rt"); +} + +static void wpp_default_close(void *file) { + fclose(file); +} + +static int wpp_default_read(void *file, char *buffer, unsigned int len){ + return fread(buffer, 1, len, file); +} + +static void wpp_default_write( const char *buffer, unsigned int len ) { + fwrite(buffer, 1, len, ppy_out); +} + /* Don't comment on the hash, its primitive but functional... */ static int pphash(const char *str) { @@ -123,9 +220,12 @@ static int pphash(const char *str) pp_entry_t *pplookup(const char *ident) { - int idx = pphash(ident); + int idx; pp_entry_t *ppp; + if(!ident) + return NULL; + idx = pphash(ident); for(ppp = pp_def_state->defines[idx]; ppp; ppp = ppp->next) { if(!strcmp(ident, ppp->ident)) @@ -171,13 +271,16 @@ static void free_pp_entry( pp_entry_t *ppp, int idx ) } /* push a new (empty) define state */ -void pp_push_define_state(void) +int pp_push_define_state(void) { pp_def_state_t *state = pp_xmalloc( sizeof(*state) ); + if(!state) + return 1; memset( state->defines, 0, sizeof(state->defines) ); state->next = pp_def_state; pp_def_state = state; + return 0; } /* pop the current define state */ @@ -207,19 +310,25 @@ void pp_del_define(const char *name) return; } + free( ppp->ident ); + free( ppp->subst.text ); + free( ppp->filename ); free_pp_entry( ppp, pphash(name) ); if(pp_status.debug) printf("Deleted (%s, %d) <%s>\n", pp_status.input, pp_status.line_number, name); } -pp_entry_t *pp_add_define(char *def, char *text) +pp_entry_t *pp_add_define(const char *def, const char *text) { int len; char *cptr; - int idx = pphash(def); + int idx; pp_entry_t *ppp; + if(!def) + return NULL; + idx = pphash(def); if((ppp = pplookup(def)) != NULL) { if(pp_status.pedantic) @@ -227,41 +336,58 @@ pp_entry_t *pp_add_define(char *def, char *text) pp_del_define(def); } ppp = pp_xmalloc(sizeof(pp_entry_t)); + if(!ppp) + return NULL; memset( ppp, 0, sizeof(*ppp) ); - ppp->ident = def; + ppp->ident = pp_xstrdup(def); + if(!ppp->ident) + goto error; ppp->type = def_define; - ppp->subst.text = text; + ppp->subst.text = text ? pp_xstrdup(text) : NULL; + if(text && !ppp->subst.text) + goto error; ppp->filename = pp_xstrdup(pp_status.input ? pp_status.input : ""); + if(!ppp->filename) + goto error; ppp->linenumber = pp_status.input ? pp_status.line_number : 0; ppp->next = pp_def_state->defines[idx]; pp_def_state->defines[idx] = ppp; if(ppp->next) ppp->next->prev = ppp; - if(text) + if(ppp->subst.text) { /* Strip trailing white space from subst text */ - len = strlen(text); - while(len && strchr(" \t\r\n", text[len-1])) + len = strlen(ppp->subst.text); + while(len && strchr(" \t\r\n", ppp->subst.text[len-1])) { - text[--len] = '\0'; + ppp->subst.text[--len] = '\0'; } /* Strip leading white space from subst text */ - for(cptr = text; *cptr && strchr(" \t\r", *cptr); cptr++) + for(cptr = ppp->subst.text; *cptr && strchr(" \t\r", *cptr); cptr++) ; - if(text != cptr) - memmove(text, cptr, strlen(cptr)+1); + if(ppp->subst.text != cptr) + memmove(ppp->subst.text, cptr, strlen(cptr)+1); } if(pp_status.debug) - printf("Added define (%s, %d) <%s> to <%s>\n", pp_status.input, pp_status.line_number, ppp->ident, text ? text : "(null)"); + printf("Added define (%s, %d) <%s> to <%s>\n", pp_status.input, pp_status.line_number, ppp->ident, ppp->subst.text ? ppp->subst.text : "(null)"); return ppp; + +error: + free(ppp->ident); + free(ppp->subst.text); + free(ppp); + return NULL; } pp_entry_t *pp_add_macro(char *id, marg_t *args[], int nargs, mtext_t *exp) { - int idx = pphash(id); + int idx; pp_entry_t *ppp; + if(!id) + return NULL; + idx = pphash(id); if((ppp = pplookup(id)) != NULL) { if(pp_status.pedantic) @@ -269,6 +395,8 @@ pp_entry_t *pp_add_macro(char *id, marg_t *args[], int nargs, mtext_t *exp) pp_del_define(id); } ppp = pp_xmalloc(sizeof(pp_entry_t)); + if(!ppp) + return NULL; memset( ppp, 0, sizeof(*ppp) ); ppp->ident = id; ppp->type = def_macro; @@ -276,6 +404,11 @@ pp_entry_t *pp_add_macro(char *id, marg_t *args[], int nargs, mtext_t *exp) ppp->nargs = nargs; ppp->subst.mtext= exp; ppp->filename = pp_xstrdup(pp_status.input ? pp_status.input : ""); + if(!ppp->filename) + { + free(ppp); + return NULL; + } ppp->linenumber = pp_status.input ? pp_status.line_number : 0; ppp->next = pp_def_state->defines[idx]; pp_def_state->defines[idx] = ppp; @@ -323,19 +456,12 @@ pp_entry_t *pp_add_macro(char *id, marg_t *args[], int nargs, mtext_t *exp) static char **includepath; static int nincludepath = 0; -void wpp_add_include_path(const char *path) +int wpp_add_include_path(const char *path) { char *tok; char *cpy = pp_xstrdup(path); - - /* check for absolute windows paths */ - if (strchr(cpy, ':') != NULL) - { - nincludepath++; - includepath = pp_xrealloc(includepath, nincludepath * sizeof(*includepath)); - includepath[nincludepath-1] = cpy; - return; - } + if(!cpy) + return 1; tok = strtok(cpy, INCLUDESEPARATOR); while(tok) @@ -343,7 +469,14 @@ void wpp_add_include_path(const char *path) if(*tok) { char *dir; char *cptr; + char **new_path; + dir = pp_xstrdup(tok); + if(!dir) + { + free(cpy); + return 1; + } for(cptr = dir; *cptr; cptr++) { /* Convert to forward slash */ @@ -355,87 +488,36 @@ void wpp_add_include_path(const char *path) *cptr = '\0'; /* Add to list */ + new_path = pp_xrealloc(includepath, (nincludepath+1) * sizeof(*includepath)); + if(!new_path) + { + free(dir); + free(cpy); + return 1; + } + includepath = new_path; + includepath[nincludepath] = dir; nincludepath++; - includepath = pp_xrealloc(includepath, nincludepath * sizeof(*includepath)); - includepath[nincludepath-1] = dir; } tok = strtok(NULL, INCLUDESEPARATOR); } free(cpy); + return 0; } char *wpp_find_include(const char *name, const char *parent_name) { - char *cpy; - char *cptr; - char *path; - const char *ccptr; - int i, fd; - - cpy = pp_xmalloc(strlen(name)+1); - cptr = cpy; - - for(ccptr = name; *ccptr; ccptr++) - { - /* Convert to forward slash */ - if(*ccptr == '\\') { - /* kill double backslash */ - if(ccptr[1] == '\\') - ccptr++; - *cptr = '/'; - }else { - *cptr = *ccptr; - } - cptr++; - } - *cptr = '\0'; - - if(parent_name) - { - /* Search directory of parent include and then -I path */ - const char *p; - - if ((p = strrchr( parent_name, '/' ))) p++; - else p = parent_name; - path = pp_xmalloc( (p - parent_name) + strlen(cpy) + 1 ); - memcpy( path, parent_name, p - parent_name ); - strcpy( path + (p - parent_name), cpy ); - fd = open( path, O_RDONLY ); - if (fd != -1) - { - close( fd ); - free( cpy ); - return path; - } - free( path ); - } - /* Search -I path */ - for(i = 0; i < nincludepath; i++) - { - path = pp_xmalloc(strlen(includepath[i]) + strlen(cpy) + 2); - strcpy(path, includepath[i]); - strcat(path, "/"); - strcat(path, cpy); - fd = open( path, O_RDONLY ); - if (fd != -1) - { - close( fd ); - free( cpy ); - return path; - } - free( path ); - } - free( cpy ); - return NULL; + return wpp_default_lookup(name, parent_name, includepath, nincludepath); } -FILE *pp_open_include(const char *name, const char *parent_name, char **newpath) +void *pp_open_include(const char *name, const char *parent_name, char **newpath) { char *path; - FILE *fp; + void *fp; - if (!(path = wpp_find_include( name, parent_name ))) return NULL; - fp = fopen(path, "rt"); + if (!(path = wpp_callbacks->lookup(name, parent_name, includepath, + nincludepath))) return NULL; + fp = wpp_callbacks->open(path, parent_name == NULL ? 1 : 0); if (fp) { @@ -527,13 +609,18 @@ void pp_push_if(pp_if_state_t s) case if_ignore: pp_push_ignore_state(); break; + default: + pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d)", (int)pp_if_state()); } } pp_if_state_t pp_pop_if(void) { if(if_stack_idx <= 0) + { ppy_error("#{endif,else,elif} without #{if,ifdef,ifndef} (#if-stack underflow)"); + return if_error; + } switch(pp_if_state()) { @@ -546,6 +633,8 @@ pp_if_state_t pp_pop_if(void) case if_ignore: pp_pop_ignore_state(); break; + default: + pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d)", (int)pp_if_state()); } if(pp_flex_debug) @@ -606,22 +695,49 @@ static void generic_msg(const char *s, const char *t, const char *n, va_list ap) if(n) { cpy = pp_xstrdup(n); + if(!cpy) + goto end; for (p = cpy; *p; p++) if(!isprint(*p)) *p = ' '; fprintf(stderr, " near '%s'", cpy); free(cpy); } } +end: #endif fprintf(stderr, "\n"); } +static void wpp_default_error(const char *file, int line, int col, const char *near, const char *msg, va_list ap) +{ + generic_msg(msg, "Error", near, ap); + exit(1); +} + +static void wpp_default_warning(const char *file, int line, int col, const char *near, const char *msg, va_list ap) +{ + generic_msg(msg, "Warning", near, ap); +} + +static const struct wpp_callbacks default_callbacks = +{ + wpp_default_lookup, + wpp_default_open, + wpp_default_close, + wpp_default_read, + wpp_default_write, + wpp_default_error, + wpp_default_warning, +}; + +struct wpp_callbacks *wpp_callbacks = &default_callbacks; + int ppy_error(const char *s, ...) { va_list ap; va_start(ap, s); - generic_msg(s, "Error", ppy_text, ap); + wpp_callbacks->error(pp_status.input, pp_status.line_number, pp_status.char_number, ppy_text, s, ap); va_end(ap); - exit(1); + pp_status.state = 1; return 1; } @@ -629,7 +745,7 @@ int ppy_warning(const char *s, ...) { va_list ap; va_start(ap, s); - generic_msg(s, "Warning", ppy_text, ap); + wpp_callbacks->warning(pp_status.input, pp_status.line_number, pp_status.char_number, ppy_text, s, ap); va_end(ap); return 0; } diff --git a/reactos/tools/wpp/wpp.c b/reactos/tools/wpp/wpp.c index d149591f790..0c9c80852ea 100644 --- a/reactos/tools/wpp/wpp.c +++ b/reactos/tools/wpp/wpp.c @@ -45,7 +45,7 @@ static void add_cmdline_defines(void) for (def = cmdline_defines; def; def = def->next) { - if (def->value) pp_add_define( pp_xstrdup(def->name), pp_xstrdup(def->value) ); + if (def->value) pp_add_define( def->name, def->value ); } } @@ -56,21 +56,23 @@ static void add_special_defines(void) char buf[32]; strftime(buf, sizeof(buf), "\"%b %d %Y\"", localtime(&now)); - pp_add_define( pp_xstrdup("__DATE__"), pp_xstrdup(buf) ); + pp_add_define( "__DATE__", buf ); strftime(buf, sizeof(buf), "\"%H:%M:%S\"", localtime(&now)); - pp_add_define( pp_xstrdup("__TIME__"), pp_xstrdup(buf) ); + pp_add_define( "__TIME__", buf ); - ppp = pp_add_define( pp_xstrdup("__FILE__"), pp_xstrdup("") ); - ppp->type = def_special; + ppp = pp_add_define( "__FILE__", "" ); + if(ppp) + ppp->type = def_special; - ppp = pp_add_define( pp_xstrdup("__LINE__"), pp_xstrdup("") ); - ppp->type = def_special; + ppp = pp_add_define( "__LINE__", "" ); + if(ppp) + ppp->type = def_special; } /* add a define to the preprocessor list */ -void wpp_add_define( const char *name, const char *value ) +int wpp_add_define( const char *name, const char *value ) { struct define *def; @@ -80,17 +82,35 @@ void wpp_add_define( const char *name, const char *value ) { if (!strcmp( def->name, name )) { + char *new_value = pp_xstrdup(value); + if(!new_value) + return 1; free( def->value ); - def->value = pp_xstrdup(value); - return; + def->value = new_value; + + return 0; } } def = pp_xmalloc( sizeof(*def) ); + if(!def) + return 1; def->next = cmdline_defines; def->name = pp_xstrdup(name); + if(!def->name) + { + free(def); + return 1; + } def->value = pp_xstrdup(value); + if(!def->value) + { + free(def->name); + free(def); + return 1; + } cmdline_defines = def; + return 0; } @@ -112,13 +132,17 @@ void wpp_del_define( const char *name ) /* add a command-line define of the form NAME=VALUE */ -void wpp_add_cmdline_define( const char *value ) +int wpp_add_cmdline_define( const char *value ) { + char *p; char *str = pp_xstrdup(value); - char *p = strchr( str, '=' ); + if(!str) + return 1; + p = strchr( str, '=' ); if (p) *p++ = 0; wpp_add_define( str, p ); free( str ); + return 0; } @@ -144,58 +168,42 @@ int wpp_parse( const char *input, FILE *output ) int ret; pp_status.input = NULL; + pp_status.line_number = 1; + pp_status.char_number = 1; + pp_status.state = 0; - pp_push_define_state(); + ret = pp_push_define_state(); + if(ret) + return ret; add_cmdline_defines(); add_special_defines(); - if (!input) ppy_in = stdin; - else if (!(ppy_in = fopen(input, "rt"))) + if (!input) pp_status.file = stdin; + else if (!(pp_status.file = wpp_callbacks->open(input, 1))) { - fprintf(stderr,"Could not open %s\n", input); - exit(2); + ppy_error("Could not open %s\n", input); + pp_pop_define_state(); + return 2; } pp_status.input = input; ppy_out = output; - fprintf(ppy_out, "# 1 \"%s\" 1\n", input ? input : ""); + pp_writestring("# 1 \"%s\" 1\n", input ? input : ""); ret = ppy_parse(); + /* If there were errors during processing, return an error code */ + if (!ret && pp_status.state) ret = pp_status.state; - if (input) fclose(ppy_in); + if (input) wpp_callbacks->close(pp_status.file); + /* Clean if_stack, it could remain dirty on errors */ + while (pp_get_if_depth()) pp_pop_if(); pp_pop_define_state(); return ret; } -/* parse into a temporary file */ -int wpp_parse_temp( const char *input, const char *output_base, char **output_name ) +void wpp_set_callbacks( const struct wpp_callbacks *callbacks ) { - FILE *output; - int ret, fd; - char *temp_name; - - if (!output_base || !output_base[0]) output_base = "wpptmp"; - - temp_name = pp_xmalloc( strlen(output_base) + 8 ); - strcpy( temp_name, output_base ); - strcat( temp_name, ".XXXXXX" ); - - if((fd = mkstemps( temp_name, 0 )) == -1) - { - fprintf(stderr, "Could not generate a temp name from %s\n", temp_name); - exit(2); - } - - if (!(output = fdopen(fd, "wt"))) - { - fprintf(stderr,"Could not open fd %s for writing\n", temp_name); - exit(2); - } - - *output_name = temp_name; - ret = wpp_parse( input, output ); - fclose( output ); - return ret; + wpp_callbacks = callbacks; } diff --git a/reactos/tools/wpp/wpp_private.h b/reactos/tools/wpp/wpp_private.h index 24ed6b844b5..5686bda808d 100644 --- a/reactos/tools/wpp/wpp_private.h +++ b/reactos/tools/wpp/wpp_private.h @@ -113,7 +113,8 @@ typedef enum { if_elif, if_elsefalse, if_elsetrue, - if_ignore + if_ignore, + if_error } pp_if_state_t; @@ -201,12 +202,12 @@ void *pp_xmalloc(size_t); void *pp_xrealloc(void *, size_t); char *pp_xstrdup(const char *str); pp_entry_t *pplookup(const char *ident); -void pp_push_define_state(void); +int pp_push_define_state(void); void pp_pop_define_state(void); -pp_entry_t *pp_add_define(char *def, char *text); +pp_entry_t *pp_add_define(const char *def, const char *text); pp_entry_t *pp_add_macro(char *ident, marg_t *args[], int nargs, mtext_t *exp); void pp_del_define(const char *name); -FILE *pp_open_include(const char *name, const char *parent_name, char **newpath); +void *pp_open_include(const char *name, const char *parent_name, char **newpath); void pp_push_if(pp_if_state_t s); void pp_next_if_state(int); pp_if_state_t pp_pop_if(void); @@ -217,6 +218,8 @@ int pp_get_if_depth(void); #define __attribute__(x) /*nothing*/ #endif +extern struct wpp_callbacks *wpp_callbacks; + int ppy_error(const char *s, ...) __attribute__((format (printf, 1, 2))); int ppy_warning(const char *s, ...) __attribute__((format (printf, 1, 2))); void pp_internal_error(const char *file, int line, const char *s, ...) __attribute__((format (printf, 3, 4))); @@ -226,8 +229,10 @@ void pp_internal_error(const char *file, int line, const char *s, ...) __attribu struct pp_status { const char *input; /* current input file name */ + void *file; /* current input file descriptor */ int line_number; /* current line number */ int char_number; /* current char number in line */ + int state; /* current error state */ int pedantic; /* pedantic option */ int debug; /* debug messages flag */ }; @@ -249,6 +254,7 @@ void pp_do_include(char *fname, int type); void pp_push_ignore_state(void); void pp_pop_ignore_state(void); +void pp_writestring(const char *format, ...) __attribute__((format (printf, 1, 2))); /* * From ppy.y diff --git a/reactos/tools/wrc/CMakeLists.txt b/reactos/tools/wrc/CMakeLists.txt index c94abad88e4..1cc368dc4bd 100644 --- a/reactos/tools/wrc/CMakeLists.txt +++ b/reactos/tools/wrc/CMakeLists.txt @@ -3,6 +3,7 @@ list(APPEND SOURCE dumpres.c genres.c newstruc.c + po.c readres.c translation.c utils.c diff --git a/reactos/tools/wrc/dumpres.c b/reactos/tools/wrc/dumpres.c index fdaecb077da..f2efe30d658 100644 --- a/reactos/tools/wrc/dumpres.c +++ b/reactos/tools/wrc/dumpres.c @@ -44,12 +44,10 @@ const char *get_typename(const resource_t* r) case res_cur: return "CURSOR"; case res_curg: return "GROUP_CURSOR"; case res_dlg: return "DIALOG"; - case res_dlgex: return "DIALOGEX"; case res_fnt: return "FONT"; case res_ico: return "ICON"; case res_icog: return "GROUP_ICON"; case res_men: return "MENU"; - case res_menex: return "MENUEX"; case res_rdt: return "RCDATA"; case res_stt: return "STRINGTABLE"; case res_usr: return "UserResource"; @@ -605,61 +603,10 @@ static void dump_dialog(const dialog_t *dlg) } } -/* - ***************************************************************************** - * Function : dump_dialogex - * Syntax : void dump_dialogex(const dialogex_t *dlgex) - * Input : - * dlgex - DialogEx resource descriptor - * Output : - * Description : - * Remarks : - ***************************************************************************** -*/ -static void dump_dialogex(const dialogex_t *dlgex) -{ - const control_t *c = dlgex->controls; - - dump_memopt(dlgex->memopt); - dump_lvc(&(dlgex->lvc)); - printf("x, y, w, h: %d, %d, %d, %d\n", dlgex->x, dlgex->y, dlgex->width, dlgex->height); - if(dlgex->gotstyle) - { - assert(dlgex->style != NULL); - assert(dlgex->style->and_mask == 0); - printf("Style: %08x\n", dlgex->style->or_mask); - } - if(dlgex->gotexstyle) - { - assert(dlgex->exstyle != NULL); - assert(dlgex->exstyle->and_mask == 0); - printf("ExStyle: %08x\n", dlgex->exstyle->or_mask); - } - if(dlgex->gothelpid) - printf("Helpid: %d\n", dlgex->helpid); - printf("Menu: %s\n", get_nameid_str(dlgex->menu)); - printf("Class: %s\n", get_nameid_str(dlgex->dlgclass)); - printf("Title: "); print_string(dlgex->title); printf("\n"); - printf("Font: "); - if(!dlgex->font) - printf("\n"); - else - { - printf("%d, ", dlgex->font->size); - print_string(dlgex->font->name); - printf(", %d, %d\n", dlgex->font->weight, dlgex->font->italic); - } - while(c) - { - dump_control(c); - c = c->next; - } -} - /* ***************************************************************************** * Function : dump_menu_item - * Syntax : void dump_menu_item(const menu_item_t *item) + * Syntax : void dump_menu_item(const menuex_item_t *item) * Input : * Output : * Description : @@ -667,61 +614,6 @@ static void dump_dialogex(const dialogex_t *dlgex) ***************************************************************************** */ static void dump_menu_item(const menu_item_t *item) -{ - while(item) - { - if(item->popup) - { - printf("POPUP "); - print_string(item->name); - printf("\n"); - dump_menu_item(item->popup); - } - else - { - printf("MENUITEM "); - if(item->name) - { - print_string(item->name); - printf(", %d, %08x", item->id, item->state); - } - else - printf("SEPARATOR"); - printf("\n"); - } - item = item->next; - } -} - -/* - ***************************************************************************** - * Function : dump_menu - * Syntax : void dump_menu(const menu_t *men) - * Input : - * men - Menu resource descriptor - * Output : - * Description : - * Remarks : - ***************************************************************************** -*/ -static void dump_menu(const menu_t *men) -{ - dump_memopt(men->memopt); - dump_lvc(&(men->lvc)); - dump_menu_item(men->items); -} - -/* - ***************************************************************************** - * Function : dump_menuex_item - * Syntax : void dump_menuex_item(const menuex_item_t *item) - * Input : - * Output : - * Description : - * Remarks : - ***************************************************************************** -*/ -static void dump_menuex_item(const menuex_item_t *item) { while(item) { @@ -738,7 +630,7 @@ static void dump_menuex_item(const menuex_item_t *item) if(item->gothelpid) printf(", HelpId=%d", item->helpid); printf("\n"); - dump_menuex_item(item->popup); + dump_menu_item(item->popup); } else { @@ -765,20 +657,20 @@ static void dump_menuex_item(const menuex_item_t *item) /* ***************************************************************************** - * Function : dump_menuex - * Syntax : void dump_menuex(const menuex_t *menex) + * Function : dump_menu + * Syntax : void dump_menu(const menu_t *men) * Input : - * menex - MenuEx resource descriptor + * men - Menu resource descriptor * Output : * Description : * Remarks : ***************************************************************************** */ -static void dump_menuex(const menuex_t *menex) +static void dump_menu(const menu_t *men) { - dump_memopt(menex->memopt); - dump_lvc(&(menex->lvc)); - dump_menuex_item(menex->items); + dump_memopt(men->memopt); + dump_lvc(&(men->lvc)); + dump_menu_item(men->items); } /* @@ -986,9 +878,6 @@ void dump_resources(const resource_t *top) case res_dlg: dump_dialog(top->res.dlg); break; - case res_dlgex: - dump_dialogex(top->res.dlgex); - break; case res_fnt: dump_font(top->res.fnt); break; @@ -1001,9 +890,6 @@ void dump_resources(const resource_t *top) case res_men: dump_menu(top->res.men); break; - case res_menex: - dump_menuex(top->res.menex); - break; case res_rdt: dump_rcdata(top->res.rdt); break; diff --git a/reactos/tools/wrc/genres.c b/reactos/tools/wrc/genres.c index 7e293436548..709a83e5d94 100644 --- a/reactos/tools/wrc/genres.c +++ b/reactos/tools/wrc/genres.c @@ -33,18 +33,11 @@ #include #include #include - #include "wrc.h" #include "genres.h" #include "utils.h" -#include "wine/unicode.h" -/* Fix 64-bit host, re: put_dword */ -#if defined(unix) && defined(__x86_64__) -typedef unsigned int HOST_DWORD; -#else -typedef unsigned long HOST_DWORD; -#endif +#include "wine/unicode.h" #define SetResSize(res, tag) set_dword((res), (tag), (res)->size - get_dword((res), (tag))) @@ -315,11 +308,17 @@ static void put_string(res_t *res, const string_t *str, enum str_e type, int ist if (str->type == str_char) { if (!check_unicode_conversion( str, newstr, codepage )) + { + print_location( &str->loc ); error( "String %s does not convert identically to Unicode and back in codepage %d. " "Try using a Unicode string instead\n", str->str.cstr, codepage ); + } if (check_valid_utf8( str, codepage )) + { + print_location( &str->loc ); warning( "string \"%s\" seems to be UTF-8 but codepage %u is in use.\n", str->str.cstr, codepage ); + } } if (!isterm) put_word(res, newstr->size); for(cnt = 0; cnt < newstr->size; cnt++) @@ -563,8 +562,25 @@ static res_t *dialog2res(name_id_t *name, dialog_t *dlg) { restag = put_res_header(res, WRC_RT_DIALOG, NULL, name, dlg->memopt, &(dlg->lvc)); - put_dword(res, dlg->style->or_mask); - put_dword(res, dlg->gotexstyle ? dlg->exstyle->or_mask : 0); + if (dlg->is_ex) + { + /* FIXME: MS doc says that the first word must contain 0xffff + * and the second 0x0001 to signal a DLGTEMPLATEEX. Borland's + * compiler reverses the two words. + * I don't know which one to choose, but I write it as Mr. B + * writes it. + */ + put_word(res, 1); /* Signature */ + put_word(res, 0xffff); /* DlgVer */ + put_dword(res, dlg->gothelpid ? dlg->helpid : 0); + put_dword(res, dlg->gotexstyle ? dlg->exstyle->or_mask : 0); + put_dword(res, dlg->gotstyle ? dlg->style->or_mask : WS_POPUPWINDOW); + } + else + { + put_dword(res, dlg->style->or_mask); + put_dword(res, dlg->gotexstyle ? dlg->exstyle->or_mask : 0); + } tag_nctrl = res->size; put_word(res, 0); /* Number of controls */ put_word(res, dlg->x); @@ -586,20 +602,42 @@ static res_t *dialog2res(name_id_t *name, dialog_t *dlg) if(dlg->font) { put_word(res, dlg->font->size); + if (dlg->is_ex) + { + put_word(res, dlg->font->weight); + /* FIXME: ? TRUE should be sufficient to say that it's + * italic, but Borland's compiler says it's 0x0101. + * I just copy it here, and hope for the best. + */ + put_word(res, dlg->font->italic ? 0x0101 : 0); + } put_string(res, dlg->font->name, str_unicode, TRUE, dlg->lvc.language); } put_pad(res); while(ctrl) { - /* FIXME: what is default control style? */ - put_dword(res, ctrl->gotstyle ? ctrl->style->or_mask: WS_CHILD); - put_dword(res, ctrl->gotexstyle ? ctrl->exstyle->or_mask : 0); + if (dlg->is_ex) + { + put_dword(res, ctrl->gothelpid ? ctrl->helpid : 0); + put_dword(res, ctrl->gotexstyle ? ctrl->exstyle->or_mask : 0); + /* FIXME: what is default control style? */ + put_dword(res, ctrl->gotstyle ? ctrl->style->or_mask : WS_CHILD | WS_VISIBLE); + } + else + { + /* FIXME: what is default control style? */ + put_dword(res, ctrl->gotstyle ? ctrl->style->or_mask: WS_CHILD); + put_dword(res, ctrl->gotexstyle ? ctrl->exstyle->or_mask : 0); + } put_word(res, ctrl->x); put_word(res, ctrl->y); put_word(res, ctrl->width); put_word(res, ctrl->height); - put_word(res, ctrl->id); + if (dlg->is_ex) + put_dword(res, ctrl->id); + else + put_word(res, ctrl->id); if(ctrl->ctlclass) put_name_id(res, ctrl->ctlclass, TRUE, dlg->lvc.language); else @@ -694,124 +732,6 @@ static res_t *dialog2res(name_id_t *name, dialog_t *dlg) return res; } -/* - ***************************************************************************** - * Function : dialogex2res - * Syntax : res_t *dialogex2res(name_id_t *name, dialogex_t *dlgex) - * Input : - * name - Name/ordinal of the resource - * dlgex - The dialogex descriptor - * Output : New .res format structure - * Description : - * Remarks : - ***************************************************************************** -*/ -static res_t *dialogex2res(name_id_t *name, dialogex_t *dlgex) -{ - int restag; - res_t *res; - control_t *ctrl; - int tag_nctrl; - int nctrl = 0; - assert(name != NULL); - assert(dlgex != NULL); - - ctrl = dlgex->controls; - res = new_res(); - if(win32) - { - restag = put_res_header(res, WRC_RT_DIALOG, NULL, name, dlgex->memopt, &(dlgex->lvc)); - - /* FIXME: MS doc says that the first word must contain 0xffff - * and the second 0x0001 to signal a DLGTEMPLATEEX. Borland's - * compiler reverses the two words. - * I don't know which one to choose, but I write it as Mr. B - * writes it. - */ - put_word(res, 1); /* Signature */ - put_word(res, 0xffff); /* DlgVer */ - put_dword(res, dlgex->gothelpid ? dlgex->helpid : 0); - put_dword(res, dlgex->gotexstyle ? dlgex->exstyle->or_mask : 0); - put_dword(res, dlgex->gotstyle ? dlgex->style->or_mask : WS_POPUPWINDOW); - tag_nctrl = res->size; - put_word(res, 0); /* Number of controls */ - put_word(res, dlgex->x); - put_word(res, dlgex->y); - put_word(res, dlgex->width); - put_word(res, dlgex->height); - if(dlgex->menu) - put_name_id(res, dlgex->menu, TRUE, dlgex->lvc.language); - else - put_word(res, 0); - if(dlgex->dlgclass) - put_name_id(res, dlgex->dlgclass, TRUE, dlgex->lvc.language); - else - put_word(res, 0); - if(dlgex->title) - put_string(res, dlgex->title, str_unicode, TRUE, dlgex->lvc.language); - else - put_word(res, 0); - if(dlgex->font) - { - put_word(res, dlgex->font->size); - put_word(res, dlgex->font->weight); - /* FIXME: ? TRUE should be sufficient to say that it's - * italic, but Borland's compiler says it's 0x0101. - * I just copy it here, and hope for the best. - */ - put_word(res, dlgex->font->italic ? 0x0101 : 0); - put_string(res, dlgex->font->name, str_unicode, TRUE, dlgex->lvc.language); - } - - put_pad(res); - while(ctrl) - { - put_dword(res, ctrl->gothelpid ? ctrl->helpid : 0); - put_dword(res, ctrl->gotexstyle ? ctrl->exstyle->or_mask : 0); - /* FIXME: what is default control style? */ - put_dword(res, ctrl->gotstyle ? ctrl->style->or_mask : WS_CHILD | WS_VISIBLE); - put_word(res, ctrl->x); - put_word(res, ctrl->y); - put_word(res, ctrl->width); - put_word(res, ctrl->height); - put_dword(res, ctrl->id); - if(ctrl->ctlclass) - put_name_id(res, ctrl->ctlclass, TRUE, dlgex->lvc.language); - else - internal_error(__FILE__, __LINE__, "Control has no control-class\n"); - if(ctrl->title) - put_name_id(res, ctrl->title, FALSE, dlgex->lvc.language); - else - put_word(res, 0); - if(ctrl->extra) - { - put_pad(res); - put_word(res, ctrl->extra->size); - put_raw_data(res, ctrl->extra, 0); - } - else - put_word(res, 0); - - put_pad(res); - nctrl++; - ctrl = ctrl->next; - } - /* Set number of controls */ - set_word(res, tag_nctrl, (WORD)nctrl); - /* Set ResourceSize */ - SetResSize(res, restag); - put_pad(res); - } - else /* win16 */ - { - /* Do not generate anything in 16-bit mode */ - free(res->data); - free(res); - return NULL; - } - return res; -} - /* ***************************************************************************** * Function : menuitem2res @@ -860,37 +780,6 @@ static void menuitem2res(res_t *res, menu_item_t *menitem, const language_t *lan } -/* - ***************************************************************************** - * Function : menu2res - * Syntax : res_t *menu2res(name_id_t *name, menu_t *men) - * Input : - * name - Name/ordinal of the resource - * men - The menu descriptor - * Output : New .res format structure - * Description : - * Remarks : - ***************************************************************************** -*/ -static res_t *menu2res(name_id_t *name, menu_t *men) -{ - int restag; - res_t *res; - assert(name != NULL); - assert(men != NULL); - - res = new_res(); - restag = put_res_header(res, WRC_RT_MENU, NULL, name, men->memopt, win32 ? &(men->lvc) : NULL); - - put_dword(res, 0); /* Menuheader: Version and HeaderSize */ - menuitem2res(res, men->items, win32 ? men->lvc.language : NULL); - /* Set ResourceSize */ - SetResSize(res, restag); - if(win32) - put_pad(res); - return res; -} - /* ***************************************************************************** * Function : menuexitem2res @@ -901,9 +790,9 @@ static res_t *menu2res(name_id_t *name, menu_t *men) * Remarks : Self recursive ***************************************************************************** */ -static void menuexitem2res(res_t *res, menuex_item_t *menitem, const language_t *lang) +static void menuexitem2res(res_t *res, menu_item_t *menitem, const language_t *lang) { - menuex_item_t *itm = menitem; + menu_item_t *itm = menitem; assert(win32 != 0); while(itm) { @@ -928,8 +817,8 @@ static void menuexitem2res(res_t *res, menuex_item_t *menitem, const language_t /* ***************************************************************************** - * Function : menuex2res - * Syntax : res_t *menuex2res(name_id_t *name, menuex_t *menex) + * Function : menu2res + * Syntax : res_t *menu2res(name_id_t *name, menu_t *men) * Input : * name - Name/ordinal of the resource * menex - The menuex descriptor @@ -938,33 +827,43 @@ static void menuexitem2res(res_t *res, menuex_item_t *menitem, const language_t * Remarks : ***************************************************************************** */ -static res_t *menuex2res(name_id_t *name, menuex_t *menex) +static res_t *menu2res(name_id_t *name, menu_t *men) { int restag; res_t *res; assert(name != NULL); - assert(menex != NULL); + assert(men != NULL); res = new_res(); if(win32) { - restag = put_res_header(res, WRC_RT_MENU, NULL, name, menex->memopt, &(menex->lvc)); + restag = put_res_header(res, WRC_RT_MENU, NULL, name, men->memopt, &(men->lvc)); - put_word(res, 1); /* Menuheader: Version */ - put_word(res, 4); /* Offset */ - put_dword(res, 0); /* HelpId */ - put_pad(res); - menuexitem2res(res, menex->items, menex->lvc.language); + if (men->is_ex) + { + put_word(res, 1); /* Menuheader: Version */ + put_word(res, 4); /* Offset */ + put_dword(res, 0); /* HelpId */ + put_pad(res); + menuexitem2res(res, men->items, men->lvc.language); + } + else + { + put_dword(res, 0); /* Menuheader: Version and HeaderSize */ + menuitem2res(res, men->items, men->lvc.language); + } /* Set ResourceSize */ SetResSize(res, restag); put_pad(res); } else /* win16 */ { - /* Do not generate anything in 16-bit mode */ - free(res->data); - free(res); - return NULL; + restag = put_res_header(res, WRC_RT_MENU, NULL, name, men->memopt, NULL); + + put_dword(res, 0); /* Menuheader: Version and HeaderSize */ + menuitem2res(res, men->items, NULL); + /* Set ResourceSize */ + SetResSize(res, restag); } return res; } @@ -1844,23 +1743,8 @@ char *prep_nid_for_label(const name_id_t *nid) */ char *make_c_name(const char *base, const name_id_t *nid, const language_t *lan) { - int nlen; - char *buf; - char *ret; - char lanbuf[6]; - - sprintf(lanbuf, "%d", lan ? MAKELANGID(lan->id, lan->sub) : 0); - buf = prep_nid_for_label(nid); - nlen = strlen(buf) + strlen(lanbuf); - nlen += strlen(base) + 4; /* three time '_' and '\0' */ - ret = xmalloc(nlen); - strcpy(ret, "_"); - strcat(ret, base); - strcat(ret, "_"); - strcat(ret, buf); - strcat(ret, "_"); - strcat(ret, lanbuf); - return ret; + char *buf = prep_nid_for_label(nid); + return strmake( "_%s_%s_%d", base, buf, lan ? MAKELANGID(lan->id, lan->sub) : 0); } /* @@ -1884,14 +1768,12 @@ const char *get_c_typename(enum res_e type) case res_bmp: return "Bmp"; case res_cur: return "Cur"; case res_curg: return "CurGrp"; - case res_dlg: - case res_dlgex: return "Dlg"; + case res_dlg: return "Dlg"; case res_fnt: return "Fnt"; case res_fntdir:return "FntDir"; case res_ico: return "Ico"; case res_icog: return "IcoGrp"; - case res_men: - case res_menex: return "Men"; + case res_men: return "Men"; case res_rdt: return "RCDat"; case res_stt: return "StrTab"; case res_usr: return "Usr"; @@ -1940,10 +1822,6 @@ void resources2res(resource_t *top) if(!top->binres) top->binres = dialog2res(top->name, top->res.dlg); break; - case res_dlgex: - if(!top->binres) - top->binres = dialogex2res(top->name, top->res.dlgex); - break; case res_fnt: if(!top->binres) top->binres = font2res(top->name, top->res.fnt); @@ -1964,10 +1842,6 @@ void resources2res(resource_t *top) if(!top->binres) top->binres = menu2res(top->name, top->res.men); break; - case res_menex: - if(!top->binres) - top->binres = menuex2res(top->name, top->res.menex); - break; case res_html: if(!top->binres) top->binres = html2res(top->name, top->res.html); diff --git a/reactos/tools/wrc/lex.yy.c b/reactos/tools/wrc/lex.yy.c index 041342bb101..4f3e64d4410 100644 --- a/reactos/tools/wrc/lex.yy.c +++ b/reactos/tools/wrc/lex.yy.c @@ -1,8 +1,13 @@ +#line 2 "lex.yy.c" + +#line 4 "lex.yy.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + #define yy_create_buffer parser__create_buffer #define yy_delete_buffer parser__delete_buffer -#define yy_scan_buffer parser__scan_buffer -#define yy_scan_string parser__scan_string -#define yy_scan_bytes parser__scan_bytes #define yy_flex_debug parser__flex_debug #define yy_init_buffer parser__init_buffer #define yy_flush_buffer parser__flush_buffer @@ -11,75 +16,118 @@ #define yyin parser_in #define yyleng parser_leng #define yylex parser_lex +#define yylineno parser_lineno #define yyout parser_out #define yyrestart parser_restart #define yytext parser_text - -#line 19 "lex.yy.c" -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ - */ +#define yywrap parser_wrap +#define yyalloc parser_alloc +#define yyrealloc parser_realloc +#define yyfree parser_free #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ #include +#include +#include +#include +/* end standard C headers. */ -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 #endif +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ #ifdef __cplusplus -#include -#include - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ -#if __STDC__ +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) -#define YY_USE_PROTOS #define YY_USE_CONST -#endif /* __STDC__ */ +#endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - /* Returned upon end-of-file. */ #define YY_NULL 0 @@ -94,71 +142,78 @@ * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ -#define BEGIN yy_start = 1 + 2 * +#define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ -#define YY_START ((yy_start - 1) / 2) +#define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) +#define YY_NEW_FILE parser_restart(parser_in ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif -extern int yyleng; -extern FILE *yyin, *yyout; +extern int parser_leng; + +extern FILE *parser_in, *parser_out; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ + /* Undo effects of setting up parser_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up parser_text again */ \ } \ while ( 0 ) -#define unput(c) yyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; +#define unput(c) yyunput( c, (yytext_ptr) ) +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; @@ -195,12 +250,16 @@ struct yy_buffer_state */ int yy_at_bol; + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; + #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process @@ -210,102 +269,138 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. + * (via parser_restart()), so that the user can continue scanning by + * just pointing parser_in at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 - }; -static YY_BUFFER_STATE yy_current_buffer = 0; + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". + * + * Returns the top of the stack, or NULL. */ -#define YY_CURRENT_BUFFER yy_current_buffer +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] -/* yy_hold_char holds the character lost when yytext is formed. */ +/* yy_hold_char holds the character lost when parser_text is formed. */ static char yy_hold_char; - static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; +int parser_leng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ +static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... +/* Flag which is used to allow parser_wrap()'s to do buffer switches + * instead of setting up a fresh parser_in. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; -void yyrestart YY_PROTO(( FILE *input_file )); +void parser_restart (FILE *input_file ); +void parser__switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE parser__create_buffer (FILE *file,int size ); +void parser__delete_buffer (YY_BUFFER_STATE b ); +void parser__flush_buffer (YY_BUFFER_STATE b ); +void parser_push_buffer_state (YY_BUFFER_STATE new_buffer ); +void parser_pop_buffer_state (void ); -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) +static void parser_ensure_buffer_stack (void ); +static void parser__load_buffer_state (void ); +static void parser__init_buffer (YY_BUFFER_STATE b,FILE *file ); -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); +#define YY_FLUSH_BUFFER parser__flush_buffer(YY_CURRENT_BUFFER ) -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); +YY_BUFFER_STATE parser__scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE parser__scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE parser__scan_bytes (yyconst char *bytes,int len ); -#define yy_new_buffer yy_create_buffer +void *parser_alloc (yy_size_t ); +void *parser_realloc (void *,yy_size_t ); +void parser_free (void * ); + +#define yy_new_buffer parser__create_buffer #define yy_set_interactive(is_interactive) \ { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ + if ( ! YY_CURRENT_BUFFER ){ \ + parser_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + parser__create_buffer(parser_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ + if ( ! YY_CURRENT_BUFFER ){\ + parser_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + parser__create_buffer(parser_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) +/* Begin user sect3 */ -#define yywrap() 1 +#define parser_wrap(n) 1 #define YY_SKIP_YYWRAP -typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; -typedef int yy_state_type; -extern char *yytext; -#define yytext_ptr yytext -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); +typedef unsigned char YY_CHAR; + +FILE *parser_in = (FILE *) 0, *parser_out = (FILE *) 0; + +typedef int yy_state_type; + +extern int parser_lineno; + +int parser_lineno = 1; + +extern char *parser_text; +#define yytext_ptr parser_text + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. + * corresponding action - sets up parser_text. */ #define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ + (yytext_ptr) = yy_bp; \ + parser_leng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; + (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 80 #define YY_END_OF_BUFFER 81 -static yyconst short int yy_accept[191] = +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[191] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 70, 0, 0, 3, 3, 5, 5, 9, 9, 81, 79, @@ -329,7 +424,7 @@ static yyconst short int yy_accept[191] = 7, 1, 5, 9, 4, 9, 6, 4, 6, 0 } ; -static yyconst int yy_ec[256] = +static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, 4, 1, 1, 1, 1, 1, 1, 1, @@ -361,7 +456,7 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[45] = +static yyconst flex_int32_t yy_meta[45] = { 0, 1, 1, 2, 1, 1, 1, 3, 1, 1, 1, 1, 4, 5, 5, 6, 6, 6, 6, 1, 6, @@ -370,7 +465,7 @@ static yyconst int yy_meta[45] = 5, 5, 1, 1 } ; -static yyconst short int yy_base[224] = +static yyconst flex_int16_t yy_base[224] = { 0, 0, 43, 43, 46, 49, 51, 74, 104, 52, 54, 57, 134, 419, 412, 56, 58, 59, 62, 414, 629, @@ -399,7 +494,7 @@ static yyconst short int yy_base[224] = 607, 614, 621 } ; -static yyconst short int yy_def[224] = +static yyconst flex_int16_t yy_def[224] = { 0, 190, 1, 191, 191, 192, 192, 193, 193, 194, 194, 195, 195, 196, 196, 197, 197, 198, 198, 190, 190, @@ -428,7 +523,7 @@ static yyconst short int yy_def[224] = 190, 190, 190 } ; -static yyconst short int yy_nxt[674] = +static yyconst flex_int16_t yy_nxt[674] = { 0, 20, 21, 22, 21, 23, 24, 25, 24, 26, 24, 24, 24, 27, 28, 29, 30, 30, 30, 31, 27, @@ -506,7 +601,7 @@ static yyconst short int yy_nxt[674] = 190, 190, 190 } ; -static yyconst short int yy_chk[674] = +static yyconst flex_int16_t yy_chk[674] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -587,6 +682,9 @@ static yyconst short int yy_chk[674] = static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; +extern int parser__flex_debug; +int parser__flex_debug = 0; + /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ @@ -594,9 +692,8 @@ static char *yy_last_accepting_cpos; #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -char *yytext; +char *parser_text; #line 1 "parser.l" -#define INITIAL 0 /* -*-C-*- * * Copyright 1998-2000 Bertho A. Stultiens (BS) @@ -666,33 +763,21 @@ char *yytext; * escaped '\0'. */ /* Exclusive string handling */ -#define tkstr 1 /* Exclusive unicode string handling */ -#define tklstr 2 /* Exclusive rcdata single quoted data handling */ -#define tkrcd 3 /* Exclusive comment eating... */ -#define comment 4 /* Set when stripping c-junk */ -#define pp_cstrip 5 /* Set when scanning #line style directives */ -#define pp_line 6 /* Set when scanning #pragma */ -#define pp_pragma 7 -#define pp_code_page 8 -#define YY_STACK_USED 1 #define YY_NO_INPUT 1 -#define YY_NO_UNPUT 1 -#define YY_NO_TOP_STATE 1 -#define YY_NEVER_INTERACTIVE 1 /* Some shortcut definitions */ #line 96 "parser.l" @@ -708,7 +793,9 @@ char *yytext; #include #include -#ifndef HAVE_UNISTD_H +#ifdef HAVE_UNISTD_H +#include +#else #define YY_NO_UNISTD_H #endif @@ -721,7 +808,7 @@ char *yytext; #include "parser.tab.h" /* Always update the current character position within a line */ -#define YY_USER_ACTION char_number+=yyleng; wanted_id = want_id; want_id = 0; +#define YY_USER_ACTION char_number+=parser_leng; wanted_id = want_id; want_id = 0; #define YY_USER_INIT current_codepage = -1; @@ -919,7 +1006,60 @@ static unsigned long xstrtoul(const char *nptr, char **endptr, int base) * The flexer starts here ************************************************************************** */ -#line 923 "lex.yy.c" +#line 1010 "lex.yy.c" + +#define INITIAL 0 +#define tkstr 1 +#define tklstr 2 +#define tkrcd 3 +#define comment 4 +#define pp_cstrip 5 +#define pp_line 6 +#define pp_pragma 7 +#define pp_code_page 8 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int parser_lex_destroy (void ); + +int parser_get_debug (void ); + +void parser_set_debug (int debug_flag ); + +YY_EXTRA_TYPE parser_get_extra (void ); + +void parser_set_extra (YY_EXTRA_TYPE user_defined ); + +FILE *parser_get_in (void ); + +void parser_set_in (FILE * in_str ); + +FILE *parser_get_out (void ); + +void parser_set_out (FILE * out_str ); + +int parser_get_leng (void ); + +char *parser_get_text (void ); + +int parser_get_lineno (void ); + +void parser_set_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -927,79 +1067,54 @@ static unsigned long xstrtoul(const char *nptr, char **endptr, int base) #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); +extern "C" int parser_wrap (void ); #else -extern int yywrap YY_PROTO(( void )); +extern int parser_wrap (void ); #endif #endif -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - #ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); +static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT + #ifdef __cplusplus -static int yyinput YY_PROTO(( void )); +static int yyinput (void ); #else -static int input YY_PROTO(( void )); -#endif +static int input (void ); #endif -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif #endif + static int yy_start_stack_ptr = 0; + static int yy_start_stack_depth = 0; + static int *yy_start_stack = NULL; + + static void yy_push_state (int new_state ); + + static void yy_pop_state (void ); + /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ - #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( parser_text, parser_leng, 1, parser_out )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1007,21 +1122,35 @@ YY_MALLOC_DECL */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ - int c = '*', n; \ + int c = '*'; \ + size_t n; \ for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + (c = getc( parser_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ + if ( c == EOF && ferror( parser_in ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, parser_in))==0 && ferror(parser_in)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(parser_in); \ + } \ + }\ +\ + #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - @@ -1042,14 +1171,20 @@ YY_MALLOC_DECL #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif +/* end tables serialization structures and prototypes */ + /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif +#define YY_DECL_IS_OURS 1 -/* Code executed at the beginning of each rule, after yytext and yyleng +extern int parser_lex (void); + +#define YY_DECL int parser_lex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after parser_text and parser_leng * have been set up. */ #ifndef YY_USER_ACTION @@ -1062,18 +1197,20 @@ YY_MALLOC_DECL #endif #define YY_RULE_SETUP \ - if ( yyleng > 0 ) \ - yy_current_buffer->yy_at_bol = \ - (yytext[yyleng - 1] == '\n'); \ + if ( parser_leng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (parser_text[parser_leng - 1] == '\n'); \ YY_USER_ACTION +/** The main scanner function which does all the work. + */ YY_DECL - { +{ register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; - -#line 322 "parser.l" + +#line 324 "parser.l" /* * Catch the GCC-style line statements here and parse them. @@ -1093,45 +1230,47 @@ YY_DECL * because we only want to know the linenumber and * filename. */ -#line 1097 "lex.yy.c" +#line 1234 "lex.yy.c" - if ( yy_init ) + if ( !(yy_init) ) { - yy_init = 0; + (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if ( ! parser_in ) + parser_in = stdin; - if ( ! yyout ) - yyout = stdout; + if ( ! parser_out ) + parser_out = stdout; - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); + if ( ! YY_CURRENT_BUFFER ) { + parser_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + parser__create_buffer(parser_in,YY_BUF_SIZE ); + } - yy_load_buffer_state(); + parser__load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { - yy_cp = yy_c_buf_p; + yy_cp = (yy_c_buf_p); - /* Support of yytext. */ - *yy_cp = yy_hold_char; + /* Support of parser_text. */ + *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; - yy_current_state = yy_start; + yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); yy_match: do @@ -1139,8 +1278,8 @@ yy_match: register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -1151,51 +1290,45 @@ yy_match: yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 629 ); + while ( yy_current_state != 190 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); yy_find_action: yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } YY_DO_BEFORE_ACTION; - do_action: /* This label is used only to access EOF actions. */ - switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP -#line 341 "parser.l" +#line 343 "parser.l" yy_push_state(pp_pragma); YY_BREAK case 2: YY_RULE_SETUP -#line 342 "parser.l" +#line 344 "parser.l" yy_push_state(pp_line); YY_BREAK case 3: YY_RULE_SETUP -#line 343 "parser.l" +#line 345 "parser.l" { int lineno, len; char *cptr; char *fname; yy_pop_state(); - lineno = (int)strtol(yytext, &cptr, 10); + lineno = (int)strtol(parser_text, &cptr, 10); if(!lineno) parser_error("Malformed '#...' line-directive; invalid linenumber"); fname = strchr(cptr, '"'); @@ -1218,29 +1351,29 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 369 "parser.l" +#line 371 "parser.l" yyless(9); yy_pop_state(); yy_push_state(pp_code_page); YY_BREAK case 5: YY_RULE_SETUP -#line 370 "parser.l" -yy_pop_state(); if (pedantic) parser_warning("Unrecognized #pragma directive '%s'\n",yytext); +#line 372 "parser.l" +yy_pop_state(); if (pedantic) parser_warning("Unrecognized #pragma directive '%s'\n",parser_text); YY_BREAK case 6: YY_RULE_SETUP -#line 372 "parser.l" +#line 374 "parser.l" current_codepage = -1; yy_pop_state(); YY_BREAK case 7: YY_RULE_SETUP -#line 373 "parser.l" +#line 375 "parser.l" current_codepage = CP_UTF8; yy_pop_state(); YY_BREAK case 8: YY_RULE_SETUP -#line 374 "parser.l" +#line 376 "parser.l" { - char *p = yytext; + char *p = parser_text; yy_pop_state(); while (*p < '0' || *p > '9') p++; current_codepage = strtol( p, NULL, 10 ); @@ -1253,7 +1386,7 @@ YY_RULE_SETUP YY_BREAK case 9: YY_RULE_SETUP -#line 385 "parser.l" +#line 387 "parser.l" yy_pop_state(); parser_error("Malformed #pragma code_page directive"); YY_BREAK /* @@ -1262,39 +1395,43 @@ yy_pop_state(); parser_error("Malformed #pragma code_page directive"); * classes and enums. */ case 10: +/* rule 10 can match eol */ YY_RULE_SETUP -#line 392 "parser.l" +#line 394 "parser.l" line_number++; char_number = 1; YY_BREAK case 11: YY_RULE_SETUP -#line 393 "parser.l" +#line 395 "parser.l" ; /* ignore */ YY_BREAK case 12: YY_RULE_SETUP -#line 395 "parser.l" +#line 397 "parser.l" return tBEGIN; YY_BREAK case 13: YY_RULE_SETUP -#line 396 "parser.l" +#line 398 "parser.l" return tEND; YY_BREAK case 14: YY_RULE_SETUP -#line 398 "parser.l" -{ parser_lval.num = xstrtoul(yytext, 0, 10); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } +#line 400 "parser.l" +{ parser_lval.num = xstrtoul(parser_text, 0, 10); + return (parser_text[parser_leng-1] == 'L' || parser_text[parser_leng-1] == 'l') ? tLNUMBER : tNUMBER; } YY_BREAK case 15: YY_RULE_SETUP -#line 399 "parser.l" -{ parser_lval.num = xstrtoul(yytext, 0, 16); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } +#line 402 "parser.l" +{ parser_lval.num = xstrtoul(parser_text, 0, 16); + return (parser_text[parser_leng-1] == 'L' || parser_text[parser_leng-1] == 'l') ? tLNUMBER : tNUMBER; } YY_BREAK case 16: YY_RULE_SETUP -#line 400 "parser.l" -{ parser_lval.num = xstrtoul(yytext+2, 0, 8); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } +#line 404 "parser.l" +{ parser_lval.num = xstrtoul(parser_text+2, 0, 8); + return (parser_text[parser_leng-1] == 'L' || parser_text[parser_leng-1] == 'l') ? tLNUMBER : tNUMBER; } YY_BREAK /* * The next two rules scan identifiers and filenames. @@ -1305,15 +1442,15 @@ YY_RULE_SETUP */ case 17: YY_RULE_SETUP -#line 409 "parser.l" +#line 414 "parser.l" { - struct keyword *tok = iskeyword(yytext); + struct keyword *tok = iskeyword(parser_text); if(tok) { if(wanted_id && !tok->alwayskw) { - parser_lval.str = make_string(yytext); + parser_lval.str = make_string(parser_text); return tIDENT; } else @@ -1321,22 +1458,22 @@ YY_RULE_SETUP } else { - parser_lval.str = make_string(yytext); + parser_lval.str = make_string(parser_text); return tIDENT; } } YY_BREAK case 18: YY_RULE_SETUP -#line 428 "parser.l" -parser_lval.str = make_string(yytext); return tFILENAME; +#line 433 "parser.l" +parser_lval.str = make_string(parser_text); return tFILENAME; YY_BREAK /* * Wide string scanning */ case 19: YY_RULE_SETUP -#line 433 "parser.l" +#line 438 "parser.l" { yy_push_state(tklstr); wbufidx = 0; @@ -1345,10 +1482,10 @@ YY_RULE_SETUP } YY_BREAK case 20: -#line 440 "parser.l" +#line 445 "parser.l" case 21: YY_RULE_SETUP -#line 440 "parser.l" +#line 445 "parser.l" { yy_pop_state(); parser_lval.str = get_buffered_wstring(); @@ -1357,10 +1494,10 @@ YY_RULE_SETUP YY_BREAK case 22: YY_RULE_SETUP -#line 445 "parser.l" +#line 450 "parser.l" { /* octal escape sequence */ unsigned int result; - result = strtoul(yytext+1, 0, 8); + result = strtoul(parser_text+1, 0, 8); if ( result > 0xffff ) parser_error("Character constant out of range"); addwchar((WCHAR)result); @@ -1368,100 +1505,111 @@ YY_RULE_SETUP YY_BREAK case 23: YY_RULE_SETUP -#line 452 "parser.l" +#line 457 "parser.l" { /* hex escape sequence */ unsigned int result; - result = strtoul(yytext+2, 0, 16); + result = strtoul(parser_text+2, 0, 16); addwchar((WCHAR)result); } YY_BREAK case 24: YY_RULE_SETUP -#line 457 "parser.l" -{ parser_error("Invalid hex escape sequence '%s'", yytext); } +#line 462 "parser.l" +{ parser_error("Invalid hex escape sequence '%s'", parser_text); } YY_BREAK case 25: YY_RULE_SETUP -#line 459 "parser.l" +#line 464 "parser.l" parser_error("Bad escape sequence"); YY_BREAK case 26: +/* rule 26 can match eol */ YY_RULE_SETUP -#line 460 "parser.l" +#line 465 "parser.l" line_number++; char_number = 1; /* backslash at EOL continues string after leading whitespace on next line */ YY_BREAK case 27: YY_RULE_SETUP -#line 461 "parser.l" +#line 466 "parser.l" addwchar('\a'); YY_BREAK case 28: YY_RULE_SETUP -#line 462 "parser.l" +#line 467 "parser.l" addwchar('\b'); YY_BREAK case 29: YY_RULE_SETUP -#line 463 "parser.l" +#line 468 "parser.l" addwchar('\f'); YY_BREAK case 30: YY_RULE_SETUP -#line 464 "parser.l" +#line 469 "parser.l" addwchar('\n'); YY_BREAK case 31: YY_RULE_SETUP -#line 465 "parser.l" +#line 470 "parser.l" addwchar('\r'); YY_BREAK case 32: YY_RULE_SETUP -#line 466 "parser.l" +#line 471 "parser.l" addwchar('\t'); YY_BREAK case 33: YY_RULE_SETUP -#line 467 "parser.l" +#line 472 "parser.l" addwchar('\v'); YY_BREAK case 34: YY_RULE_SETUP -#line 468 "parser.l" -addwchar(yytext[1]); +#line 473 "parser.l" +{ + if (parser_text[1] & 0x80) + parser_error("Invalid char %u in wide string", (unsigned char)parser_text[1]); + addwchar(parser_text[1]); + } YY_BREAK case 35: +/* rule 35 can match eol */ YY_RULE_SETUP -#line 469 "parser.l" -addwchar(yytext[2]); line_number++; char_number = 1; +#line 478 "parser.l" +addwchar(parser_text[2]); line_number++; char_number = 1; YY_BREAK case 36: YY_RULE_SETUP -#line 470 "parser.l" +#line 479 "parser.l" addwchar('\"'); /* "bla""bla" -> "bla\"bla" */ YY_BREAK case 37: YY_RULE_SETUP -#line 471 "parser.l" +#line 480 "parser.l" addwchar('\"'); /* "bla\""bla" -> "bla\"bla" */ YY_BREAK case 38: YY_RULE_SETUP -#line 472 "parser.l" +#line 481 "parser.l" ; /* "bla" "bla" -> "blabla" */ YY_BREAK case 39: YY_RULE_SETUP -#line 473 "parser.l" +#line 482 "parser.l" { - char *yptr = yytext; + char *yptr = parser_text; while(*yptr) /* FIXME: codepage translation */ - addwchar(*yptr++ & 0xff); + { + if (*yptr & 0x80) + parser_error("Invalid char %u in wide string", (unsigned char)*yptr); + addwchar(*yptr++ & 0xff); + } } YY_BREAK case 40: +/* rule 40 can match eol */ YY_RULE_SETUP -#line 478 "parser.l" +#line 491 "parser.l" parser_error("Unterminated string"); YY_BREAK /* @@ -1469,14 +1617,14 @@ parser_error("Unterminated string"); */ case 41: YY_RULE_SETUP -#line 483 "parser.l" +#line 496 "parser.l" yy_push_state(tkstr); cbufidx = 0; YY_BREAK case 42: -#line 485 "parser.l" +#line 498 "parser.l" case 43: YY_RULE_SETUP -#line 485 "parser.l" +#line 498 "parser.l" { yy_pop_state(); parser_lval.str = get_buffered_cstring(); @@ -1485,10 +1633,10 @@ YY_RULE_SETUP YY_BREAK case 44: YY_RULE_SETUP -#line 490 "parser.l" +#line 503 "parser.l" { /* octal escape sequence */ int result; - result = strtol(yytext+1, 0, 8); + result = strtol(parser_text+1, 0, 8); if ( result > 0xff ) parser_error("Character constant out of range"); addcchar((char)result); @@ -1496,100 +1644,103 @@ YY_RULE_SETUP YY_BREAK case 45: YY_RULE_SETUP -#line 497 "parser.l" +#line 510 "parser.l" { /* hex escape sequence */ int result; - result = strtol(yytext+2, 0, 16); + result = strtol(parser_text+2, 0, 16); addcchar((char)result); } YY_BREAK case 46: YY_RULE_SETUP -#line 502 "parser.l" -{ parser_error("Invalid hex escape sequence '%s'", yytext); } +#line 515 "parser.l" +{ parser_error("Invalid hex escape sequence '%s'", parser_text); } YY_BREAK case 47: YY_RULE_SETUP -#line 504 "parser.l" +#line 517 "parser.l" parser_error("Bad escape sequence"); YY_BREAK case 48: +/* rule 48 can match eol */ YY_RULE_SETUP -#line 505 "parser.l" +#line 518 "parser.l" line_number++; char_number = 1; /* backslash at EOL continues string after leading whitespace on next line */ YY_BREAK case 49: YY_RULE_SETUP -#line 506 "parser.l" +#line 519 "parser.l" addcchar('\a'); YY_BREAK case 50: YY_RULE_SETUP -#line 507 "parser.l" +#line 520 "parser.l" addcchar('\b'); YY_BREAK case 51: YY_RULE_SETUP -#line 508 "parser.l" +#line 521 "parser.l" addcchar('\f'); YY_BREAK case 52: YY_RULE_SETUP -#line 509 "parser.l" +#line 522 "parser.l" addcchar('\n'); YY_BREAK case 53: YY_RULE_SETUP -#line 510 "parser.l" +#line 523 "parser.l" addcchar('\r'); YY_BREAK case 54: YY_RULE_SETUP -#line 511 "parser.l" +#line 524 "parser.l" addcchar('\t'); YY_BREAK case 55: YY_RULE_SETUP -#line 512 "parser.l" +#line 525 "parser.l" addcchar('\v'); YY_BREAK case 56: YY_RULE_SETUP -#line 513 "parser.l" -addcchar(yytext[1]); +#line 526 "parser.l" +addcchar(parser_text[1]); YY_BREAK case 57: +/* rule 57 can match eol */ YY_RULE_SETUP -#line 514 "parser.l" -addcchar(yytext[2]); line_number++; char_number = 1; +#line 527 "parser.l" +addcchar(parser_text[2]); line_number++; char_number = 1; YY_BREAK case 58: YY_RULE_SETUP -#line 515 "parser.l" +#line 528 "parser.l" { - char *yptr = yytext; + char *yptr = parser_text; while(*yptr) addcchar(*yptr++); } YY_BREAK case 59: YY_RULE_SETUP -#line 520 "parser.l" +#line 533 "parser.l" addcchar('\"'); /* "bla""bla" -> "bla\"bla" */ YY_BREAK case 60: YY_RULE_SETUP -#line 521 "parser.l" +#line 534 "parser.l" addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */ YY_BREAK case 61: YY_RULE_SETUP -#line 522 "parser.l" +#line 535 "parser.l" ; /* "bla" "bla" -> "blabla" */ YY_BREAK case 62: +/* rule 62 can match eol */ YY_RULE_SETUP -#line 523 "parser.l" +#line 536 "parser.l" parser_error("Unterminated string"); YY_BREAK /* @@ -1597,12 +1748,12 @@ parser_error("Unterminated string"); */ case 63: YY_RULE_SETUP -#line 528 "parser.l" +#line 541 "parser.l" yy_push_state(tkrcd); cbufidx = 0; YY_BREAK case 64: YY_RULE_SETUP -#line 529 "parser.l" +#line 542 "parser.l" { yy_pop_state(); parser_lval.raw = new_raw_data(); @@ -1614,26 +1765,27 @@ YY_RULE_SETUP YY_BREAK case 65: YY_RULE_SETUP -#line 537 "parser.l" +#line 550 "parser.l" { int result; - result = strtol(yytext, 0, 16); + result = strtol(parser_text, 0, 16); addcchar((char)result); } YY_BREAK case 66: YY_RULE_SETUP -#line 542 "parser.l" +#line 555 "parser.l" ; /* Ignore space */ YY_BREAK case 67: +/* rule 67 can match eol */ YY_RULE_SETUP -#line 543 "parser.l" +#line 556 "parser.l" line_number++; char_number = 1; YY_BREAK case 68: YY_RULE_SETUP -#line 544 "parser.l" +#line 557 "parser.l" parser_error("Malformed data-line"); YY_BREAK /* @@ -1642,7 +1794,7 @@ parser_error("Malformed data-line"); */ case 69: YY_RULE_SETUP -#line 550 "parser.l" +#line 563 "parser.l" { yy_push_state(comment); save_wanted_id = wanted_id; @@ -1652,37 +1804,39 @@ YY_RULE_SETUP YY_BREAK case 70: YY_RULE_SETUP -#line 556 "parser.l" +#line 569 "parser.l" ; YY_BREAK case 71: YY_RULE_SETUP -#line 557 "parser.l" +#line 570 "parser.l" ; YY_BREAK case 72: +/* rule 72 can match eol */ YY_RULE_SETUP -#line 558 "parser.l" +#line 571 "parser.l" line_number++; char_number = 1; YY_BREAK case 73: YY_RULE_SETUP -#line 559 "parser.l" +#line 572 "parser.l" yy_pop_state(); want_id = save_wanted_id; YY_BREAK case 74: YY_RULE_SETUP -#line 561 "parser.l" +#line 574 "parser.l" want_id = wanted_id; /* not really comment, but left-over c-junk */ YY_BREAK case 75: YY_RULE_SETUP -#line 562 "parser.l" +#line 575 "parser.l" want_id = wanted_id; if(!no_preprocess) parser_warning("Found comments after preprocessing, please report\n"); YY_BREAK case 76: +/* rule 76 can match eol */ YY_RULE_SETUP -#line 564 "parser.l" +#line 577 "parser.l" { want_id = wanted_id; line_number++; @@ -1696,28 +1850,35 @@ YY_RULE_SETUP YY_BREAK case 77: YY_RULE_SETUP -#line 574 "parser.l" +#line 587 "parser.l" want_id = wanted_id; /* Eat whitespace */ YY_BREAK case 78: YY_RULE_SETUP -#line 576 "parser.l" -return yytext[0]; +#line 589 "parser.l" +return parser_text[0]; YY_BREAK case 79: +/* rule 79 can match eol */ YY_RULE_SETUP -#line 578 "parser.l" +#line 591 "parser.l" { /* Catch all rule to find any unmatched text */ - if(*yytext == '\n') + if(*parser_text == '\n') { line_number++; char_number = 1; } parser_error("Unmatched text '%c' (0x%02x) YY_START=%d", - isprint((unsigned char)*yytext) ? *yytext : '.', *yytext, YY_START); + isprint((unsigned char)*parser_text) ? *parser_text : '.', *parser_text, YY_START); } YY_BREAK +case 80: +YY_RULE_SETUP +#line 602 "parser.l" +ECHO; + YY_BREAK +#line 1882 "lex.yy.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(tkstr): case YY_STATE_EOF(tklstr): @@ -1727,39 +1888,31 @@ case YY_STATE_EOF(pp_cstrip): case YY_STATE_EOF(pp_line): case YY_STATE_EOF(pp_pragma): case YY_STATE_EOF(pp_code_page): -#line 589 "parser.l" -current_codepage = -1; yyterminate(); - YY_BREAK -case 80: -YY_RULE_SETUP -#line 590 "parser.l" -ECHO; - YY_BREAK -#line 1739 "lex.yy.c" + yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; + *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our + * just pointed parser_in at a new source and called + * parser_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = parser_in; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position @@ -1769,13 +1922,13 @@ ECHO; * end-of-buffer state). Contrast this with the test * in input(). */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have @@ -1788,41 +1941,42 @@ ECHO; yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; + yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { - yy_cp = yy_c_buf_p; + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); goto yy_find_action; } } - else switch ( yy_get_next_buffer() ) + else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { - yy_did_buffer_switch_on_eof = 0; + (yy_did_buffer_switch_on_eof) = 0; - if ( yywrap() ) + if ( parser_wrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up - * yytext, we can now set up + * parser_text, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; @@ -1830,30 +1984,30 @@ ECHO; else { - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; @@ -1864,8 +2018,7 @@ ECHO; "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ - } /* end of yylex */ - +} /* end of parser_lex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -1874,21 +2027,20 @@ ECHO; * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); - if ( yy_current_buffer->yy_fill_buffer == 0 ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. @@ -1908,34 +2060,30 @@ static int yy_get_next_buffer() /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); + (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { @@ -1948,8 +2096,7 @@ static int yy_get_next_buffer() b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); + parser_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ @@ -1959,35 +2106,35 @@ static int yy_get_next_buffer() YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - num_to_read = yy_current_buffer->yy_buf_size - + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; -#endif + } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); - yy_current_buffer->yy_n_chars = yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - if ( yy_n_chars == 0 ) + if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); + parser_restart(parser_in ); } else { ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } @@ -1995,33 +2142,40 @@ static int yy_get_next_buffer() else ret_val = EOB_ACT_CONTINUE_SCAN; - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) parser_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} /* yy_get_previous_state - get the state just before the EOB char was reached */ -static yy_state_type yy_get_previous_state() - { + static yy_state_type yy_get_previous_state (void) +{ register yy_state_type yy_current_state; register char *yy_cp; - - yy_current_state = yy_start; + + yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -2033,30 +2187,23 @@ static yy_state_type yy_get_previous_state() } return yy_current_state; - } - +} /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; + register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -2068,80 +2215,36 @@ yy_state_type yy_current_state; yy_is_jam = (yy_current_state == 190); return yy_is_jam ? 0 : yy_current_state; - } - - -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - +} +#ifndef YY_NO_INPUT #ifdef __cplusplus -static int yyinput() + static int yyinput (void) #else -static int input() + static int input (void) #endif - { + +{ int c; + + *(yy_c_buf_p) = (yy_hold_char); - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ - *yy_c_buf_p = '\0'; + *(yy_c_buf_p) = '\0'; else { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); - switch ( yy_get_next_buffer() ) + switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() @@ -2155,16 +2258,16 @@ static int input() */ /* Reset buffer status. */ - yyrestart( yyin ); + parser_restart(parser_in ); - /* fall through */ + /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap() ) + if ( parser_wrap( ) ) return EOF; - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); @@ -2174,173 +2277,167 @@ static int input() } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; + (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve parser_text */ + (yy_hold_char) = *++(yy_c_buf_p); - yy_current_buffer->yy_at_bol = (c == '\n'); + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void parser_restart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + parser_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + parser__create_buffer(parser_in,YY_BUF_SIZE ); } + parser__init_buffer(YY_CURRENT_BUFFER,input_file ); + parser__load_buffer_state( ); +} -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void parser__switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * parser_pop_buffer_state(); + * parser_push_buffer_state(new_buffer); + */ + parser_ensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) return; - if ( yy_current_buffer ) + if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - yy_current_buffer = new_buffer; - yy_load_buffer_state(); + YY_CURRENT_BUFFER_LVALUE = new_buffer; + parser__load_buffer_state( ); /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe + * EOF (parser_wrap()) processing, but the only time this flag + * is looked at is after parser_wrap() is called, so it's safe * to go ahead and always set it. */ - yy_did_buffer_switch_on_eof = 1; - } + (yy_did_buffer_switch_on_eof) = 1; +} +static void parser__load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + parser_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE parser__create_buffer (FILE * file, int size ) +{ YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + + b = (YY_BUFFER_STATE) parser_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in parser__create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) parser_alloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in parser__create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer( b, file ); + parser__init_buffer(b,file ); return b; - } +} - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { +/** Destroy the buffer. + * @param b a buffer created with parser__create_buffer() + * + */ + void parser__delete_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) return; - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); + parser_free((void *) b->yy_ch_buf ); - yy_flex_free( (void *) b ); - } + parser_free((void *) b ); +} +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a parser_restart() or at EOF. + */ + static void parser__init_buffer (YY_BUFFER_STATE b, FILE * file ) -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - - - { - yy_flush_buffer( b ); +{ + int oerrno = errno; + + parser__flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } + /* If b is the current buffer, then parser__init_buffer was _probably_ + * called from parser_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + b->yy_is_interactive = 0; + + errno = oerrno; +} -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - - { - if ( ! b ) +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void parser__flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) return; b->yy_n_chars = 0; @@ -2357,31 +2454,127 @@ YY_BUFFER_STATE b; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == yy_current_buffer ) - yy_load_buffer_state(); + if ( b == YY_CURRENT_BUFFER ) + parser__load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void parser_push_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + parser_ensure_buffer_stack(); + + /* This block is copied from parser__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from parser__switch_to_buffer. */ + parser__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void parser_pop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + parser__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + parser__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void parser_ensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)parser_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in parser_ensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; } + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)parser_realloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in parser_ensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE parser__scan_buffer (char * base, yy_size_t size ) +{ YY_BUFFER_STATE b; - + if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) parser_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in parser__scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; @@ -2393,58 +2586,53 @@ yy_size_t size; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer( b ); + parser__switch_to_buffer(b ); return b; - } -#endif +} +/** Setup the input buffer state to scan a string. The next call to parser_lex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * parser__scan_bytes() instead. + */ +YY_BUFFER_STATE parser__scan_string (yyconst char * yystr ) +{ + + return parser__scan_bytes(yystr,strlen(yystr) ); +} -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { +/** Setup the input buffer state to scan the given bytes. The next call to parser_lex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE parser__scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; - + /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); + n = _yybytes_len + 2; + buf = (char *) parser_alloc(n ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in parser__scan_bytes()" ); - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer( buf, n ); + b = parser__scan_buffer(buf,n ); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in parser__scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -2452,78 +2640,49 @@ int len; b->yy_is_our_buffer = 1; return b; - } -#endif +} - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) + static void yy_push_state (int new_state ) +{ + if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) ) { yy_size_t new_size; - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); + (yy_start_stack_depth) += YY_START_STACK_INCR; + new_size = (yy_start_stack_depth) * sizeof( int ); - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); + if ( ! (yy_start_stack) ) + (yy_start_stack) = (int *) parser_alloc(new_size ); else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); + (yy_start_stack) = (int *) parser_realloc((void *) (yy_start_stack),new_size ); - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); + if ( ! (yy_start_stack) ) + YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } - yy_start_stack[yy_start_stack_ptr++] = YY_START; + (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START; BEGIN(new_state); - } -#endif +} - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) + static void yy_pop_state (void) +{ + if ( --(yy_start_stack_ptr) < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif + BEGIN((yy_start_stack)[(yy_start_stack_ptr)]); +} #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); - } - - +} /* Redefine yyless() so it works in section 3 code. */ @@ -2531,69 +2690,186 @@ char msg[]; #define yyless(n) \ do \ { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ + /* Undo effects of setting up parser_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + parser_text[parser_leng] = (yy_hold_char); \ + (yy_c_buf_p) = parser_text + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + parser_leng = yyless_macro_arg; \ } \ while ( 0 ) +/* Accessor methods (get/set functions) to struct members. */ -/* Internal utility routines. */ +/** Get the current line number. + * + */ +int parser_get_lineno (void) +{ + + return parser_lineno; +} + +/** Get the input stream. + * + */ +FILE *parser_get_in (void) +{ + return parser_in; +} + +/** Get the output stream. + * + */ +FILE *parser_get_out (void) +{ + return parser_out; +} + +/** Get the length of the current token. + * + */ +int parser_get_leng (void) +{ + return parser_leng; +} + +/** Get the current token. + * + */ + +char *parser_get_text (void) +{ + return parser_text; +} + +/** Set the current line number. + * @param line_number + * + */ +void parser_set_lineno (int line_number ) +{ + + parser_lineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see parser__switch_to_buffer + */ +void parser_set_in (FILE * in_str ) +{ + parser_in = in_str ; +} + +void parser_set_out (FILE * out_str ) +{ + parser_out = out_str ; +} + +int parser_get_debug (void) +{ + return parser__flex_debug; +} + +void parser_set_debug (int bdebug ) +{ + parser__flex_debug = bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from parser_lex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + + (yy_start_stack_ptr) = 0; + (yy_start_stack_depth) = 0; + (yy_start_stack) = NULL; + +/* Defined in main.c */ +#ifdef YY_STDINIT + parser_in = stdin; + parser_out = stdout; +#else + parser_in = (FILE *) 0; + parser_out = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * parser_lex_init() + */ + return 0; +} + +/* parser_lex_destroy is for both reentrant and non-reentrant scanners. */ +int parser_lex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + parser__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + parser_pop_buffer_state(); + } + + /* Destroy the stack itself. */ + parser_free((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Destroy the start condition stack. */ + parser_free((yy_start_stack) ); + (yy_start_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * parser_lex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ #ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; - } +} #endif #ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { +static int yy_flex_strlen (yyconst char * s ) +{ register int n; for ( n = 0; s[n]; ++n ) ; return n; - } +} #endif - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { +void *parser_alloc (yy_size_t size ) +{ return (void *) malloc( size ); - } +} -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { +void *parser_realloc (void * ptr, yy_size_t size ) +{ /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -2602,26 +2878,17 @@ yy_size_t size; * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); - } +} -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } +void parser_free (void * ptr ) +{ + free( (char *) ptr ); /* see parser_realloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 602 "parser.l" -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif -#line 590 "parser.l" /* These dup functions copy the enclosed '\0' from @@ -2673,7 +2940,7 @@ static string_t *get_buffered_cstring(void) parser_error("String %s does not convert identically to Unicode and back in codepage %d. " "Try using a Unicode string instead", str->str.cstr, current_codepage ); if (check_valid_utf8( str, current_codepage )) - parser_warning( "string \"%s\" seems to be UTF-8 but codepage %u is in use.", + parser_warning( "string \"%s\" seems to be UTF-8 but codepage %u is in use.\n", str->str.cstr, current_codepage ); free_string( str ); return str_w; @@ -2700,3 +2967,4 @@ static string_t *make_string(char *s) memcpy(str->str.cstr, s, str->size+1); return str; } + diff --git a/reactos/tools/wrc/newstruc.c b/reactos/tools/wrc/newstruc.c index da8fead55a1..de9d4880459 100644 --- a/reactos/tools/wrc/newstruc.c +++ b/reactos/tools/wrc/newstruc.c @@ -43,34 +43,145 @@ typedef struct } BITMAPOS2HEADER; #include -/* Generate new_* functions that have no parameters (NOTE: no ';') */ -__NEW_STRUCT_FUNC(dialog) -__NEW_STRUCT_FUNC(dialogex) -__NEW_STRUCT_FUNC(name_id) -__NEW_STRUCT_FUNC(menu) -__NEW_STRUCT_FUNC(menuex) -__NEW_STRUCT_FUNC(menu_item) -__NEW_STRUCT_FUNC(menuex_item) -__NEW_STRUCT_FUNC(control) -__NEW_STRUCT_FUNC(icon) -__NEW_STRUCT_FUNC(cursor) -__NEW_STRUCT_FUNC(versioninfo) -__NEW_STRUCT_FUNC(ver_value) -__NEW_STRUCT_FUNC(ver_block) -__NEW_STRUCT_FUNC(stt_entry) -__NEW_STRUCT_FUNC(accelerator) -__NEW_STRUCT_FUNC(event) -__NEW_STRUCT_FUNC(raw_data) -__NEW_STRUCT_FUNC(lvc) -__NEW_STRUCT_FUNC(res_count) -__NEW_STRUCT_FUNC(string) -__NEW_STRUCT_FUNC(toolbar_item) -__NEW_STRUCT_FUNC(ani_any) - /* New instances for all types of structures */ /* Very inefficient (in size), but very functional :-] * Especially for type-checking. */ + +dialog_t *new_dialog(void) +{ + dialog_t *ret = xmalloc( sizeof(*ret) ); + memset( ret, 0, sizeof(*ret) ); + return ret; +} + +name_id_t *new_name_id(void) +{ + name_id_t *ret = xmalloc( sizeof(*ret) ); + memset( ret, 0, sizeof(*ret) ); + return ret; +} + +menu_t *new_menu(void) +{ + menu_t *ret = xmalloc( sizeof(*ret) ); + memset( ret, 0, sizeof(*ret) ); + return ret; +} + +menu_item_t *new_menu_item(void) +{ + menu_item_t *ret = xmalloc( sizeof(*ret) ); + memset( ret, 0, sizeof(*ret) ); + return ret; +} + +control_t *new_control(void) +{ + control_t *ret = xmalloc( sizeof(*ret) ); + memset( ret, 0, sizeof(*ret) ); + return ret; +} + +icon_t *new_icon(void) +{ + icon_t *ret = xmalloc( sizeof(*ret) ); + memset( ret, 0, sizeof(*ret) ); + return ret; +} + +cursor_t *new_cursor(void) +{ + cursor_t *ret = xmalloc( sizeof(*ret) ); + memset( ret, 0, sizeof(*ret) ); + return ret; +} + +versioninfo_t *new_versioninfo(void) +{ + versioninfo_t *ret = xmalloc( sizeof(*ret) ); + memset( ret, 0, sizeof(*ret) ); + return ret; +} + +ver_value_t *new_ver_value(void) +{ + ver_value_t *ret = xmalloc( sizeof(*ret) ); + memset( ret, 0, sizeof(*ret) ); + return ret; +} + +ver_block_t *new_ver_block(void) +{ + ver_block_t *ret = xmalloc( sizeof(*ret) ); + memset( ret, 0, sizeof(*ret) ); + return ret; +} + +stt_entry_t *new_stt_entry(void) +{ + stt_entry_t *ret = xmalloc( sizeof(*ret) ); + memset( ret, 0, sizeof(*ret) ); + return ret; +} + +accelerator_t *new_accelerator(void) +{ + accelerator_t *ret = xmalloc( sizeof(*ret) ); + memset( ret, 0, sizeof(*ret) ); + return ret; +} + +event_t *new_event(void) +{ + event_t *ret = xmalloc( sizeof(*ret) ); + memset( ret, 0, sizeof(*ret) ); + return ret; +} + +raw_data_t *new_raw_data(void) +{ + raw_data_t *ret = xmalloc( sizeof(*ret) ); + memset( ret, 0, sizeof(*ret) ); + return ret; +} + +lvc_t *new_lvc(void) +{ + lvc_t *ret = xmalloc( sizeof(*ret) ); + memset( ret, 0, sizeof(*ret) ); + return ret; +} + +res_count_t *new_res_count(void) +{ + res_count_t *ret = xmalloc( sizeof(*ret) ); + memset( ret, 0, sizeof(*ret) ); + return ret; +} + +string_t *new_string(void) +{ + string_t *ret = xmalloc( sizeof(*ret) ); + memset( ret, 0, sizeof(*ret) ); + set_location( &ret->loc ); + return ret; +} + +toolbar_item_t *new_toolbar_item(void) +{ + toolbar_item_t *ret = xmalloc( sizeof(*ret) ); + memset( ret, 0, sizeof(*ret) ); + return ret; +} + +ani_any_t *new_ani_any(void) +{ + ani_any_t *ret = xmalloc( sizeof(*ret) ); + memset( ret, 0, sizeof(*ret) ); + return ret; +} + resource_t *new_resource(enum res_e t, void *res, int memopt, language_t *lan) { resource_t *r = xmalloc(sizeof(resource_t)); @@ -207,41 +318,42 @@ fontdir_t *new_fontdir(raw_data_t *rd, int *memopt) /* * Convert bitmaps to proper endian */ -static void convert_bitmap_swap_v3(BITMAPINFOHEADER *bih) +static void convert_bitmap_swap(BITMAPV5HEADER *bh, DWORD size) { - bih->biSize = BYTESWAP_DWORD(bih->biSize); - bih->biWidth = BYTESWAP_DWORD(bih->biWidth); - bih->biHeight = BYTESWAP_DWORD(bih->biHeight); - bih->biPlanes = BYTESWAP_WORD(bih->biPlanes); - bih->biBitCount = BYTESWAP_WORD(bih->biBitCount); - bih->biCompression = BYTESWAP_DWORD(bih->biCompression); - bih->biSizeImage = BYTESWAP_DWORD(bih->biSizeImage); - bih->biXPelsPerMeter = BYTESWAP_DWORD(bih->biXPelsPerMeter); - bih->biYPelsPerMeter = BYTESWAP_DWORD(bih->biYPelsPerMeter); - bih->biClrUsed = BYTESWAP_DWORD(bih->biClrUsed); - bih->biClrImportant = BYTESWAP_DWORD(bih->biClrImportant); -} - -static void convert_bitmap_swap_v4(BITMAPV4HEADER *b4h) -{ - convert_bitmap_swap_v3((BITMAPINFOHEADER *)b4h); - b4h->bV4RedMask = BYTESWAP_DWORD(b4h->bV4RedMask); - b4h->bV4GreenMask = BYTESWAP_DWORD(b4h->bV4GreenMask); - b4h->bV4BlueMask = BYTESWAP_DWORD(b4h->bV4BlueMask); - b4h->bV4AlphaMask = BYTESWAP_DWORD(b4h->bV4AlphaMask); - b4h->bV4CSType = BYTESWAP_DWORD(b4h->bV4CSType); - b4h->bV4Endpoints.ciexyzRed.ciexyzX = BYTESWAP_DWORD(b4h->bV4Endpoints.ciexyzRed.ciexyzX); - b4h->bV4Endpoints.ciexyzRed.ciexyzY = BYTESWAP_DWORD(b4h->bV4Endpoints.ciexyzRed.ciexyzY); - b4h->bV4Endpoints.ciexyzRed.ciexyzZ = BYTESWAP_DWORD(b4h->bV4Endpoints.ciexyzRed.ciexyzZ); - b4h->bV4Endpoints.ciexyzGreen.ciexyzX = BYTESWAP_DWORD(b4h->bV4Endpoints.ciexyzGreen.ciexyzX); - b4h->bV4Endpoints.ciexyzGreen.ciexyzY = BYTESWAP_DWORD(b4h->bV4Endpoints.ciexyzGreen.ciexyzY); - b4h->bV4Endpoints.ciexyzGreen.ciexyzZ = BYTESWAP_DWORD(b4h->bV4Endpoints.ciexyzGreen.ciexyzZ); - b4h->bV4Endpoints.ciexyzBlue.ciexyzX = BYTESWAP_DWORD(b4h->bV4Endpoints.ciexyzBlue.ciexyzX); - b4h->bV4Endpoints.ciexyzBlue.ciexyzY = BYTESWAP_DWORD(b4h->bV4Endpoints.ciexyzBlue.ciexyzY); - b4h->bV4Endpoints.ciexyzBlue.ciexyzZ = BYTESWAP_DWORD(b4h->bV4Endpoints.ciexyzBlue.ciexyzZ); - b4h->bV4GammaRed = BYTESWAP_DWORD(b4h->bV4GammaRed); - b4h->bV4GammaGreen = BYTESWAP_DWORD(b4h->bV4GammaGreen); - b4h->bV4GammaBlue = BYTESWAP_DWORD(b4h->bV4GammaBlue); + bh->bV5Size = BYTESWAP_DWORD(bh->bV5Size); + bh->bV5Width = BYTESWAP_DWORD(bh->bV5Width); + bh->bV5Height = BYTESWAP_DWORD(bh->bV5Height); + bh->bV5Planes = BYTESWAP_WORD(bh->bV5Planes); + bh->bV5BitCount = BYTESWAP_WORD(bh->bV5BitCount); + bh->bV5Compression = BYTESWAP_DWORD(bh->bV5Compression); + bh->bV5SizeImage = BYTESWAP_DWORD(bh->bV5SizeImage); + bh->bV5XPelsPerMeter = BYTESWAP_DWORD(bh->bV5XPelsPerMeter); + bh->bV5YPelsPerMeter = BYTESWAP_DWORD(bh->bV5YPelsPerMeter); + bh->bV5ClrUsed = BYTESWAP_DWORD(bh->bV5ClrUsed); + bh->bV5ClrImportant = BYTESWAP_DWORD(bh->bV5ClrImportant); + if (size == sizeof(BITMAPINFOHEADER)) return; + bh->bV5RedMask = BYTESWAP_DWORD(bh->bV5RedMask); + bh->bV5GreenMask = BYTESWAP_DWORD(bh->bV5GreenMask); + bh->bV5BlueMask = BYTESWAP_DWORD(bh->bV5BlueMask); + bh->bV5AlphaMask = BYTESWAP_DWORD(bh->bV5AlphaMask); + bh->bV5CSType = BYTESWAP_DWORD(bh->bV5CSType); + bh->bV5Endpoints.ciexyzRed.ciexyzX = BYTESWAP_DWORD(bh->bV5Endpoints.ciexyzRed.ciexyzX); + bh->bV5Endpoints.ciexyzRed.ciexyzY = BYTESWAP_DWORD(bh->bV5Endpoints.ciexyzRed.ciexyzY); + bh->bV5Endpoints.ciexyzRed.ciexyzZ = BYTESWAP_DWORD(bh->bV5Endpoints.ciexyzRed.ciexyzZ); + bh->bV5Endpoints.ciexyzGreen.ciexyzX = BYTESWAP_DWORD(bh->bV5Endpoints.ciexyzGreen.ciexyzX); + bh->bV5Endpoints.ciexyzGreen.ciexyzY = BYTESWAP_DWORD(bh->bV5Endpoints.ciexyzGreen.ciexyzY); + bh->bV5Endpoints.ciexyzGreen.ciexyzZ = BYTESWAP_DWORD(bh->bV5Endpoints.ciexyzGreen.ciexyzZ); + bh->bV5Endpoints.ciexyzBlue.ciexyzX = BYTESWAP_DWORD(bh->bV5Endpoints.ciexyzBlue.ciexyzX); + bh->bV5Endpoints.ciexyzBlue.ciexyzY = BYTESWAP_DWORD(bh->bV5Endpoints.ciexyzBlue.ciexyzY); + bh->bV5Endpoints.ciexyzBlue.ciexyzZ = BYTESWAP_DWORD(bh->bV5Endpoints.ciexyzBlue.ciexyzZ); + bh->bV5GammaRed = BYTESWAP_DWORD(bh->bV5GammaRed); + bh->bV5GammaGreen = BYTESWAP_DWORD(bh->bV5GammaGreen); + bh->bV5GammaBlue = BYTESWAP_DWORD(bh->bV5GammaBlue); + if (size == sizeof(BITMAPV4HEADER)) return; + bh->bV5Intent = BYTESWAP_DWORD(bh->bV5Intent); + bh->bV5ProfileData = BYTESWAP_DWORD(bh->bV5ProfileData); + bh->bV5ProfileSize = BYTESWAP_DWORD(bh->bV5ProfileSize); + bh->bV5Reserved = BYTESWAP_DWORD(bh->bV5Reserved); } static void convert_bitmap_swap_os2(BITMAPOS2HEADER *boh) @@ -255,31 +367,13 @@ static void convert_bitmap_swap_os2(BITMAPOS2HEADER *boh) #define FL_SIGBE 0x01 #define FL_SIZEBE 0x02 -#define FL_V4 0x04 -#define FL_OS2 0x08 static int convert_bitmap(char *data, int size) { - BITMAPINFOHEADER *bih = (BITMAPINFOHEADER *)data; - BITMAPV4HEADER *b4h = (BITMAPV4HEADER *)data; + BITMAPV5HEADER *bih = (BITMAPV5HEADER *)data; BITMAPOS2HEADER *boh = (BITMAPOS2HEADER *)data; + DWORD bmsize; int type = 0; int returnSize = 0; /* size to be returned */ -#ifdef WORDS_BIGENDIAN - DWORD bisizel = BYTESWAP_DWORD(sizeof(BITMAPINFOHEADER)); - DWORD b4sizel = BYTESWAP_DWORD(sizeof(BITMAPV4HEADER)); - DWORD bosizel = BYTESWAP_DWORD(sizeof(BITMAPOS2HEADER)); - DWORD bisizeb = sizeof(BITMAPINFOHEADER); - DWORD b4sizeb = sizeof(BITMAPV4HEADER); - DWORD bosizeb = sizeof(BITMAPOS2HEADER); -#else - DWORD bisizel = sizeof(BITMAPINFOHEADER); - DWORD b4sizel = sizeof(BITMAPV4HEADER); - DWORD bosizel = sizeof(BITMAPOS2HEADER); - DWORD bisizeb = BYTESWAP_DWORD(sizeof(BITMAPINFOHEADER)); - DWORD b4sizeb = BYTESWAP_DWORD(sizeof(BITMAPV4HEADER)); - DWORD bosizeb = BYTESWAP_DWORD(sizeof(BITMAPOS2HEADER)); -#endif - /* * Originally the bih and b4h pointers were simply incremented here, @@ -300,47 +394,40 @@ static int convert_bitmap(char *data, int size) } - if(bih->biSize == bisizel) - { - /* Little endian */ - } - else if(bih->biSize == bisizeb) - { - type |= FL_SIZEBE; - } - else if(bih->biSize == b4sizel) - { - type |= FL_V4; - } - else if(bih->biSize == b4sizeb) - { - type |= FL_SIZEBE | FL_V4; - } - else if(!bih->biSize || bih->biSize == bosizel) - { - type |= FL_OS2; - } - else if(bih->biSize == bosizeb) - { - type |= FL_SIZEBE | FL_OS2; - } - else - parser_error("Invalid bitmap format, bih->biSize = %d", bih->biSize); + bmsize = bih->bV5Size; + if (bmsize >> 16) /* assume swapped */ + { +#ifndef WORDS_BIGENDIAN + type |= FL_SIZEBE; +#endif + bmsize = BYTESWAP_DWORD( bmsize ); + } + else + { +#ifdef WORDS_BIGENDIAN + type |= FL_SIZEBE; +#endif + } + + switch (bmsize) + { + case sizeof(BITMAPOS2HEADER): + case sizeof(BITMAPINFOHEADER): + case sizeof(BITMAPV4HEADER): + case sizeof(BITMAPV5HEADER): + break; + default: + parser_error("Invalid bitmap format, bih->biSize = %d", bih->bV5Size); + } switch(type) { - default: - break; case FL_SIZEBE: - case FL_SIZEBE | FL_V4: - case FL_SIZEBE | FL_OS2: - parser_warning("Bitmap v%c signature little-endian, but size big-endian\n", type & FL_V4 ? '4' : '3'); - break; + parser_warning("Bitmap signature little-endian, but size big-endian\n"); + break; case FL_SIGBE: - case FL_SIGBE | FL_V4: - case FL_SIGBE | FL_OS2: - parser_warning("Bitmap v%c signature big-endian, but size little-endian\n", type & FL_V4 ? '4' : '3'); - break; + parser_warning("Bitmap signature big-endian, but size little-endian\n"); + break; } switch(byteorder) @@ -351,14 +438,10 @@ static int convert_bitmap(char *data, int size) case WRC_BO_BIG: if(!(type & FL_SIZEBE)) { - if(type & FL_V4) - convert_bitmap_swap_v4(b4h); - else if(type & FL_OS2) - { - convert_bitmap_swap_os2(boh); - } - else - convert_bitmap_swap_v3(bih); + if (bmsize == sizeof(BITMAPOS2HEADER)) + convert_bitmap_swap_os2(boh); + else + convert_bitmap_swap(bih, bmsize); } break; #ifndef WORDS_BIGENDIAN @@ -367,14 +450,10 @@ static int convert_bitmap(char *data, int size) case WRC_BO_LITTLE: if(type & FL_SIZEBE) { - if(type & FL_V4) - convert_bitmap_swap_v4(b4h); - else if(type & FL_OS2) - { - convert_bitmap_swap_os2(boh); - } - else - convert_bitmap_swap_v3(bih); + if (bmsize == sizeof(BITMAPOS2HEADER)) + convert_bitmap_swap_os2(boh); + else + convert_bitmap_swap(bih, bmsize); } break; } @@ -389,7 +468,6 @@ static int convert_bitmap(char *data, int size) } #undef FL_SIGBE #undef FL_SIZEBE -#undef FL_V4 /* * Cursor and icon splitter functions used when allocating diff --git a/reactos/tools/wrc/newstruc.h b/reactos/tools/wrc/newstruc.h index 2e46b144035..c7a74eb1abe 100644 --- a/reactos/tools/wrc/newstruc.h +++ b/reactos/tools/wrc/newstruc.h @@ -23,39 +23,25 @@ #include "wrctypes.h" -#define __NEW_STRUCT_FUNC(p) \ - p##_t *new_##p(void)\ - {\ - p##_t * ret = xmalloc(sizeof(*ret)); \ - memset( ret, 0, sizeof(*ret) ); \ - return ret; \ - } - -#define __NEW_STRUCT_PROTO(p) p##_t *new_##p(void) - -__NEW_STRUCT_PROTO(dialog); -__NEW_STRUCT_PROTO(dialogex); -__NEW_STRUCT_PROTO(name_id); -__NEW_STRUCT_PROTO(menu); -__NEW_STRUCT_PROTO(menuex); -__NEW_STRUCT_PROTO(menu_item); -__NEW_STRUCT_PROTO(menuex_item); -__NEW_STRUCT_PROTO(control); -__NEW_STRUCT_PROTO(icon); -__NEW_STRUCT_PROTO(cursor); -__NEW_STRUCT_PROTO(versioninfo); -__NEW_STRUCT_PROTO(ver_value); -__NEW_STRUCT_PROTO(ver_block); -__NEW_STRUCT_PROTO(stt_entry); -__NEW_STRUCT_PROTO(accelerator); -__NEW_STRUCT_PROTO(event); -__NEW_STRUCT_PROTO(raw_data); -__NEW_STRUCT_PROTO(lvc); -__NEW_STRUCT_PROTO(res_count); -__NEW_STRUCT_PROTO(string); -__NEW_STRUCT_PROTO(toolbar_item); -__NEW_STRUCT_PROTO(ani_any); - +dialog_t *new_dialog(void); +name_id_t *new_name_id(void); +menu_t *new_menu(void); +menu_item_t *new_menu_item(void); +control_t *new_control(void); +icon_t *new_icon(void); +cursor_t *new_cursor(void); +versioninfo_t *new_versioninfo(void); +ver_value_t *new_ver_value(void); +ver_block_t *new_ver_block(void); +stt_entry_t *new_stt_entry(void); +accelerator_t *new_accelerator(void); +event_t *new_event(void); +raw_data_t *new_raw_data(void); +lvc_t *new_lvc(void); +res_count_t *new_res_count(void); +string_t *new_string(void); +toolbar_item_t *new_toolbar_item(void); +ani_any_t *new_ani_any(void); resource_t *new_resource(enum res_e t, void *res, int memopt, language_t *lan); version_t *new_version(DWORD v); characts_t *new_characts(DWORD c); diff --git a/reactos/tools/wrc/parser.h b/reactos/tools/wrc/parser.h index b9e204589db..e9fc8e62349 100644 --- a/reactos/tools/wrc/parser.h +++ b/reactos/tools/wrc/parser.h @@ -34,5 +34,6 @@ extern char *parser_text; extern int yy_flex_debug; int parser_lex(void); +int parser_lex_destroy(void); #endif diff --git a/reactos/tools/wrc/parser.l b/reactos/tools/wrc/parser.l index 8ed04459429..a1ef1cf486f 100644 --- a/reactos/tools/wrc/parser.l +++ b/reactos/tools/wrc/parser.l @@ -106,7 +106,9 @@ cident [a-zA-Z_][0-9a-zA-Z_]* #include #include -#ifndef HAVE_UNISTD_H +#ifdef HAVE_UNISTD_H +#include +#else #define YY_NO_UNISTD_H #endif @@ -395,9 +397,12 @@ static unsigned long xstrtoul(const char *nptr, char **endptr, int base) \{ return tBEGIN; \} return tEND; -[0-9]+[lL]? { parser_lval.num = xstrtoul(yytext, 0, 10); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } -0[xX][0-9A-Fa-f]+[lL]? { parser_lval.num = xstrtoul(yytext, 0, 16); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } -0[oO][0-7]+[lL]? { parser_lval.num = xstrtoul(yytext+2, 0, 8); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } +[0-9]+[lL]? { parser_lval.num = xstrtoul(yytext, 0, 10); + return (yytext[yyleng-1] == 'L' || yytext[yyleng-1] == 'l') ? tLNUMBER : tNUMBER; } +0[xX][0-9A-Fa-f]+[lL]? { parser_lval.num = xstrtoul(yytext, 0, 16); + return (yytext[yyleng-1] == 'L' || yytext[yyleng-1] == 'l') ? tLNUMBER : tNUMBER; } +0[oO][0-7]+[lL]? { parser_lval.num = xstrtoul(yytext+2, 0, 8); + return (yytext[yyleng-1] == 'L' || yytext[yyleng-1] == 'l') ? tLNUMBER : tNUMBER; } /* * The next two rules scan identifiers and filenames. @@ -465,7 +470,11 @@ L\" { \\r addwchar('\r'); \\t addwchar('\t'); \\v addwchar('\v'); -\\. addwchar(yytext[1]); +\\. { + if (yytext[1] & 0x80) + parser_error("Invalid char %u in wide string", (unsigned char)yytext[1]); + addwchar(yytext[1]); + } \\\r\n addwchar(yytext[2]); line_number++; char_number = 1; \"\" addwchar('\"'); /* "bla""bla" -> "bla\"bla" */ \\\"\" addwchar('\"'); /* "bla\""bla" -> "bla\"bla" */ @@ -473,7 +482,11 @@ L\" { [^\\\n\"]+ { char *yptr = yytext; while(*yptr) /* FIXME: codepage translation */ - addwchar(*yptr++ & 0xff); + { + if (*yptr & 0x80) + parser_error("Invalid char %u in wide string", (unsigned char)*yptr); + addwchar(*yptr++ & 0xff); + } } \n parser_error("Unterminated string"); @@ -586,7 +599,6 @@ L\" { isprint((unsigned char)*yytext) ? *yytext : '.', *yytext, YY_START); } -<> current_codepage = -1; yyterminate(); %% /* These dup functions copy the enclosed '\0' from @@ -638,7 +650,7 @@ static string_t *get_buffered_cstring(void) parser_error("String %s does not convert identically to Unicode and back in codepage %d. " "Try using a Unicode string instead", str->str.cstr, current_codepage ); if (check_valid_utf8( str, current_codepage )) - parser_warning( "string \"%s\" seems to be UTF-8 but codepage %u is in use.", + parser_warning( "string \"%s\" seems to be UTF-8 but codepage %u is in use.\n", str->str.cstr, current_codepage ); free_string( str ); return str_w; diff --git a/reactos/tools/wrc/parser.tab.c b/reactos/tools/wrc/parser.tab.c index 2617a0df370..c0cf993003b 100644 --- a/reactos/tools/wrc/parser.tab.c +++ b/reactos/tools/wrc/parser.tab.c @@ -1,10 +1,9 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.4.2. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,7 +45,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.1" +#define YYBISON_VERSION "2.4.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -267,7 +266,6 @@ static control_t *get_control_head(control_t *p); static ver_value_t *get_ver_value_head(ver_value_t *p); static ver_block_t *get_ver_block_head(ver_block_t *p); static resource_t *get_resource_head(resource_t *p); -static menuex_item_t *get_itemex_head(menuex_item_t *p); static menu_item_t *get_item_head(menu_item_t *p); static raw_data_t *merge_raw_data_str(raw_data_t *r1, string_t *str); static raw_data_t *merge_raw_data_int(raw_data_t *r1, int i); @@ -280,15 +278,6 @@ static raw_data_t *load_file(string_t *name, language_t *lang); static itemex_opt_t *new_itemex_opt(int id, int type, int state, int helpid); static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev); static event_t *add_event(int key, int id, int flags, event_t *prev); -static dialogex_t *dialogex_version(version_t *v, dialogex_t *dlg); -static dialogex_t *dialogex_characteristics(characts_t *c, dialogex_t *dlg); -static dialogex_t *dialogex_language(language_t *l, dialogex_t *dlg); -static dialogex_t *dialogex_menu(name_id_t *m, dialogex_t *dlg); -static dialogex_t *dialogex_class(name_id_t *n, dialogex_t *dlg); -static dialogex_t *dialogex_font(font_id_t *f, dialogex_t *dlg); -static dialogex_t *dialogex_caption(string_t *s, dialogex_t *dlg); -static dialogex_t *dialogex_exstyle(style_t *st, dialogex_t *dlg); -static dialogex_t *dialogex_style(style_t *st, dialogex_t *dlg); static name_id_t *convert_ctlclass(name_id_t *cls); static control_t *ins_ctrl(int type, int special_style, control_t *ctrl, control_t *prev); static dialog_t *dialog_version(version_t *v, dialog_t *dlg); @@ -312,7 +301,7 @@ static int rsrcid_to_token(int lookahead); /* Line 189 of yacc.c */ -#line 320 "parser.tab.c" +#line 309 "parser.tab.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -432,7 +421,7 @@ typedef union YYSTYPE { /* Line 214 of yacc.c */ -#line 238 "parser.y" +#line 228 "parser.y" string_t *str; int num; @@ -442,11 +431,9 @@ typedef union YYSTYPE accelerator_t *acc; bitmap_t *bmp; dialog_t *dlg; - dialogex_t *dlgex; font_t *fnt; fontdir_t *fnd; menu_t *men; - menuex_t *menex; html_t *html; rcdata_t *rdt; stringtable_t *stt; @@ -462,7 +449,6 @@ typedef union YYSTYPE characts_t *chars; event_t *event; menu_item_t *menitm; - menuex_item_t *menexitm; itemex_opt_t *exopt; raw_data_t *raw; lvc_t *lvc; @@ -479,7 +465,7 @@ typedef union YYSTYPE /* Line 214 of yacc.c */ -#line 487 "parser.tab.c" +#line 473 "parser.tab.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -491,7 +477,7 @@ typedef union YYSTYPE /* Line 264 of yacc.c */ -#line 499 "parser.tab.c" +#line 485 "parser.tab.c" #ifdef short # undef short @@ -541,7 +527,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -706,16 +692,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 677 +#define YYLAST 718 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 97 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 83 /* YYNRULES -- Number of rules. */ -#define YYNRULES 258 +#define YYNRULES 259 /* YYNRULES -- Number of states. */ -#define YYNSTATES 572 +#define YYNSTATES 573 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -785,16 +771,16 @@ static const yytype_uint16 yyprhs[] = 482, 486, 490, 494, 498, 502, 506, 510, 514, 518, 522, 533, 553, 570, 585, 598, 599, 601, 602, 605, 615, 616, 619, 624, 628, 629, 636, 640, 646, 647, - 651, 655, 659, 663, 667, 671, 676, 680, 681, 686, - 690, 696, 697, 700, 706, 713, 714, 717, 722, 729, - 738, 743, 747, 748, 753, 754, 756, 763, 764, 774, - 784, 788, 792, 796, 800, 804, 805, 808, 814, 815, - 818, 820, 825, 830, 832, 836, 846, 847, 851, 854, - 855, 858, 861, 863, 865, 867, 869, 871, 873, 875, - 876, 879, 882, 885, 890, 893, 896, 901, 903, 905, - 908, 910, 913, 915, 919, 923, 928, 932, 937, 941, - 943, 945, 946, 948, 950, 954, 958, 962, 966, 970, - 974, 978, 981, 984, 987, 991, 993, 996, 998 + 650, 653, 656, 659, 662, 665, 668, 673, 677, 678, + 683, 687, 693, 694, 697, 703, 710, 711, 714, 719, + 726, 735, 740, 744, 745, 750, 751, 753, 760, 761, + 771, 781, 785, 789, 793, 797, 801, 802, 805, 811, + 812, 815, 817, 822, 827, 829, 833, 843, 844, 848, + 851, 852, 855, 858, 860, 862, 864, 866, 868, 870, + 872, 873, 876, 879, 882, 887, 890, 893, 898, 900, + 902, 905, 907, 910, 912, 916, 920, 925, 929, 934, + 938, 940, 942, 943, 945, 947, 951, 955, 959, 963, + 967, 971, 975, 978, 981, 984, 988, 990, 993, 995 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ @@ -864,73 +850,73 @@ static const yytype_int16 yyrhs[] = 177, 94, 177, 143, -1, -1, 94, 177, -1, 15, 166, 169, 145, -1, 81, 146, 82, -1, -1, 146, 75, 6, 156, 177, 147, -1, 146, 75, 77, -1, - 146, 76, 6, 147, 145, -1, -1, 156, 49, 147, - -1, 156, 48, 147, -1, 156, 78, 147, -1, 156, - 50, 147, -1, 156, 73, 147, -1, 156, 74, 147, - -1, 16, 166, 169, 149, -1, 81, 150, 82, -1, - -1, 150, 75, 6, 151, -1, 150, 75, 77, -1, - 150, 76, 6, 152, 149, -1, -1, 94, 177, -1, - 94, 176, 94, 176, 147, -1, 94, 176, 94, 176, - 94, 177, -1, -1, 94, 177, -1, 94, 176, 94, - 177, -1, 94, 176, 94, 176, 94, 177, -1, 94, - 176, 94, 176, 94, 176, 94, 177, -1, 154, 81, - 155, 82, -1, 20, 166, 169, -1, -1, 155, 177, - 156, 6, -1, -1, 94, -1, 19, 166, 158, 81, - 159, 82, -1, -1, 158, 66, 177, 94, 177, 94, - 177, 94, 177, -1, 158, 67, 177, 94, 177, 94, - 177, 94, 177, -1, 158, 71, 177, -1, 158, 68, - 177, -1, 158, 69, 177, -1, 158, 70, 177, -1, - 158, 72, 177, -1, -1, 159, 160, -1, 42, 6, - 81, 161, 82, -1, -1, 161, 162, -1, 160, -1, - 43, 6, 94, 6, -1, 43, 6, 94, 163, -1, - 177, -1, 163, 94, 177, -1, 79, 166, 177, 94, - 177, 169, 81, 165, 82, -1, -1, 165, 80, 177, - -1, 165, 77, -1, -1, 166, 167, -1, 166, 168, - -1, 56, -1, 58, -1, 54, -1, 52, -1, 55, - -1, 57, -1, 53, -1, -1, 169, 170, -1, 169, - 171, -1, 169, 172, -1, 65, 177, 94, 177, -1, - 61, 177, -1, 64, 177, -1, 169, 81, 174, 82, - -1, 9, -1, 4, -1, 88, 4, -1, 5, -1, - 88, 5, -1, 6, -1, 174, 156, 9, -1, 174, - 156, 4, -1, 174, 156, 88, 4, -1, 174, 156, - 5, -1, 174, 156, 88, 5, -1, 174, 156, 6, - -1, 106, -1, 173, -1, -1, 177, -1, 178, -1, - 178, 87, 178, -1, 178, 88, 178, -1, 178, 84, - 178, -1, 178, 86, 178, -1, 178, 89, 178, -1, - 178, 90, 178, -1, 178, 85, 178, -1, 91, 178, - -1, 88, 178, -1, 87, 178, -1, 95, 178, 96, - -1, 179, -1, 92, 179, -1, 4, -1, 5, -1 + 146, 76, 6, 147, 145, -1, -1, 94, 147, -1, + 49, 147, -1, 48, 147, -1, 78, 147, -1, 50, + 147, -1, 73, 147, -1, 74, 147, -1, 16, 166, + 169, 149, -1, 81, 150, 82, -1, -1, 150, 75, + 6, 151, -1, 150, 75, 77, -1, 150, 76, 6, + 152, 149, -1, -1, 94, 177, -1, 94, 176, 94, + 176, 147, -1, 94, 176, 94, 176, 94, 177, -1, + -1, 94, 177, -1, 94, 176, 94, 177, -1, 94, + 176, 94, 176, 94, 177, -1, 94, 176, 94, 176, + 94, 176, 94, 177, -1, 154, 81, 155, 82, -1, + 20, 166, 169, -1, -1, 155, 177, 156, 6, -1, + -1, 94, -1, 19, 166, 158, 81, 159, 82, -1, + -1, 158, 66, 177, 94, 177, 94, 177, 94, 177, + -1, 158, 67, 177, 94, 177, 94, 177, 94, 177, + -1, 158, 71, 177, -1, 158, 68, 177, -1, 158, + 69, 177, -1, 158, 70, 177, -1, 158, 72, 177, + -1, -1, 159, 160, -1, 42, 6, 81, 161, 82, + -1, -1, 161, 162, -1, 160, -1, 43, 6, 94, + 6, -1, 43, 6, 94, 163, -1, 177, -1, 163, + 94, 177, -1, 79, 166, 177, 94, 177, 169, 81, + 165, 82, -1, -1, 165, 80, 177, -1, 165, 77, + -1, -1, 166, 167, -1, 166, 168, -1, 56, -1, + 58, -1, 54, -1, 52, -1, 55, -1, 57, -1, + 53, -1, -1, 169, 170, -1, 169, 171, -1, 169, + 172, -1, 65, 177, 94, 177, -1, 61, 177, -1, + 64, 177, -1, 169, 81, 174, 82, -1, 9, -1, + 4, -1, 88, 4, -1, 5, -1, 88, 5, -1, + 6, -1, 174, 156, 9, -1, 174, 156, 4, -1, + 174, 156, 88, 4, -1, 174, 156, 5, -1, 174, + 156, 88, 5, -1, 174, 156, 6, -1, 106, -1, + 173, -1, -1, 177, -1, 178, -1, 178, 87, 178, + -1, 178, 88, 178, -1, 178, 84, 178, -1, 178, + 86, 178, -1, 178, 89, 178, -1, 178, 90, 178, + -1, 178, 85, 178, -1, 91, 178, -1, 88, 178, + -1, 87, 178, -1, 95, 178, 96, -1, 179, -1, + 92, 179, -1, 4, -1, 5, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 360, 360, 406, 407, 478, 484, 496, 506, 514, - 514, 557, 563, 570, 580, 581, 590, 591, 592, 616, - 617, 623, 624, 625, 626, 650, 651, 657, 658, 659, - 660, 661, 662, 666, 667, 668, 672, 676, 692, 714, - 724, 732, 740, 744, 748, 752, 763, 768, 777, 801, - 802, 803, 812, 813, 816, 817, 820, 821, 822, 823, - 824, 825, 830, 865, 866, 867, 868, 869, 870, 871, - 872, 873, 874, 877, 878, 879, 880, 881, 882, 883, - 884, 885, 886, 888, 889, 890, 891, 892, 893, 894, - 895, 897, 907, 930, 952, 954, 959, 966, 977, 991, - 1006, 1011, 1012, 1013, 1017, 1018, 1019, 1020, 1024, 1029, - 1037, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, - 1090, 1091, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, - 1102, 1103, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, - 1114, 1124, 1149, 1165, 1191, 1214, 1215, 1218, 1219, 1223, - 1230, 1231, 1235, 1258, 1262, 1263, 1272, 1278, 1297, 1298, - 1299, 1300, 1301, 1302, 1303, 1307, 1332, 1336, 1337, 1353, - 1359, 1379, 1380, 1384, 1392, 1403, 1404, 1408, 1414, 1422, - 1442, 1480, 1490, 1491, 1524, 1526, 1531, 1547, 1548, 1558, - 1568, 1575, 1582, 1589, 1596, 1606, 1607, 1616, 1624, 1625, - 1634, 1639, 1645, 1654, 1655, 1659, 1685, 1686, 1691, 1700, - 1701, 1711, 1726, 1727, 1728, 1729, 1732, 1733, 1734, 1738, - 1739, 1747, 1755, 1773, 1780, 1784, 1788, 1803, 1804, 1805, - 1806, 1807, 1808, 1809, 1810, 1811, 1812, 1813, 1814, 1818, - 1819, 1826, 1827, 1831, 1834, 1835, 1836, 1837, 1838, 1839, - 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1849, 1850 + 0, 344, 344, 390, 391, 462, 468, 480, 490, 498, + 498, 541, 547, 554, 564, 565, 574, 575, 576, 600, + 601, 607, 608, 609, 610, 634, 635, 641, 642, 643, + 644, 645, 646, 650, 651, 652, 656, 660, 676, 698, + 708, 716, 724, 728, 732, 736, 747, 752, 761, 785, + 786, 787, 796, 797, 800, 801, 804, 805, 806, 807, + 808, 809, 814, 849, 850, 851, 852, 853, 854, 855, + 856, 857, 858, 861, 862, 863, 864, 865, 866, 867, + 868, 869, 870, 872, 873, 874, 875, 876, 877, 878, + 879, 881, 891, 914, 936, 938, 943, 950, 961, 975, + 990, 995, 996, 997, 1001, 1002, 1003, 1004, 1008, 1013, + 1021, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, + 1074, 1075, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, + 1086, 1087, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, + 1098, 1108, 1133, 1149, 1175, 1198, 1199, 1202, 1203, 1207, + 1214, 1215, 1219, 1242, 1246, 1247, 1256, 1262, 1281, 1282, + 1283, 1284, 1285, 1286, 1287, 1288, 1292, 1318, 1322, 1323, + 1339, 1345, 1365, 1366, 1370, 1378, 1389, 1390, 1394, 1400, + 1408, 1428, 1466, 1476, 1477, 1510, 1512, 1517, 1533, 1534, + 1544, 1554, 1561, 1568, 1575, 1582, 1592, 1593, 1602, 1610, + 1611, 1620, 1625, 1631, 1640, 1641, 1645, 1671, 1672, 1677, + 1686, 1687, 1697, 1712, 1714, 1716, 1718, 1722, 1724, 1726, + 1731, 1732, 1740, 1748, 1766, 1773, 1777, 1781, 1796, 1797, + 1798, 1799, 1800, 1801, 1802, 1803, 1804, 1805, 1806, 1807, + 1811, 1812, 1819, 1820, 1824, 1827, 1828, 1829, 1830, 1831, + 1832, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1842, 1843 }; #endif @@ -1011,16 +997,16 @@ static const yytype_uint8 yyr1[] = 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 137, 137, 138, 139, 140, 140, 141, 141, 142, 143, 143, 144, 145, 146, 146, 146, 146, 147, 147, - 147, 147, 147, 147, 147, 148, 149, 150, 150, 150, - 150, 151, 151, 151, 151, 152, 152, 152, 152, 152, - 153, 154, 155, 155, 156, 156, 157, 158, 158, 158, - 158, 158, 158, 158, 158, 159, 159, 160, 161, 161, - 162, 162, 162, 163, 163, 164, 165, 165, 165, 166, - 166, 166, 167, 167, 167, 167, 168, 168, 168, 169, - 169, 169, 169, 170, 171, 172, 173, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 175, - 175, 176, 176, 177, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 179, 179 + 147, 147, 147, 147, 147, 147, 148, 149, 150, 150, + 150, 150, 151, 151, 151, 151, 152, 152, 152, 152, + 152, 153, 154, 155, 155, 156, 156, 157, 158, 158, + 158, 158, 158, 158, 158, 158, 159, 159, 160, 161, + 161, 162, 162, 162, 163, 163, 164, 165, 165, 165, + 166, 166, 166, 167, 167, 167, 167, 168, 168, 168, + 169, 169, 169, 169, 170, 171, 172, 173, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, + 175, 175, 176, 176, 177, 178, 178, 178, 178, 178, + 178, 178, 178, 178, 178, 178, 178, 178, 179, 179 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -1041,17 +1027,17 @@ static const yytype_uint8 yyr2[] = 2, 2, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 10, 19, 16, 14, 12, 0, 1, 0, 2, 9, - 0, 2, 4, 3, 0, 6, 3, 5, 0, 3, - 3, 3, 3, 3, 3, 4, 3, 0, 4, 3, - 5, 0, 2, 5, 6, 0, 2, 4, 6, 8, - 4, 3, 0, 4, 0, 1, 6, 0, 9, 9, - 3, 3, 3, 3, 3, 0, 2, 5, 0, 2, - 1, 4, 4, 1, 3, 9, 0, 3, 2, 0, - 2, 2, 1, 1, 1, 1, 1, 1, 1, 0, - 2, 2, 2, 4, 2, 2, 4, 1, 1, 2, - 1, 2, 1, 3, 3, 4, 3, 4, 3, 1, - 1, 0, 1, 1, 3, 3, 3, 3, 3, 3, - 3, 2, 2, 2, 3, 1, 2, 1, 1 + 0, 2, 4, 3, 0, 6, 3, 5, 0, 2, + 2, 2, 2, 2, 2, 2, 4, 3, 0, 4, + 3, 5, 0, 2, 5, 6, 0, 2, 4, 6, + 8, 4, 3, 0, 4, 0, 1, 6, 0, 9, + 9, 3, 3, 3, 3, 3, 0, 2, 5, 0, + 2, 1, 4, 4, 1, 3, 9, 0, 3, 2, + 0, 2, 2, 1, 1, 1, 1, 1, 1, 1, + 0, 2, 2, 2, 4, 2, 2, 4, 1, 1, + 2, 1, 2, 1, 3, 3, 4, 3, 4, 3, + 1, 1, 0, 1, 1, 3, 3, 3, 3, 3, + 3, 3, 2, 2, 2, 3, 1, 2, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -1059,306 +1045,314 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint16 yydefact[] = { - 3, 0, 2, 1, 5, 257, 258, 11, 209, 9, - 0, 0, 0, 0, 0, 4, 8, 0, 11, 243, - 255, 0, 219, 0, 253, 252, 251, 256, 0, 182, + 3, 0, 2, 1, 5, 258, 259, 11, 210, 9, + 0, 0, 0, 0, 0, 4, 8, 0, 11, 244, + 256, 0, 220, 0, 254, 253, 252, 257, 0, 183, 0, 0, 0, 0, 0, 0, 0, 0, 46, 47, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, - 209, 209, 209, 209, 209, 209, 7, 17, 18, 24, - 22, 23, 27, 28, 29, 21, 31, 209, 16, 19, - 20, 25, 26, 32, 30, 215, 218, 214, 216, 212, - 217, 213, 210, 211, 181, 0, 254, 0, 6, 246, - 250, 247, 244, 245, 248, 249, 219, 219, 219, 0, - 0, 219, 219, 219, 219, 187, 219, 219, 219, 219, - 0, 219, 219, 0, 0, 0, 220, 221, 222, 0, - 180, 184, 0, 35, 34, 33, 239, 0, 240, 36, + 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, + 210, 210, 210, 210, 210, 210, 7, 17, 18, 24, + 22, 23, 27, 28, 29, 21, 31, 210, 16, 19, + 20, 25, 26, 32, 30, 216, 219, 215, 217, 213, + 218, 214, 211, 212, 182, 0, 255, 0, 6, 247, + 251, 248, 245, 246, 249, 250, 220, 220, 220, 0, + 0, 220, 220, 220, 220, 188, 220, 220, 220, 220, + 0, 220, 220, 0, 0, 0, 221, 222, 223, 0, + 181, 185, 0, 35, 34, 33, 240, 0, 241, 36, 37, 0, 0, 0, 0, 41, 43, 0, 39, 40, - 38, 42, 0, 44, 45, 224, 225, 0, 10, 185, - 0, 49, 0, 0, 0, 154, 152, 167, 165, 0, - 0, 0, 0, 0, 0, 0, 195, 0, 0, 183, - 0, 228, 230, 232, 227, 0, 184, 0, 0, 0, - 0, 0, 0, 191, 192, 193, 190, 194, 0, 219, - 223, 0, 48, 0, 229, 231, 226, 0, 0, 0, - 0, 0, 153, 0, 0, 166, 0, 0, 0, 186, - 196, 0, 0, 0, 234, 236, 238, 233, 0, 0, - 0, 184, 156, 184, 171, 169, 175, 0, 0, 0, - 206, 52, 52, 235, 237, 0, 0, 0, 0, 0, - 241, 168, 241, 0, 0, 0, 198, 0, 0, 50, - 51, 63, 147, 184, 157, 184, 184, 184, 184, 184, - 184, 0, 172, 0, 176, 170, 0, 0, 0, 208, - 0, 205, 58, 57, 59, 60, 61, 56, 53, 54, - 0, 0, 111, 155, 160, 159, 162, 163, 164, 161, - 241, 241, 0, 0, 0, 197, 200, 199, 207, 0, - 0, 0, 0, 0, 0, 0, 73, 67, 70, 71, - 72, 148, 0, 184, 242, 0, 177, 188, 189, 0, - 55, 13, 69, 12, 0, 15, 14, 68, 66, 0, - 0, 65, 106, 64, 0, 0, 0, 0, 0, 0, - 0, 122, 115, 116, 119, 120, 121, 185, 173, 241, - 0, 0, 107, 0, 0, 0, 0, 0, 0, 0, + 38, 42, 0, 44, 45, 225, 226, 0, 10, 186, + 0, 49, 0, 0, 0, 154, 152, 168, 166, 0, + 0, 0, 0, 0, 0, 0, 196, 0, 0, 184, + 0, 229, 231, 233, 228, 0, 185, 0, 0, 0, + 0, 0, 0, 192, 193, 194, 191, 195, 0, 220, + 224, 0, 48, 0, 230, 232, 227, 0, 0, 0, + 0, 0, 153, 0, 0, 167, 0, 0, 0, 187, + 197, 0, 0, 0, 235, 237, 239, 234, 0, 0, + 0, 185, 156, 158, 172, 170, 176, 0, 0, 0, + 207, 52, 52, 236, 238, 0, 0, 0, 158, 158, + 158, 158, 158, 158, 158, 0, 242, 169, 242, 0, + 0, 0, 199, 0, 0, 50, 51, 63, 147, 158, + 161, 160, 163, 164, 165, 162, 159, 157, 0, 173, + 0, 177, 171, 0, 0, 0, 209, 0, 206, 58, + 57, 59, 60, 61, 56, 53, 54, 0, 0, 111, + 155, 242, 242, 0, 0, 0, 198, 201, 200, 208, + 0, 0, 0, 0, 0, 0, 0, 73, 67, 70, + 71, 72, 148, 0, 158, 243, 0, 178, 189, 190, + 0, 55, 13, 69, 12, 0, 15, 14, 68, 66, + 0, 0, 65, 106, 64, 0, 0, 0, 0, 0, + 0, 0, 122, 115, 116, 119, 120, 121, 158, 174, + 242, 0, 0, 107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 62, 118, 0, 117, 114, 113, 112, - 0, 174, 0, 178, 201, 202, 203, 100, 105, 104, - 184, 184, 84, 86, 87, 79, 80, 82, 83, 85, - 81, 77, 0, 76, 78, 184, 74, 75, 90, 89, - 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 62, 118, 0, 117, 114, 113, + 112, 0, 175, 0, 179, 202, 203, 204, 100, 105, + 104, 185, 185, 84, 86, 87, 79, 80, 82, 83, + 85, 81, 77, 0, 76, 78, 185, 74, 75, 90, + 89, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 110, 0, 0, 0, 0, 0, 0, 100, 184, 184, - 133, 135, 136, 128, 129, 131, 132, 134, 130, 126, - 0, 125, 127, 184, 123, 124, 139, 138, 137, 179, - 204, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 110, 0, 0, 0, 0, 0, 0, 100, 185, + 185, 133, 135, 136, 128, 129, 131, 132, 134, 130, + 126, 0, 125, 127, 185, 123, 124, 139, 138, 137, + 180, 205, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 109, 0, 108, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 150, 0, 0, 0, 0, 94, - 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, - 91, 0, 0, 0, 151, 94, 0, 0, 0, 0, - 0, 101, 0, 140, 0, 0, 0, 0, 0, 0, - 93, 0, 0, 101, 0, 95, 101, 102, 0, 0, - 147, 0, 0, 92, 0, 0, 101, 145, 0, 96, - 103, 0, 147, 144, 146, 0, 0, 0, 145, 0, - 97, 99, 143, 0, 0, 145, 98, 0, 142, 147, - 145, 141 + 0, 0, 0, 109, 0, 108, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 150, 0, 0, 0, 0, + 94, 0, 0, 0, 0, 149, 0, 0, 0, 0, + 0, 91, 0, 0, 0, 151, 94, 0, 0, 0, + 0, 0, 101, 0, 140, 0, 0, 0, 0, 0, + 0, 93, 0, 0, 101, 0, 95, 101, 102, 0, + 0, 147, 0, 0, 92, 0, 0, 101, 145, 0, + 96, 103, 0, 147, 144, 146, 0, 0, 0, 145, + 0, 97, 99, 143, 0, 0, 145, 98, 0, 142, + 147, 145, 141 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 1, 2, 15, 23, 21, 326, 391, 56, 126, + -1, 1, 2, 15, 23, 21, 327, 392, 56, 126, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 170, 249, 278, 279, 69, 280, 334, 392, - 401, 510, 406, 307, 530, 331, 483, 70, 312, 380, - 454, 440, 449, 553, 282, 343, 504, 71, 156, 179, - 238, 72, 158, 180, 241, 243, 16, 17, 87, 239, - 73, 137, 188, 210, 268, 297, 385, 74, 247, 22, - 82, 83, 127, 116, 117, 118, 128, 176, 129, 261, - 323, 19, 20 + 67, 68, 170, 255, 285, 286, 69, 287, 335, 393, + 402, 511, 407, 308, 531, 332, 484, 70, 313, 381, + 455, 441, 450, 554, 289, 344, 505, 71, 156, 179, + 266, 72, 158, 180, 247, 249, 16, 17, 87, 150, + 73, 137, 188, 210, 275, 298, 386, 74, 253, 22, + 82, 83, 127, 116, 117, 118, 128, 176, 129, 268, + 324, 19, 20 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -535 +#define YYPACT_NINF -520 static const yytype_int16 yypact[] = { - -535, 31, 12, -535, -535, -535, -535, -535, -535, -535, - 240, 240, 240, 182, 240, -535, -535, -69, -535, 577, - -535, 365, 616, 240, -535, -535, -535, -535, 564, -535, - 365, 240, 240, 240, 240, 240, 240, 240, -535, -535, - -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, - -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, - -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, - -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, - -535, -535, -535, -535, 362, -60, -535, 111, -535, 392, - 329, 363, 131, 131, -535, -535, 616, 403, 403, 84, - 84, 616, 616, 403, 403, 616, 403, 403, 403, 403, - 84, 403, 403, 240, 240, 240, -535, -535, -535, 240, - -535, -7, -6, -535, -535, -535, -535, 83, -535, -535, - -535, 0, 8, 202, 265, -535, -535, 449, -535, -535, - -535, -535, 15, -535, -535, -535, -535, 36, -535, -535, - 90, -535, 18, 240, 240, -535, -535, -535, -535, 240, - 240, 240, 240, 240, 240, 240, -535, 240, 240, -535, - 213, -535, -535, -535, -535, 318, -11, 51, 55, -46, - 211, 88, 94, -535, -535, -535, -535, -535, -28, -535, - -535, 119, -535, 134, -535, -535, -535, 40, 240, 240, - 1, 108, -535, 3, 174, -535, 240, 240, 248, -535, - -535, 290, 240, 240, -535, -535, -535, -535, 339, 162, - 175, -7, -535, -41, 188, -535, 190, 200, 203, 144, - -535, 258, 258, -535, -535, 240, 240, 240, 195, 364, - 240, -535, 240, 199, 240, 240, -535, 159, 501, -535, - -535, -535, 267, 171, -535, 133, 133, 133, 133, 133, - 133, 268, 272, 274, 272, -535, 276, 291, -32, -535, - 240, -535, -535, -535, -535, -535, -535, -535, 297, -535, - 5, 240, -535, -535, -535, -535, -535, -535, -535, -535, - 240, 240, 240, 240, 419, -535, -535, -535, -535, 501, - 219, 240, 86, 422, 37, 37, -535, -535, -535, -535, - -535, -535, 277, 227, -535, 341, 272, -535, -535, 342, - -535, -535, -535, -535, 345, -535, -535, -535, -535, 182, - 37, 212, -535, 212, 367, 219, 240, 86, 439, 37, - 37, -535, -535, -535, -535, -535, -535, 240, -535, 240, - 186, 440, -535, 71, 37, 86, 86, 86, 86, 86, - 86, 86, 86, 86, 86, 240, 240, 240, 86, 240, - 86, 86, 86, -535, -535, 353, -535, -535, 212, 212, - 563, -535, 360, 272, -535, 368, -535, -535, -535, -535, - -7, -7, -535, -535, -535, -535, -535, -535, -535, -535, - -535, -535, 381, -535, -535, -7, -535, -535, -535, -535, - -535, 485, 86, 86, 86, 86, 86, 86, 86, 86, - 86, 86, 240, 240, 240, 86, 240, 86, 86, 86, - -535, 240, 240, 240, 240, 240, 240, 398, -7, -7, - -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, - 406, -535, -535, -7, -535, -535, -535, -535, -535, -535, - -535, 408, 412, 414, 418, 240, 240, 240, 240, 240, - 240, 240, 240, 225, 420, 433, 437, 438, 441, 442, - 446, 447, -535, 448, -535, 240, 240, 240, 240, 225, - 240, 240, 240, 37, 450, 456, 457, 460, 463, 464, - 465, 466, -21, 240, -535, 240, 240, 240, 37, 240, - -535, 240, 240, 240, -535, 464, 469, 479, 11, 480, - 481, 483, 487, -535, 240, 240, 240, 240, 240, 37, - -535, 240, 488, 483, 489, 491, 483, 100, 536, 240, - 267, 240, 37, -535, 37, 240, 483, 292, 537, 101, - 212, 543, 267, -535, -535, 240, 37, 240, 292, 546, - 212, 561, -535, 240, 37, 89, 212, 37, -535, 138, - 292, -535 + -520, 3, 8, -520, -520, -520, -520, -520, -520, -520, + 220, 220, 220, 124, 220, -520, -520, -61, -520, 621, + -520, 366, 660, 220, -520, -520, -520, -520, 608, -520, + 366, 220, 220, 220, 220, 220, 220, 220, -520, -520, + -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, + -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, + -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, + -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, + -520, -520, -520, -520, 207, -58, -520, 111, -520, 322, + 350, 554, 66, 66, -520, -520, 660, 348, 348, 14, + 14, 660, 660, 348, 348, 660, 348, 348, 348, 348, + 14, 348, 348, 220, 220, 220, -520, -520, -520, 220, + -520, -53, 233, -520, -520, -520, -520, 432, -520, -520, + -520, -47, -34, 434, 455, -520, -520, 603, -520, -520, + -520, -520, -30, -520, -520, -520, -520, -14, -520, -520, + 78, -520, 26, 220, 220, -520, -520, -520, -520, 220, + 220, 220, 220, 220, 220, 220, -520, 220, 220, -520, + 50, -520, -520, -520, -520, 176, -57, 16, 36, 97, + 139, 42, 70, -520, -520, -520, -520, -520, -32, -520, + -520, 73, -520, 82, -520, -520, -520, 279, 220, 220, + 0, 86, -520, 1, 184, -520, 220, 220, 185, -520, + -520, 467, 220, 220, -520, -520, -520, -520, 235, 88, + 100, -53, -520, 368, 107, -520, 118, 138, 151, 171, + -520, 187, 187, -520, -520, 220, 220, 220, 368, 368, + 368, 368, 368, 368, 368, 195, 220, -520, 220, 201, + 220, 220, -520, 236, 285, -520, -520, -520, 193, 368, + -520, -520, -520, -520, -520, -520, -520, -520, 202, 209, + 210, 209, -520, 216, 223, -19, -520, 220, -520, -520, + -520, -520, -520, -520, -520, 227, -520, 278, 220, -520, + -520, 220, 220, 220, 220, 289, -520, -520, -520, -520, + 285, 182, 220, 83, 328, 54, 54, -520, -520, -520, + -520, -520, -520, 332, 379, -520, 234, 209, -520, -520, + 250, -520, -520, -520, -520, 251, -520, -520, -520, -520, + 124, 54, 268, -520, 268, 564, 182, 220, 83, 351, + 54, 54, -520, -520, -520, -520, -520, -520, 135, -520, + 220, 214, 352, -520, -39, 54, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 220, 220, 220, 83, + 220, 83, 83, 83, -520, -520, 269, -520, -520, 268, + 268, 583, -520, 275, 209, -520, 277, -520, -520, -520, + -520, -53, -53, -520, -520, -520, -520, -520, -520, -520, + -520, -520, -520, 280, -520, -520, -53, -520, -520, -520, + -520, -520, 356, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 220, 220, 220, 83, 220, 83, 83, + 83, -520, 220, 220, 220, 220, 220, 220, 292, -53, + -53, -520, -520, -520, -520, -520, -520, -520, -520, -520, + -520, 304, -520, -520, -53, -520, -520, -520, -520, -520, + -520, -520, 305, 320, 321, 325, 220, 220, 220, 220, + 220, 220, 220, 220, 232, 326, 330, 349, 353, 354, + 357, 365, 367, -520, 369, -520, 220, 220, 220, 220, + 232, 220, 220, 220, 54, 380, 388, 389, 398, 400, + 406, 407, 409, -67, 220, -520, 220, 220, 220, 54, + 220, -520, 220, 220, 220, -520, 406, 413, 415, -1, + 423, 424, 427, 428, -520, 220, 220, 220, 220, 220, + 54, -520, 220, 439, 427, 440, 441, 427, 10, 443, + 220, 193, 220, 54, -520, 54, 220, 427, 478, 447, + 59, 268, 451, 193, -520, -520, 220, 54, 220, 478, + 452, 268, 453, -520, 220, 54, 186, 268, 54, -520, + 60, 478, -520 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -535, -535, -535, -535, -535, 515, -296, -294, 504, -535, - -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, - -535, -535, -535, 324, -535, 330, -535, -535, -535, 208, - -118, 141, -535, 346, -390, -292, 168, -535, -535, -535, - -535, 207, 17, -486, -534, -535, -535, -535, 421, -535, - 2, -535, 432, -535, -535, -535, -535, -535, -535, -120, - -535, -535, -535, 409, -535, -535, -535, -535, -535, 565, - -535, -535, -20, -275, -255, -252, -358, -535, 535, -239, - -2, 462, 20 + -520, -520, -520, -520, -520, 408, -292, -295, 342, -520, + -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, + -520, -520, -520, 212, -520, 150, -520, -520, -520, 208, + -220, -56, -520, 239, -472, -302, 61, -520, -520, -520, + -520, 238, -171, -480, -519, -520, -520, -520, 308, -520, + 19, -520, 300, -520, -520, -520, -520, -520, -520, -175, + -520, -520, -520, 282, -520, -520, -520, -520, -520, 585, + -520, -520, -20, -273, -271, -261, -371, -520, 579, -243, + -2, 444, 20 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -243 +#define YYTABLE_NINF -244 static const yytype_int16 yytable[] = { - 18, 150, 84, 263, 322, 308, 547, 221, 327, 224, - 208, 294, 29, 333, 208, 4, 5, 6, 558, 7, - 300, 85, 171, 172, 173, 309, 301, 174, 310, 200, - 201, 3, 8, 27, 119, 570, 202, 344, 353, 374, - -158, 5, 6, 376, 214, 215, 216, 378, 379, 217, - 295, 313, 315, 149, 209, 113, 197, 345, 114, 115, - 346, 390, 389, 354, 302, 303, 113, 304, 305, 114, - 115, 196, 562, 513, 405, 151, 122, 9, 222, 568, - 225, 133, 134, 149, 571, 121, 306, 149, 5, 6, - 5, 6, 325, 321, 153, 354, 169, 131, 132, 10, - 11, 237, 154, 12, 13, 526, 175, 14, 142, 167, - 382, 145, 146, 147, 223, 5, 6, 148, 438, 439, - 439, 439, 439, 439, 439, 439, 439, 439, 218, 329, - 168, 453, 330, 439, 439, 439, 75, 76, 77, 78, - 79, 80, 81, 540, 113, 198, 543, 114, 115, 199, - -219, 177, 178, -219, -219, 354, 552, 181, 182, 183, - 184, 185, 186, 187, 152, 189, 190, 388, 193, 211, - -219, 10, 11, 10, 11, 12, 13, 12, 13, 14, - 226, 14, 206, 567, 354, 354, 5, 6, 207, 554, - 5, 6, 384, 120, 544, 556, 219, 220, 10, 11, - 554, 502, 12, 13, 227, 228, 14, 554, -158, -158, - 231, 232, 554, 212, -158, -158, 518, 5, 6, 191, - 36, 37, 354, 5, 6, 246, 321, 149, 213, 5, - 6, 482, 281, 251, 252, 253, 269, 537, 262, 270, - 264, 271, 266, 267, 5, 6, -158, -158, 403, 404, - 549, 407, 550, -158, 229, 283, 235, 284, 285, 286, - 287, 288, 289, 113, 560, 149, 114, 115, 298, 236, - 433, 434, 566, 10, 11, 569, 155, 12, 13, 311, - 157, 14, 240, 155, 242, 436, 203, 204, 314, 316, - 317, 318, 335, 205, 244, 192, 354, 245, 336, 324, - 10, 11, -158, -158, 12, 13, 10, 11, 14, -158, - 12, 13, 10, 11, 14, 348, 12, 13, 466, 467, - 14, 347, 194, 195, 332, 332, 113, 10, 11, 114, - 115, 12, 13, 469, 375, 14, 337, 338, 113, 339, - 340, 114, 115, 233, 234, 381, 157, 383, 386, 352, - 332, 113, 248, -219, 114, 115, -219, -219, 341, 332, - 332, 281, 290, 402, 402, 402, -242, 402, 291, 38, - 292, 230, 39, -219, 332, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 293, 50, 51, 52, 53, - 355, 299, 356, 357, 358, 359, 360, 361, 362, 363, - 364, 365, 366, 367, 368, 369, 370, 371, 372, 123, - 124, 125, 255, 256, 257, 33, 34, 35, 36, 37, - 450, 450, 450, 113, 450, 319, 114, 115, 328, 459, - 460, 461, 462, 463, 464, 349, 350, 258, 259, 351, - 451, 452, 260, 455, 54, 377, 387, 411, 55, 373, - 34, 35, 36, 37, 431, 75, 76, 77, 78, 79, - 80, 81, 432, 474, 475, 476, 477, 478, 479, 480, - 481, 484, 24, 25, 26, 435, 28, 32, 33, 34, - 35, 36, 37, 494, 495, 496, 497, 484, 499, 500, - 501, 437, 465, 89, 90, 91, 92, 93, 94, 95, - 468, 514, 470, 515, 516, 517, 471, 519, 472, 520, - 521, 522, 473, 332, 485, 159, 160, 161, 162, 163, - 164, 165, 532, 533, 534, 535, 536, 486, 332, 538, - 166, 487, 488, 30, 88, 489, 490, 546, 272, 548, - 491, 492, 493, 551, 503, 273, 274, 275, 276, 332, - 505, 506, 277, 559, 507, 561, 250, 508, 509, 511, - 512, 565, 332, 524, 332, 393, 394, 395, 396, 397, - 398, 399, 400, 525, 527, 528, 332, 529, 408, 409, - 410, 531, 539, 541, 332, 542, 412, 332, 413, 414, - 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, - 425, 426, 427, 428, 429, 96, 97, 98, 99, 100, + 18, 197, 84, 3, 334, 270, 221, 224, 328, 323, + 208, 4, 5, 6, 309, 7, 310, 355, 5, 6, + 29, 85, 548, 208, 295, 196, 311, 514, 8, 354, + 171, 172, 173, 27, 559, 174, 119, 149, 379, 380, + 345, 149, 346, 377, 375, 355, 237, 153, 314, 316, + 209, 571, 347, 390, 5, 6, 191, 389, 5, 6, + 154, 391, 541, 296, 167, 544, 75, 76, 77, 78, + 79, 80, 81, 9, 406, 553, 122, 222, 225, 563, + 168, 133, 134, 355, 169, 121, 569, 5, 6, 326, + 322, 572, 223, 527, 355, 10, 11, 131, 132, 12, + 13, 10, 11, 14, 545, 12, 13, 383, 142, 14, + 198, 145, 146, 147, 175, 5, 6, 148, 439, 440, + 440, 440, 440, 440, 440, 440, 440, 440, 5, 6, + 199, 454, 192, 440, 440, 440, 206, 10, 11, 5, + 6, 12, 13, 355, 355, 14, 330, 404, 405, 331, + 408, 177, 178, 557, 288, 36, 37, 181, 182, 183, + 184, 185, 186, 187, 207, 189, 190, 212, 193, 211, + 10, 11, 200, 201, 12, 13, 213, 555, 14, 202, + 194, 195, 235, 238, 239, 240, 5, 6, 555, 322, + 226, 229, 503, 120, 236, 555, 219, 220, 10, 11, + 555, 246, 12, 13, 227, 228, 14, 519, 241, 242, + 231, 232, 248, 243, 203, 204, 434, 435, 5, 6, + 385, 205, 10, 11, 5, 6, 12, 13, 538, 244, + 14, 437, 250, 257, 258, 259, 5, 6, 483, 233, + 234, 550, 245, 551, 269, 251, 271, -220, 273, 274, + -220, -220, 252, 452, 453, 561, 456, 260, 261, 262, + 263, 264, 265, 567, 467, 468, 570, -220, 113, 10, + 11, 114, 115, 12, 13, 299, 155, 14, 290, 470, + 568, 254, 157, 214, 215, 216, 312, 288, 217, 315, + 317, 318, 319, 301, 113, 320, 291, 114, 115, 302, + 325, 10, 11, -243, 292, 12, 13, 10, 11, 14, + 293, 12, 13, 276, 151, 14, 277, 294, 278, 10, + 11, 300, 279, 12, 13, 333, 333, 14, 350, 280, + 281, 282, 283, 349, 329, 376, 284, 303, 304, 113, + 305, 306, 114, 115, 351, 352, 382, 336, 384, 387, + 353, 333, 355, 337, 123, 124, 125, 378, 388, 307, + 333, 333, 438, 412, 403, 403, 403, 218, 403, 432, + 38, 433, 88, 39, 436, 333, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 466, 50, 51, 52, + 53, 338, 339, 113, 340, 341, 114, 115, 469, 471, + 75, 76, 77, 78, 79, 80, 81, 32, 33, 34, + 35, 36, 37, 342, 472, 473, 238, 239, 240, 474, + 486, 451, 451, 451, 487, 451, 30, 238, 239, 240, + 460, 461, 462, 463, 464, 465, 33, 34, 35, 36, + 37, 241, 242, 488, 256, 54, 243, 489, 490, 55, + 321, 491, 241, 242, 24, 25, 26, 243, 28, 492, + 524, 493, 244, 494, 475, 476, 477, 478, 479, 480, + 481, 482, 485, 348, 504, 89, 90, 91, 92, 93, + 94, 95, 506, 507, 495, 496, 497, 498, 485, 500, + 501, 502, 508, 113, 509, 113, 114, 115, 114, 115, + 510, 512, 515, 513, 516, 517, 518, 525, 520, 526, + 521, 522, 523, 152, 333, 155, 113, 528, 529, 114, + 115, 530, 532, 533, 534, 535, 536, 537, 113, 333, + 539, 114, 115, 540, 542, 543, 157, 546, 547, -220, + 549, 556, -220, -220, 552, 558, 564, 565, 230, 272, + 333, 499, 343, 267, 560, 0, 562, 297, 0, -220, + 0, 0, 566, 333, 0, 333, 394, 395, 396, 397, + 398, 399, 400, 401, 0, 0, 0, 333, 0, 409, + 410, 411, 0, 0, 0, 333, 0, 356, 333, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, + 368, 369, 370, 371, 372, 373, 413, 0, 414, 415, + 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, + 426, 427, 428, 429, 430, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 441, 442, 443, 444, 445, 446, 447, 448, 320, - 545, 555, 112, 130, 456, 457, 458, 557, 135, 136, - 563, 138, 139, 140, 141, 430, 143, 144, 31, 32, - 33, 34, 35, 36, 37, 564, 523, 498, 342, 254, - 86, 31, 32, 33, 34, 35, 36, 37, 75, 76, - 77, 78, 79, 80, 81, 265, 0, 296 + 111, 34, 35, 36, 37, 0, 374, 0, 0, 0, + 0, 0, 112, 442, 443, 444, 445, 446, 447, 448, + 449, 0, 0, 0, 0, 431, 457, 458, 459, 159, + 160, 161, 162, 163, 164, 165, 0, 130, 0, 0, + 0, 0, 135, 136, 166, 138, 139, 140, 141, 0, + 143, 144, 31, 32, 33, 34, 35, 36, 37, 0, + 0, 0, 0, 0, 86, 31, 32, 33, 34, 35, + 36, 37, 75, 76, 77, 78, 79, 80, 81 }; static const yytype_int16 yycheck[] = { - 2, 121, 22, 242, 300, 280, 540, 6, 302, 6, - 42, 43, 81, 305, 42, 3, 4, 5, 552, 7, - 15, 23, 4, 5, 6, 280, 21, 9, 280, 75, - 76, 0, 20, 13, 94, 569, 82, 312, 330, 335, - 81, 4, 5, 337, 4, 5, 6, 339, 340, 9, - 82, 290, 291, 94, 82, 61, 176, 312, 64, 65, - 312, 355, 354, 84, 59, 60, 61, 62, 63, 64, - 65, 82, 558, 94, 368, 81, 96, 65, 77, 565, - 77, 101, 102, 94, 570, 87, 81, 94, 4, 5, - 4, 5, 6, 7, 94, 84, 6, 99, 100, 87, - 88, 221, 94, 91, 92, 94, 88, 95, 110, 94, - 349, 113, 114, 115, 6, 4, 5, 119, 412, 413, - 414, 415, 416, 417, 418, 419, 420, 421, 88, 92, - 94, 425, 95, 427, 428, 429, 52, 53, 54, 55, - 56, 57, 58, 533, 61, 94, 536, 64, 65, 94, - 61, 153, 154, 64, 65, 84, 546, 159, 160, 161, - 162, 163, 164, 165, 81, 167, 168, 96, 170, 189, - 81, 87, 88, 87, 88, 91, 92, 91, 92, 95, - 6, 95, 94, 94, 84, 84, 4, 5, 94, 547, - 4, 5, 6, 82, 94, 94, 198, 199, 87, 88, - 558, 493, 91, 92, 206, 207, 95, 565, 75, 76, - 212, 213, 570, 94, 81, 82, 508, 4, 5, 6, - 89, 90, 84, 4, 5, 81, 7, 94, 94, 4, - 5, 6, 94, 235, 236, 237, 77, 529, 240, 80, - 242, 82, 244, 245, 4, 5, 75, 76, 366, 367, - 542, 369, 544, 82, 6, 253, 94, 255, 256, 257, - 258, 259, 260, 61, 556, 94, 64, 65, 270, 94, - 390, 391, 564, 87, 88, 567, 81, 91, 92, 281, - 81, 95, 94, 81, 94, 405, 75, 76, 290, 291, - 292, 293, 15, 82, 94, 82, 84, 94, 21, 301, - 87, 88, 75, 76, 91, 92, 87, 88, 95, 82, - 91, 92, 87, 88, 95, 313, 91, 92, 438, 439, - 95, 94, 4, 5, 304, 305, 61, 87, 88, 64, - 65, 91, 92, 453, 336, 95, 59, 60, 61, 62, - 63, 64, 65, 4, 5, 347, 81, 349, 350, 329, - 330, 61, 94, 61, 64, 65, 64, 65, 81, 339, - 340, 94, 94, 365, 366, 367, 94, 369, 94, 4, - 94, 81, 7, 81, 354, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 94, 21, 22, 23, 24, - 23, 94, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 6, - 7, 8, 48, 49, 50, 86, 87, 88, 89, 90, - 422, 423, 424, 61, 426, 6, 64, 65, 6, 431, - 432, 433, 434, 435, 436, 94, 94, 73, 74, 94, - 423, 424, 78, 426, 79, 6, 6, 94, 83, 82, - 87, 88, 89, 90, 94, 52, 53, 54, 55, 56, - 57, 58, 94, 465, 466, 467, 468, 469, 470, 471, - 472, 473, 10, 11, 12, 94, 14, 85, 86, 87, - 88, 89, 90, 485, 486, 487, 488, 489, 490, 491, - 492, 6, 94, 31, 32, 33, 34, 35, 36, 37, - 94, 503, 94, 505, 506, 507, 94, 509, 94, 511, - 512, 513, 94, 493, 94, 66, 67, 68, 69, 70, - 71, 72, 524, 525, 526, 527, 528, 94, 508, 531, - 81, 94, 94, 18, 30, 94, 94, 539, 37, 541, - 94, 94, 94, 545, 94, 44, 45, 46, 47, 529, - 94, 94, 51, 555, 94, 557, 232, 94, 94, 94, - 94, 563, 542, 94, 544, 357, 358, 359, 360, 361, - 362, 363, 364, 94, 94, 94, 556, 94, 370, 371, - 372, 94, 94, 94, 564, 94, 23, 567, 25, 26, + 2, 176, 22, 0, 306, 248, 6, 6, 303, 301, + 42, 3, 4, 5, 287, 7, 287, 84, 4, 5, + 81, 23, 541, 42, 43, 82, 287, 94, 20, 331, + 4, 5, 6, 13, 553, 9, 94, 94, 340, 341, + 313, 94, 313, 338, 336, 84, 221, 94, 291, 292, + 82, 570, 313, 355, 4, 5, 6, 96, 4, 5, + 94, 356, 534, 82, 94, 537, 52, 53, 54, 55, + 56, 57, 58, 65, 369, 547, 96, 77, 77, 559, + 94, 101, 102, 84, 6, 87, 566, 4, 5, 6, + 7, 571, 6, 94, 84, 87, 88, 99, 100, 91, + 92, 87, 88, 95, 94, 91, 92, 350, 110, 95, + 94, 113, 114, 115, 88, 4, 5, 119, 413, 414, + 415, 416, 417, 418, 419, 420, 421, 422, 4, 5, + 94, 426, 82, 428, 429, 430, 94, 87, 88, 4, + 5, 91, 92, 84, 84, 95, 92, 367, 368, 95, + 370, 153, 154, 94, 94, 89, 90, 159, 160, 161, + 162, 163, 164, 165, 94, 167, 168, 94, 170, 189, + 87, 88, 75, 76, 91, 92, 94, 548, 95, 82, + 4, 5, 94, 48, 49, 50, 4, 5, 559, 7, + 6, 6, 494, 82, 94, 566, 198, 199, 87, 88, + 571, 94, 91, 92, 206, 207, 95, 509, 73, 74, + 212, 213, 94, 78, 75, 76, 391, 392, 4, 5, + 6, 82, 87, 88, 4, 5, 91, 92, 530, 94, + 95, 406, 94, 235, 236, 237, 4, 5, 6, 4, + 5, 543, 223, 545, 246, 94, 248, 61, 250, 251, + 64, 65, 81, 424, 425, 557, 427, 238, 239, 240, + 241, 242, 243, 565, 439, 440, 568, 81, 61, 87, + 88, 64, 65, 91, 92, 277, 81, 95, 259, 454, + 94, 94, 81, 4, 5, 6, 288, 94, 9, 291, + 292, 293, 294, 15, 61, 6, 94, 64, 65, 21, + 302, 87, 88, 94, 94, 91, 92, 87, 88, 95, + 94, 91, 92, 77, 81, 95, 80, 94, 82, 87, + 88, 94, 37, 91, 92, 305, 306, 95, 94, 44, + 45, 46, 47, 314, 6, 337, 51, 59, 60, 61, + 62, 63, 64, 65, 94, 94, 348, 15, 350, 351, + 330, 331, 84, 21, 6, 7, 8, 6, 6, 81, + 340, 341, 6, 94, 366, 367, 368, 88, 370, 94, + 4, 94, 30, 7, 94, 355, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 94, 21, 22, 23, + 24, 59, 60, 61, 62, 63, 64, 65, 94, 94, + 52, 53, 54, 55, 56, 57, 58, 85, 86, 87, + 88, 89, 90, 81, 94, 94, 48, 49, 50, 94, + 94, 423, 424, 425, 94, 427, 18, 48, 49, 50, + 432, 433, 434, 435, 436, 437, 86, 87, 88, 89, + 90, 73, 74, 94, 232, 79, 78, 94, 94, 83, + 300, 94, 73, 74, 10, 11, 12, 78, 14, 94, + 516, 94, 94, 94, 466, 467, 468, 469, 470, 471, + 472, 473, 474, 94, 94, 31, 32, 33, 34, 35, + 36, 37, 94, 94, 486, 487, 488, 489, 490, 491, + 492, 493, 94, 61, 94, 61, 64, 65, 64, 65, + 94, 94, 504, 94, 506, 507, 508, 94, 510, 94, + 512, 513, 514, 81, 494, 81, 61, 94, 94, 64, + 65, 94, 94, 525, 526, 527, 528, 529, 61, 509, + 532, 64, 65, 94, 94, 94, 81, 94, 540, 61, + 542, 94, 64, 65, 546, 94, 94, 94, 81, 249, + 530, 490, 313, 245, 556, -1, 558, 275, -1, 81, + -1, -1, 564, 543, -1, 545, 358, 359, 360, 361, + 362, 363, 364, 365, -1, -1, -1, 557, -1, 371, + 372, 373, -1, -1, -1, 565, -1, 23, 568, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 23, -1, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 414, 415, 416, 417, 418, 419, 420, 421, 299, - 94, 94, 67, 98, 427, 428, 429, 94, 103, 104, - 94, 106, 107, 108, 109, 82, 111, 112, 84, 85, - 86, 87, 88, 89, 90, 94, 515, 489, 312, 238, - 96, 84, 85, 86, 87, 88, 89, 90, 52, 53, - 54, 55, 56, 57, 58, 243, -1, 268 + 55, 87, 88, 89, 90, -1, 82, -1, -1, -1, + -1, -1, 67, 415, 416, 417, 418, 419, 420, 421, + 422, -1, -1, -1, -1, 82, 428, 429, 430, 66, + 67, 68, 69, 70, 71, 72, -1, 98, -1, -1, + -1, -1, 103, 104, 81, 106, 107, 108, 109, -1, + 111, 112, 84, 85, 86, 87, 88, 89, 90, -1, + -1, -1, -1, -1, 96, 84, 85, 86, 87, 88, + 89, 90, 52, 53, 54, 55, 56, 57, 58 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -1388,41 +1382,41 @@ static const yytype_uint8 yystos[] = 75, 76, 82, 75, 76, 82, 94, 94, 42, 82, 160, 169, 94, 94, 4, 5, 6, 9, 88, 177, 177, 6, 77, 6, 6, 77, 6, 177, 177, 6, - 81, 177, 177, 4, 5, 94, 94, 156, 147, 156, - 94, 151, 94, 152, 94, 94, 81, 165, 94, 120, - 120, 177, 177, 177, 145, 48, 49, 50, 73, 74, - 78, 176, 177, 176, 177, 149, 177, 177, 161, 77, - 80, 82, 37, 44, 45, 46, 47, 51, 121, 122, - 124, 94, 141, 147, 147, 147, 147, 147, 147, 147, - 94, 94, 94, 94, 43, 82, 160, 162, 177, 94, - 15, 21, 59, 60, 62, 63, 81, 130, 170, 171, - 172, 177, 135, 176, 177, 176, 177, 177, 177, 6, - 122, 7, 103, 177, 177, 6, 103, 104, 6, 92, - 95, 132, 179, 132, 125, 15, 21, 59, 60, 62, - 63, 81, 130, 142, 170, 171, 172, 94, 147, 94, - 94, 94, 179, 132, 84, 23, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 82, 103, 177, 104, 6, 132, 132, - 136, 177, 176, 177, 6, 163, 177, 6, 96, 132, - 104, 104, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 127, 177, 127, 127, 104, 129, 127, 126, 126, - 126, 94, 23, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 82, 94, 94, 156, 156, 94, 156, 6, 104, 104, - 138, 138, 138, 138, 138, 138, 138, 138, 138, 139, - 177, 139, 139, 104, 137, 139, 138, 138, 138, 177, - 177, 177, 177, 177, 177, 94, 156, 156, 94, 156, - 94, 94, 94, 94, 177, 177, 177, 177, 177, 177, - 177, 177, 6, 133, 177, 94, 94, 94, 94, 94, - 94, 94, 94, 94, 177, 177, 177, 177, 133, 177, - 177, 177, 132, 94, 143, 94, 94, 94, 94, 94, - 128, 94, 94, 94, 177, 177, 177, 177, 132, 177, - 177, 177, 177, 128, 94, 94, 94, 94, 94, 94, - 131, 94, 177, 177, 177, 177, 177, 132, 177, 94, - 131, 94, 94, 131, 94, 94, 177, 141, 177, 132, - 132, 177, 131, 140, 173, 94, 94, 94, 141, 177, - 132, 177, 140, 94, 94, 177, 132, 94, 140, 132, - 141, 140 + 81, 177, 177, 4, 5, 94, 94, 156, 48, 49, + 50, 73, 74, 78, 94, 147, 94, 151, 94, 152, + 94, 94, 81, 165, 94, 120, 120, 177, 177, 177, + 147, 147, 147, 147, 147, 147, 147, 145, 176, 177, + 176, 177, 149, 177, 177, 161, 77, 80, 82, 37, + 44, 45, 46, 47, 51, 121, 122, 124, 94, 141, + 147, 94, 94, 94, 94, 43, 82, 160, 162, 177, + 94, 15, 21, 59, 60, 62, 63, 81, 130, 170, + 171, 172, 177, 135, 176, 177, 176, 177, 177, 177, + 6, 122, 7, 103, 177, 177, 6, 103, 104, 6, + 92, 95, 132, 179, 132, 125, 15, 21, 59, 60, + 62, 63, 81, 130, 142, 170, 171, 172, 94, 147, + 94, 94, 94, 179, 132, 84, 23, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 82, 103, 177, 104, 6, 132, + 132, 136, 177, 176, 177, 6, 163, 177, 6, 96, + 132, 104, 104, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 127, 177, 127, 127, 104, 129, 127, 126, + 126, 126, 94, 23, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 82, 94, 94, 156, 156, 94, 156, 6, 104, + 104, 138, 138, 138, 138, 138, 138, 138, 138, 138, + 139, 177, 139, 139, 104, 137, 139, 138, 138, 138, + 177, 177, 177, 177, 177, 177, 94, 156, 156, 94, + 156, 94, 94, 94, 94, 177, 177, 177, 177, 177, + 177, 177, 177, 6, 133, 177, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 177, 177, 177, 177, 133, + 177, 177, 177, 132, 94, 143, 94, 94, 94, 94, + 94, 128, 94, 94, 94, 177, 177, 177, 177, 132, + 177, 177, 177, 177, 128, 94, 94, 94, 94, 94, + 94, 131, 94, 177, 177, 177, 177, 177, 132, 177, + 94, 131, 94, 94, 131, 94, 94, 177, 141, 177, + 132, 132, 177, 131, 140, 173, 94, 94, 94, 141, + 177, 132, 177, 140, 94, 94, 177, 132, 94, 140, + 132, 141, 140 }; #define yyerrok (yyerrstatus = 0) @@ -1437,9 +1431,18 @@ static const yytype_uint8 yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ #define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif #define YYRECOVERING() (!!yyerrstatus) @@ -1496,7 +1499,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -2235,8 +2238,8 @@ yyreduce: { case 2: -/* Line 1455 of yacc.c */ -#line 360 "parser.y" +/* Line 1464 of yacc.c */ +#line 344 "parser.y" { resource_t *rsc, *head; /* First add stringtables to the resource-list */ @@ -2265,7 +2268,7 @@ yyreduce: else (yyvsp[(1) - (1)].res) = rsc; - /* Final statements before were done */ + /* Final statements before we're done */ if ((head = get_resource_head((yyvsp[(1) - (1)].res))) != NULL) { if (resource_top) /* append to existing resources */ @@ -2283,15 +2286,15 @@ yyreduce: case 3: -/* Line 1455 of yacc.c */ -#line 406 "parser.y" +/* Line 1464 of yacc.c */ +#line 390 "parser.y" { (yyval.res) = NULL; want_id = 1; ;} break; case 4: -/* Line 1455 of yacc.c */ -#line 407 "parser.y" +/* Line 1464 of yacc.c */ +#line 391 "parser.y" { if((yyvsp[(2) - (2)].res)) { @@ -2342,8 +2345,8 @@ yyreduce: case 6: -/* Line 1455 of yacc.c */ -#line 484 "parser.y" +/* Line 1464 of yacc.c */ +#line 468 "parser.y" { (yyval.res) = (yyvsp[(3) - (3)].res); if((yyval.res)) @@ -2360,8 +2363,8 @@ yyreduce: case 7: -/* Line 1455 of yacc.c */ -#line 496 "parser.y" +/* Line 1464 of yacc.c */ +#line 480 "parser.y" { (yyval.res) = (yyvsp[(3) - (3)].res); if((yyval.res)) @@ -2376,8 +2379,8 @@ yyreduce: case 8: -/* Line 1455 of yacc.c */ -#line 506 "parser.y" +/* Line 1464 of yacc.c */ +#line 490 "parser.y" { /* Don't do anything, stringtables are converted to * resource_t structures when we are finished parsing and @@ -2390,15 +2393,15 @@ yyreduce: case 9: -/* Line 1455 of yacc.c */ -#line 514 "parser.y" +/* Line 1464 of yacc.c */ +#line 498 "parser.y" {want_nl = 1; ;} break; case 10: -/* Line 1455 of yacc.c */ -#line 514 "parser.y" +/* Line 1464 of yacc.c */ +#line 498 "parser.y" { /* We *NEED* the newline to delimit the expression. * Otherwise, we would not be able to set the next @@ -2440,15 +2443,15 @@ yyreduce: case 11: -/* Line 1455 of yacc.c */ -#line 557 "parser.y" +/* Line 1464 of yacc.c */ +#line 541 "parser.y" { yychar = rsrcid_to_token(yychar); ;} break; case 12: -/* Line 1455 of yacc.c */ -#line 563 "parser.y" +/* Line 1464 of yacc.c */ +#line 547 "parser.y" { if((yyvsp[(1) - (1)].num) > 65535 || (yyvsp[(1) - (1)].num) < -32768) yyerror("Resource's ID out of range (%d)", (yyvsp[(1) - (1)].num)); @@ -2460,8 +2463,8 @@ yyreduce: case 13: -/* Line 1455 of yacc.c */ -#line 570 "parser.y" +/* Line 1464 of yacc.c */ +#line 554 "parser.y" { (yyval.nid) = new_name_id(); (yyval.nid)->type = name_str; @@ -2471,15 +2474,15 @@ yyreduce: case 14: -/* Line 1455 of yacc.c */ -#line 580 "parser.y" +/* Line 1464 of yacc.c */ +#line 564 "parser.y" { (yyval.nid) = (yyvsp[(1) - (1)].nid); ;} break; case 15: -/* Line 1455 of yacc.c */ -#line 581 "parser.y" +/* Line 1464 of yacc.c */ +#line 565 "parser.y" { (yyval.nid) = new_name_id(); (yyval.nid)->type = name_str; @@ -2489,22 +2492,22 @@ yyreduce: case 16: -/* Line 1455 of yacc.c */ -#line 590 "parser.y" +/* Line 1464 of yacc.c */ +#line 574 "parser.y" { (yyval.res) = new_resource(res_acc, (yyvsp[(1) - (1)].acc), (yyvsp[(1) - (1)].acc)->memopt, (yyvsp[(1) - (1)].acc)->lvc.language); ;} break; case 17: -/* Line 1455 of yacc.c */ -#line 591 "parser.y" +/* Line 1464 of yacc.c */ +#line 575 "parser.y" { (yyval.res) = new_resource(res_bmp, (yyvsp[(1) - (1)].bmp), (yyvsp[(1) - (1)].bmp)->memopt, (yyvsp[(1) - (1)].bmp)->data->lvc.language); ;} break; case 18: -/* Line 1455 of yacc.c */ -#line 592 "parser.y" +/* Line 1464 of yacc.c */ +#line 576 "parser.y" { resource_t *rsc; if((yyvsp[(1) - (1)].ani)->type == res_anicur) @@ -2533,18 +2536,18 @@ yyreduce: case 19: -/* Line 1455 of yacc.c */ -#line 616 "parser.y" +/* Line 1464 of yacc.c */ +#line 600 "parser.y" { (yyval.res) = new_resource(res_dlg, (yyvsp[(1) - (1)].dlg), (yyvsp[(1) - (1)].dlg)->memopt, (yyvsp[(1) - (1)].dlg)->lvc.language); ;} break; case 20: -/* Line 1455 of yacc.c */ -#line 617 "parser.y" +/* Line 1464 of yacc.c */ +#line 601 "parser.y" { if(win32) - (yyval.res) = new_resource(res_dlgex, (yyvsp[(1) - (1)].dlgex), (yyvsp[(1) - (1)].dlgex)->memopt, (yyvsp[(1) - (1)].dlgex)->lvc.language); + (yyval.res) = new_resource(res_dlg, (yyvsp[(1) - (1)].dlg), (yyvsp[(1) - (1)].dlg)->memopt, (yyvsp[(1) - (1)].dlg)->lvc.language); else (yyval.res) = NULL; ;} @@ -2552,29 +2555,29 @@ yyreduce: case 21: -/* Line 1455 of yacc.c */ -#line 623 "parser.y" +/* Line 1464 of yacc.c */ +#line 607 "parser.y" { (yyval.res) = new_resource(res_dlginit, (yyvsp[(1) - (1)].dginit), (yyvsp[(1) - (1)].dginit)->memopt, (yyvsp[(1) - (1)].dginit)->data->lvc.language); ;} break; case 22: -/* Line 1455 of yacc.c */ -#line 624 "parser.y" +/* Line 1464 of yacc.c */ +#line 608 "parser.y" { (yyval.res) = new_resource(res_fnt, (yyvsp[(1) - (1)].fnt), (yyvsp[(1) - (1)].fnt)->memopt, (yyvsp[(1) - (1)].fnt)->data->lvc.language); ;} break; case 23: -/* Line 1455 of yacc.c */ -#line 625 "parser.y" +/* Line 1464 of yacc.c */ +#line 609 "parser.y" { (yyval.res) = new_resource(res_fntdir, (yyvsp[(1) - (1)].fnd), (yyvsp[(1) - (1)].fnd)->memopt, (yyvsp[(1) - (1)].fnd)->data->lvc.language); ;} break; case 24: -/* Line 1455 of yacc.c */ -#line 626 "parser.y" +/* Line 1464 of yacc.c */ +#line 610 "parser.y" { resource_t *rsc; if((yyvsp[(1) - (1)].ani)->type == res_aniico) @@ -2603,18 +2606,18 @@ yyreduce: case 25: -/* Line 1455 of yacc.c */ -#line 650 "parser.y" +/* Line 1464 of yacc.c */ +#line 634 "parser.y" { (yyval.res) = new_resource(res_men, (yyvsp[(1) - (1)].men), (yyvsp[(1) - (1)].men)->memopt, (yyvsp[(1) - (1)].men)->lvc.language); ;} break; case 26: -/* Line 1455 of yacc.c */ -#line 651 "parser.y" +/* Line 1464 of yacc.c */ +#line 635 "parser.y" { if(win32) - (yyval.res) = new_resource(res_menex, (yyvsp[(1) - (1)].menex), (yyvsp[(1) - (1)].menex)->memopt, (yyvsp[(1) - (1)].menex)->lvc.language); + (yyval.res) = new_resource(res_men, (yyvsp[(1) - (1)].men), (yyvsp[(1) - (1)].men)->memopt, (yyvsp[(1) - (1)].men)->lvc.language); else (yyval.res) = NULL; ;} @@ -2622,78 +2625,78 @@ yyreduce: case 27: -/* Line 1455 of yacc.c */ -#line 657 "parser.y" +/* Line 1464 of yacc.c */ +#line 641 "parser.y" { (yyval.res) = new_resource(res_msg, (yyvsp[(1) - (1)].msg), WRC_MO_MOVEABLE | WRC_MO_DISCARDABLE, (yyvsp[(1) - (1)].msg)->data->lvc.language); ;} break; case 28: -/* Line 1455 of yacc.c */ -#line 658 "parser.y" +/* Line 1464 of yacc.c */ +#line 642 "parser.y" { (yyval.res) = new_resource(res_html, (yyvsp[(1) - (1)].html), (yyvsp[(1) - (1)].html)->memopt, (yyvsp[(1) - (1)].html)->data->lvc.language); ;} break; case 29: -/* Line 1455 of yacc.c */ -#line 659 "parser.y" +/* Line 1464 of yacc.c */ +#line 643 "parser.y" { (yyval.res) = new_resource(res_rdt, (yyvsp[(1) - (1)].rdt), (yyvsp[(1) - (1)].rdt)->memopt, (yyvsp[(1) - (1)].rdt)->data->lvc.language); ;} break; case 30: -/* Line 1455 of yacc.c */ -#line 660 "parser.y" +/* Line 1464 of yacc.c */ +#line 644 "parser.y" { (yyval.res) = new_resource(res_toolbar, (yyvsp[(1) - (1)].tlbar), (yyvsp[(1) - (1)].tlbar)->memopt, (yyvsp[(1) - (1)].tlbar)->lvc.language); ;} break; case 31: -/* Line 1455 of yacc.c */ -#line 661 "parser.y" +/* Line 1464 of yacc.c */ +#line 645 "parser.y" { (yyval.res) = new_resource(res_usr, (yyvsp[(1) - (1)].usr), (yyvsp[(1) - (1)].usr)->memopt, (yyvsp[(1) - (1)].usr)->data->lvc.language); ;} break; case 32: -/* Line 1455 of yacc.c */ -#line 662 "parser.y" +/* Line 1464 of yacc.c */ +#line 646 "parser.y" { (yyval.res) = new_resource(res_ver, (yyvsp[(1) - (1)].veri), WRC_MO_MOVEABLE | WRC_MO_DISCARDABLE, (yyvsp[(1) - (1)].veri)->lvc.language); ;} break; case 33: -/* Line 1455 of yacc.c */ -#line 666 "parser.y" +/* Line 1464 of yacc.c */ +#line 650 "parser.y" { (yyval.str) = make_filename((yyvsp[(1) - (1)].str)); ;} break; case 34: -/* Line 1455 of yacc.c */ -#line 667 "parser.y" +/* Line 1464 of yacc.c */ +#line 651 "parser.y" { (yyval.str) = make_filename((yyvsp[(1) - (1)].str)); ;} break; case 35: -/* Line 1455 of yacc.c */ -#line 668 "parser.y" +/* Line 1464 of yacc.c */ +#line 652 "parser.y" { (yyval.str) = make_filename((yyvsp[(1) - (1)].str)); ;} break; case 36: -/* Line 1455 of yacc.c */ -#line 672 "parser.y" +/* Line 1464 of yacc.c */ +#line 656 "parser.y" { (yyval.bmp) = new_bitmap((yyvsp[(3) - (3)].raw), (yyvsp[(2) - (3)].iptr)); ;} break; case 37: -/* Line 1455 of yacc.c */ -#line 676 "parser.y" +/* Line 1464 of yacc.c */ +#line 660 "parser.y" { (yyval.ani) = new_ani_any(); if((yyvsp[(3) - (3)].raw)->size > 4 && !memcmp((yyvsp[(3) - (3)].raw)->data, riff, sizeof(riff))) @@ -2711,8 +2714,8 @@ yyreduce: case 38: -/* Line 1455 of yacc.c */ -#line 692 "parser.y" +/* Line 1464 of yacc.c */ +#line 676 "parser.y" { (yyval.ani) = new_ani_any(); if((yyvsp[(3) - (3)].raw)->size > 4 && !memcmp((yyvsp[(3) - (3)].raw)->data, riff, sizeof(riff))) @@ -2730,22 +2733,22 @@ yyreduce: case 39: -/* Line 1455 of yacc.c */ -#line 714 "parser.y" +/* Line 1464 of yacc.c */ +#line 698 "parser.y" { (yyval.fnt) = new_font((yyvsp[(3) - (3)].raw), (yyvsp[(2) - (3)].iptr)); ;} break; case 40: -/* Line 1455 of yacc.c */ -#line 724 "parser.y" +/* Line 1464 of yacc.c */ +#line 708 "parser.y" { (yyval.fnd) = new_fontdir((yyvsp[(3) - (3)].raw), (yyvsp[(2) - (3)].iptr)); ;} break; case 41: -/* Line 1455 of yacc.c */ -#line 732 "parser.y" +/* Line 1464 of yacc.c */ +#line 716 "parser.y" { if(!win32) parser_warning("MESSAGETABLE not supported in 16-bit mode\n"); @@ -2755,29 +2758,29 @@ yyreduce: case 42: -/* Line 1455 of yacc.c */ -#line 740 "parser.y" +/* Line 1464 of yacc.c */ +#line 724 "parser.y" { (yyval.html) = new_html((yyvsp[(3) - (3)].raw), (yyvsp[(2) - (3)].iptr)); ;} break; case 43: -/* Line 1455 of yacc.c */ -#line 744 "parser.y" +/* Line 1464 of yacc.c */ +#line 728 "parser.y" { (yyval.rdt) = new_rcdata((yyvsp[(3) - (3)].raw), (yyvsp[(2) - (3)].iptr)); ;} break; case 44: -/* Line 1455 of yacc.c */ -#line 748 "parser.y" +/* Line 1464 of yacc.c */ +#line 732 "parser.y" { (yyval.dginit) = new_dlginit((yyvsp[(3) - (3)].raw), (yyvsp[(2) - (3)].iptr)); ;} break; case 45: -/* Line 1455 of yacc.c */ -#line 752 "parser.y" +/* Line 1464 of yacc.c */ +#line 736 "parser.y" { #ifdef WORDS_BIGENDIAN if(pedantic && byteorder != WRC_BO_LITTLE) @@ -2791,8 +2794,8 @@ yyreduce: case 46: -/* Line 1455 of yacc.c */ -#line 763 "parser.y" +/* Line 1464 of yacc.c */ +#line 747 "parser.y" { (yyval.nid) = new_name_id(); (yyval.nid)->type = name_ord; @@ -2802,8 +2805,8 @@ yyreduce: case 47: -/* Line 1455 of yacc.c */ -#line 768 "parser.y" +/* Line 1464 of yacc.c */ +#line 752 "parser.y" { (yyval.nid) = new_name_id(); (yyval.nid)->type = name_str; @@ -2813,8 +2816,8 @@ yyreduce: case 48: -/* Line 1455 of yacc.c */ -#line 777 "parser.y" +/* Line 1464 of yacc.c */ +#line 761 "parser.y" { (yyval.acc) = new_accelerator(); if((yyvsp[(2) - (6)].iptr)) @@ -2841,99 +2844,99 @@ yyreduce: case 49: -/* Line 1455 of yacc.c */ -#line 801 "parser.y" +/* Line 1464 of yacc.c */ +#line 785 "parser.y" { (yyval.event)=NULL; ;} break; case 50: -/* Line 1455 of yacc.c */ -#line 802 "parser.y" +/* Line 1464 of yacc.c */ +#line 786 "parser.y" { (yyval.event)=add_string_event((yyvsp[(2) - (5)].str), (yyvsp[(4) - (5)].num), (yyvsp[(5) - (5)].num), (yyvsp[(1) - (5)].event)); ;} break; case 51: -/* Line 1455 of yacc.c */ -#line 803 "parser.y" +/* Line 1464 of yacc.c */ +#line 787 "parser.y" { (yyval.event)=add_event((yyvsp[(2) - (5)].num), (yyvsp[(4) - (5)].num), (yyvsp[(5) - (5)].num), (yyvsp[(1) - (5)].event)); ;} break; case 52: -/* Line 1455 of yacc.c */ -#line 812 "parser.y" +/* Line 1464 of yacc.c */ +#line 796 "parser.y" { (yyval.num) = 0; ;} break; case 53: -/* Line 1455 of yacc.c */ -#line 813 "parser.y" +/* Line 1464 of yacc.c */ +#line 797 "parser.y" { (yyval.num) = (yyvsp[(2) - (2)].num); ;} break; case 54: -/* Line 1455 of yacc.c */ -#line 816 "parser.y" +/* Line 1464 of yacc.c */ +#line 800 "parser.y" { (yyval.num) = (yyvsp[(1) - (1)].num); ;} break; case 55: -/* Line 1455 of yacc.c */ -#line 817 "parser.y" +/* Line 1464 of yacc.c */ +#line 801 "parser.y" { (yyval.num) = (yyvsp[(1) - (3)].num) | (yyvsp[(3) - (3)].num); ;} break; case 56: -/* Line 1455 of yacc.c */ -#line 820 "parser.y" +/* Line 1464 of yacc.c */ +#line 804 "parser.y" { (yyval.num) = WRC_AF_NOINVERT; ;} break; case 57: -/* Line 1455 of yacc.c */ -#line 821 "parser.y" +/* Line 1464 of yacc.c */ +#line 805 "parser.y" { (yyval.num) = WRC_AF_SHIFT; ;} break; case 58: -/* Line 1455 of yacc.c */ -#line 822 "parser.y" +/* Line 1464 of yacc.c */ +#line 806 "parser.y" { (yyval.num) = WRC_AF_CONTROL; ;} break; case 59: -/* Line 1455 of yacc.c */ -#line 823 "parser.y" +/* Line 1464 of yacc.c */ +#line 807 "parser.y" { (yyval.num) = WRC_AF_ALT; ;} break; case 60: -/* Line 1455 of yacc.c */ -#line 824 "parser.y" +/* Line 1464 of yacc.c */ +#line 808 "parser.y" { (yyval.num) = WRC_AF_ASCII; ;} break; case 61: -/* Line 1455 of yacc.c */ -#line 825 "parser.y" +/* Line 1464 of yacc.c */ +#line 809 "parser.y" { (yyval.num) = WRC_AF_VIRTKEY; ;} break; case 62: -/* Line 1455 of yacc.c */ -#line 831 "parser.y" +/* Line 1464 of yacc.c */ +#line 815 "parser.y" { if((yyvsp[(2) - (13)].iptr)) { @@ -2969,204 +2972,204 @@ yyreduce: case 63: -/* Line 1455 of yacc.c */ -#line 865 "parser.y" +/* Line 1464 of yacc.c */ +#line 849 "parser.y" { (yyval.dlg)=new_dialog(); ;} break; case 64: -/* Line 1455 of yacc.c */ -#line 866 "parser.y" +/* Line 1464 of yacc.c */ +#line 850 "parser.y" { (yyval.dlg)=dialog_style((yyvsp[(3) - (3)].style),(yyvsp[(1) - (3)].dlg)); ;} break; case 65: -/* Line 1455 of yacc.c */ -#line 867 "parser.y" +/* Line 1464 of yacc.c */ +#line 851 "parser.y" { (yyval.dlg)=dialog_exstyle((yyvsp[(3) - (3)].style),(yyvsp[(1) - (3)].dlg)); ;} break; case 66: -/* Line 1455 of yacc.c */ -#line 868 "parser.y" +/* Line 1464 of yacc.c */ +#line 852 "parser.y" { (yyval.dlg)=dialog_caption((yyvsp[(3) - (3)].str),(yyvsp[(1) - (3)].dlg)); ;} break; case 67: -/* Line 1455 of yacc.c */ -#line 869 "parser.y" +/* Line 1464 of yacc.c */ +#line 853 "parser.y" { (yyval.dlg)=dialog_font((yyvsp[(2) - (2)].fntid),(yyvsp[(1) - (2)].dlg)); ;} break; case 68: -/* Line 1455 of yacc.c */ -#line 870 "parser.y" +/* Line 1464 of yacc.c */ +#line 854 "parser.y" { (yyval.dlg)=dialog_class((yyvsp[(3) - (3)].nid),(yyvsp[(1) - (3)].dlg)); ;} break; case 69: -/* Line 1455 of yacc.c */ -#line 871 "parser.y" +/* Line 1464 of yacc.c */ +#line 855 "parser.y" { (yyval.dlg)=dialog_menu((yyvsp[(3) - (3)].nid),(yyvsp[(1) - (3)].dlg)); ;} break; case 70: -/* Line 1455 of yacc.c */ -#line 872 "parser.y" +/* Line 1464 of yacc.c */ +#line 856 "parser.y" { (yyval.dlg)=dialog_language((yyvsp[(2) - (2)].lan),(yyvsp[(1) - (2)].dlg)); ;} break; case 71: -/* Line 1455 of yacc.c */ -#line 873 "parser.y" +/* Line 1464 of yacc.c */ +#line 857 "parser.y" { (yyval.dlg)=dialog_characteristics((yyvsp[(2) - (2)].chars),(yyvsp[(1) - (2)].dlg)); ;} break; case 72: -/* Line 1455 of yacc.c */ -#line 874 "parser.y" +/* Line 1464 of yacc.c */ +#line 858 "parser.y" { (yyval.dlg)=dialog_version((yyvsp[(2) - (2)].ver),(yyvsp[(1) - (2)].dlg)); ;} break; case 73: -/* Line 1455 of yacc.c */ -#line 877 "parser.y" +/* Line 1464 of yacc.c */ +#line 861 "parser.y" { (yyval.ctl) = NULL; ;} break; case 74: -/* Line 1455 of yacc.c */ -#line 878 "parser.y" +/* Line 1464 of yacc.c */ +#line 862 "parser.y" { (yyval.ctl)=ins_ctrl(-1, 0, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 75: -/* Line 1455 of yacc.c */ -#line 879 "parser.y" +/* Line 1464 of yacc.c */ +#line 863 "parser.y" { (yyval.ctl)=ins_ctrl(CT_EDIT, 0, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 76: -/* Line 1455 of yacc.c */ -#line 880 "parser.y" +/* Line 1464 of yacc.c */ +#line 864 "parser.y" { (yyval.ctl)=ins_ctrl(CT_LISTBOX, 0, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 77: -/* Line 1455 of yacc.c */ -#line 881 "parser.y" +/* Line 1464 of yacc.c */ +#line 865 "parser.y" { (yyval.ctl)=ins_ctrl(CT_COMBOBOX, 0, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 78: -/* Line 1455 of yacc.c */ -#line 882 "parser.y" +/* Line 1464 of yacc.c */ +#line 866 "parser.y" { (yyval.ctl)=ins_ctrl(CT_SCROLLBAR, 0, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 79: -/* Line 1455 of yacc.c */ -#line 883 "parser.y" +/* Line 1464 of yacc.c */ +#line 867 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_CHECKBOX, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 80: -/* Line 1455 of yacc.c */ -#line 884 "parser.y" +/* Line 1464 of yacc.c */ +#line 868 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_DEFPUSHBUTTON, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 81: -/* Line 1455 of yacc.c */ -#line 885 "parser.y" +/* Line 1464 of yacc.c */ +#line 869 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_GROUPBOX, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl));;} break; case 82: -/* Line 1455 of yacc.c */ -#line 886 "parser.y" +/* Line 1464 of yacc.c */ +#line 870 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_PUSHBUTTON, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 83: -/* Line 1455 of yacc.c */ -#line 888 "parser.y" +/* Line 1464 of yacc.c */ +#line 872 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_RADIOBUTTON, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 84: -/* Line 1455 of yacc.c */ -#line 889 "parser.y" +/* Line 1464 of yacc.c */ +#line 873 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_AUTO3STATE, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 85: -/* Line 1455 of yacc.c */ -#line 890 "parser.y" +/* Line 1464 of yacc.c */ +#line 874 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_3STATE, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 86: -/* Line 1455 of yacc.c */ -#line 891 "parser.y" +/* Line 1464 of yacc.c */ +#line 875 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_AUTOCHECKBOX, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 87: -/* Line 1455 of yacc.c */ -#line 892 "parser.y" +/* Line 1464 of yacc.c */ +#line 876 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_AUTORADIOBUTTON, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 88: -/* Line 1455 of yacc.c */ -#line 893 "parser.y" +/* Line 1464 of yacc.c */ +#line 877 "parser.y" { (yyval.ctl)=ins_ctrl(CT_STATIC, SS_LEFT, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 89: -/* Line 1455 of yacc.c */ -#line 894 "parser.y" +/* Line 1464 of yacc.c */ +#line 878 "parser.y" { (yyval.ctl)=ins_ctrl(CT_STATIC, SS_CENTER, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 90: -/* Line 1455 of yacc.c */ -#line 895 "parser.y" +/* Line 1464 of yacc.c */ +#line 879 "parser.y" { (yyval.ctl)=ins_ctrl(CT_STATIC, SS_RIGHT, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 91: -/* Line 1455 of yacc.c */ -#line 897 "parser.y" +/* Line 1464 of yacc.c */ +#line 881 "parser.y" { (yyvsp[(10) - (10)].ctl)->title = (yyvsp[(3) - (10)].nid); (yyvsp[(10) - (10)].ctl)->id = (yyvsp[(5) - (10)].num); @@ -3178,8 +3181,8 @@ yyreduce: case 92: -/* Line 1455 of yacc.c */ -#line 907 "parser.y" +/* Line 1464 of yacc.c */ +#line 891 "parser.y" { (yyval.ctl)=new_control(); (yyval.ctl)->title = (yyvsp[(1) - (12)].nid); @@ -3204,8 +3207,8 @@ yyreduce: case 93: -/* Line 1455 of yacc.c */ -#line 930 "parser.y" +/* Line 1464 of yacc.c */ +#line 914 "parser.y" { (yyval.ctl) = new_control(); (yyval.ctl)->id = (yyvsp[(1) - (10)].num); @@ -3229,15 +3232,15 @@ yyreduce: case 94: -/* Line 1455 of yacc.c */ -#line 952 "parser.y" +/* Line 1464 of yacc.c */ +#line 936 "parser.y" { (yyval.ctl) = new_control(); ;} break; case 95: -/* Line 1455 of yacc.c */ -#line 954 "parser.y" +/* Line 1464 of yacc.c */ +#line 938 "parser.y" { (yyval.ctl) = new_control(); (yyval.ctl)->width = (yyvsp[(2) - (4)].num); @@ -3247,8 +3250,8 @@ yyreduce: case 96: -/* Line 1455 of yacc.c */ -#line 959 "parser.y" +/* Line 1464 of yacc.c */ +#line 943 "parser.y" { (yyval.ctl) = new_control(); (yyval.ctl)->width = (yyvsp[(2) - (6)].num); @@ -3260,8 +3263,8 @@ yyreduce: case 97: -/* Line 1455 of yacc.c */ -#line 966 "parser.y" +/* Line 1464 of yacc.c */ +#line 950 "parser.y" { (yyval.ctl) = new_control(); (yyval.ctl)->width = (yyvsp[(2) - (8)].num); @@ -3275,8 +3278,8 @@ yyreduce: case 98: -/* Line 1455 of yacc.c */ -#line 977 "parser.y" +/* Line 1464 of yacc.c */ +#line 961 "parser.y" { (yyval.ctl)=new_control(); (yyval.ctl)->title = (yyvsp[(1) - (17)].nid); @@ -3295,8 +3298,8 @@ yyreduce: case 99: -/* Line 1455 of yacc.c */ -#line 991 "parser.y" +/* Line 1464 of yacc.c */ +#line 975 "parser.y" { (yyval.ctl)=new_control(); (yyval.ctl)->title = (yyvsp[(1) - (15)].nid); @@ -3313,64 +3316,64 @@ yyreduce: case 100: -/* Line 1455 of yacc.c */ -#line 1006 "parser.y" +/* Line 1464 of yacc.c */ +#line 990 "parser.y" { (yyval.fntid) = new_font_id((yyvsp[(2) - (4)].num), (yyvsp[(4) - (4)].str), 0, 0); ;} break; case 101: -/* Line 1455 of yacc.c */ -#line 1011 "parser.y" +/* Line 1464 of yacc.c */ +#line 995 "parser.y" { (yyval.styles) = NULL; ;} break; case 102: -/* Line 1455 of yacc.c */ -#line 1012 "parser.y" +/* Line 1464 of yacc.c */ +#line 996 "parser.y" { (yyval.styles) = new_style_pair((yyvsp[(2) - (2)].style), 0); ;} break; case 103: -/* Line 1455 of yacc.c */ -#line 1013 "parser.y" +/* Line 1464 of yacc.c */ +#line 997 "parser.y" { (yyval.styles) = new_style_pair((yyvsp[(2) - (4)].style), (yyvsp[(4) - (4)].style)); ;} break; case 104: -/* Line 1455 of yacc.c */ -#line 1017 "parser.y" +/* Line 1464 of yacc.c */ +#line 1001 "parser.y" { (yyval.style) = new_style((yyvsp[(1) - (3)].style)->or_mask | (yyvsp[(3) - (3)].style)->or_mask, (yyvsp[(1) - (3)].style)->and_mask | (yyvsp[(3) - (3)].style)->and_mask); free((yyvsp[(1) - (3)].style)); free((yyvsp[(3) - (3)].style));;} break; case 105: -/* Line 1455 of yacc.c */ -#line 1018 "parser.y" +/* Line 1464 of yacc.c */ +#line 1002 "parser.y" { (yyval.style) = (yyvsp[(2) - (3)].style); ;} break; case 106: -/* Line 1455 of yacc.c */ -#line 1019 "parser.y" +/* Line 1464 of yacc.c */ +#line 1003 "parser.y" { (yyval.style) = new_style((yyvsp[(1) - (1)].num), 0); ;} break; case 107: -/* Line 1455 of yacc.c */ -#line 1020 "parser.y" +/* Line 1464 of yacc.c */ +#line 1004 "parser.y" { (yyval.style) = new_style(0, (yyvsp[(2) - (2)].num)); ;} break; case 108: -/* Line 1455 of yacc.c */ -#line 1024 "parser.y" +/* Line 1464 of yacc.c */ +#line 1008 "parser.y" { (yyval.nid) = new_name_id(); (yyval.nid)->type = name_ord; @@ -3380,8 +3383,8 @@ yyreduce: case 109: -/* Line 1455 of yacc.c */ -#line 1029 "parser.y" +/* Line 1464 of yacc.c */ +#line 1013 "parser.y" { (yyval.nid) = new_name_id(); (yyval.nid)->type = name_str; @@ -3391,257 +3394,257 @@ yyreduce: case 110: -/* Line 1455 of yacc.c */ -#line 1038 "parser.y" +/* Line 1464 of yacc.c */ +#line 1022 "parser.y" { if(!win32) parser_warning("DIALOGEX not supported in 16-bit mode\n"); if((yyvsp[(2) - (14)].iptr)) { - (yyvsp[(11) - (14)].dlgex)->memopt = *((yyvsp[(2) - (14)].iptr)); + (yyvsp[(11) - (14)].dlg)->memopt = *((yyvsp[(2) - (14)].iptr)); free((yyvsp[(2) - (14)].iptr)); } else - (yyvsp[(11) - (14)].dlgex)->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE | WRC_MO_DISCARDABLE; - (yyvsp[(11) - (14)].dlgex)->x = (yyvsp[(3) - (14)].num); - (yyvsp[(11) - (14)].dlgex)->y = (yyvsp[(5) - (14)].num); - (yyvsp[(11) - (14)].dlgex)->width = (yyvsp[(7) - (14)].num); - (yyvsp[(11) - (14)].dlgex)->height = (yyvsp[(9) - (14)].num); + (yyvsp[(11) - (14)].dlg)->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE | WRC_MO_DISCARDABLE; + (yyvsp[(11) - (14)].dlg)->x = (yyvsp[(3) - (14)].num); + (yyvsp[(11) - (14)].dlg)->y = (yyvsp[(5) - (14)].num); + (yyvsp[(11) - (14)].dlg)->width = (yyvsp[(7) - (14)].num); + (yyvsp[(11) - (14)].dlg)->height = (yyvsp[(9) - (14)].num); if((yyvsp[(10) - (14)].iptr)) { - (yyvsp[(11) - (14)].dlgex)->helpid = *((yyvsp[(10) - (14)].iptr)); - (yyvsp[(11) - (14)].dlgex)->gothelpid = TRUE; + (yyvsp[(11) - (14)].dlg)->helpid = *((yyvsp[(10) - (14)].iptr)); + (yyvsp[(11) - (14)].dlg)->gothelpid = TRUE; free((yyvsp[(10) - (14)].iptr)); } - (yyvsp[(11) - (14)].dlgex)->controls = get_control_head((yyvsp[(13) - (14)].ctl)); - (yyval.dlgex) = (yyvsp[(11) - (14)].dlgex); + (yyvsp[(11) - (14)].dlg)->controls = get_control_head((yyvsp[(13) - (14)].ctl)); + (yyval.dlg) = (yyvsp[(11) - (14)].dlg); - assert((yyval.dlgex)->style != NULL); - if(!(yyval.dlgex)->gotstyle) + assert((yyval.dlg)->style != NULL); + if(!(yyval.dlg)->gotstyle) { - (yyval.dlgex)->style->or_mask = WS_POPUP; - (yyval.dlgex)->gotstyle = TRUE; + (yyval.dlg)->style->or_mask = WS_POPUP; + (yyval.dlg)->gotstyle = TRUE; } - if((yyval.dlgex)->title) - (yyval.dlgex)->style->or_mask |= WS_CAPTION; - if((yyval.dlgex)->font) - (yyval.dlgex)->style->or_mask |= DS_SETFONT; + if((yyval.dlg)->title) + (yyval.dlg)->style->or_mask |= WS_CAPTION; + if((yyval.dlg)->font) + (yyval.dlg)->style->or_mask |= DS_SETFONT; - (yyval.dlgex)->style->or_mask &= ~((yyval.dlgex)->style->and_mask); - (yyval.dlgex)->style->and_mask = 0; + (yyval.dlg)->style->or_mask &= ~((yyval.dlg)->style->and_mask); + (yyval.dlg)->style->and_mask = 0; - if(!(yyval.dlgex)->lvc.language) - (yyval.dlgex)->lvc.language = dup_language(currentlanguage); + if(!(yyval.dlg)->lvc.language) + (yyval.dlg)->lvc.language = dup_language(currentlanguage); ;} break; case 111: -/* Line 1455 of yacc.c */ -#line 1081 "parser.y" - { (yyval.dlgex)=new_dialogex(); ;} +/* Line 1464 of yacc.c */ +#line 1065 "parser.y" + { (yyval.dlg)=new_dialog(); (yyval.dlg)->is_ex = TRUE; ;} break; case 112: -/* Line 1455 of yacc.c */ -#line 1082 "parser.y" - { (yyval.dlgex)=dialogex_style((yyvsp[(3) - (3)].style),(yyvsp[(1) - (3)].dlgex)); ;} +/* Line 1464 of yacc.c */ +#line 1066 "parser.y" + { (yyval.dlg)=dialog_style((yyvsp[(3) - (3)].style),(yyvsp[(1) - (3)].dlg)); ;} break; case 113: -/* Line 1455 of yacc.c */ -#line 1083 "parser.y" - { (yyval.dlgex)=dialogex_exstyle((yyvsp[(3) - (3)].style),(yyvsp[(1) - (3)].dlgex)); ;} +/* Line 1464 of yacc.c */ +#line 1067 "parser.y" + { (yyval.dlg)=dialog_exstyle((yyvsp[(3) - (3)].style),(yyvsp[(1) - (3)].dlg)); ;} break; case 114: -/* Line 1455 of yacc.c */ -#line 1084 "parser.y" - { (yyval.dlgex)=dialogex_caption((yyvsp[(3) - (3)].str),(yyvsp[(1) - (3)].dlgex)); ;} +/* Line 1464 of yacc.c */ +#line 1068 "parser.y" + { (yyval.dlg)=dialog_caption((yyvsp[(3) - (3)].str),(yyvsp[(1) - (3)].dlg)); ;} break; case 115: -/* Line 1455 of yacc.c */ -#line 1085 "parser.y" - { (yyval.dlgex)=dialogex_font((yyvsp[(2) - (2)].fntid),(yyvsp[(1) - (2)].dlgex)); ;} +/* Line 1464 of yacc.c */ +#line 1069 "parser.y" + { (yyval.dlg)=dialog_font((yyvsp[(2) - (2)].fntid),(yyvsp[(1) - (2)].dlg)); ;} break; case 116: -/* Line 1455 of yacc.c */ -#line 1086 "parser.y" - { (yyval.dlgex)=dialogex_font((yyvsp[(2) - (2)].fntid),(yyvsp[(1) - (2)].dlgex)); ;} +/* Line 1464 of yacc.c */ +#line 1070 "parser.y" + { (yyval.dlg)=dialog_font((yyvsp[(2) - (2)].fntid),(yyvsp[(1) - (2)].dlg)); ;} break; case 117: -/* Line 1455 of yacc.c */ -#line 1087 "parser.y" - { (yyval.dlgex)=dialogex_class((yyvsp[(3) - (3)].nid),(yyvsp[(1) - (3)].dlgex)); ;} +/* Line 1464 of yacc.c */ +#line 1071 "parser.y" + { (yyval.dlg)=dialog_class((yyvsp[(3) - (3)].nid),(yyvsp[(1) - (3)].dlg)); ;} break; case 118: -/* Line 1455 of yacc.c */ -#line 1088 "parser.y" - { (yyval.dlgex)=dialogex_menu((yyvsp[(3) - (3)].nid),(yyvsp[(1) - (3)].dlgex)); ;} +/* Line 1464 of yacc.c */ +#line 1072 "parser.y" + { (yyval.dlg)=dialog_menu((yyvsp[(3) - (3)].nid),(yyvsp[(1) - (3)].dlg)); ;} break; case 119: -/* Line 1455 of yacc.c */ -#line 1089 "parser.y" - { (yyval.dlgex)=dialogex_language((yyvsp[(2) - (2)].lan),(yyvsp[(1) - (2)].dlgex)); ;} +/* Line 1464 of yacc.c */ +#line 1073 "parser.y" + { (yyval.dlg)=dialog_language((yyvsp[(2) - (2)].lan),(yyvsp[(1) - (2)].dlg)); ;} break; case 120: -/* Line 1455 of yacc.c */ -#line 1090 "parser.y" - { (yyval.dlgex)=dialogex_characteristics((yyvsp[(2) - (2)].chars),(yyvsp[(1) - (2)].dlgex)); ;} +/* Line 1464 of yacc.c */ +#line 1074 "parser.y" + { (yyval.dlg)=dialog_characteristics((yyvsp[(2) - (2)].chars),(yyvsp[(1) - (2)].dlg)); ;} break; case 121: -/* Line 1455 of yacc.c */ -#line 1091 "parser.y" - { (yyval.dlgex)=dialogex_version((yyvsp[(2) - (2)].ver),(yyvsp[(1) - (2)].dlgex)); ;} +/* Line 1464 of yacc.c */ +#line 1075 "parser.y" + { (yyval.dlg)=dialog_version((yyvsp[(2) - (2)].ver),(yyvsp[(1) - (2)].dlg)); ;} break; case 122: -/* Line 1455 of yacc.c */ -#line 1094 "parser.y" +/* Line 1464 of yacc.c */ +#line 1078 "parser.y" { (yyval.ctl) = NULL; ;} break; case 123: -/* Line 1455 of yacc.c */ -#line 1095 "parser.y" +/* Line 1464 of yacc.c */ +#line 1079 "parser.y" { (yyval.ctl)=ins_ctrl(-1, 0, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 124: -/* Line 1455 of yacc.c */ -#line 1096 "parser.y" +/* Line 1464 of yacc.c */ +#line 1080 "parser.y" { (yyval.ctl)=ins_ctrl(CT_EDIT, 0, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 125: -/* Line 1455 of yacc.c */ -#line 1097 "parser.y" +/* Line 1464 of yacc.c */ +#line 1081 "parser.y" { (yyval.ctl)=ins_ctrl(CT_LISTBOX, 0, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 126: -/* Line 1455 of yacc.c */ -#line 1098 "parser.y" +/* Line 1464 of yacc.c */ +#line 1082 "parser.y" { (yyval.ctl)=ins_ctrl(CT_COMBOBOX, 0, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 127: -/* Line 1455 of yacc.c */ -#line 1099 "parser.y" +/* Line 1464 of yacc.c */ +#line 1083 "parser.y" { (yyval.ctl)=ins_ctrl(CT_SCROLLBAR, 0, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 128: -/* Line 1455 of yacc.c */ -#line 1100 "parser.y" +/* Line 1464 of yacc.c */ +#line 1084 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_CHECKBOX, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 129: -/* Line 1455 of yacc.c */ -#line 1101 "parser.y" +/* Line 1464 of yacc.c */ +#line 1085 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_DEFPUSHBUTTON, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 130: -/* Line 1455 of yacc.c */ -#line 1102 "parser.y" +/* Line 1464 of yacc.c */ +#line 1086 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_GROUPBOX, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl));;} break; case 131: -/* Line 1455 of yacc.c */ -#line 1103 "parser.y" +/* Line 1464 of yacc.c */ +#line 1087 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_PUSHBUTTON, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 132: -/* Line 1455 of yacc.c */ -#line 1105 "parser.y" +/* Line 1464 of yacc.c */ +#line 1089 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_RADIOBUTTON, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 133: -/* Line 1455 of yacc.c */ -#line 1106 "parser.y" +/* Line 1464 of yacc.c */ +#line 1090 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_AUTO3STATE, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 134: -/* Line 1455 of yacc.c */ -#line 1107 "parser.y" +/* Line 1464 of yacc.c */ +#line 1091 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_3STATE, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 135: -/* Line 1455 of yacc.c */ -#line 1108 "parser.y" +/* Line 1464 of yacc.c */ +#line 1092 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_AUTOCHECKBOX, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 136: -/* Line 1455 of yacc.c */ -#line 1109 "parser.y" +/* Line 1464 of yacc.c */ +#line 1093 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_AUTORADIOBUTTON, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 137: -/* Line 1455 of yacc.c */ -#line 1110 "parser.y" +/* Line 1464 of yacc.c */ +#line 1094 "parser.y" { (yyval.ctl)=ins_ctrl(CT_STATIC, SS_LEFT, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 138: -/* Line 1455 of yacc.c */ -#line 1111 "parser.y" +/* Line 1464 of yacc.c */ +#line 1095 "parser.y" { (yyval.ctl)=ins_ctrl(CT_STATIC, SS_CENTER, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 139: -/* Line 1455 of yacc.c */ -#line 1112 "parser.y" +/* Line 1464 of yacc.c */ +#line 1096 "parser.y" { (yyval.ctl)=ins_ctrl(CT_STATIC, SS_RIGHT, (yyvsp[(3) - (3)].ctl), (yyvsp[(1) - (3)].ctl)); ;} break; case 140: -/* Line 1455 of yacc.c */ -#line 1114 "parser.y" +/* Line 1464 of yacc.c */ +#line 1098 "parser.y" { (yyvsp[(10) - (10)].ctl)->title = (yyvsp[(3) - (10)].nid); (yyvsp[(10) - (10)].ctl)->id = (yyvsp[(5) - (10)].num); @@ -3653,8 +3656,8 @@ yyreduce: case 141: -/* Line 1455 of yacc.c */ -#line 1125 "parser.y" +/* Line 1464 of yacc.c */ +#line 1109 "parser.y" { (yyval.ctl)=new_control(); (yyval.ctl)->title = (yyvsp[(1) - (19)].nid); @@ -3683,8 +3686,8 @@ yyreduce: case 142: -/* Line 1455 of yacc.c */ -#line 1149 "parser.y" +/* Line 1464 of yacc.c */ +#line 1133 "parser.y" { (yyval.ctl)=new_control(); (yyval.ctl)->title = (yyvsp[(1) - (16)].nid); @@ -3702,8 +3705,8 @@ yyreduce: case 143: -/* Line 1455 of yacc.c */ -#line 1165 "parser.y" +/* Line 1464 of yacc.c */ +#line 1149 "parser.y" { (yyval.ctl)=new_control(); (yyval.ctl)->title = (yyvsp[(1) - (14)].nid); @@ -3731,8 +3734,8 @@ yyreduce: case 144: -/* Line 1455 of yacc.c */ -#line 1191 "parser.y" +/* Line 1464 of yacc.c */ +#line 1175 "parser.y" { (yyval.ctl) = new_control(); (yyval.ctl)->id = (yyvsp[(1) - (12)].num); @@ -3758,57 +3761,57 @@ yyreduce: case 145: -/* Line 1455 of yacc.c */ -#line 1214 "parser.y" +/* Line 1464 of yacc.c */ +#line 1198 "parser.y" { (yyval.raw) = NULL; ;} break; case 146: -/* Line 1455 of yacc.c */ -#line 1215 "parser.y" +/* Line 1464 of yacc.c */ +#line 1199 "parser.y" { (yyval.raw) = (yyvsp[(1) - (1)].raw); ;} break; case 147: -/* Line 1455 of yacc.c */ -#line 1218 "parser.y" +/* Line 1464 of yacc.c */ +#line 1202 "parser.y" { (yyval.iptr) = NULL; ;} break; case 148: -/* Line 1455 of yacc.c */ -#line 1219 "parser.y" +/* Line 1464 of yacc.c */ +#line 1203 "parser.y" { (yyval.iptr) = new_int((yyvsp[(2) - (2)].num)); ;} break; case 149: -/* Line 1455 of yacc.c */ -#line 1223 "parser.y" +/* Line 1464 of yacc.c */ +#line 1207 "parser.y" { (yyval.fntid) = new_font_id((yyvsp[(2) - (9)].num), (yyvsp[(4) - (9)].str), (yyvsp[(6) - (9)].num), (yyvsp[(8) - (9)].num)); ;} break; case 150: -/* Line 1455 of yacc.c */ -#line 1230 "parser.y" +/* Line 1464 of yacc.c */ +#line 1214 "parser.y" { (yyval.fntid) = NULL; ;} break; case 151: -/* Line 1455 of yacc.c */ -#line 1231 "parser.y" +/* Line 1464 of yacc.c */ +#line 1215 "parser.y" { (yyval.fntid) = NULL; ;} break; case 152: -/* Line 1455 of yacc.c */ -#line 1235 "parser.y" +/* Line 1464 of yacc.c */ +#line 1219 "parser.y" { if(!(yyvsp[(4) - (4)].menitm)) yyerror("Menu must contain items"); @@ -3833,22 +3836,22 @@ yyreduce: case 153: -/* Line 1455 of yacc.c */ -#line 1258 "parser.y" +/* Line 1464 of yacc.c */ +#line 1242 "parser.y" { (yyval.menitm) = (yyvsp[(2) - (3)].menitm); ;} break; case 154: -/* Line 1455 of yacc.c */ -#line 1262 "parser.y" +/* Line 1464 of yacc.c */ +#line 1246 "parser.y" {(yyval.menitm) = NULL;;} break; case 155: -/* Line 1455 of yacc.c */ -#line 1263 "parser.y" +/* Line 1464 of yacc.c */ +#line 1247 "parser.y" { (yyval.menitm)=new_menu_item(); (yyval.menitm)->prev = (yyvsp[(1) - (6)].menitm); @@ -3862,8 +3865,8 @@ yyreduce: case 156: -/* Line 1455 of yacc.c */ -#line 1272 "parser.y" +/* Line 1464 of yacc.c */ +#line 1256 "parser.y" { (yyval.menitm)=new_menu_item(); (yyval.menitm)->prev = (yyvsp[(1) - (3)].menitm); @@ -3874,8 +3877,8 @@ yyreduce: case 157: -/* Line 1455 of yacc.c */ -#line 1278 "parser.y" +/* Line 1464 of yacc.c */ +#line 1262 "parser.y" { (yyval.menitm) = new_menu_item(); (yyval.menitm)->prev = (yyvsp[(1) - (5)].menitm); @@ -3888,173 +3891,181 @@ yyreduce: case 158: -/* Line 1455 of yacc.c */ -#line 1297 "parser.y" +/* Line 1464 of yacc.c */ +#line 1281 "parser.y" { (yyval.num) = 0; ;} break; case 159: -/* Line 1455 of yacc.c */ -#line 1298 "parser.y" - { (yyval.num) = (yyvsp[(3) - (3)].num) | MF_CHECKED; ;} +/* Line 1464 of yacc.c */ +#line 1282 "parser.y" + { (yyval.num) = (yyvsp[(2) - (2)].num); ;} break; case 160: -/* Line 1455 of yacc.c */ -#line 1299 "parser.y" - { (yyval.num) = (yyvsp[(3) - (3)].num) | MF_GRAYED; ;} +/* Line 1464 of yacc.c */ +#line 1283 "parser.y" + { (yyval.num) = (yyvsp[(2) - (2)].num) | MF_CHECKED; ;} break; case 161: -/* Line 1455 of yacc.c */ -#line 1300 "parser.y" - { (yyval.num) = (yyvsp[(3) - (3)].num) | MF_HELP; ;} +/* Line 1464 of yacc.c */ +#line 1284 "parser.y" + { (yyval.num) = (yyvsp[(2) - (2)].num) | MF_GRAYED; ;} break; case 162: -/* Line 1455 of yacc.c */ -#line 1301 "parser.y" - { (yyval.num) = (yyvsp[(3) - (3)].num) | MF_DISABLED; ;} +/* Line 1464 of yacc.c */ +#line 1285 "parser.y" + { (yyval.num) = (yyvsp[(2) - (2)].num) | MF_HELP; ;} break; case 163: -/* Line 1455 of yacc.c */ -#line 1302 "parser.y" - { (yyval.num) = (yyvsp[(3) - (3)].num) | MF_MENUBARBREAK; ;} +/* Line 1464 of yacc.c */ +#line 1286 "parser.y" + { (yyval.num) = (yyvsp[(2) - (2)].num) | MF_DISABLED; ;} break; case 164: -/* Line 1455 of yacc.c */ -#line 1303 "parser.y" - { (yyval.num) = (yyvsp[(3) - (3)].num) | MF_MENUBREAK; ;} +/* Line 1464 of yacc.c */ +#line 1287 "parser.y" + { (yyval.num) = (yyvsp[(2) - (2)].num) | MF_MENUBARBREAK; ;} break; case 165: -/* Line 1455 of yacc.c */ -#line 1307 "parser.y" - { - if(!win32) - parser_warning("MENUEX not supported in 16-bit mode\n"); - if(!(yyvsp[(4) - (4)].menexitm)) - yyerror("MenuEx must contain items"); - (yyval.menex) = new_menuex(); - if((yyvsp[(2) - (4)].iptr)) - { - (yyval.menex)->memopt = *((yyvsp[(2) - (4)].iptr)); - free((yyvsp[(2) - (4)].iptr)); - } - else - (yyval.menex)->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE | WRC_MO_DISCARDABLE; - (yyval.menex)->items = get_itemex_head((yyvsp[(4) - (4)].menexitm)); - if((yyvsp[(3) - (4)].lvc)) - { - (yyval.menex)->lvc = *((yyvsp[(3) - (4)].lvc)); - free((yyvsp[(3) - (4)].lvc)); - } - if(!(yyval.menex)->lvc.language) - (yyval.menex)->lvc.language = dup_language(currentlanguage); - ;} +/* Line 1464 of yacc.c */ +#line 1288 "parser.y" + { (yyval.num) = (yyvsp[(2) - (2)].num) | MF_MENUBREAK; ;} break; case 166: -/* Line 1455 of yacc.c */ -#line 1332 "parser.y" - { (yyval.menexitm) = (yyvsp[(2) - (3)].menexitm); ;} +/* Line 1464 of yacc.c */ +#line 1292 "parser.y" + { + if(!win32) + parser_warning("MENUEX not supported in 16-bit mode\n"); + if(!(yyvsp[(4) - (4)].menitm)) + yyerror("MenuEx must contain items"); + (yyval.men) = new_menu(); + (yyval.men)->is_ex = TRUE; + if((yyvsp[(2) - (4)].iptr)) + { + (yyval.men)->memopt = *((yyvsp[(2) - (4)].iptr)); + free((yyvsp[(2) - (4)].iptr)); + } + else + (yyval.men)->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE | WRC_MO_DISCARDABLE; + (yyval.men)->items = get_item_head((yyvsp[(4) - (4)].menitm)); + if((yyvsp[(3) - (4)].lvc)) + { + (yyval.men)->lvc = *((yyvsp[(3) - (4)].lvc)); + free((yyvsp[(3) - (4)].lvc)); + } + if(!(yyval.men)->lvc.language) + (yyval.men)->lvc.language = dup_language(currentlanguage); + ;} break; case 167: -/* Line 1455 of yacc.c */ -#line 1336 "parser.y" - {(yyval.menexitm) = NULL; ;} +/* Line 1464 of yacc.c */ +#line 1318 "parser.y" + { (yyval.menitm) = (yyvsp[(2) - (3)].menitm); ;} break; case 168: -/* Line 1455 of yacc.c */ -#line 1337 "parser.y" - { - (yyval.menexitm) = new_menuex_item(); - (yyval.menexitm)->prev = (yyvsp[(1) - (4)].menexitm); - if((yyvsp[(1) - (4)].menexitm)) - (yyvsp[(1) - (4)].menexitm)->next = (yyval.menexitm); - (yyval.menexitm)->name = (yyvsp[(3) - (4)].str); - (yyval.menexitm)->id = (yyvsp[(4) - (4)].exopt)->id; - (yyval.menexitm)->type = (yyvsp[(4) - (4)].exopt)->type; - (yyval.menexitm)->state = (yyvsp[(4) - (4)].exopt)->state; - (yyval.menexitm)->helpid = (yyvsp[(4) - (4)].exopt)->helpid; - (yyval.menexitm)->gotid = (yyvsp[(4) - (4)].exopt)->gotid; - (yyval.menexitm)->gottype = (yyvsp[(4) - (4)].exopt)->gottype; - (yyval.menexitm)->gotstate = (yyvsp[(4) - (4)].exopt)->gotstate; - (yyval.menexitm)->gothelpid = (yyvsp[(4) - (4)].exopt)->gothelpid; - free((yyvsp[(4) - (4)].exopt)); - ;} +/* Line 1464 of yacc.c */ +#line 1322 "parser.y" + {(yyval.menitm) = NULL; ;} break; case 169: -/* Line 1455 of yacc.c */ -#line 1353 "parser.y" +/* Line 1464 of yacc.c */ +#line 1323 "parser.y" { - (yyval.menexitm) = new_menuex_item(); - (yyval.menexitm)->prev = (yyvsp[(1) - (3)].menexitm); - if((yyvsp[(1) - (3)].menexitm)) - (yyvsp[(1) - (3)].menexitm)->next = (yyval.menexitm); + (yyval.menitm) = new_menu_item(); + (yyval.menitm)->prev = (yyvsp[(1) - (4)].menitm); + if((yyvsp[(1) - (4)].menitm)) + (yyvsp[(1) - (4)].menitm)->next = (yyval.menitm); + (yyval.menitm)->name = (yyvsp[(3) - (4)].str); + (yyval.menitm)->id = (yyvsp[(4) - (4)].exopt)->id; + (yyval.menitm)->type = (yyvsp[(4) - (4)].exopt)->type; + (yyval.menitm)->state = (yyvsp[(4) - (4)].exopt)->state; + (yyval.menitm)->helpid = (yyvsp[(4) - (4)].exopt)->helpid; + (yyval.menitm)->gotid = (yyvsp[(4) - (4)].exopt)->gotid; + (yyval.menitm)->gottype = (yyvsp[(4) - (4)].exopt)->gottype; + (yyval.menitm)->gotstate = (yyvsp[(4) - (4)].exopt)->gotstate; + (yyval.menitm)->gothelpid = (yyvsp[(4) - (4)].exopt)->gothelpid; + free((yyvsp[(4) - (4)].exopt)); ;} break; case 170: -/* Line 1455 of yacc.c */ -#line 1359 "parser.y" +/* Line 1464 of yacc.c */ +#line 1339 "parser.y" { - (yyval.menexitm) = new_menuex_item(); - (yyval.menexitm)->prev = (yyvsp[(1) - (5)].menexitm); - if((yyvsp[(1) - (5)].menexitm)) - (yyvsp[(1) - (5)].menexitm)->next = (yyval.menexitm); - (yyval.menexitm)->popup = get_itemex_head((yyvsp[(5) - (5)].menexitm)); - (yyval.menexitm)->name = (yyvsp[(3) - (5)].str); - (yyval.menexitm)->id = (yyvsp[(4) - (5)].exopt)->id; - (yyval.menexitm)->type = (yyvsp[(4) - (5)].exopt)->type; - (yyval.menexitm)->state = (yyvsp[(4) - (5)].exopt)->state; - (yyval.menexitm)->helpid = (yyvsp[(4) - (5)].exopt)->helpid; - (yyval.menexitm)->gotid = (yyvsp[(4) - (5)].exopt)->gotid; - (yyval.menexitm)->gottype = (yyvsp[(4) - (5)].exopt)->gottype; - (yyval.menexitm)->gotstate = (yyvsp[(4) - (5)].exopt)->gotstate; - (yyval.menexitm)->gothelpid = (yyvsp[(4) - (5)].exopt)->gothelpid; - free((yyvsp[(4) - (5)].exopt)); + (yyval.menitm) = new_menu_item(); + (yyval.menitm)->prev = (yyvsp[(1) - (3)].menitm); + if((yyvsp[(1) - (3)].menitm)) + (yyvsp[(1) - (3)].menitm)->next = (yyval.menitm); ;} break; case 171: -/* Line 1455 of yacc.c */ -#line 1379 "parser.y" - { (yyval.exopt) = new_itemex_opt(0, 0, 0, 0); ;} +/* Line 1464 of yacc.c */ +#line 1345 "parser.y" + { + (yyval.menitm) = new_menu_item(); + (yyval.menitm)->prev = (yyvsp[(1) - (5)].menitm); + if((yyvsp[(1) - (5)].menitm)) + (yyvsp[(1) - (5)].menitm)->next = (yyval.menitm); + (yyval.menitm)->popup = get_item_head((yyvsp[(5) - (5)].menitm)); + (yyval.menitm)->name = (yyvsp[(3) - (5)].str); + (yyval.menitm)->id = (yyvsp[(4) - (5)].exopt)->id; + (yyval.menitm)->type = (yyvsp[(4) - (5)].exopt)->type; + (yyval.menitm)->state = (yyvsp[(4) - (5)].exopt)->state; + (yyval.menitm)->helpid = (yyvsp[(4) - (5)].exopt)->helpid; + (yyval.menitm)->gotid = (yyvsp[(4) - (5)].exopt)->gotid; + (yyval.menitm)->gottype = (yyvsp[(4) - (5)].exopt)->gottype; + (yyval.menitm)->gotstate = (yyvsp[(4) - (5)].exopt)->gotstate; + (yyval.menitm)->gothelpid = (yyvsp[(4) - (5)].exopt)->gothelpid; + free((yyvsp[(4) - (5)].exopt)); + ;} break; case 172: -/* Line 1455 of yacc.c */ -#line 1380 "parser.y" +/* Line 1464 of yacc.c */ +#line 1365 "parser.y" + { (yyval.exopt) = new_itemex_opt(0, 0, 0, 0); ;} + break; + + case 173: + +/* Line 1464 of yacc.c */ +#line 1366 "parser.y" { (yyval.exopt) = new_itemex_opt((yyvsp[(2) - (2)].num), 0, 0, 0); (yyval.exopt)->gotid = TRUE; ;} break; - case 173: + case 174: -/* Line 1455 of yacc.c */ -#line 1384 "parser.y" +/* Line 1464 of yacc.c */ +#line 1370 "parser.y" { (yyval.exopt) = new_itemex_opt((yyvsp[(2) - (5)].iptr) ? *((yyvsp[(2) - (5)].iptr)) : 0, (yyvsp[(4) - (5)].iptr) ? *((yyvsp[(4) - (5)].iptr)) : 0, (yyvsp[(5) - (5)].num), 0); (yyval.exopt)->gotid = TRUE; @@ -4065,10 +4076,10 @@ yyreduce: ;} break; - case 174: + case 175: -/* Line 1455 of yacc.c */ -#line 1392 "parser.y" +/* Line 1464 of yacc.c */ +#line 1378 "parser.y" { (yyval.exopt) = new_itemex_opt((yyvsp[(2) - (6)].iptr) ? *((yyvsp[(2) - (6)].iptr)) : 0, (yyvsp[(4) - (6)].iptr) ? *((yyvsp[(4) - (6)].iptr)) : 0, (yyvsp[(6) - (6)].num), 0); (yyval.exopt)->gotid = TRUE; @@ -4079,27 +4090,27 @@ yyreduce: ;} break; - case 175: + case 176: -/* Line 1455 of yacc.c */ -#line 1403 "parser.y" +/* Line 1464 of yacc.c */ +#line 1389 "parser.y" { (yyval.exopt) = new_itemex_opt(0, 0, 0, 0); ;} break; - case 176: + case 177: -/* Line 1455 of yacc.c */ -#line 1404 "parser.y" +/* Line 1464 of yacc.c */ +#line 1390 "parser.y" { (yyval.exopt) = new_itemex_opt((yyvsp[(2) - (2)].num), 0, 0, 0); (yyval.exopt)->gotid = TRUE; ;} break; - case 177: + case 178: -/* Line 1455 of yacc.c */ -#line 1408 "parser.y" +/* Line 1464 of yacc.c */ +#line 1394 "parser.y" { (yyval.exopt) = new_itemex_opt((yyvsp[(2) - (4)].iptr) ? *((yyvsp[(2) - (4)].iptr)) : 0, (yyvsp[(4) - (4)].num), 0, 0); free((yyvsp[(2) - (4)].iptr)); @@ -4108,10 +4119,10 @@ yyreduce: ;} break; - case 178: + case 179: -/* Line 1455 of yacc.c */ -#line 1414 "parser.y" +/* Line 1464 of yacc.c */ +#line 1400 "parser.y" { (yyval.exopt) = new_itemex_opt((yyvsp[(2) - (6)].iptr) ? *((yyvsp[(2) - (6)].iptr)) : 0, (yyvsp[(4) - (6)].iptr) ? *((yyvsp[(4) - (6)].iptr)) : 0, (yyvsp[(6) - (6)].num), 0); free((yyvsp[(2) - (6)].iptr)); @@ -4122,10 +4133,10 @@ yyreduce: ;} break; - case 179: + case 180: -/* Line 1455 of yacc.c */ -#line 1422 "parser.y" +/* Line 1464 of yacc.c */ +#line 1408 "parser.y" { (yyval.exopt) = new_itemex_opt((yyvsp[(2) - (8)].iptr) ? *((yyvsp[(2) - (8)].iptr)) : 0, (yyvsp[(4) - (8)].iptr) ? *((yyvsp[(4) - (8)].iptr)) : 0, (yyvsp[(6) - (8)].iptr) ? *((yyvsp[(6) - (8)].iptr)) : 0, (yyvsp[(8) - (8)].num)); free((yyvsp[(2) - (8)].iptr)); @@ -4138,10 +4149,10 @@ yyreduce: ;} break; - case 180: + case 181: -/* Line 1455 of yacc.c */ -#line 1442 "parser.y" +/* Line 1464 of yacc.c */ +#line 1428 "parser.y" { if(!(yyvsp[(3) - (4)].stt)) { @@ -4179,10 +4190,10 @@ yyreduce: ;} break; - case 181: + case 182: -/* Line 1455 of yacc.c */ -#line 1480 "parser.y" +/* Line 1464 of yacc.c */ +#line 1466 "parser.y" { if((tagstt = find_stringtable((yyvsp[(3) - (3)].lvc))) == NULL) tagstt = new_stringtable((yyvsp[(3) - (3)].lvc)); @@ -4193,17 +4204,17 @@ yyreduce: ;} break; - case 182: + case 183: -/* Line 1455 of yacc.c */ -#line 1490 "parser.y" +/* Line 1464 of yacc.c */ +#line 1476 "parser.y" { (yyval.stt) = NULL; ;} break; - case 183: + case 184: -/* Line 1455 of yacc.c */ -#line 1491 "parser.y" +/* Line 1464 of yacc.c */ +#line 1477 "parser.y" { int i; assert(tagstt != NULL); @@ -4237,10 +4248,10 @@ yyreduce: ;} break; - case 186: + case 187: -/* Line 1455 of yacc.c */ -#line 1531 "parser.y" +/* Line 1464 of yacc.c */ +#line 1517 "parser.y" { (yyval.veri) = (yyvsp[(3) - (6)].veri); if((yyvsp[(2) - (6)].iptr)) @@ -4256,17 +4267,17 @@ yyreduce: ;} break; - case 187: + case 188: -/* Line 1455 of yacc.c */ -#line 1547 "parser.y" +/* Line 1464 of yacc.c */ +#line 1533 "parser.y" { (yyval.veri) = new_versioninfo(); ;} break; - case 188: + case 189: -/* Line 1455 of yacc.c */ -#line 1548 "parser.y" +/* Line 1464 of yacc.c */ +#line 1534 "parser.y" { if((yyvsp[(1) - (9)].veri)->gotit.fv) yyerror("FILEVERSION already defined"); @@ -4279,10 +4290,10 @@ yyreduce: ;} break; - case 189: + case 190: -/* Line 1455 of yacc.c */ -#line 1558 "parser.y" +/* Line 1464 of yacc.c */ +#line 1544 "parser.y" { if((yyvsp[(1) - (9)].veri)->gotit.pv) yyerror("PRODUCTVERSION already defined"); @@ -4295,10 +4306,10 @@ yyreduce: ;} break; - case 190: + case 191: -/* Line 1455 of yacc.c */ -#line 1568 "parser.y" +/* Line 1464 of yacc.c */ +#line 1554 "parser.y" { if((yyvsp[(1) - (3)].veri)->gotit.ff) yyerror("FILEFLAGS already defined"); @@ -4308,10 +4319,10 @@ yyreduce: ;} break; - case 191: + case 192: -/* Line 1455 of yacc.c */ -#line 1575 "parser.y" +/* Line 1464 of yacc.c */ +#line 1561 "parser.y" { if((yyvsp[(1) - (3)].veri)->gotit.ffm) yyerror("FILEFLAGSMASK already defined"); @@ -4321,10 +4332,10 @@ yyreduce: ;} break; - case 192: + case 193: -/* Line 1455 of yacc.c */ -#line 1582 "parser.y" +/* Line 1464 of yacc.c */ +#line 1568 "parser.y" { if((yyvsp[(1) - (3)].veri)->gotit.fo) yyerror("FILEOS already defined"); @@ -4334,10 +4345,10 @@ yyreduce: ;} break; - case 193: + case 194: -/* Line 1455 of yacc.c */ -#line 1589 "parser.y" +/* Line 1464 of yacc.c */ +#line 1575 "parser.y" { if((yyvsp[(1) - (3)].veri)->gotit.ft) yyerror("FILETYPE already defined"); @@ -4347,10 +4358,10 @@ yyreduce: ;} break; - case 194: + case 195: -/* Line 1455 of yacc.c */ -#line 1596 "parser.y" +/* Line 1464 of yacc.c */ +#line 1582 "parser.y" { if((yyvsp[(1) - (3)].veri)->gotit.fst) yyerror("FILESUBTYPE already defined"); @@ -4360,17 +4371,17 @@ yyreduce: ;} break; - case 195: + case 196: -/* Line 1455 of yacc.c */ -#line 1606 "parser.y" +/* Line 1464 of yacc.c */ +#line 1592 "parser.y" { (yyval.blk) = NULL; ;} break; - case 196: + case 197: -/* Line 1455 of yacc.c */ -#line 1607 "parser.y" +/* Line 1464 of yacc.c */ +#line 1593 "parser.y" { (yyval.blk) = (yyvsp[(2) - (2)].blk); (yyval.blk)->prev = (yyvsp[(1) - (2)].blk); @@ -4379,10 +4390,10 @@ yyreduce: ;} break; - case 197: + case 198: -/* Line 1455 of yacc.c */ -#line 1616 "parser.y" +/* Line 1464 of yacc.c */ +#line 1602 "parser.y" { (yyval.blk) = new_ver_block(); (yyval.blk)->name = (yyvsp[(2) - (5)].str); @@ -4390,17 +4401,17 @@ yyreduce: ;} break; - case 198: + case 199: -/* Line 1455 of yacc.c */ -#line 1624 "parser.y" +/* Line 1464 of yacc.c */ +#line 1610 "parser.y" { (yyval.val) = NULL; ;} break; - case 199: + case 200: -/* Line 1455 of yacc.c */ -#line 1625 "parser.y" +/* Line 1464 of yacc.c */ +#line 1611 "parser.y" { (yyval.val) = (yyvsp[(2) - (2)].val); (yyval.val)->prev = (yyvsp[(1) - (2)].val); @@ -4409,10 +4420,10 @@ yyreduce: ;} break; - case 200: + case 201: -/* Line 1455 of yacc.c */ -#line 1634 "parser.y" +/* Line 1464 of yacc.c */ +#line 1620 "parser.y" { (yyval.val) = new_ver_value(); (yyval.val)->type = val_block; @@ -4420,10 +4431,10 @@ yyreduce: ;} break; - case 201: + case 202: -/* Line 1455 of yacc.c */ -#line 1639 "parser.y" +/* Line 1464 of yacc.c */ +#line 1625 "parser.y" { (yyval.val) = new_ver_value(); (yyval.val)->type = val_str; @@ -4432,10 +4443,10 @@ yyreduce: ;} break; - case 202: + case 203: -/* Line 1455 of yacc.c */ -#line 1645 "parser.y" +/* Line 1464 of yacc.c */ +#line 1631 "parser.y" { (yyval.val) = new_ver_value(); (yyval.val)->type = val_words; @@ -4444,24 +4455,24 @@ yyreduce: ;} break; - case 203: - -/* Line 1455 of yacc.c */ -#line 1654 "parser.y" - { (yyval.verw) = new_ver_words((yyvsp[(1) - (1)].num)); ;} - break; - case 204: -/* Line 1455 of yacc.c */ -#line 1655 "parser.y" - { (yyval.verw) = add_ver_words((yyvsp[(1) - (3)].verw), (yyvsp[(3) - (3)].num)); ;} +/* Line 1464 of yacc.c */ +#line 1640 "parser.y" + { (yyval.verw) = new_ver_words((yyvsp[(1) - (1)].num)); ;} break; case 205: -/* Line 1455 of yacc.c */ -#line 1659 "parser.y" +/* Line 1464 of yacc.c */ +#line 1641 "parser.y" + { (yyval.verw) = add_ver_words((yyvsp[(1) - (3)].verw), (yyvsp[(3) - (3)].num)); ;} + break; + + case 206: + +/* Line 1464 of yacc.c */ +#line 1645 "parser.y" { int nitems; toolbar_item_t *items = get_tlbr_buttons_head((yyvsp[(8) - (9)].tlbarItems), &nitems); @@ -4487,17 +4498,17 @@ yyreduce: ;} break; - case 206: + case 207: -/* Line 1455 of yacc.c */ -#line 1685 "parser.y" +/* Line 1464 of yacc.c */ +#line 1671 "parser.y" { (yyval.tlbarItems) = NULL; ;} break; - case 207: + case 208: -/* Line 1455 of yacc.c */ -#line 1686 "parser.y" +/* Line 1464 of yacc.c */ +#line 1672 "parser.y" { toolbar_item_t *idrec = new_toolbar_item(); idrec->id = (yyvsp[(3) - (3)].num); @@ -4505,10 +4516,10 @@ yyreduce: ;} break; - case 208: + case 209: -/* Line 1455 of yacc.c */ -#line 1691 "parser.y" +/* Line 1464 of yacc.c */ +#line 1677 "parser.y" { toolbar_item_t *idrec = new_toolbar_item(); idrec->id = 0; @@ -4516,17 +4527,17 @@ yyreduce: ;} break; - case 209: + case 210: -/* Line 1455 of yacc.c */ -#line 1700 "parser.y" +/* Line 1464 of yacc.c */ +#line 1686 "parser.y" { (yyval.iptr) = NULL; ;} break; - case 210: + case 211: -/* Line 1455 of yacc.c */ -#line 1701 "parser.y" +/* Line 1464 of yacc.c */ +#line 1687 "parser.y" { if((yyvsp[(1) - (2)].iptr)) { @@ -4539,10 +4550,10 @@ yyreduce: ;} break; - case 211: + case 212: -/* Line 1455 of yacc.c */ -#line 1711 "parser.y" +/* Line 1464 of yacc.c */ +#line 1697 "parser.y" { if((yyvsp[(1) - (2)].iptr)) { @@ -4558,66 +4569,73 @@ yyreduce: ;} break; - case 212: - -/* Line 1455 of yacc.c */ -#line 1726 "parser.y" - { (yyval.iptr) = new_int(WRC_MO_PRELOAD); ;} - break; - case 213: -/* Line 1455 of yacc.c */ -#line 1727 "parser.y" - { (yyval.iptr) = new_int(WRC_MO_MOVEABLE); ;} +/* Line 1464 of yacc.c */ +#line 1712 "parser.y" + { (yyval.iptr) = new_int(WRC_MO_PRELOAD); + if (win32 && pedantic) parser_warning("PRELOAD is ignored in 32-bit mode\n"); ;} break; case 214: -/* Line 1455 of yacc.c */ -#line 1728 "parser.y" - { (yyval.iptr) = new_int(WRC_MO_DISCARDABLE); ;} +/* Line 1464 of yacc.c */ +#line 1714 "parser.y" + { (yyval.iptr) = new_int(WRC_MO_MOVEABLE); + if (win32 && pedantic) parser_warning("MOVEABLE is ignored in 32-bit mode\n"); ;} break; case 215: -/* Line 1455 of yacc.c */ -#line 1729 "parser.y" - { (yyval.iptr) = new_int(WRC_MO_PURE); ;} +/* Line 1464 of yacc.c */ +#line 1716 "parser.y" + { (yyval.iptr) = new_int(WRC_MO_DISCARDABLE); + if (win32 && pedantic) parser_warning("DISCARDABLE is ignored in 32-bit mode\n"); ;} break; case 216: -/* Line 1455 of yacc.c */ -#line 1732 "parser.y" - { (yyval.iptr) = new_int(~WRC_MO_PRELOAD); ;} +/* Line 1464 of yacc.c */ +#line 1718 "parser.y" + { (yyval.iptr) = new_int(WRC_MO_PURE); + if (win32 && pedantic) parser_warning("PURE is ignored in 32-bit mode\n"); ;} break; case 217: -/* Line 1455 of yacc.c */ -#line 1733 "parser.y" - { (yyval.iptr) = new_int(~WRC_MO_MOVEABLE); ;} +/* Line 1464 of yacc.c */ +#line 1722 "parser.y" + { (yyval.iptr) = new_int(~WRC_MO_PRELOAD); + if (win32 && pedantic) parser_warning("LOADONCALL is ignored in 32-bit mode\n"); ;} break; case 218: -/* Line 1455 of yacc.c */ -#line 1734 "parser.y" - { (yyval.iptr) = new_int(~WRC_MO_PURE); ;} +/* Line 1464 of yacc.c */ +#line 1724 "parser.y" + { (yyval.iptr) = new_int(~WRC_MO_MOVEABLE); + if (win32 && pedantic) parser_warning("FIXED is ignored in 32-bit mode\n"); ;} break; case 219: -/* Line 1455 of yacc.c */ -#line 1738 "parser.y" - { (yyval.lvc) = new_lvc(); ;} +/* Line 1464 of yacc.c */ +#line 1726 "parser.y" + { (yyval.iptr) = new_int(~WRC_MO_PURE); + if (win32 && pedantic) parser_warning("IMPURE is ignored in 32-bit mode\n"); ;} break; case 220: -/* Line 1455 of yacc.c */ -#line 1739 "parser.y" +/* Line 1464 of yacc.c */ +#line 1731 "parser.y" + { (yyval.lvc) = new_lvc(); ;} + break; + + case 221: + +/* Line 1464 of yacc.c */ +#line 1732 "parser.y" { if(!win32) parser_warning("LANGUAGE not supported in 16-bit mode\n"); @@ -4628,10 +4646,10 @@ yyreduce: ;} break; - case 221: + case 222: -/* Line 1455 of yacc.c */ -#line 1747 "parser.y" +/* Line 1464 of yacc.c */ +#line 1740 "parser.y" { if(!win32) parser_warning("CHARACTERISTICS not supported in 16-bit mode\n"); @@ -4642,10 +4660,10 @@ yyreduce: ;} break; - case 222: + case 223: -/* Line 1455 of yacc.c */ -#line 1755 "parser.y" +/* Line 1464 of yacc.c */ +#line 1748 "parser.y" { if(!win32) parser_warning("VERSION not supported in 16-bit mode\n"); @@ -4656,34 +4674,34 @@ yyreduce: ;} break; - case 223: + case 224: -/* Line 1455 of yacc.c */ -#line 1773 "parser.y" +/* Line 1464 of yacc.c */ +#line 1766 "parser.y" { (yyval.lan) = new_language((yyvsp[(2) - (4)].num), (yyvsp[(4) - (4)].num)); if (get_language_codepage((yyvsp[(2) - (4)].num), (yyvsp[(4) - (4)].num)) == -1) yyerror( "Language %04x is not supported", ((yyvsp[(4) - (4)].num)<<10) + (yyvsp[(2) - (4)].num)); ;} break; - case 224: - -/* Line 1455 of yacc.c */ -#line 1780 "parser.y" - { (yyval.chars) = new_characts((yyvsp[(2) - (2)].num)); ;} - break; - case 225: -/* Line 1455 of yacc.c */ -#line 1784 "parser.y" - { (yyval.ver) = new_version((yyvsp[(2) - (2)].num)); ;} +/* Line 1464 of yacc.c */ +#line 1773 "parser.y" + { (yyval.chars) = new_characts((yyvsp[(2) - (2)].num)); ;} break; case 226: -/* Line 1455 of yacc.c */ -#line 1788 "parser.y" +/* Line 1464 of yacc.c */ +#line 1777 "parser.y" + { (yyval.ver) = new_version((yyvsp[(2) - (2)].num)); ;} + break; + + case 227: + +/* Line 1464 of yacc.c */ +#line 1781 "parser.y" { if((yyvsp[(1) - (4)].lvc)) { @@ -4698,234 +4716,234 @@ yyreduce: ;} break; - case 227: - -/* Line 1455 of yacc.c */ -#line 1803 "parser.y" - { (yyval.raw) = (yyvsp[(1) - (1)].raw); ;} - break; - case 228: -/* Line 1455 of yacc.c */ -#line 1804 "parser.y" - { (yyval.raw) = int2raw_data((yyvsp[(1) - (1)].num)); ;} +/* Line 1464 of yacc.c */ +#line 1796 "parser.y" + { (yyval.raw) = (yyvsp[(1) - (1)].raw); ;} break; case 229: -/* Line 1455 of yacc.c */ -#line 1805 "parser.y" - { (yyval.raw) = int2raw_data(-((yyvsp[(2) - (2)].num))); ;} +/* Line 1464 of yacc.c */ +#line 1797 "parser.y" + { (yyval.raw) = int2raw_data((yyvsp[(1) - (1)].num)); ;} break; case 230: -/* Line 1455 of yacc.c */ -#line 1806 "parser.y" - { (yyval.raw) = long2raw_data((yyvsp[(1) - (1)].num)); ;} +/* Line 1464 of yacc.c */ +#line 1798 "parser.y" + { (yyval.raw) = int2raw_data(-((yyvsp[(2) - (2)].num))); ;} break; case 231: -/* Line 1455 of yacc.c */ -#line 1807 "parser.y" - { (yyval.raw) = long2raw_data(-((yyvsp[(2) - (2)].num))); ;} +/* Line 1464 of yacc.c */ +#line 1799 "parser.y" + { (yyval.raw) = long2raw_data((yyvsp[(1) - (1)].num)); ;} break; case 232: -/* Line 1455 of yacc.c */ -#line 1808 "parser.y" - { (yyval.raw) = str2raw_data((yyvsp[(1) - (1)].str)); ;} +/* Line 1464 of yacc.c */ +#line 1800 "parser.y" + { (yyval.raw) = long2raw_data(-((yyvsp[(2) - (2)].num))); ;} break; case 233: -/* Line 1455 of yacc.c */ -#line 1809 "parser.y" - { (yyval.raw) = merge_raw_data((yyvsp[(1) - (3)].raw), (yyvsp[(3) - (3)].raw)); free((yyvsp[(3) - (3)].raw)->data); free((yyvsp[(3) - (3)].raw)); ;} +/* Line 1464 of yacc.c */ +#line 1801 "parser.y" + { (yyval.raw) = str2raw_data((yyvsp[(1) - (1)].str)); ;} break; case 234: -/* Line 1455 of yacc.c */ -#line 1810 "parser.y" - { (yyval.raw) = merge_raw_data_int((yyvsp[(1) - (3)].raw), (yyvsp[(3) - (3)].num)); ;} +/* Line 1464 of yacc.c */ +#line 1802 "parser.y" + { (yyval.raw) = merge_raw_data((yyvsp[(1) - (3)].raw), (yyvsp[(3) - (3)].raw)); free((yyvsp[(3) - (3)].raw)->data); free((yyvsp[(3) - (3)].raw)); ;} break; case 235: -/* Line 1455 of yacc.c */ -#line 1811 "parser.y" - { (yyval.raw) = merge_raw_data_int((yyvsp[(1) - (4)].raw), -((yyvsp[(4) - (4)].num))); ;} +/* Line 1464 of yacc.c */ +#line 1803 "parser.y" + { (yyval.raw) = merge_raw_data_int((yyvsp[(1) - (3)].raw), (yyvsp[(3) - (3)].num)); ;} break; case 236: -/* Line 1455 of yacc.c */ -#line 1812 "parser.y" - { (yyval.raw) = merge_raw_data_long((yyvsp[(1) - (3)].raw), (yyvsp[(3) - (3)].num)); ;} +/* Line 1464 of yacc.c */ +#line 1804 "parser.y" + { (yyval.raw) = merge_raw_data_int((yyvsp[(1) - (4)].raw), -((yyvsp[(4) - (4)].num))); ;} break; case 237: -/* Line 1455 of yacc.c */ -#line 1813 "parser.y" - { (yyval.raw) = merge_raw_data_long((yyvsp[(1) - (4)].raw), -((yyvsp[(4) - (4)].num))); ;} +/* Line 1464 of yacc.c */ +#line 1805 "parser.y" + { (yyval.raw) = merge_raw_data_long((yyvsp[(1) - (3)].raw), (yyvsp[(3) - (3)].num)); ;} break; case 238: -/* Line 1455 of yacc.c */ -#line 1814 "parser.y" - { (yyval.raw) = merge_raw_data_str((yyvsp[(1) - (3)].raw), (yyvsp[(3) - (3)].str)); ;} +/* Line 1464 of yacc.c */ +#line 1806 "parser.y" + { (yyval.raw) = merge_raw_data_long((yyvsp[(1) - (4)].raw), -((yyvsp[(4) - (4)].num))); ;} break; case 239: -/* Line 1455 of yacc.c */ -#line 1818 "parser.y" - { (yyval.raw) = load_file((yyvsp[(1) - (1)].str),dup_language(currentlanguage)); ;} +/* Line 1464 of yacc.c */ +#line 1807 "parser.y" + { (yyval.raw) = merge_raw_data_str((yyvsp[(1) - (3)].raw), (yyvsp[(3) - (3)].str)); ;} break; case 240: -/* Line 1455 of yacc.c */ -#line 1819 "parser.y" - { (yyval.raw) = (yyvsp[(1) - (1)].raw); ;} +/* Line 1464 of yacc.c */ +#line 1811 "parser.y" + { (yyval.raw) = load_file((yyvsp[(1) - (1)].str),dup_language(currentlanguage)); ;} break; case 241: -/* Line 1455 of yacc.c */ -#line 1826 "parser.y" - { (yyval.iptr) = 0; ;} +/* Line 1464 of yacc.c */ +#line 1812 "parser.y" + { (yyval.raw) = (yyvsp[(1) - (1)].raw); ;} break; case 242: -/* Line 1455 of yacc.c */ -#line 1827 "parser.y" - { (yyval.iptr) = new_int((yyvsp[(1) - (1)].num)); ;} +/* Line 1464 of yacc.c */ +#line 1819 "parser.y" + { (yyval.iptr) = 0; ;} break; case 243: -/* Line 1455 of yacc.c */ -#line 1831 "parser.y" - { (yyval.num) = ((yyvsp[(1) - (1)].num)); ;} +/* Line 1464 of yacc.c */ +#line 1820 "parser.y" + { (yyval.iptr) = new_int((yyvsp[(1) - (1)].num)); ;} break; case 244: -/* Line 1455 of yacc.c */ -#line 1834 "parser.y" - { (yyval.num) = ((yyvsp[(1) - (3)].num)) + ((yyvsp[(3) - (3)].num)); ;} +/* Line 1464 of yacc.c */ +#line 1824 "parser.y" + { (yyval.num) = ((yyvsp[(1) - (1)].num)); ;} break; case 245: -/* Line 1455 of yacc.c */ -#line 1835 "parser.y" - { (yyval.num) = ((yyvsp[(1) - (3)].num)) - ((yyvsp[(3) - (3)].num)); ;} +/* Line 1464 of yacc.c */ +#line 1827 "parser.y" + { (yyval.num) = ((yyvsp[(1) - (3)].num)) + ((yyvsp[(3) - (3)].num)); ;} break; case 246: -/* Line 1455 of yacc.c */ -#line 1836 "parser.y" - { (yyval.num) = ((yyvsp[(1) - (3)].num)) | ((yyvsp[(3) - (3)].num)); ;} +/* Line 1464 of yacc.c */ +#line 1828 "parser.y" + { (yyval.num) = ((yyvsp[(1) - (3)].num)) - ((yyvsp[(3) - (3)].num)); ;} break; case 247: -/* Line 1455 of yacc.c */ -#line 1837 "parser.y" - { (yyval.num) = ((yyvsp[(1) - (3)].num)) & ((yyvsp[(3) - (3)].num)); ;} +/* Line 1464 of yacc.c */ +#line 1829 "parser.y" + { (yyval.num) = ((yyvsp[(1) - (3)].num)) | ((yyvsp[(3) - (3)].num)); ;} break; case 248: -/* Line 1455 of yacc.c */ -#line 1838 "parser.y" - { (yyval.num) = ((yyvsp[(1) - (3)].num)) * ((yyvsp[(3) - (3)].num)); ;} +/* Line 1464 of yacc.c */ +#line 1830 "parser.y" + { (yyval.num) = ((yyvsp[(1) - (3)].num)) & ((yyvsp[(3) - (3)].num)); ;} break; case 249: -/* Line 1455 of yacc.c */ -#line 1839 "parser.y" - { (yyval.num) = ((yyvsp[(1) - (3)].num)) / ((yyvsp[(3) - (3)].num)); ;} +/* Line 1464 of yacc.c */ +#line 1831 "parser.y" + { (yyval.num) = ((yyvsp[(1) - (3)].num)) * ((yyvsp[(3) - (3)].num)); ;} break; case 250: -/* Line 1455 of yacc.c */ -#line 1840 "parser.y" - { (yyval.num) = ((yyvsp[(1) - (3)].num)) ^ ((yyvsp[(3) - (3)].num)); ;} +/* Line 1464 of yacc.c */ +#line 1832 "parser.y" + { (yyval.num) = ((yyvsp[(1) - (3)].num)) / ((yyvsp[(3) - (3)].num)); ;} break; case 251: -/* Line 1455 of yacc.c */ -#line 1841 "parser.y" - { (yyval.num) = ~((yyvsp[(2) - (2)].num)); ;} +/* Line 1464 of yacc.c */ +#line 1833 "parser.y" + { (yyval.num) = ((yyvsp[(1) - (3)].num)) ^ ((yyvsp[(3) - (3)].num)); ;} break; case 252: -/* Line 1455 of yacc.c */ -#line 1842 "parser.y" - { (yyval.num) = -((yyvsp[(2) - (2)].num)); ;} +/* Line 1464 of yacc.c */ +#line 1834 "parser.y" + { (yyval.num) = ~((yyvsp[(2) - (2)].num)); ;} break; case 253: -/* Line 1455 of yacc.c */ -#line 1843 "parser.y" - { (yyval.num) = (yyvsp[(2) - (2)].num); ;} +/* Line 1464 of yacc.c */ +#line 1835 "parser.y" + { (yyval.num) = -((yyvsp[(2) - (2)].num)); ;} break; case 254: -/* Line 1455 of yacc.c */ -#line 1844 "parser.y" - { (yyval.num) = (yyvsp[(2) - (3)].num); ;} +/* Line 1464 of yacc.c */ +#line 1836 "parser.y" + { (yyval.num) = (yyvsp[(2) - (2)].num); ;} break; case 255: -/* Line 1455 of yacc.c */ -#line 1845 "parser.y" - { (yyval.num) = (yyvsp[(1) - (1)].num); ;} +/* Line 1464 of yacc.c */ +#line 1837 "parser.y" + { (yyval.num) = (yyvsp[(2) - (3)].num); ;} break; case 256: -/* Line 1455 of yacc.c */ -#line 1846 "parser.y" - { (yyval.num) = ~((yyvsp[(2) - (2)].num)); ;} +/* Line 1464 of yacc.c */ +#line 1838 "parser.y" + { (yyval.num) = (yyvsp[(1) - (1)].num); ;} break; case 257: -/* Line 1455 of yacc.c */ -#line 1849 "parser.y" - { (yyval.num) = (yyvsp[(1) - (1)].num); ;} +/* Line 1464 of yacc.c */ +#line 1839 "parser.y" + { (yyval.num) = ~((yyvsp[(2) - (2)].num)); ;} break; case 258: -/* Line 1455 of yacc.c */ -#line 1850 "parser.y" +/* Line 1464 of yacc.c */ +#line 1842 "parser.y" + { (yyval.num) = (yyvsp[(1) - (1)].num); ;} + break; + + case 259: + +/* Line 1464 of yacc.c */ +#line 1843 "parser.y" { (yyval.num) = (yyvsp[(1) - (1)].num); ;} break; -/* Line 1455 of yacc.c */ -#line 4933 "parser.tab.c" +/* Line 1464 of yacc.c */ +#line 4951 "parser.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -5136,8 +5154,8 @@ yyreturn: -/* Line 1675 of yacc.c */ -#line 1853 "parser.y" +/* Line 1684 of yacc.c */ +#line 1846 "parser.y" /* Dialog specific functions */ static dialog_t *dialog_style(style_t * st, dialog_t *dlg) @@ -5451,118 +5469,6 @@ static name_id_t *convert_ctlclass(name_id_t *cls) return cls; } -/* DialogEx specific functions */ -static dialogex_t *dialogex_style(style_t * st, dialogex_t *dlg) -{ - assert(dlg != NULL); - if(dlg->style == NULL) - { - dlg->style = new_style(0,0); - } - - if(dlg->gotstyle) - { - parser_warning("Style already defined, or-ing together\n"); - } - else - { - dlg->style->or_mask = 0; - dlg->style->and_mask = 0; - } - dlg->style->or_mask |= st->or_mask; - dlg->style->and_mask |= st->and_mask; - dlg->gotstyle = TRUE; - free(st); - return dlg; -} - -static dialogex_t *dialogex_exstyle(style_t * st, dialogex_t *dlg) -{ - assert(dlg != NULL); - if(dlg->exstyle == NULL) - { - dlg->exstyle = new_style(0,0); - } - - if(dlg->gotexstyle) - { - parser_warning("ExStyle already defined, or-ing together\n"); - } - else - { - dlg->exstyle->or_mask = 0; - dlg->exstyle->and_mask = 0; - } - dlg->exstyle->or_mask |= st->or_mask; - dlg->exstyle->and_mask |= st->and_mask; - dlg->gotexstyle = TRUE; - free(st); - return dlg; -} - -static dialogex_t *dialogex_caption(string_t *s, dialogex_t *dlg) -{ - assert(dlg != NULL); - if(dlg->title) - yyerror("Caption already defined"); - dlg->title = s; - return dlg; -} - -static dialogex_t *dialogex_font(font_id_t *f, dialogex_t *dlg) -{ - assert(dlg != NULL); - if(dlg->font) - yyerror("Font already defined"); - dlg->font = f; - return dlg; -} - -static dialogex_t *dialogex_class(name_id_t *n, dialogex_t *dlg) -{ - assert(dlg != NULL); - if(dlg->dlgclass) - yyerror("Class already defined"); - dlg->dlgclass = n; - return dlg; -} - -static dialogex_t *dialogex_menu(name_id_t *m, dialogex_t *dlg) -{ - assert(dlg != NULL); - if(dlg->menu) - yyerror("Menu already defined"); - dlg->menu = m; - return dlg; -} - -static dialogex_t *dialogex_language(language_t *l, dialogex_t *dlg) -{ - assert(dlg != NULL); - if(dlg->lvc.language) - yyerror("Language already defined"); - dlg->lvc.language = l; - return dlg; -} - -static dialogex_t *dialogex_characteristics(characts_t *c, dialogex_t *dlg) -{ - assert(dlg != NULL); - if(dlg->lvc.characts) - yyerror("Characteristics already defined"); - dlg->lvc.characts = c; - return dlg; -} - -static dialogex_t *dialogex_version(version_t *v, dialogex_t *dlg) -{ - assert(dlg != NULL); - if(dlg->lvc.version) - yyerror("Version already defined"); - dlg->lvc.version = v; - return dlg; -} - /* Accelerator specific functions */ static event_t *add_event(int key, int id, int flags, event_t *prev) { @@ -5587,7 +5493,9 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev if(key->type == str_char) { - if((flags & WRC_AF_VIRTKEY) && (!isupper(key->str.cstr[0] & 0xff) && !isdigit(key->str.cstr[0] & 0xff))) + if((flags & WRC_AF_VIRTKEY) && + !((key->str.cstr[0] >= 'A' && key->str.cstr[0] <= 'Z') || + (key->str.cstr[0] >= '0' && key->str.cstr[0] <= '9'))) yyerror("VIRTKEY code is not equal to ascii value"); if(key->str.cstr[0] == '^' && (flags & WRC_AF_CONTROL) != 0) @@ -5596,7 +5504,7 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev } else if(key->str.cstr[0] == '^') { - keycode = toupper(key->str.cstr[1]) - '@'; + keycode = toupper((unsigned char)key->str.cstr[1]) - '@'; if(keycode >= ' ') yyerror("Control-code out of range"); } @@ -5605,7 +5513,9 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev } else { - if((flags & WRC_AF_VIRTKEY) && !isupperW(key->str.wstr[0]) && !isdigitW(key->str.wstr[0])) + if((flags & WRC_AF_VIRTKEY) && + !((key->str.wstr[0] >= 'A' && key->str.wstr[0] <= 'Z') || + (key->str.wstr[0] >= '0' && key->str.wstr[0] <= '9'))) yyerror("VIRTKEY code is not equal to ascii value"); if(key->str.wstr[0] == '^' && (flags & WRC_AF_CONTROL) != 0) @@ -5825,15 +5735,6 @@ static menu_item_t *get_item_head(menu_item_t *p) return p; } -static menuex_item_t *get_itemex_head(menuex_item_t *p) -{ - if(!p) - return NULL; - while(p->prev) - p = p->prev; - return p; -} - static resource_t *get_resource_head(resource_t *p) { if(!p) @@ -6289,7 +6190,6 @@ clean: static int rsrcid_to_token(int lookahead) { int token; - const char *type = "?"; /* Get a token if we don't have one yet */ if(lookahead == YYEMPTY) @@ -6310,64 +6210,49 @@ static int rsrcid_to_token(int lookahead) switch(yylval.num) { case WRC_RT_CURSOR: - type = "CURSOR"; token = tCURSOR; break; case WRC_RT_ICON: - type = "ICON"; token = tICON; break; case WRC_RT_BITMAP: - type = "BITMAP"; token = tBITMAP; break; case WRC_RT_FONT: - type = "FONT"; token = tFONT; break; case WRC_RT_FONTDIR: - type = "FONTDIR"; token = tFONTDIR; break; case WRC_RT_RCDATA: - type = "RCDATA"; token = tRCDATA; break; case WRC_RT_MESSAGETABLE: - type = "MESSAGETABLE"; token = tMESSAGETABLE; break; case WRC_RT_DLGINIT: - type = "DLGINIT"; token = tDLGINIT; break; case WRC_RT_ACCELERATOR: - type = "ACCELERATOR"; token = tACCELERATORS; break; case WRC_RT_MENU: - type = "MENU"; token = tMENU; break; case WRC_RT_DIALOG: - type = "DIALOG"; token = tDIALOG; break; case WRC_RT_VERSION: - type = "VERSION"; token = tVERSIONINFO; break; case WRC_RT_TOOLBAR: - type = "TOOLBAR"; token = tTOOLBAR; break; case WRC_RT_HTML: - type = "HTML"; token = tHTML; break; case WRC_RT_STRING: - type = "STRINGTABLE"; break; case WRC_RT_ANICURSOR: diff --git a/reactos/tools/wrc/parser.tab.h b/reactos/tools/wrc/parser.tab.h index 73afc6c0c41..40536714bea 100644 --- a/reactos/tools/wrc/parser.tab.h +++ b/reactos/tools/wrc/parser.tab.h @@ -1,10 +1,9 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.4.2. */ /* Skeleton interface for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -131,8 +130,8 @@ typedef union YYSTYPE { -/* Line 1676 of yacc.c */ -#line 238 "parser.y" +/* Line 1685 of yacc.c */ +#line 228 "parser.y" string_t *str; int num; @@ -142,11 +141,9 @@ typedef union YYSTYPE accelerator_t *acc; bitmap_t *bmp; dialog_t *dlg; - dialogex_t *dlgex; font_t *fnt; fontdir_t *fnd; menu_t *men; - menuex_t *menex; html_t *html; rcdata_t *rdt; stringtable_t *stt; @@ -162,7 +159,6 @@ typedef union YYSTYPE characts_t *chars; event_t *event; menu_item_t *menitm; - menuex_item_t *menexitm; itemex_opt_t *exopt; raw_data_t *raw; lvc_t *lvc; @@ -178,8 +174,8 @@ typedef union YYSTYPE -/* Line 1676 of yacc.c */ -#line 183 "parser.tab.h" +/* Line 1685 of yacc.c */ +#line 179 "parser.tab.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ diff --git a/reactos/tools/wrc/parser.y b/reactos/tools/wrc/parser.y index d9054751da1..e1a3c689be3 100644 --- a/reactos/tools/wrc/parser.y +++ b/reactos/tools/wrc/parser.y @@ -192,7 +192,6 @@ static control_t *get_control_head(control_t *p); static ver_value_t *get_ver_value_head(ver_value_t *p); static ver_block_t *get_ver_block_head(ver_block_t *p); static resource_t *get_resource_head(resource_t *p); -static menuex_item_t *get_itemex_head(menuex_item_t *p); static menu_item_t *get_item_head(menu_item_t *p); static raw_data_t *merge_raw_data_str(raw_data_t *r1, string_t *str); static raw_data_t *merge_raw_data_int(raw_data_t *r1, int i); @@ -205,15 +204,6 @@ static raw_data_t *load_file(string_t *name, language_t *lang); static itemex_opt_t *new_itemex_opt(int id, int type, int state, int helpid); static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev); static event_t *add_event(int key, int id, int flags, event_t *prev); -static dialogex_t *dialogex_version(version_t *v, dialogex_t *dlg); -static dialogex_t *dialogex_characteristics(characts_t *c, dialogex_t *dlg); -static dialogex_t *dialogex_language(language_t *l, dialogex_t *dlg); -static dialogex_t *dialogex_menu(name_id_t *m, dialogex_t *dlg); -static dialogex_t *dialogex_class(name_id_t *n, dialogex_t *dlg); -static dialogex_t *dialogex_font(font_id_t *f, dialogex_t *dlg); -static dialogex_t *dialogex_caption(string_t *s, dialogex_t *dlg); -static dialogex_t *dialogex_exstyle(style_t *st, dialogex_t *dlg); -static dialogex_t *dialogex_style(style_t *st, dialogex_t *dlg); static name_id_t *convert_ctlclass(name_id_t *cls); static control_t *ins_ctrl(int type, int special_style, control_t *ctrl, control_t *prev); static dialog_t *dialog_version(version_t *v, dialog_t *dlg); @@ -244,11 +234,9 @@ static int rsrcid_to_token(int lookahead); accelerator_t *acc; bitmap_t *bmp; dialog_t *dlg; - dialogex_t *dlgex; font_t *fnt; fontdir_t *fnd; menu_t *men; - menuex_t *menex; html_t *html; rcdata_t *rdt; stringtable_t *stt; @@ -264,7 +252,6 @@ static int rsrcid_to_token(int lookahead); characts_t *chars; event_t *event; menu_item_t *menitm; - menuex_item_t *menexitm; itemex_opt_t *exopt; raw_data_t *raw; lvc_t *lvc; @@ -316,10 +303,9 @@ static int rsrcid_to_token(int lookahead); %type events %type bitmap %type cursor icon -%type dialog dlg_attributes +%type dialog dlg_attributes dialogex dlgex_attribs %type ctrls gen_ctrl lab_ctrl ctrl_desc iconinfo %type helpid -%type dialogex dlgex_attribs %type exctrls gen_exctrl lab_exctrl exctrl_desc %type html %type rcdata @@ -328,10 +314,8 @@ static int rsrcid_to_token(int lookahead); %type ver_words %type ver_blocks ver_block %type ver_values ver_value -%type menu -%type item_definitions menu_body -%type menuex -%type itemex_definitions menuex_body +%type menu menuex +%type item_definitions menu_body itemex_definitions menuex_body %type itemex_p_options itemex_options %type messagetable %type userres @@ -385,7 +369,7 @@ resource_file else $1 = rsc; - /* Final statements before were done */ + /* Final statements before we're done */ if ((head = get_resource_head($1)) != NULL) { if (resource_top) /* append to existing resources */ @@ -616,7 +600,7 @@ resource_definition | dialog { $$ = new_resource(res_dlg, $1, $1->memopt, $1->lvc.language); } | dialogex { if(win32) - $$ = new_resource(res_dlgex, $1, $1->memopt, $1->lvc.language); + $$ = new_resource(res_dlg, $1, $1->memopt, $1->lvc.language); else $$ = NULL; } @@ -650,7 +634,7 @@ resource_definition | menu { $$ = new_resource(res_men, $1, $1->memopt, $1->lvc.language); } | menuex { if(win32) - $$ = new_resource(res_menex, $1, $1->memopt, $1->lvc.language); + $$ = new_resource(res_men, $1, $1->memopt, $1->lvc.language); else $$ = NULL; } @@ -1078,17 +1062,17 @@ dialogex: tDIALOGEX loadmemopts expr ',' expr ',' expr ',' expr helpid dlgex_att ; dlgex_attribs - : /* Empty */ { $$=new_dialogex(); } - | dlgex_attribs tSTYLE style { $$=dialogex_style($3,$1); } - | dlgex_attribs tEXSTYLE style { $$=dialogex_exstyle($3,$1); } - | dlgex_attribs tCAPTION tSTRING { $$=dialogex_caption($3,$1); } - | dlgex_attribs opt_font { $$=dialogex_font($2,$1); } - | dlgex_attribs opt_exfont { $$=dialogex_font($2,$1); } - | dlgex_attribs tCLASS nameid_s { $$=dialogex_class($3,$1); } - | dlgex_attribs tMENU nameid { $$=dialogex_menu($3,$1); } - | dlgex_attribs opt_language { $$=dialogex_language($2,$1); } - | dlgex_attribs opt_characts { $$=dialogex_characteristics($2,$1); } - | dlgex_attribs opt_version { $$=dialogex_version($2,$1); } + : /* Empty */ { $$=new_dialog(); $$->is_ex = TRUE; } + | dlgex_attribs tSTYLE style { $$=dialog_style($3,$1); } + | dlgex_attribs tEXSTYLE style { $$=dialog_exstyle($3,$1); } + | dlgex_attribs tCAPTION tSTRING { $$=dialog_caption($3,$1); } + | dlgex_attribs opt_font { $$=dialog_font($2,$1); } + | dlgex_attribs opt_exfont { $$=dialog_font($2,$1); } + | dlgex_attribs tCLASS nameid_s { $$=dialog_class($3,$1); } + | dlgex_attribs tMENU nameid { $$=dialog_menu($3,$1); } + | dlgex_attribs opt_language { $$=dialog_language($2,$1); } + | dlgex_attribs opt_characts { $$=dialog_characteristics($2,$1); } + | dlgex_attribs opt_version { $$=dialog_version($2,$1); } ; exctrls : /* Empty */ { $$ = NULL; } @@ -1294,13 +1278,14 @@ item_definitions * (who would want to specify a MF_x flag twice?). */ item_options - : /* Empty */ { $$ = 0; } - | opt_comma tCHECKED item_options { $$ = $3 | MF_CHECKED; } - | opt_comma tGRAYED item_options { $$ = $3 | MF_GRAYED; } - | opt_comma tHELP item_options { $$ = $3 | MF_HELP; } - | opt_comma tINACTIVE item_options { $$ = $3 | MF_DISABLED; } - | opt_comma tMENUBARBREAK item_options { $$ = $3 | MF_MENUBARBREAK; } - | opt_comma tMENUBREAK item_options { $$ = $3 | MF_MENUBREAK; } + : /* Empty */ { $$ = 0; } + | ',' item_options { $$ = $2; } + | tCHECKED item_options { $$ = $2 | MF_CHECKED; } + | tGRAYED item_options { $$ = $2 | MF_GRAYED; } + | tHELP item_options { $$ = $2 | MF_HELP; } + | tINACTIVE item_options { $$ = $2 | MF_DISABLED; } + | tMENUBARBREAK item_options { $$ = $2 | MF_MENUBARBREAK; } + | tMENUBREAK item_options { $$ = $2 | MF_MENUBREAK; } ; /* ------------------------------ MenuEx ------------------------------ */ @@ -1309,7 +1294,8 @@ menuex : tMENUEX loadmemopts opt_lvc menuex_body { parser_warning("MENUEX not supported in 16-bit mode\n"); if(!$4) yyerror("MenuEx must contain items"); - $$ = new_menuex(); + $$ = new_menu(); + $$->is_ex = TRUE; if($2) { $$->memopt = *($2); @@ -1317,7 +1303,7 @@ menuex : tMENUEX loadmemopts opt_lvc menuex_body { } else $$->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE | WRC_MO_DISCARDABLE; - $$->items = get_itemex_head($4); + $$->items = get_item_head($4); if($3) { $$->lvc = *($3); @@ -1335,7 +1321,7 @@ menuex_body itemex_definitions : /* Empty */ {$$ = NULL; } | itemex_definitions tMENUITEM tSTRING itemex_options { - $$ = new_menuex_item(); + $$ = new_menu_item(); $$->prev = $1; if($1) $1->next = $$; @@ -1351,17 +1337,17 @@ itemex_definitions free($4); } | itemex_definitions tMENUITEM tSEPARATOR { - $$ = new_menuex_item(); + $$ = new_menu_item(); $$->prev = $1; if($1) $1->next = $$; } | itemex_definitions tPOPUP tSTRING itemex_p_options menuex_body { - $$ = new_menuex_item(); + $$ = new_menu_item(); $$->prev = $1; if($1) $1->next = $$; - $$->popup = get_itemex_head($5); + $$->popup = get_item_head($5); $$->name = $3; $$->id = $4->id; $$->type = $4->type; @@ -1723,15 +1709,22 @@ loadmemopts } ; -lamo : tPRELOAD { $$ = new_int(WRC_MO_PRELOAD); } - | tMOVEABLE { $$ = new_int(WRC_MO_MOVEABLE); } - | tDISCARDABLE { $$ = new_int(WRC_MO_DISCARDABLE); } - | tPURE { $$ = new_int(WRC_MO_PURE); } +lamo : tPRELOAD { $$ = new_int(WRC_MO_PRELOAD); + if (win32 && pedantic) parser_warning("PRELOAD is ignored in 32-bit mode\n"); } + | tMOVEABLE { $$ = new_int(WRC_MO_MOVEABLE); + if (win32 && pedantic) parser_warning("MOVEABLE is ignored in 32-bit mode\n"); } + | tDISCARDABLE { $$ = new_int(WRC_MO_DISCARDABLE); + if (win32 && pedantic) parser_warning("DISCARDABLE is ignored in 32-bit mode\n"); } + | tPURE { $$ = new_int(WRC_MO_PURE); + if (win32 && pedantic) parser_warning("PURE is ignored in 32-bit mode\n"); } ; -lama : tLOADONCALL { $$ = new_int(~WRC_MO_PRELOAD); } - | tFIXED { $$ = new_int(~WRC_MO_MOVEABLE); } - | tIMPURE { $$ = new_int(~WRC_MO_PURE); } +lama : tLOADONCALL { $$ = new_int(~WRC_MO_PRELOAD); + if (win32 && pedantic) parser_warning("LOADONCALL is ignored in 32-bit mode\n"); } + | tFIXED { $$ = new_int(~WRC_MO_MOVEABLE); + if (win32 && pedantic) parser_warning("FIXED is ignored in 32-bit mode\n"); } + | tIMPURE { $$ = new_int(~WRC_MO_PURE); + if (win32 && pedantic) parser_warning("IMPURE is ignored in 32-bit mode\n"); } ; /* ------------------------------ Win32 options ------------------------------ */ @@ -2163,118 +2156,6 @@ static name_id_t *convert_ctlclass(name_id_t *cls) return cls; } -/* DialogEx specific functions */ -static dialogex_t *dialogex_style(style_t * st, dialogex_t *dlg) -{ - assert(dlg != NULL); - if(dlg->style == NULL) - { - dlg->style = new_style(0,0); - } - - if(dlg->gotstyle) - { - parser_warning("Style already defined, or-ing together\n"); - } - else - { - dlg->style->or_mask = 0; - dlg->style->and_mask = 0; - } - dlg->style->or_mask |= st->or_mask; - dlg->style->and_mask |= st->and_mask; - dlg->gotstyle = TRUE; - free(st); - return dlg; -} - -static dialogex_t *dialogex_exstyle(style_t * st, dialogex_t *dlg) -{ - assert(dlg != NULL); - if(dlg->exstyle == NULL) - { - dlg->exstyle = new_style(0,0); - } - - if(dlg->gotexstyle) - { - parser_warning("ExStyle already defined, or-ing together\n"); - } - else - { - dlg->exstyle->or_mask = 0; - dlg->exstyle->and_mask = 0; - } - dlg->exstyle->or_mask |= st->or_mask; - dlg->exstyle->and_mask |= st->and_mask; - dlg->gotexstyle = TRUE; - free(st); - return dlg; -} - -static dialogex_t *dialogex_caption(string_t *s, dialogex_t *dlg) -{ - assert(dlg != NULL); - if(dlg->title) - yyerror("Caption already defined"); - dlg->title = s; - return dlg; -} - -static dialogex_t *dialogex_font(font_id_t *f, dialogex_t *dlg) -{ - assert(dlg != NULL); - if(dlg->font) - yyerror("Font already defined"); - dlg->font = f; - return dlg; -} - -static dialogex_t *dialogex_class(name_id_t *n, dialogex_t *dlg) -{ - assert(dlg != NULL); - if(dlg->dlgclass) - yyerror("Class already defined"); - dlg->dlgclass = n; - return dlg; -} - -static dialogex_t *dialogex_menu(name_id_t *m, dialogex_t *dlg) -{ - assert(dlg != NULL); - if(dlg->menu) - yyerror("Menu already defined"); - dlg->menu = m; - return dlg; -} - -static dialogex_t *dialogex_language(language_t *l, dialogex_t *dlg) -{ - assert(dlg != NULL); - if(dlg->lvc.language) - yyerror("Language already defined"); - dlg->lvc.language = l; - return dlg; -} - -static dialogex_t *dialogex_characteristics(characts_t *c, dialogex_t *dlg) -{ - assert(dlg != NULL); - if(dlg->lvc.characts) - yyerror("Characteristics already defined"); - dlg->lvc.characts = c; - return dlg; -} - -static dialogex_t *dialogex_version(version_t *v, dialogex_t *dlg) -{ - assert(dlg != NULL); - if(dlg->lvc.version) - yyerror("Version already defined"); - dlg->lvc.version = v; - return dlg; -} - /* Accelerator specific functions */ static event_t *add_event(int key, int id, int flags, event_t *prev) { @@ -2299,7 +2180,9 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev if(key->type == str_char) { - if((flags & WRC_AF_VIRTKEY) && (!isupper(key->str.cstr[0] & 0xff) && !isdigit(key->str.cstr[0] & 0xff))) + if((flags & WRC_AF_VIRTKEY) && + !((key->str.cstr[0] >= 'A' && key->str.cstr[0] <= 'Z') || + (key->str.cstr[0] >= '0' && key->str.cstr[0] <= '9'))) yyerror("VIRTKEY code is not equal to ascii value"); if(key->str.cstr[0] == '^' && (flags & WRC_AF_CONTROL) != 0) @@ -2308,7 +2191,7 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev } else if(key->str.cstr[0] == '^') { - keycode = toupper(key->str.cstr[1]) - '@'; + keycode = toupper((unsigned char)key->str.cstr[1]) - '@'; if(keycode >= ' ') yyerror("Control-code out of range"); } @@ -2317,7 +2200,9 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev } else { - if((flags & WRC_AF_VIRTKEY) && !isupperW(key->str.wstr[0]) && !isdigitW(key->str.wstr[0])) + if((flags & WRC_AF_VIRTKEY) && + !((key->str.wstr[0] >= 'A' && key->str.wstr[0] <= 'Z') || + (key->str.wstr[0] >= '0' && key->str.wstr[0] <= '9'))) yyerror("VIRTKEY code is not equal to ascii value"); if(key->str.wstr[0] == '^' && (flags & WRC_AF_CONTROL) != 0) @@ -2537,15 +2422,6 @@ static menu_item_t *get_item_head(menu_item_t *p) return p; } -static menuex_item_t *get_itemex_head(menuex_item_t *p) -{ - if(!p) - return NULL; - while(p->prev) - p = p->prev; - return p; -} - static resource_t *get_resource_head(resource_t *p) { if(!p) @@ -3001,7 +2877,6 @@ clean: static int rsrcid_to_token(int lookahead) { int token; - const char *type = "?"; /* Get a token if we don't have one yet */ if(lookahead == YYEMPTY) @@ -3022,64 +2897,49 @@ static int rsrcid_to_token(int lookahead) switch(yylval.num) { case WRC_RT_CURSOR: - type = "CURSOR"; token = tCURSOR; break; case WRC_RT_ICON: - type = "ICON"; token = tICON; break; case WRC_RT_BITMAP: - type = "BITMAP"; token = tBITMAP; break; case WRC_RT_FONT: - type = "FONT"; token = tFONT; break; case WRC_RT_FONTDIR: - type = "FONTDIR"; token = tFONTDIR; break; case WRC_RT_RCDATA: - type = "RCDATA"; token = tRCDATA; break; case WRC_RT_MESSAGETABLE: - type = "MESSAGETABLE"; token = tMESSAGETABLE; break; case WRC_RT_DLGINIT: - type = "DLGINIT"; token = tDLGINIT; break; case WRC_RT_ACCELERATOR: - type = "ACCELERATOR"; token = tACCELERATORS; break; case WRC_RT_MENU: - type = "MENU"; token = tMENU; break; case WRC_RT_DIALOG: - type = "DIALOG"; token = tDIALOG; break; case WRC_RT_VERSION: - type = "VERSION"; token = tVERSIONINFO; break; case WRC_RT_TOOLBAR: - type = "TOOLBAR"; token = tTOOLBAR; break; case WRC_RT_HTML: - type = "HTML"; token = tHTML; break; case WRC_RT_STRING: - type = "STRINGTABLE"; break; case WRC_RT_ANICURSOR: diff --git a/reactos/tools/wrc/po.c b/reactos/tools/wrc/po.c new file mode 100644 index 00000000000..5d9f6b5117e --- /dev/null +++ b/reactos/tools/wrc/po.c @@ -0,0 +1,1016 @@ +/* + * Support for po files + * + * Copyright 2010 Alexandre Julliard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#ifdef HAVE_LIBGETTEXTPO +#include +#endif + +#include "wrc.h" +#include "genres.h" +#include "newstruc.h" +#include "utils.h" +#include "wine/list.h" +#include "wine/unicode.h" + +static resource_t *new_top, *new_tail; + +static int is_english( const language_t *lan ) +{ + return lan->id == LANG_ENGLISH && lan->sub == SUBLANG_DEFAULT; +} + +static version_t *get_dup_version( language_t *lang ) +{ + /* English "translations" take precedence over the original rc contents */ + return new_version( is_english( lang ) ? 1 : -1 ); +} + +static name_id_t *dup_name_id( name_id_t *id ) +{ + name_id_t *new; + + if (!id || id->type != name_str) return id; + new = new_name_id(); + *new = *id; + new->name.s_name = convert_string( id->name.s_name, str_unicode, 1252 ); + return new; +} + +static char *convert_msgid_ascii( const string_t *str, int error_on_invalid_char ) +{ + int i; + string_t *newstr = convert_string( str, str_unicode, 1252 ); + char *buffer = xmalloc( newstr->size + 1 ); + + for (i = 0; i < newstr->size; i++) + { + buffer[i] = newstr->str.wstr[i]; + if (newstr->str.wstr[i] >= 32 && newstr->str.wstr[i] <= 127) continue; + if (newstr->str.wstr[i] == '\t' || newstr->str.wstr[i] == '\n') continue; + if (error_on_invalid_char) + { + print_location( &newstr->loc ); + error( "Invalid character %04x in source string\n", newstr->str.wstr[i] ); + } + free( buffer); + free_string( newstr ); + return NULL; + } + buffer[i] = 0; + free_string( newstr ); + return buffer; +} + +static char *get_message_context( char **msgid ) +{ + static const char magic[] = "#msgctxt#"; + char *id, *context; + + if (strncmp( *msgid, magic, sizeof(magic) - 1 )) return NULL; + context = *msgid + sizeof(magic) - 1; + if (!(id = strchr( context, '#' ))) return NULL; + *id = 0; + *msgid = id + 1; + return context; +} + +static int control_has_title( const control_t *ctrl ) +{ + if (!ctrl->title) return 0; + if (ctrl->title->type != name_str) return 0; + /* check for text static control */ + if (ctrl->ctlclass && ctrl->ctlclass->type == name_ord && ctrl->ctlclass->name.i_name == CT_STATIC) + { + switch (ctrl->style->or_mask & SS_TYPEMASK) + { + case SS_LEFT: + case SS_CENTER: + case SS_RIGHT: + return 1; + default: + return 0; + } + } + return 1; +} + +static resource_t *dup_resource( resource_t *res, language_t *lang ) +{ + resource_t *new = xmalloc( sizeof(*new) ); + + *new = *res; + new->lan = lang; + new->next = new->prev = NULL; + new->name = dup_name_id( res->name ); + + switch (res->type) + { + case res_dlg: + new->res.dlg = xmalloc( sizeof(*(new)->res.dlg) ); + *new->res.dlg = *res->res.dlg; + new->res.dlg->lvc.language = lang; + new->res.dlg->lvc.version = get_dup_version( lang ); + break; + case res_men: + new->res.men = xmalloc( sizeof(*(new)->res.men) ); + *new->res.men = *res->res.men; + new->res.men->lvc.language = lang; + new->res.men->lvc.version = get_dup_version( lang ); + break; + case res_stt: + new->res.stt = xmalloc( sizeof(*(new)->res.stt) ); + *new->res.stt = *res->res.stt; + new->res.stt->lvc.language = lang; + new->res.stt->lvc.version = get_dup_version( lang ); + break; + default: + assert(0); + } + return new; +} + +static const struct +{ + unsigned int id, sub; + const char *name; +} languages[] = +{ + { LANG_ARABIC, SUBLANG_NEUTRAL, "ar" }, + { LANG_ARABIC, SUBLANG_ARABIC_SAUDI_ARABIA, "ar_SA" }, + { LANG_ARABIC, SUBLANG_ARABIC_IRAQ, "ar_IQ" }, + { LANG_ARABIC, SUBLANG_ARABIC_EGYPT, "ar_EG" }, + { LANG_ARABIC, SUBLANG_ARABIC_LIBYA, "ar_LY" }, + { LANG_ARABIC, SUBLANG_ARABIC_ALGERIA, "ar_DZ" }, + { LANG_ARABIC, SUBLANG_ARABIC_MOROCCO, "ar_MA" }, + { LANG_ARABIC, SUBLANG_ARABIC_TUNISIA, "ar_TN" }, + { LANG_ARABIC, SUBLANG_ARABIC_OMAN, "ar_OM" }, + { LANG_ARABIC, SUBLANG_ARABIC_YEMEN, "ar_YE" }, + { LANG_ARABIC, SUBLANG_ARABIC_SYRIA, "ar_SY" }, + { LANG_ARABIC, SUBLANG_ARABIC_JORDAN, "ar_JO" }, + { LANG_ARABIC, SUBLANG_ARABIC_LEBANON, "ar_LB" }, + { LANG_ARABIC, SUBLANG_ARABIC_KUWAIT, "ar_KW" }, + { LANG_ARABIC, SUBLANG_ARABIC_UAE, "ar_AE" }, + { LANG_ARABIC, SUBLANG_ARABIC_BAHRAIN, "ar_BH" }, + { LANG_ARABIC, SUBLANG_ARABIC_QATAR, "ar_QA" }, + { LANG_BULGARIAN, SUBLANG_NEUTRAL, "bg" }, + { LANG_BULGARIAN, SUBLANG_BULGARIAN_BULGARIA, "bg_BG" }, + { LANG_CATALAN, SUBLANG_NEUTRAL, "ca" }, + { LANG_CATALAN, SUBLANG_CATALAN_CATALAN, "ca_ES" }, + { LANG_CHINESE, SUBLANG_NEUTRAL, "zh" }, + { LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL, "zh_TW" }, + { LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED, "zh_CN" }, + { LANG_CHINESE, SUBLANG_CHINESE_HONGKONG, "zh_HK" }, + { LANG_CHINESE, SUBLANG_CHINESE_SINGAPORE, "zh_SG" }, + { LANG_CHINESE, SUBLANG_CHINESE_MACAU, "zh_MO" }, + { LANG_CZECH, SUBLANG_NEUTRAL, "cs" }, + { LANG_CZECH, SUBLANG_CZECH_CZECH_REPUBLIC, "cs_CZ" }, + { LANG_DANISH, SUBLANG_NEUTRAL, "da" }, + { LANG_DANISH, SUBLANG_DANISH_DENMARK, "da_DK" }, + { LANG_GERMAN, SUBLANG_NEUTRAL, "de" }, + { LANG_GERMAN, SUBLANG_GERMAN, "de_DE" }, + { LANG_GERMAN, SUBLANG_GERMAN_SWISS, "de_CH" }, + { LANG_GERMAN, SUBLANG_GERMAN_AUSTRIAN, "de_AT" }, + { LANG_GERMAN, SUBLANG_GERMAN_LUXEMBOURG, "de_LU" }, + { LANG_GERMAN, SUBLANG_GERMAN_LIECHTENSTEIN, "de_LI" }, + { LANG_GREEK, SUBLANG_NEUTRAL, "el" }, + { LANG_GREEK, SUBLANG_GREEK_GREECE, "el_GR" }, + { LANG_ENGLISH, SUBLANG_NEUTRAL, "en" }, + { LANG_ENGLISH, SUBLANG_ENGLISH_US, "en_US" }, + { LANG_ENGLISH, SUBLANG_ENGLISH_UK, "en_GB" }, + { LANG_ENGLISH, SUBLANG_ENGLISH_AUS, "en_AU" }, + { LANG_ENGLISH, SUBLANG_ENGLISH_CAN, "en_CA" }, + { LANG_ENGLISH, SUBLANG_ENGLISH_NZ, "en_NZ" }, + { LANG_ENGLISH, SUBLANG_ENGLISH_EIRE, "en_IE" }, + { LANG_ENGLISH, SUBLANG_ENGLISH_SOUTH_AFRICA, "en_ZA" }, + { LANG_ENGLISH, SUBLANG_ENGLISH_JAMAICA, "en_JM" }, + { LANG_ENGLISH, SUBLANG_ENGLISH_CARIBBEAN, "en_CB" }, + { LANG_ENGLISH, SUBLANG_ENGLISH_BELIZE, "en_BZ" }, + { LANG_ENGLISH, SUBLANG_ENGLISH_TRINIDAD, "en_TT" }, + { LANG_ENGLISH, SUBLANG_ENGLISH_ZIMBABWE, "en_ZW" }, + { LANG_ENGLISH, SUBLANG_ENGLISH_PHILIPPINES, "en_PH" }, + { LANG_SPANISH, SUBLANG_NEUTRAL, "es" }, + { LANG_SPANISH, SUBLANG_SPANISH, "es_ES" }, + { LANG_SPANISH, SUBLANG_SPANISH_MEXICAN, "es_MX" }, + { LANG_SPANISH, SUBLANG_SPANISH_MODERN, "es_ES_modern" }, + { LANG_SPANISH, SUBLANG_SPANISH_GUATEMALA, "es_GT" }, + { LANG_SPANISH, SUBLANG_SPANISH_COSTA_RICA, "es_CR" }, + { LANG_SPANISH, SUBLANG_SPANISH_PANAMA, "es_PA" }, + { LANG_SPANISH, SUBLANG_SPANISH_DOMINICAN_REPUBLIC, "es_DO" }, + { LANG_SPANISH, SUBLANG_SPANISH_VENEZUELA, "es_VE" }, + { LANG_SPANISH, SUBLANG_SPANISH_COLOMBIA, "es_CO" }, + { LANG_SPANISH, SUBLANG_SPANISH_PERU, "es_PE" }, + { LANG_SPANISH, SUBLANG_SPANISH_ARGENTINA, "es_AR" }, + { LANG_SPANISH, SUBLANG_SPANISH_ECUADOR, "es_EC" }, + { LANG_SPANISH, SUBLANG_SPANISH_CHILE, "es_CL" }, + { LANG_SPANISH, SUBLANG_SPANISH_URUGUAY, "es_UY" }, + { LANG_SPANISH, SUBLANG_SPANISH_PARAGUAY, "es_PY" }, + { LANG_SPANISH, SUBLANG_SPANISH_BOLIVIA, "es_BO" }, + { LANG_SPANISH, SUBLANG_SPANISH_EL_SALVADOR, "es_SV" }, + { LANG_SPANISH, SUBLANG_SPANISH_HONDURAS, "es_HN" }, + { LANG_SPANISH, SUBLANG_SPANISH_NICARAGUA, "es_NI" }, + { LANG_SPANISH, SUBLANG_SPANISH_PUERTO_RICO, "es_PR" }, + { LANG_FINNISH, SUBLANG_NEUTRAL, "fi" }, + { LANG_FINNISH, SUBLANG_FINNISH_FINLAND, "fi_FI" }, + { LANG_FRENCH, SUBLANG_NEUTRAL, "fr" }, + { LANG_FRENCH, SUBLANG_FRENCH, "fr_FR" }, + { LANG_FRENCH, SUBLANG_FRENCH_BELGIAN, "fr_BE" }, + { LANG_FRENCH, SUBLANG_FRENCH_CANADIAN, "fr_CA" }, + { LANG_FRENCH, SUBLANG_FRENCH_SWISS, "fr_CH" }, + { LANG_FRENCH, SUBLANG_FRENCH_LUXEMBOURG, "fr_LU" }, + { LANG_FRENCH, SUBLANG_FRENCH_MONACO, "fr_MC" }, + { LANG_HEBREW, SUBLANG_NEUTRAL, "he" }, + { LANG_HEBREW, SUBLANG_HEBREW_ISRAEL, "he_IL" }, + { LANG_HUNGARIAN, SUBLANG_NEUTRAL, "hu" }, + { LANG_HUNGARIAN, SUBLANG_HUNGARIAN_HUNGARY, "hu_HU" }, + { LANG_ICELANDIC, SUBLANG_NEUTRAL, "is" }, + { LANG_ICELANDIC, SUBLANG_ICELANDIC_ICELAND, "is_IS" }, + { LANG_ITALIAN, SUBLANG_NEUTRAL, "it" }, + { LANG_ITALIAN, SUBLANG_ITALIAN, "it_IT" }, + { LANG_ITALIAN, SUBLANG_ITALIAN_SWISS, "it_CH" }, + { LANG_JAPANESE, SUBLANG_NEUTRAL, "ja" }, + { LANG_JAPANESE, SUBLANG_JAPANESE_JAPAN, "ja_JP" }, + { LANG_KOREAN, SUBLANG_NEUTRAL, "ko" }, + { LANG_KOREAN, SUBLANG_KOREAN, "ko_KR" }, + { LANG_DUTCH, SUBLANG_NEUTRAL, "nl" }, + { LANG_DUTCH, SUBLANG_DUTCH, "nl_NL" }, + { LANG_DUTCH, SUBLANG_DUTCH_BELGIAN, "nl_BE" }, + { LANG_DUTCH, SUBLANG_DUTCH_SURINAM, "nl_SR" }, + { LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL, "nb_NO" }, + { LANG_NORWEGIAN, SUBLANG_NORWEGIAN_NYNORSK, "nn_NO" }, + { LANG_POLISH, SUBLANG_NEUTRAL, "pl" }, + { LANG_POLISH, SUBLANG_POLISH_POLAND, "pl_PL" }, + { LANG_PORTUGUESE, SUBLANG_NEUTRAL, "pt" }, + { LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN, "pt_BR" }, + { LANG_PORTUGUESE, SUBLANG_PORTUGUESE_PORTUGAL, "pt_PT" }, + { LANG_ROMANSH, SUBLANG_NEUTRAL, "rm" }, + { LANG_ROMANSH, SUBLANG_ROMANSH_SWITZERLAND, "rm_CH" }, + { LANG_ROMANIAN, SUBLANG_NEUTRAL, "ro" }, + { LANG_ROMANIAN, SUBLANG_ROMANIAN_ROMANIA, "ro_RO" }, + { LANG_RUSSIAN, SUBLANG_NEUTRAL, "ru" }, + { LANG_RUSSIAN, SUBLANG_RUSSIAN_RUSSIA, "ru_RU" }, + { LANG_SERBIAN, SUBLANG_NEUTRAL, "hr" }, + { LANG_SERBIAN, SUBLANG_SERBIAN_CROATIA, "hr_HR" }, + { LANG_SERBIAN, SUBLANG_SERBIAN_LATIN, "sr_RS@latin" }, + { LANG_SERBIAN, SUBLANG_SERBIAN_CYRILLIC, "sr_RS@cyrillic" }, + { LANG_SLOVAK, SUBLANG_NEUTRAL, "sk" }, + { LANG_SLOVAK, SUBLANG_SLOVAK_SLOVAKIA, "sk_SK" }, + { LANG_ALBANIAN, SUBLANG_NEUTRAL, "sq" }, + { LANG_ALBANIAN, SUBLANG_ALBANIAN_ALBANIA, "sq_AL" }, + { LANG_SWEDISH, SUBLANG_NEUTRAL, "sv" }, + { LANG_SWEDISH, SUBLANG_SWEDISH_SWEDEN, "sv_SE" }, + { LANG_SWEDISH, SUBLANG_SWEDISH_FINLAND, "sv_FI" }, + { LANG_THAI, SUBLANG_NEUTRAL, "th" }, + { LANG_THAI, SUBLANG_THAI_THAILAND, "th_TH" }, + { LANG_TURKISH, SUBLANG_NEUTRAL, "tr" }, + { LANG_TURKISH, SUBLANG_TURKISH_TURKEY, "tr_TR" }, + { LANG_URDU, SUBLANG_NEUTRAL, "ur" }, + { LANG_URDU, SUBLANG_URDU_PAKISTAN, "ur_PK" }, + { LANG_INDONESIAN, SUBLANG_NEUTRAL, "id" }, + { LANG_INDONESIAN, SUBLANG_INDONESIAN_INDONESIA, "id_ID" }, + { LANG_UKRAINIAN, SUBLANG_NEUTRAL, "uk" }, + { LANG_UKRAINIAN, SUBLANG_UKRAINIAN_UKRAINE, "uk_UA" }, + { LANG_BELARUSIAN, SUBLANG_NEUTRAL, "be" }, + { LANG_BELARUSIAN, SUBLANG_BELARUSIAN_BELARUS, "be_BY" }, + { LANG_SLOVENIAN, SUBLANG_NEUTRAL, "sl" }, + { LANG_SLOVENIAN, SUBLANG_SLOVENIAN_SLOVENIA, "sl_SI" }, + { LANG_ESTONIAN, SUBLANG_NEUTRAL, "et" }, + { LANG_ESTONIAN, SUBLANG_ESTONIAN_ESTONIA, "et_EE" }, + { LANG_LATVIAN, SUBLANG_NEUTRAL, "lv" }, + { LANG_LATVIAN, SUBLANG_LATVIAN_LATVIA, "lv_LV" }, + { LANG_LITHUANIAN, SUBLANG_NEUTRAL, "lt" }, + { LANG_LITHUANIAN, SUBLANG_LITHUANIAN_LITHUANIA, "lt_LT" }, + { LANG_PERSIAN, SUBLANG_NEUTRAL, "fa" }, + { LANG_PERSIAN, SUBLANG_PERSIAN_IRAN, "fa_IR" }, + { LANG_ARMENIAN, SUBLANG_NEUTRAL, "hy" }, + { LANG_ARMENIAN, SUBLANG_ARMENIAN_ARMENIA, "hy_AM" }, + { LANG_AZERI, SUBLANG_NEUTRAL, "az" }, + { LANG_AZERI, SUBLANG_AZERI_LATIN, "az_AZ@latin" }, + { LANG_AZERI, SUBLANG_AZERI_CYRILLIC, "az_AZ@cyrillic" }, + { LANG_BASQUE, SUBLANG_NEUTRAL, "eu" }, + { LANG_BASQUE, SUBLANG_BASQUE_BASQUE, "eu_ES" }, + { LANG_MACEDONIAN, SUBLANG_NEUTRAL, "mk" }, + { LANG_MACEDONIAN, SUBLANG_MACEDONIAN_MACEDONIA, "mk_MK" }, + { LANG_AFRIKAANS, SUBLANG_NEUTRAL, "af" }, + { LANG_AFRIKAANS, SUBLANG_AFRIKAANS_SOUTH_AFRICA, "af_ZA" }, + { LANG_GEORGIAN, SUBLANG_NEUTRAL, "ka" }, + { LANG_GEORGIAN, SUBLANG_GEORGIAN_GEORGIA, "ka_GE" }, + { LANG_FAEROESE, SUBLANG_NEUTRAL, "fo" }, + { LANG_FAEROESE, SUBLANG_FAEROESE_FAROE_ISLANDS, "fo_FO" }, + { LANG_HINDI, SUBLANG_NEUTRAL, "hi" }, + { LANG_HINDI, SUBLANG_HINDI_INDIA, "hi_IN" }, + { LANG_MALAY, SUBLANG_NEUTRAL, "ms" }, + { LANG_MALAY, SUBLANG_MALAY_MALAYSIA, "ms_MY" }, + { LANG_MALAY, SUBLANG_MALAY_BRUNEI_DARUSSALAM, "ms_BN" }, + { LANG_KAZAK, SUBLANG_NEUTRAL, "kk" }, + { LANG_KAZAK, SUBLANG_KAZAK_KAZAKHSTAN, "kk_KZ" }, + { LANG_KYRGYZ, SUBLANG_NEUTRAL, "ky" }, + { LANG_KYRGYZ, SUBLANG_KYRGYZ_KYRGYZSTAN, "ky_KG" }, + { LANG_SWAHILI, SUBLANG_NEUTRAL, "sw" }, + { LANG_SWAHILI, SUBLANG_SWAHILI_KENYA, "sw_KE" }, + { LANG_UZBEK, SUBLANG_NEUTRAL, "uz" }, + { LANG_UZBEK, SUBLANG_UZBEK_LATIN, "uz_UZ@latin" }, + { LANG_UZBEK, SUBLANG_UZBEK_CYRILLIC, "uz_UZ@cyrillic" }, + { LANG_TATAR, SUBLANG_NEUTRAL, "tt" }, + { LANG_TATAR, SUBLANG_TATAR_RUSSIA, "tt_TA" }, + { LANG_PUNJABI, SUBLANG_NEUTRAL, "pa" }, + { LANG_PUNJABI, SUBLANG_PUNJABI_INDIA, "pa_IN" }, + { LANG_GUJARATI, SUBLANG_NEUTRAL, "gu" }, + { LANG_GUJARATI, SUBLANG_GUJARATI_INDIA, "gu_IN" }, + { LANG_ORIYA, SUBLANG_NEUTRAL, "or" }, + { LANG_ORIYA, SUBLANG_ORIYA_INDIA, "or_IN" }, + { LANG_TAMIL, SUBLANG_NEUTRAL, "ta" }, + { LANG_TAMIL, SUBLANG_TAMIL_INDIA, "ta_IN" }, + { LANG_TELUGU, SUBLANG_NEUTRAL, "te" }, + { LANG_TELUGU, SUBLANG_TELUGU_INDIA, "te_IN" }, + { LANG_KANNADA, SUBLANG_NEUTRAL, "kn" }, + { LANG_KANNADA, SUBLANG_KANNADA_INDIA, "kn_IN" }, + { LANG_MALAYALAM, SUBLANG_NEUTRAL, "ml" }, + { LANG_MALAYALAM, SUBLANG_MALAYALAM_INDIA, "ml_IN" }, + { LANG_MARATHI, SUBLANG_NEUTRAL, "mr" }, + { LANG_MARATHI, SUBLANG_MARATHI_INDIA, "mr_IN" }, + { LANG_SANSKRIT, SUBLANG_NEUTRAL, "sa" }, + { LANG_SANSKRIT, SUBLANG_SANSKRIT_INDIA, "sa_IN" }, + { LANG_MONGOLIAN, SUBLANG_NEUTRAL, "mn" }, + { LANG_MONGOLIAN, SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA, "mn_MN" }, + { LANG_WELSH, SUBLANG_NEUTRAL, "cy" }, + { LANG_WELSH, SUBLANG_WELSH_UNITED_KINGDOM, "cy_GB" }, + { LANG_GALICIAN, SUBLANG_NEUTRAL, "gl" }, + { LANG_GALICIAN, SUBLANG_GALICIAN_GALICIAN, "gl_ES" }, + { LANG_KONKANI, SUBLANG_NEUTRAL, "kok" }, + { LANG_KONKANI, SUBLANG_KONKANI_INDIA, "kok_IN" }, + { LANG_DIVEHI, SUBLANG_NEUTRAL, "dv" }, + { LANG_DIVEHI, SUBLANG_DIVEHI_MALDIVES, "dv_MV" }, + { LANG_BRETON, SUBLANG_NEUTRAL, "br" }, + { LANG_BRETON, SUBLANG_BRETON_FRANCE, "br_FR" }, + +#ifdef LANG_ESPERANTO + { LANG_ESPERANTO, SUBLANG_DEFAULT, "eo" }, +#endif +#ifdef LANG_WALON + { LANG_WALON, SUBLANG_NEUTRAL, "wa" }, + { LANG_WALON, SUBLANG_DEFAULT, "wa_BE" }, +#endif +#ifdef LANG_CORNISH + { LANG_CORNISH, SUBLANG_NEUTRAL, "kw" }, + { LANG_CORNISH, SUBLANG_DEFAULT, "kw_GB" }, +#endif +#ifdef LANG_GAELIC + { LANG_GAELIC, SUBLANG_NEUTRAL, "ga" }, + { LANG_GAELIC, SUBLANG_GAELIC, "ga_IE" }, + { LANG_GAELIC, SUBLANG_GAELIC_SCOTTISH, "gd_GB" }, + { LANG_GAELIC, SUBLANG_GAELIC_MANX, "gv_GB" }, +#endif +}; + +#ifndef HAVE_LIBGETTEXTPO + +typedef void *po_file_t; + +static const char *get_msgstr( po_file_t po, const char *msgid, const char *context, int *found ) +{ + if (context) (*found)++; + return msgid; +} + +static po_file_t read_po_file( const char *name ) +{ + return NULL; +} + +static void po_file_free ( po_file_t po ) +{ +} + +void write_pot_file( const char *outname ) +{ + error( "PO files not supported in this wrc build\n" ); +} + +void write_po_files( const char *outname ) +{ + error( "PO files not supported in this wrc build\n" ); +} + +#else /* HAVE_LIBGETTEXTPO */ + +static void po_xerror( int severity, po_message_t message, + const char *filename, size_t lineno, size_t column, + int multiline_p, const char *message_text ) +{ + fprintf( stderr, "%s:%u:%u: %s\n", + filename, (unsigned int)lineno, (unsigned int)column, message_text ); + if (severity) exit(1); +} + +static void po_xerror2( int severity, po_message_t message1, + const char *filename1, size_t lineno1, size_t column1, + int multiline_p1, const char *message_text1, + po_message_t message2, + const char *filename2, size_t lineno2, size_t column2, + int multiline_p2, const char *message_text2 ) +{ + fprintf( stderr, "%s:%u:%u: %s\n", + filename1, (unsigned int)lineno1, (unsigned int)column1, message_text1 ); + fprintf( stderr, "%s:%u:%u: %s\n", + filename2, (unsigned int)lineno2, (unsigned int)column2, message_text2 ); + if (severity) exit(1); +} + +static const struct po_xerror_handler po_xerror_handler = { po_xerror, po_xerror2 }; + +static char *convert_string_utf8( const string_t *str, int codepage ) +{ + string_t *newstr = convert_string( str, str_unicode, codepage ); + char *buffer = xmalloc( newstr->size * 4 + 1 ); + int len = wine_utf8_wcstombs( 0, newstr->str.wstr, newstr->size, buffer, newstr->size * 4 ); + buffer[len] = 0; + free_string( newstr ); + return buffer; +} + +static po_message_t find_message( po_file_t po, const char *msgid, const char *msgctxt, + po_message_iterator_t *iterator ) +{ + po_message_t msg; + const char *context; + + *iterator = po_message_iterator( po, NULL ); + while ((msg = po_next_message( *iterator ))) + { + if (strcmp( po_message_msgid( msg ), msgid )) continue; + if (!msgctxt) break; + if (!(context = po_message_msgctxt( msg ))) continue; + if (!strcmp( context, msgctxt )) break; + } + return msg; +} + +static const char *get_msgstr( po_file_t po, const char *msgid, const char *context, int *found ) +{ + const char *ret = msgid; + po_message_t msg; + po_message_iterator_t iterator; + + msg = find_message( po, msgid, context, &iterator ); + if (msg && !po_message_is_fuzzy( msg )) + { + ret = po_message_msgstr( msg ); + if (!ret[0]) ret = msgid; /* ignore empty strings */ + else (*found)++; + } + po_message_iterator_free( iterator ); + return ret; +} + +static po_file_t read_po_file( const char *name ) +{ + po_file_t po; + + if (!(po = po_file_read( name, &po_xerror_handler ))) + error( "cannot load po file '%s'\n", name ); + return po; +} + +static void add_po_string( po_file_t po, const string_t *msgid, const string_t *msgstr, + const language_t *lang ) +{ + po_message_t msg; + po_message_iterator_t iterator; + int codepage; + char *id, *id_buffer, *context, *str = NULL, *str_buffer = NULL; + + if (!msgid->size) return; + + id_buffer = id = convert_msgid_ascii( msgid, 1 ); + context = get_message_context( &id ); + + if (msgstr) + { + if (lang) codepage = get_language_codepage( lang->id, lang->sub ); + else codepage = get_language_codepage( 0, 0 ); + assert( codepage != -1 ); + str_buffer = str = convert_string_utf8( msgstr, codepage ); + if (is_english( lang )) get_message_context( &str ); + } + if (!(msg = find_message( po, id, context, &iterator ))) + { + msg = po_message_create(); + po_message_set_msgid( msg, id ); + po_message_set_msgstr( msg, str ? str : "" ); + if (context) po_message_set_msgctxt( msg, context ); + po_message_insert( iterator, msg ); + } + if (msgid->loc.file) po_message_add_filepos( msg, msgid->loc.file, msgid->loc.line ); + po_message_iterator_free( iterator ); + free( id_buffer ); + free( str_buffer ); +} + +struct po_file_lang +{ + struct list entry; + language_t lang; + po_file_t po; +}; + +static struct list po_file_langs = LIST_INIT( po_file_langs ); + +static po_file_t create_po_file(void) +{ + po_file_t po; + po_message_t msg; + po_message_iterator_t iterator; + + po = po_file_create(); + iterator = po_message_iterator( po, NULL ); + msg = po_message_create(); + po_message_set_msgid( msg, "" ); + po_message_set_msgstr( msg, + "Project-Id-Version: Wine\n" + "Report-Msgid-Bugs-To: http://bugs.winehq.org\n" + "POT-Creation-Date: N/A\n" + "PO-Revision-Date: N/A\n" + "Last-Translator: Automatically generated\n" + "Language-Team: none\n" + "MIME-Version: 1.0\n" + "Content-Type: text/plain; charset=UTF-8\n" + "Content-Transfer-Encoding: 8bit\n" ); + po_message_insert( iterator, msg ); + po_message_iterator_free( iterator ); + return po; +} + +static po_file_t get_po_file( const language_t *lang ) +{ + struct po_file_lang *po_file; + + LIST_FOR_EACH_ENTRY( po_file, &po_file_langs, struct po_file_lang, entry ) + if (po_file->lang.id == lang->id && po_file->lang.sub == lang->sub) return po_file->po; + + /* create a new one */ + po_file = xmalloc( sizeof(*po_file) ); + po_file->lang = *lang; + po_file->po = create_po_file(); + list_add_tail( &po_file_langs, &po_file->entry ); + return po_file->po; +} + +static char *get_po_file_name( const language_t *lang ) +{ + unsigned int i; + char name[40]; + + sprintf( name, "%02x-%02x", lang->id, lang->sub ); + for (i = 0; i < sizeof(languages)/sizeof(languages[0]); i++) + { + if (languages[i].id == lang->id && languages[i].sub == lang->sub) + { + strcpy( name, languages[i].name ); + break; + } + } + strcat( name, ".po" ); + return xstrdup( name ); +} + +static unsigned int flush_po_files( const char *output_name ) +{ + struct po_file_lang *po_file, *next; + unsigned int count = 0; + + LIST_FOR_EACH_ENTRY_SAFE( po_file, next, &po_file_langs, struct po_file_lang, entry ) + { + char *name = get_po_file_name( &po_file->lang ); + if (output_name) + { + const char *p = strrchr( output_name, '/' ); + if (p) p++; + else p = output_name; + if (!strcmp( p, name )) + { + po_file_write( po_file->po, name, &po_xerror_handler ); + count++; + } + } + else /* no specified output name, output a file for every language found */ + { + po_file_write( po_file->po, name, &po_xerror_handler ); + count++; + fprintf( stderr, "created %s\n", name ); + } + po_file_free( po_file->po ); + list_remove( &po_file->entry ); + free( po_file ); + free( name ); + } + return count; +} + +static void add_pot_stringtable( po_file_t po, const resource_t *res ) +{ + const stringtable_t *stt = res->res.stt; + int i; + + while (stt) + { + for (i = 0; i < stt->nentries; i++) + if (stt->entries[i].str) add_po_string( po, stt->entries[i].str, NULL, NULL ); + stt = stt->next; + } +} + +static void add_po_stringtable( const resource_t *english, const resource_t *res ) +{ + const stringtable_t *english_stt = english->res.stt; + const stringtable_t *stt = res->res.stt; + po_file_t po = get_po_file( stt->lvc.language ); + int i; + + while (english_stt && stt) + { + for (i = 0; i < stt->nentries; i++) + if (english_stt->entries[i].str && stt->entries[i].str) + add_po_string( po, english_stt->entries[i].str, stt->entries[i].str, stt->lvc.language ); + stt = stt->next; + english_stt = english_stt->next; + } +} + +static void add_pot_dialog_controls( po_file_t po, const control_t *ctrl ) +{ + while (ctrl) + { + if (control_has_title( ctrl )) add_po_string( po, ctrl->title->name.s_name, NULL, NULL ); + ctrl = ctrl->next; + } +} + +static void add_pot_dialog( po_file_t po, const resource_t *res ) +{ + const dialog_t *dlg = res->res.dlg; + + if (dlg->title) add_po_string( po, dlg->title, NULL, NULL ); + if (dlg->font) add_po_string( po, dlg->font->name, NULL, NULL ); + add_pot_dialog_controls( po, dlg->controls ); +} + +static void add_po_dialog_controls( po_file_t po, const control_t *english_ctrl, + const control_t *ctrl, const language_t *lang ) +{ + while (english_ctrl && ctrl) + { + if (control_has_title( english_ctrl ) && control_has_title( ctrl )) + add_po_string( po, english_ctrl->title->name.s_name, ctrl->title->name.s_name, lang ); + + ctrl = ctrl->next; + english_ctrl = english_ctrl->next; + } +} + +static void add_po_dialog( const resource_t *english, const resource_t *res ) +{ + const dialog_t *english_dlg = english->res.dlg; + const dialog_t *dlg = res->res.dlg; + po_file_t po = get_po_file( dlg->lvc.language ); + + if (english_dlg->title && dlg->title) + add_po_string( po, english_dlg->title, dlg->title, dlg->lvc.language ); + if (english_dlg->font && dlg->font) + add_po_string( po, english_dlg->font->name, dlg->font->name, dlg->lvc.language ); + add_po_dialog_controls( po, english_dlg->controls, dlg->controls, dlg->lvc.language ); +} + +static void add_pot_menu_items( po_file_t po, const menu_item_t *item ) +{ + while (item) + { + if (item->name) add_po_string( po, item->name, NULL, NULL ); + if (item->popup) add_pot_menu_items( po, item->popup ); + item = item->next; + } +} + +static void add_pot_menu( po_file_t po, const resource_t *res ) +{ + add_pot_menu_items( po, res->res.men->items ); +} + +static void add_po_menu_items( po_file_t po, const menu_item_t *english_item, + const menu_item_t *item, const language_t *lang ) +{ + while (english_item && item) + { + if (english_item->name && item->name) + add_po_string( po, english_item->name, item->name, lang ); + if (english_item->popup && item->popup) + add_po_menu_items( po, english_item->popup, item->popup, lang ); + item = item->next; + english_item = english_item->next; + } +} + +static void add_po_menu( const resource_t *english, const resource_t *res ) +{ + const menu_item_t *english_items = english->res.men->items; + const menu_item_t *items = res->res.men->items; + po_file_t po = get_po_file( res->res.men->lvc.language ); + + add_po_menu_items( po, english_items, items, res->res.men->lvc.language ); +} + +static resource_t *find_english_resource( resource_t *res ) +{ + resource_t *ptr; + + for (ptr = resource_top; ptr; ptr = ptr->next) + { + if (ptr->type != res->type) continue; + if (!ptr->lan) continue; + if (!is_english( ptr->lan )) continue; + if (compare_name_id( ptr->name, res->name )) continue; + return ptr; + } + return NULL; +} + +void write_pot_file( const char *outname ) +{ + resource_t *res; + po_file_t po = create_po_file(); + + for (res = resource_top; res; res = res->next) + { + if (!is_english( res->lan )) continue; + + switch (res->type) + { + case res_acc: break; /* FIXME */ + case res_dlg: add_pot_dialog( po, res ); break; + case res_men: add_pot_menu( po, res ); break; + case res_stt: add_pot_stringtable( po, res ); break; + case res_msg: break; /* FIXME */ + default: break; + } + } + po_file_write( po, outname, &po_xerror_handler ); + po_file_free( po ); +} + +void write_po_files( const char *outname ) +{ + resource_t *res, *english; + + for (res = resource_top; res; res = res->next) + { + if (!(english = find_english_resource( res ))) continue; + switch (res->type) + { + case res_acc: break; /* FIXME */ + case res_dlg: add_po_dialog( english, res ); break; + case res_men: add_po_menu( english, res ); break; + case res_stt: add_po_stringtable( english, res ); break; + case res_msg: break; /* FIXME */ + default: break; + } + } + if (!flush_po_files( outname )) + { + if (outname) error( "No translations found for %s\n", outname ); + else error( "No translations found\n" ); + } +} + +#endif /* HAVE_LIBGETTEXTPO */ + +static string_t *translate_string( po_file_t po, string_t *str, int *found ) +{ + string_t *new; + const char *transl; + int res; + char *buffer, *msgid, *context; + + if (!str->size || !(buffer = convert_msgid_ascii( str, 0 ))) + return convert_string( str, str_unicode, 1252 ); + + msgid = buffer; + context = get_message_context( &msgid ); + transl = get_msgstr( po, msgid, context, found ); + + new = xmalloc( sizeof(*new) ); + new->type = str_unicode; + new->size = wine_utf8_mbstowcs( 0, transl, strlen(transl), NULL, 0 ); + new->str.wstr = xmalloc( (new->size+1) * sizeof(WCHAR) ); + res = wine_utf8_mbstowcs( MB_ERR_INVALID_CHARS, transl, strlen(transl), new->str.wstr, new->size ); + if (res == -2) + error( "Invalid utf-8 character in string '%s'\n", transl ); + new->str.wstr[new->size] = 0; + free( buffer ); + return new; +} + +static control_t *translate_controls( po_file_t po, control_t *ctrl, int *found ) +{ + control_t *new, *head = NULL, *tail = NULL; + + while (ctrl) + { + new = xmalloc( sizeof(*new) ); + *new = *ctrl; + if (control_has_title( ctrl )) + { + new->title = new_name_id(); + *new->title = *ctrl->title; + new->title->name.s_name = translate_string( po, ctrl->title->name.s_name, found ); + } + else new->title = dup_name_id( ctrl->title ); + new->ctlclass = dup_name_id( ctrl->ctlclass ); + if (tail) tail->next = new; + else head = new; + new->next = NULL; + new->prev = tail; + tail = new; + ctrl = ctrl->next; + } + return head; +} + +static menu_item_t *translate_items( po_file_t po, menu_item_t *item, int *found ) +{ + menu_item_t *new, *head = NULL, *tail = NULL; + + while (item) + { + new = xmalloc( sizeof(*new) ); + *new = *item; + if (item->name) new->name = translate_string( po, item->name, found ); + if (item->popup) new->popup = translate_items( po, item->popup, found ); + if (tail) tail->next = new; + else head = new; + new->next = NULL; + new->prev = tail; + tail = new; + item = item->next; + } + return head; +} + +static stringtable_t *translate_stringtable( po_file_t po, stringtable_t *stt, + language_t *lang, int *found ) +{ + stringtable_t *new, *head = NULL, *tail = NULL; + int i; + + while (stt) + { + new = xmalloc( sizeof(*new) ); + *new = *stt; + new->lvc.language = lang; + new->lvc.version = get_dup_version( lang ); + new->entries = xmalloc( new->nentries * sizeof(*new->entries) ); + memcpy( new->entries, stt->entries, new->nentries * sizeof(*new->entries) ); + for (i = 0; i < stt->nentries; i++) + if (stt->entries[i].str) + new->entries[i].str = translate_string( po, stt->entries[i].str, found ); + + if (tail) tail->next = new; + else head = new; + new->next = NULL; + new->prev = tail; + tail = new; + stt = stt->next; + } + return head; +} + +static void translate_dialog( po_file_t po, dialog_t *dlg, dialog_t *new, int *found ) +{ + if (dlg->title) new->title = translate_string( po, dlg->title, found ); + if (dlg->font) + { + new->font = xmalloc( sizeof(*dlg->font) ); + new->font = dlg->font; + new->font->name = translate_string( po, dlg->font->name, found ); + } + new->controls = translate_controls( po, dlg->controls, found ); +} + +static void translate_resources( po_file_t po, language_t *lang ) +{ + resource_t *res; + + for (res = resource_top; res; res = res->next) + { + resource_t *new = NULL; + int found = 0; + + if (!is_english( res->lan )) continue; + + switch (res->type) + { + case res_acc: + /* FIXME */ + break; + case res_dlg: + new = dup_resource( res, lang ); + translate_dialog( po, res->res.dlg, new->res.dlg, &found ); + break; + case res_men: + new = dup_resource( res, lang ); + new->res.men->items = translate_items( po, res->res.men->items, &found ); + break; + case res_stt: + new = dup_resource( res, lang ); + new->res.stt = translate_stringtable( po, res->res.stt, lang, &found ); + break; + case res_msg: + /* FIXME */ + break; + default: + break; + } + + if (new && found) + { + if (new_tail) new_tail->next = new; + else new_top = new; + new->prev = new_tail; + new_tail = new; + } + } +} + +void add_translations( const char *po_dir ) +{ + resource_t *res; + po_file_t po; + char buffer[256]; + char *p, *tok, *name; + unsigned int i; + FILE *f; + + /* first check if we have English resources to translate */ + for (res = resource_top; res; res = res->next) if (is_english( res->lan )) break; + if (!res) return; + + new_top = new_tail = NULL; + + name = strmake( "%s/LINGUAS", po_dir ); + if (!(f = fopen( name, "r" ))) + { + free( name ); + return; + } + free( name ); + while (fgets( buffer, sizeof(buffer), f )) + { + if ((p = strchr( buffer, '#' ))) *p = 0; + for (tok = strtok( buffer, " \t\r\n" ); tok; tok = strtok( NULL, " \t\r\n" )) + { + for (i = 0; i < sizeof(languages)/sizeof(languages[0]); i++) + if (!strcmp( tok, languages[i].name )) break; + + if (i == sizeof(languages)/sizeof(languages[0])) + error( "unknown language '%s'\n", tok ); + + name = strmake( "%s/%s.po", po_dir, tok ); + po = read_po_file( name ); + translate_resources( po, new_language(languages[i].id, languages[i].sub) ); + po_file_free( po ); + free( name ); + } + } + fclose( f ); + + /* prepend the translated resources to the global list */ + if (new_tail) + { + new_tail->next = resource_top; + resource_top->prev = new_tail; + resource_top = new_top; + } +} diff --git a/reactos/tools/wrc/translation.c b/reactos/tools/wrc/translation.c index 7262a658476..6cfe07ad5a9 100644 --- a/reactos/tools/wrc/translation.c +++ b/reactos/tools/wrc/translation.c @@ -47,8 +47,6 @@ static language_t get_language(resource_t *resource) { return *resource->res.curg->lvc.language; case res_dlg: return *resource->res.dlg->lvc.language; - case res_dlgex: - return *resource->res.dlgex->lvc.language; case res_fnt: return *resource->res.fnt->data->lvc.language; case res_fntdir: @@ -59,8 +57,6 @@ static language_t get_language(resource_t *resource) { return *resource->res.icog->lvc.language; case res_men: return *resource->res.men->lvc.language; - case res_menex: - return *resource->res.menex->lvc.language; case res_rdt: return *resource->res.rdt->data->lvc.language; case res_stt: @@ -358,6 +354,13 @@ static int compare_dialog(dialog_t *dialog1, dialog_t *dialog2) { ((dialog1->gotexstyle && !dialog2->gotexstyle) || (!dialog1->gotexstyle && dialog2->gotexstyle))) different = 1; + if(!different && dialog1->gothelpid && dialog2->gothelpid) { + if(dialog1->helpid != dialog2->helpid) + different = 1; + } else if(!different && + ((dialog1->gothelpid && !dialog2->gothelpid) || + (!dialog1->gothelpid && dialog2->gothelpid))) + different = 1; nameid = strdup(get_nameid_str(dialog1->menu)); if(!different && strcmp(nameid, get_nameid_str(dialog2->menu))) different = 1; @@ -378,60 +381,6 @@ static int compare_dialog(dialog_t *dialog1, dialog_t *dialog2) { return different; } -static int compare_dialogex(dialogex_t *dialogex1, dialogex_t *dialogex2) { - int different = 0; - char *nameid = NULL; - control_t *ctrl1, *ctrl2; - if(!different && - ((dialogex1->memopt != dialogex2->memopt) || - (dialogex1->lvc.version != dialogex2->lvc.version) || - (dialogex1->lvc.characts != dialogex2->lvc.characts))) - different = 1; - if(!different && dialogex1->gotstyle && dialogex2->gotstyle) { - if((!dialogex1->style || !dialogex2->style) || - (dialogex1->style->and_mask || dialogex2->style->and_mask) || - (dialogex1->style->or_mask != dialogex2->style->or_mask)) - different = 1; - } else if(!different && - ((dialogex1->gotstyle && !dialogex2->gotstyle) || - (!dialogex1->gotstyle && dialogex2->gotstyle))) - different = 1; - if(!different && dialogex1->gotexstyle && dialogex2->gotexstyle) { - if((!dialogex1->exstyle || !dialogex2->exstyle) || - (dialogex1->exstyle->and_mask || dialogex2->exstyle->and_mask) || - (dialogex1->exstyle->or_mask != dialogex2->exstyle->or_mask)) - different = 1; - } else if(!different && - ((dialogex1->gotexstyle && !dialogex2->gotexstyle) || - (!dialogex1->gotexstyle && dialogex2->gotexstyle))) - different = 1; - if(!different && dialogex1->gothelpid && dialogex2->gothelpid) { - if(dialogex1->helpid != dialogex2->helpid) - different = 1; - } else if(!different && - ((dialogex1->gothelpid && !dialogex2->gothelpid) || - (!dialogex1->gothelpid && dialogex2->gothelpid))) - different = 1; - nameid = strdup(get_nameid_str(dialogex1->menu)); - if(!different && strcmp(nameid, get_nameid_str(dialogex2->menu))) - different = 1; - free(nameid); - nameid = strdup(get_nameid_str(dialogex1->dlgclass)); - if(!different && strcmp(nameid, get_nameid_str(dialogex2->dlgclass))) - different = 1; - free(nameid); - - ctrl1 = dialogex1->controls; - ctrl2 = dialogex2->controls; - while(!different && (ctrl1 || ctrl2)) - { - different = compare_control(ctrl1, ctrl2); - if (ctrl1) ctrl1 = ctrl1->next; - if (ctrl2) ctrl2 = ctrl2->next; - } - return different; -} - static int compare_font(font_t *font1, font_t *font2) { int different = 0; if(!different && @@ -496,13 +445,67 @@ static int compare_icon_group(icon_group_t *icon_group1, icon_group_t *icon_grou static int compare_menu_item(menu_item_t *menu_item1, menu_item_t *menu_item2) { int different = 0; while(!different && menu_item1 && menu_item2) { - if(menu_item1->popup && menu_item2->popup) - different = compare_menu_item(menu_item1->popup, menu_item2->popup); - else if(!menu_item1->popup && !menu_item2->popup) { - if(menu_item1->name && menu_item2->name) { - if((menu_item1->id != menu_item2->id) || - (menu_item1->state != menu_item2->state)) + if(menu_item1->popup && menu_item2->popup) { + if(!different && menu_item1->gotid && menu_item2->gotid) { + if(menu_item1->id != menu_item2->id) different = 1; + } else if(!different && + ((menu_item1->gotid && !menu_item2->gotid) || + (!menu_item1->gotid && menu_item2->gotid))) + different = 1; + if(!different && menu_item1->gottype && menu_item2->gottype) { + if(menu_item1->type != menu_item2->type) + different = 1; + } else if(!different && + ((menu_item1->gottype && !menu_item2->gottype) || + (!menu_item1->gottype && menu_item2->gottype))) + different = 1; + if(!different && menu_item1->gotstate && menu_item2->gotstate) { + if(menu_item1->state != menu_item2->state) + different = 1; + } else if(!different && + ((menu_item1->gotstate && !menu_item2->gotstate) || + (!menu_item1->gotstate && menu_item2->gotstate))) + different = 1; + if(!different && menu_item1->gothelpid && menu_item2->gothelpid) { + if(menu_item1->helpid != menu_item2->helpid) + different = 1; + } else if(!different && + ((menu_item1->gothelpid && !menu_item2->gothelpid) || + (!menu_item1->gothelpid && menu_item2->gothelpid))) + different = 1; + if(!different) + different = compare_menu_item(menu_item1->popup, menu_item2->popup); + } else if(!menu_item1->popup && !menu_item2->popup) { + if(menu_item1->name && menu_item2->name) { + if(!different && menu_item1->gotid && menu_item2->gotid) { + if(menu_item1->id != menu_item2->id) + different = 1; + } else if(!different && + ((menu_item1->gotid && !menu_item2->gotid) || + (!menu_item1->gotid && menu_item2->gotid))) + different = 1; + if(!different && menu_item1->gottype && menu_item2->gottype) { + if(menu_item1->type != menu_item2->type) + different = 1; + } else if(!different && + ((menu_item1->gottype && !menu_item2->gottype) || + (!menu_item1->gottype && menu_item2->gottype))) + different = 1; + if(!different && menu_item1->gotstate && menu_item2->gotstate) { + if(menu_item1->state != menu_item2->state) + different = 1; + } else if(!different && + ((menu_item1->gotstate && !menu_item2->gotstate) || + (!menu_item1->gotstate && menu_item2->gotstate))) + different = 1; + if(!different && menu_item1->gothelpid && menu_item2->gothelpid) { + if(menu_item1->helpid != menu_item2->helpid) + different = 1; + } else if(!different && + ((menu_item1->gothelpid && !menu_item2->gothelpid) || + (!menu_item1->gothelpid && menu_item2->gothelpid))) + different = 1; } else if((menu_item1->name && !menu_item2->name) || (!menu_item1->name && menu_item2->name)) different = 1; @@ -530,97 +533,6 @@ static int compare_menu(menu_t *menu1, menu_t *menu2) { return different; } -static int compare_menuex_item(menuex_item_t *menuex_item1, menuex_item_t *menuex_item2) { - int different = 0; - while(!different && menuex_item1 && menuex_item2) { - if(menuex_item1->popup && menuex_item2->popup) { - if(!different && menuex_item1->gotid && menuex_item2->gotid) { - if(menuex_item1->id != menuex_item2->id) - different = 1; - } else if(!different && - ((menuex_item1->gotid && !menuex_item2->gotid) || - (!menuex_item2->gotid && menuex_item2->gotid))) - different = 1; - if(!different && menuex_item1->gottype && menuex_item2->gottype) { - if(menuex_item1->type != menuex_item2->type) - different = 1; - } else if(!different && - ((menuex_item1->gottype && !menuex_item2->gottype) || - (!menuex_item2->gottype && menuex_item2->gottype))) - different = 1; - if(!different && menuex_item1->gotstate && menuex_item2->gotstate) { - if(menuex_item1->state != menuex_item2->state) - different = 1; - } else if(!different && - ((menuex_item1->gotstate && !menuex_item2->gotstate) || - (!menuex_item2->gotstate && menuex_item2->gotstate))) - different = 1; - if(!different && menuex_item1->gothelpid && menuex_item2->gothelpid) { - if(menuex_item1->helpid != menuex_item2->helpid) - different = 1; - } else if(!different && - ((menuex_item1->gothelpid && !menuex_item2->gothelpid) || - (!menuex_item2->gothelpid && menuex_item2->gothelpid))) - different = 1; - if(!different) - different = compare_menuex_item(menuex_item1->popup, menuex_item2->popup); - } else if(!menuex_item1->popup && !menuex_item2->popup) { - if(menuex_item1->name && menuex_item2->name) { - if(!different && menuex_item1->gotid && menuex_item2->gotid) { - if(menuex_item1->id != menuex_item2->id) - different = 1; - } else if(!different && - ((menuex_item1->gotid && !menuex_item2->gotid) || - (!menuex_item2->gotid && menuex_item2->gotid))) - different = 1; - if(!different && menuex_item1->gottype && menuex_item2->gottype) { - if(menuex_item1->type != menuex_item2->type) - different = 1; - } else if(!different && - ((menuex_item1->gottype && !menuex_item2->gottype) || - (!menuex_item2->gottype && menuex_item2->gottype))) - different = 1; - if(!different && menuex_item1->gotstate && menuex_item2->gotstate) { - if(menuex_item1->state != menuex_item2->state) - different = 1; - } else if(!different && - ((menuex_item1->gotstate && !menuex_item2->gotstate) || - (!menuex_item2->gotstate && menuex_item2->gotstate))) - different = 1; - if(!different && menuex_item1->gothelpid && menuex_item2->gothelpid) { - if(menuex_item1->helpid != menuex_item2->helpid) - different = 1; - } else if(!different && - ((menuex_item1->gothelpid && !menuex_item2->gothelpid) || - (!menuex_item2->gothelpid && menuex_item2->gothelpid))) - different = 1; - } else if((menuex_item1->name && !menuex_item2->name) || - (!menuex_item1->name && menuex_item2->name)) - different = 1; - } else - different = 1; - menuex_item1 = menuex_item1->next; - menuex_item2 = menuex_item2->next; - } - if(!different && - ((menuex_item1 && !menuex_item2) || - (!menuex_item1 && menuex_item2))) - different = 1; - return different; -} - -static int compare_menuex(menuex_t *menuex1, menuex_t *menuex2) { - int different = 0; - if(!different && - ((menuex1->memopt != menuex2->memopt) || - (menuex1->lvc.version != menuex2->lvc.version) || - (menuex1->lvc.characts != menuex2->lvc.characts))) - different = 1; - if(!different) - different = compare_menuex_item(menuex1->items, menuex2->items); - return different; -} - static int compare_rcdata(rcdata_t *rcdata1, rcdata_t *rcdata2) { int different = 0; if(!different && @@ -924,8 +836,6 @@ static int compare(resource_t *resource1, resource_t *resource2) { return compare_cursor_group(resource1->res.curg, resource2->res.curg); case res_dlg: return compare_dialog(resource1->res.dlg, resource2->res.dlg); - case res_dlgex: - return compare_dialogex(resource1->res.dlgex, resource2->res.dlgex); case res_fnt: return compare_font(resource1->res.fnt, resource2->res.fnt); case res_fntdir: @@ -936,8 +846,6 @@ static int compare(resource_t *resource1, resource_t *resource2) { return compare_icon_group(resource1->res.icog, resource2->res.icog); case res_men: return compare_menu(resource1->res.men, resource2->res.men); - case res_menex: - return compare_menuex(resource1->res.menex, resource2->res.menex); case res_rdt: return compare_rcdata(resource1->res.rdt, resource2->res.rdt); case res_stt: @@ -979,7 +887,7 @@ typedef struct resource_id_node struct resource_id_node *next; } resource_id_node_t; -struct +static struct { int enabled; struct resource_id_node *ids; @@ -1034,13 +942,11 @@ static void setup_tabs(void) case res_cur: case res_curg: case res_dlg: - case res_dlgex: case res_fnt: case res_fntdir: case res_ico: case res_icog: case res_men: - case res_menex: case res_rdt: case res_stt: case res_usr: @@ -1077,7 +983,7 @@ static resource_t *find_main(int type, name_id_t *id, resource_lang_node_t *lang if (neutral != NULL && (en != NULL || en_US != NULL)) { - fprintf(stderr, "INFO: Resource %04x/%s has both NEUTRAL and MASTER language translarion\n", + fprintf(stderr, "INFO: Resource %04x/%s has both NEUTRAL and MASTER language translation\n", type, get_nameid_str(id)); } diff --git a/reactos/tools/wrc/utils.c b/reactos/tools/wrc/utils.c index 955c0ed63c8..397c252abb9 100644 --- a/reactos/tools/wrc/utils.c +++ b/reactos/tools/wrc/utils.c @@ -192,6 +192,25 @@ void *xrealloc(void *p, size_t size) return res; } +char *strmake( const char* fmt, ... ) +{ + int n; + size_t size = 100; + va_list ap; + + for (;;) + { + char *p = xmalloc( size ); + va_start( ap, fmt ); + n = vsnprintf( p, size, fmt, ap ); + va_end( ap ); + if (n == -1) size *= 2; + else if ((size_t)n >= size) size = n + 1; + else return p; + free( p ); + } +} + char *xstrdup(const char *str) { char *s; @@ -252,6 +271,8 @@ string_t *convert_string(const string_t *str, enum str_e type, int codepage) string_t *ret = xmalloc(sizeof(*ret)); int res; + ret->loc = str->loc; + if (!codepage && str->type != type) parser_error( "Current language is Unicode only, cannot convert string" ); @@ -367,7 +388,7 @@ struct lang2cp unsigned short lang; unsigned short sublang; unsigned int cp; -} lang2cp_t; +}; /* language to codepage conversion table */ /* specific sublanguages need only be specified if their codepage */ @@ -376,14 +397,19 @@ static const struct lang2cp lang2cps[] = { { LANG_AFRIKAANS, SUBLANG_NEUTRAL, 1252 }, { LANG_ALBANIAN, SUBLANG_NEUTRAL, 1250 }, + { LANG_ALSATIAN, SUBLANG_NEUTRAL, 1252 }, + { LANG_AMHARIC, SUBLANG_NEUTRAL, 0 }, { LANG_ARABIC, SUBLANG_NEUTRAL, 1256 }, { LANG_ARMENIAN, SUBLANG_NEUTRAL, 0 }, { LANG_ASSAMESE, SUBLANG_NEUTRAL, 0 }, { LANG_AZERI, SUBLANG_NEUTRAL, 1254 }, { LANG_AZERI, SUBLANG_AZERI_CYRILLIC, 1251 }, + { LANG_BASHKIR, SUBLANG_NEUTRAL, 1251 }, { LANG_BASQUE, SUBLANG_NEUTRAL, 1252 }, { LANG_BELARUSIAN, SUBLANG_NEUTRAL, 1251 }, { LANG_BENGALI, SUBLANG_NEUTRAL, 0 }, + { LANG_BOSNIAN, SUBLANG_NEUTRAL, 1250 }, + { LANG_BOSNIAN, SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC, 1251 }, { LANG_BRETON, SUBLANG_NEUTRAL, 1252 }, { LANG_BULGARIAN, SUBLANG_NEUTRAL, 1251 }, { LANG_CATALAN, SUBLANG_NEUTRAL, 1252 }, @@ -393,9 +419,11 @@ static const struct lang2cp lang2cps[] = #ifdef LANG_CORNISH { LANG_CORNISH, SUBLANG_NEUTRAL, 1252 }, #endif /* LANG_CORNISH */ + { LANG_CORSICAN, SUBLANG_NEUTRAL, 1252 }, { LANG_CROATIAN, SUBLANG_NEUTRAL, 1250 }, { LANG_CZECH, SUBLANG_NEUTRAL, 1250 }, { LANG_DANISH, SUBLANG_NEUTRAL, 1252 }, + { LANG_DARI, SUBLANG_NEUTRAL, 1256 }, { LANG_DIVEHI, SUBLANG_NEUTRAL, 0 }, { LANG_DUTCH, SUBLANG_NEUTRAL, 1252 }, { LANG_ENGLISH, SUBLANG_NEUTRAL, 1252 }, @@ -404,9 +432,10 @@ static const struct lang2cp lang2cps[] = #endif /* LANG_ESPERANTO */ { LANG_ESTONIAN, SUBLANG_NEUTRAL, 1257 }, { LANG_FAEROESE, SUBLANG_NEUTRAL, 1252 }, - { LANG_FARSI, SUBLANG_NEUTRAL, 1256 }, + { LANG_FILIPINO, SUBLANG_NEUTRAL, 1252 }, { LANG_FINNISH, SUBLANG_NEUTRAL, 1252 }, { LANG_FRENCH, SUBLANG_NEUTRAL, 1252 }, + { LANG_FRISIAN, SUBLANG_NEUTRAL, 1252 }, #ifdef LANG_GAELIC { LANG_GAELIC, SUBLANG_NEUTRAL, 1252 }, #endif /* LANG_GAELIC */ @@ -414,36 +443,53 @@ static const struct lang2cp lang2cps[] = { LANG_GEORGIAN, SUBLANG_NEUTRAL, 0 }, { LANG_GERMAN, SUBLANG_NEUTRAL, 1252 }, { LANG_GREEK, SUBLANG_NEUTRAL, 1253 }, + { LANG_GREENLANDIC, SUBLANG_NEUTRAL, 1252 }, { LANG_GUJARATI, SUBLANG_NEUTRAL, 0 }, + { LANG_HAUSA, SUBLANG_NEUTRAL, 1252 }, { LANG_HEBREW, SUBLANG_NEUTRAL, 1255 }, { LANG_HINDI, SUBLANG_NEUTRAL, 0 }, { LANG_HUNGARIAN, SUBLANG_NEUTRAL, 1250 }, { LANG_ICELANDIC, SUBLANG_NEUTRAL, 1252 }, + { LANG_IGBO, SUBLANG_NEUTRAL, 1252 }, { LANG_INDONESIAN, SUBLANG_NEUTRAL, 1252 }, + { LANG_INUKTITUT, SUBLANG_NEUTRAL, 0 }, + { LANG_INUKTITUT, SUBLANG_INUKTITUT_CANADA_LATIN, 0 }, { LANG_IRISH, SUBLANG_NEUTRAL, 1252 }, { LANG_ITALIAN, SUBLANG_NEUTRAL, 1252 }, { LANG_JAPANESE, SUBLANG_NEUTRAL, 932 }, { LANG_KANNADA, SUBLANG_NEUTRAL, 0 }, { LANG_KAZAK, SUBLANG_NEUTRAL, 1251 }, + { LANG_KHMER, SUBLANG_NEUTRAL, 0 }, + { LANG_KICHE, SUBLANG_NEUTRAL, 1252 }, + { LANG_KINYARWANDA, SUBLANG_NEUTRAL, 1252 }, { LANG_KONKANI, SUBLANG_NEUTRAL, 0 }, { LANG_KOREAN, SUBLANG_NEUTRAL, 949 }, { LANG_KYRGYZ, SUBLANG_NEUTRAL, 1251 }, + { LANG_LAO, SUBLANG_NEUTRAL, 0 }, { LANG_LATVIAN, SUBLANG_NEUTRAL, 1257 }, { LANG_LITHUANIAN, SUBLANG_NEUTRAL, 1257 }, { LANG_LOWER_SORBIAN, SUBLANG_NEUTRAL, 1252 }, + { LANG_LUXEMBOURGISH, SUBLANG_NEUTRAL, 1252 }, { LANG_MACEDONIAN, SUBLANG_NEUTRAL, 1251 }, { LANG_MALAY, SUBLANG_NEUTRAL, 1252 }, { LANG_MALAYALAM, SUBLANG_NEUTRAL, 0 }, { LANG_MALTESE, SUBLANG_NEUTRAL, 0 }, + { LANG_MAORI, SUBLANG_NEUTRAL, 0 }, + { LANG_MAPUDUNGUN, SUBLANG_NEUTRAL, 1252 }, { LANG_MARATHI, SUBLANG_NEUTRAL, 0 }, + { LANG_MOHAWK, SUBLANG_NEUTRAL, 1252 }, { LANG_MONGOLIAN, SUBLANG_NEUTRAL, 1251 }, { LANG_NEPALI, SUBLANG_NEUTRAL, 0 }, { LANG_NEUTRAL, SUBLANG_NEUTRAL, 1252 }, { LANG_NORWEGIAN, SUBLANG_NEUTRAL, 1252 }, + { LANG_OCCITAN, SUBLANG_NEUTRAL, 1252 }, { LANG_ORIYA, SUBLANG_NEUTRAL, 0 }, + { LANG_PASHTO, SUBLANG_NEUTRAL, 0 }, + { LANG_PERSIAN, SUBLANG_NEUTRAL, 1256 }, { LANG_POLISH, SUBLANG_NEUTRAL, 1250 }, { LANG_PORTUGUESE, SUBLANG_NEUTRAL, 1252 }, { LANG_PUNJABI, SUBLANG_NEUTRAL, 0 }, + { LANG_QUECHUA, SUBLANG_NEUTRAL, 1252 }, { LANG_ROMANIAN, SUBLANG_NEUTRAL, 1250 }, { LANG_ROMANSH, SUBLANG_NEUTRAL, 1252 }, { LANG_RUSSIAN, SUBLANG_NEUTRAL, 1251 }, @@ -451,19 +497,25 @@ static const struct lang2cp lang2cps[] = { LANG_SANSKRIT, SUBLANG_NEUTRAL, 0 }, { LANG_SERBIAN, SUBLANG_NEUTRAL, 1250 }, { LANG_SERBIAN, SUBLANG_SERBIAN_CYRILLIC, 1251 }, + { LANG_SINHALESE, SUBLANG_NEUTRAL, 0 }, { LANG_SLOVAK, SUBLANG_NEUTRAL, 1250 }, { LANG_SLOVENIAN, SUBLANG_NEUTRAL, 1250 }, + { LANG_SOTHO, SUBLANG_NEUTRAL, 1252 }, { LANG_SPANISH, SUBLANG_NEUTRAL, 1252 }, { LANG_SWAHILI, SUBLANG_NEUTRAL, 1252 }, { LANG_SWEDISH, SUBLANG_NEUTRAL, 1252 }, { LANG_SYRIAC, SUBLANG_NEUTRAL, 0 }, { LANG_TAJIK, SUBLANG_NEUTRAL, 1251 }, + { LANG_TAMAZIGHT, SUBLANG_NEUTRAL, 1252 }, { LANG_TAMIL, SUBLANG_NEUTRAL, 0 }, { LANG_TATAR, SUBLANG_NEUTRAL, 1251 }, { LANG_TELUGU, SUBLANG_NEUTRAL, 0 }, { LANG_THAI, SUBLANG_NEUTRAL, 874 }, + { LANG_TIBETAN, SUBLANG_NEUTRAL, 0 }, { LANG_TSWANA, SUBLANG_NEUTRAL, 1252 }, { LANG_TURKISH, SUBLANG_NEUTRAL, 1254 }, + { LANG_TURKMEN, SUBLANG_NEUTRAL, 1250 }, + { LANG_UIGHUR, SUBLANG_NEUTRAL, 1256 }, { LANG_UKRAINIAN, SUBLANG_NEUTRAL, 1251 }, { LANG_UPPER_SORBIAN, SUBLANG_NEUTRAL, 1252 }, { LANG_URDU, SUBLANG_NEUTRAL, 1256 }, @@ -473,10 +525,12 @@ static const struct lang2cp lang2cps[] = #ifdef LANG_WALON { LANG_WALON, SUBLANG_NEUTRAL, 1252 }, #endif /* LANG_WALON */ -#ifdef LANG_WELSH { LANG_WELSH, SUBLANG_NEUTRAL, 1252 }, -#endif + { LANG_WOLOF, SUBLANG_NEUTRAL, 1252 }, { LANG_XHOSA, SUBLANG_NEUTRAL, 1252 }, + { LANG_YAKUT, SUBLANG_NEUTRAL, 1251 }, + { LANG_YI, SUBLANG_NEUTRAL, 0 }, + { LANG_YORUBA, SUBLANG_NEUTRAL, 1252 }, { LANG_ZULU, SUBLANG_NEUTRAL, 1252 } }; diff --git a/reactos/tools/wrc/utils.h b/reactos/tools/wrc/utils.h index ced55abc3af..19daa09b3a9 100644 --- a/reactos/tools/wrc/utils.h +++ b/reactos/tools/wrc/utils.h @@ -33,6 +33,7 @@ char *xstrdup(const char *str); #define __attribute__(X) #endif +char *strmake(const char* fmt, ...) __attribute__((__format__ (__printf__, 1, 2 ))); int parser_error(const char *s, ...) __attribute__((format (printf, 1, 2))); int parser_warning(const char *s, ...) __attribute__((format (printf, 1, 2))); void internal_error(const char *file, int line, const char *s, ...) __attribute__((format (printf, 3, 4), noreturn)); diff --git a/reactos/tools/wrc/wrc.c b/reactos/tools/wrc/wrc.c index 7dd91fb0f98..5bf3babddec 100644 --- a/reactos/tools/wrc/wrc.c +++ b/reactos/tools/wrc/wrc.c @@ -44,10 +44,6 @@ #include "parser.h" #include "wine/wpp.h" -#ifndef INCLUDEDIR -#define INCLUDEDIR "/usr/local/include/wine" -#endif - #ifdef WORDS_BIGENDIAN #define ENDIAN "big" #else @@ -56,41 +52,33 @@ static const char usage[] = "Usage: wrc [options...] [infile[.rc|.res]]\n" - " -D id[=val] Define preprocessor identifier id=val\n" - " -E Preprocess only\n" - " -F target Ignored for compatibility with windres\n" - " -h Prints this summary\n" - " -i file The name of the input file\n" - " -I path Set include search dir to path (multiple -I allowed)\n" - " -J format The input format (either `rc' or `rc16')\n" - " -l lan Set default language to lan (default is neutral {0, 0})\n" - " -o file Output to file (default is infile.res)\n" - " -O format The output format (either `res' or `res16`)\n" - " -r Ignored for compatibility with rc\n" - " -U id Undefine preprocessor identifier id\n" - " -v Enable verbose mode\n" - "The following long options are supported:\n" - " --debug=nn Set debug level to 'nn'\n" - " --define Synonym for -D\n" - " --endianess=e Set output byte-order e={n[ative], l[ittle], b[ig]}\n" - " (win32 only; default is " ENDIAN "-endian)\n" - " --help Synonym for -h\n" - " --include-dir Synonym for -I\n" - " --input Synonym for -i\n" - " --input-format Synonym for -J\n" - " --language Synonym for -l\n" - " --no-use-temp-file Ignored for compatibility with windres\n" - " --nostdinc Disables searching the standard include path\n" - " --output -fo Synonym for -o\n" - " --output-format Synonym for -O\n" - " --pedantic Enable pedantic warnings\n" - " --preprocessor Specifies the preprocessor to use, including arguments\n" - " --target Synonym for -F\n" - " --undefine Synonym for -U\n" - " --use-temp-file Ignored for compatibility with windres\n" - " --verbose Synonym for -v\n" - " --verify-translations Check the status of the various translations\n" - " --version Print version and exit\n" + " -b, --target=TARGET Specify target CPU and platform when cross-compiling\n" + " -D, --define id[=val] Define preprocessor identifier id=val\n" + " --debug=nn Set debug level to 'nn'\n" + " -E Preprocess only\n" + " --endianess=e Set output byte-order e={n[ative], l[ittle], b[ig]}\n" + " (win32 only; default is " ENDIAN "-endian)\n" + " -F TARGET Synonym for -b for compatibility with windres\n" + " -fo FILE Synonym for -o for compatibility with windres\n" + " -h, --help Prints this summary\n" + " -i, --input=FILE The name of the input file\n" + " -I, --include-dir=PATH Set include search dir to path (multiple -I allowed)\n" + " -J, --input-format=FORMAT The input format (either `rc' or `rc16')\n" + " -l, --language=LANG Set default language to LANG (default is neutral {0, 0})\n" + " -m16, -m32, -m64 Build for 16-bit, 32-bit resp. 64-bit platforms\n" + " --no-use-temp-file Ignored for compatibility with windres\n" + " --nostdinc Disables searching the standard include path\n" + " -o, --output=FILE Output to file (default is infile.res)\n" + " -O, --output-format=FORMAT The output format (`po', `pot', `res', or `res16`)\n" + " --pedantic Enable pedantic warnings\n" + " --po-dir=DIR Directory containing po files for translations\n" + " --preprocessor Specifies the preprocessor to use, including arguments\n" + " -r Ignored for compatibility with rc\n" + " -U, --undefine id Undefine preprocessor identifier id\n" + " --use-temp-file Ignored for compatibility with windres\n" + " -v, --verbose Enable verbose mode\n" + " --verify-translations Check the status of the various translations\n" + " --version Print version and exit\n" "Input is taken from stdin if no sourcefile specified.\n" "Debug level 'n' is a bitmask with following meaning:\n" " * 0x01 Tell which resource is parsed (verbose mode)\n" @@ -157,11 +145,13 @@ int no_preprocess = 0; int check_utf8 = 1; /* whether to check for valid utf8 */ +static int pointer_size = sizeof(void *); + static int verify_translations_mode; -char *output_name = NULL; /* The name given by the -o option */ +static char *output_name; /* The name given by the -o option */ char *input_name = NULL; /* The name given on the command-line */ -char *temp_name = NULL; /* Temporary file for preprocess pipe */ +static char *temp_name = NULL; /* Temporary file for preprocess pipe */ int line_number = 1; /* The current line */ int char_number = 1; /* The current char pos within the line */ @@ -182,6 +172,7 @@ enum long_options_values LONG_OPT_NOSTDINC = 1, LONG_OPT_TMPFILE, LONG_OPT_NOTMPFILE, + LONG_OPT_PO_DIR, LONG_OPT_PREPROCESSOR, LONG_OPT_VERSION, LONG_OPT_DEBUG, @@ -191,29 +182,30 @@ enum long_options_values }; static const char short_options[] = - "D:Ef:F:hi:I:J:l:o:O:rU:v"; + "b:D:Ef:F:hi:I:J:l:m:o:O:rU:v"; static const struct option long_options[] = { - { "debug", 1, 0, LONG_OPT_DEBUG }, - { "define", 1, 0, 'D' }, - { "endianess", 1, 0, LONG_OPT_ENDIANESS }, - { "help", 0, 0, 'h' }, - { "include-dir", 1, 0, 'I' }, - { "input", 1, 0, 'i' }, - { "input-format", 1, 0, 'J' }, - { "language", 1, 0, 'l' }, - { "no-use-temp-file", 0, 0, LONG_OPT_NOTMPFILE }, - { "nostdinc", 0, 0, LONG_OPT_NOSTDINC }, - { "output", 1, 0, 'o' }, - { "output-format", 1, 0, 'O' }, - { "pedantic", 0, 0, LONG_OPT_PEDANTIC }, - { "preprocessor", 1, 0, LONG_OPT_PREPROCESSOR }, - { "target", 1, 0, 'F' }, - { "undefine", 1, 0, 'U' }, - { "use-temp-file", 0, 0, LONG_OPT_TMPFILE }, - { "verbose", 0, 0, 'v' }, - { "verify-translations", 0, 0, LONG_OPT_VERIFY_TRANSL }, - { "version", 0, 0, LONG_OPT_VERSION }, - { 0, 0, 0, 0 } + { "debug", 1, NULL, LONG_OPT_DEBUG }, + { "define", 1, NULL, 'D' }, + { "endianess", 1, NULL, LONG_OPT_ENDIANESS }, + { "help", 0, NULL, 'h' }, + { "include-dir", 1, NULL, 'I' }, + { "input", 1, NULL, 'i' }, + { "input-format", 1, NULL, 'J' }, + { "language", 1, NULL, 'l' }, + { "no-use-temp-file", 0, NULL, LONG_OPT_NOTMPFILE }, + { "nostdinc", 0, NULL, LONG_OPT_NOSTDINC }, + { "output", 1, NULL, 'o' }, + { "output-format", 1, NULL, 'O' }, + { "pedantic", 0, NULL, LONG_OPT_PEDANTIC }, + { "po-dir", 1, NULL, LONG_OPT_PO_DIR }, + { "preprocessor", 1, NULL, LONG_OPT_PREPROCESSOR }, + { "target", 1, NULL, 'F' }, + { "undefine", 1, NULL, 'U' }, + { "use-temp-file", 0, NULL, LONG_OPT_TMPFILE }, + { "verbose", 0, NULL, 'v' }, + { "verify-translations", 0, NULL, LONG_OPT_VERIFY_TRANSL }, + { "version", 0, NULL, LONG_OPT_VERSION }, + { NULL, 0, NULL, 0 } }; static void set_version_defines(void) @@ -256,40 +248,45 @@ static int load_file( const char *input_name, const char *output_name ) /* Run the preprocessor on the input */ if(!no_preprocess) { + FILE *output; + int ret, fd; + char *name; + /* * Preprocess the input to a temp-file, or stdout if * no output was given. */ - chat("Starting preprocess\n"); - - if (!preprocess_only) + if (preprocess_only) { - ret = wpp_parse_temp( input_name, output_name, &temp_name ); - } - else if (output_name) - { - FILE *output; + if (output_name) + { + if (!(output = fopen( output_name, "w" ))) + fatal_perror( "Could not open %s for writing", output_name ); + ret = wpp_parse( input_name, output ); + fclose( output ); + } + else ret = wpp_parse( input_name, stdout ); - if (!(output = fopen( output_name, "w" ))) - fatal_perror( "Could not open %s for writing", output_name ); - ret = wpp_parse( input_name, output ); - fclose( output ); - } - else - { - ret = wpp_parse( input_name, stdout ); - } - - if (ret) return ret; - - if(preprocess_only) - { + if (ret) return ret; output_name = NULL; exit(0); } - input_name = temp_name; + if (output_name && output_name[0]) name = strmake( "%s.XXXXXX", output_name ); + else name = xstrdup( "wrc.XXXXXX" ); + + if ((fd = mkstemps( name, 0 )) == -1) + error("Could not generate a temp name from %s\n", name); + + temp_name = name; + if (!(output = fdopen(fd, "wt"))) + error("Could not open fd %s for writing\n", name); + + ret = wpp_parse( input_name, output ); + fclose( output ); + if (ret) return ret; + input_name = name; } /* Reset the language */ @@ -304,6 +301,7 @@ static int load_file( const char *input_name, const char *output_name ) ret = parser_parse(); fclose(parser_in); + parser_lex_destroy(); if (temp_name) { unlink( temp_name ); @@ -313,6 +311,19 @@ static int load_file( const char *input_name, const char *output_name ) return ret; } +static void set_target( const char *target ) +{ + char *p, *cpu = xstrdup( target ); + + /* target specification is in the form CPU-MANUFACTURER-OS or CPU-MANUFACTURER-KERNEL-OS */ + if (!(p = strchr( cpu, '-' ))) error( "Invalid target specification '%s'\n", target ); + *p = 0; + if (!strcmp( cpu, "amd64" ) || !strcmp( cpu, "x86_64" ) || !strcmp( cpu, "ia64" )) + pointer_size = 8; + else + pointer_size = 4; + free( cpu ); +} int main(int argc,char *argv[]) { @@ -325,6 +336,8 @@ int main(int argc,char *argv[]) int nb_files = 0; int i; int cmdlen; + int po_mode = 0; + char *po_dir = NULL; char **files = xmalloc( argc * sizeof(*files) ); signal(SIGSEGV, segvhandler); @@ -339,8 +352,6 @@ int main(int argc,char *argv[]) /* Set the default defined stuff */ set_version_defines(); wpp_add_cmdline_define("RC_INVOKED=1"); - wpp_add_cmdline_define("__WIN32__=1"); - wpp_add_cmdline_define("__FLAT__=1"); /* Microsoft RC always searches current directory */ wpp_add_include_path("."); @@ -371,6 +382,9 @@ int main(int argc,char *argv[]) case LONG_OPT_NOTMPFILE: if (debuglevel) warning("--no-use-temp-file option not yet supported, ignored.\n"); break; + case LONG_OPT_PO_DIR: + po_dir = xstrdup( optarg ); + break; case LONG_OPT_PREPROCESSOR: if (strcmp(optarg, "cat") == 0) no_preprocess = 1; else fprintf(stderr, "-P option not yet supported, ignored.\n"); @@ -415,8 +429,9 @@ int main(int argc,char *argv[]) case 'E': preprocess_only = 1; break; + case 'b': case 'F': - /* ignored for compatibility with windres */ + set_target( optarg ); break; case 'h': printf(usage); @@ -440,6 +455,12 @@ int main(int argc,char *argv[]) defaultlanguage = new_language(PRIMARYLANGID(lan), SUBLANGID(lan)); } break; + case 'm': + if (!strcmp( optarg, "16" )) win32 = 0; + else if (!strcmp( optarg, "32" )) { win32 = 1; pointer_size = 4; } + else if (!strcmp( optarg, "64" )) { win32 = 1; pointer_size = 8; } + else error( "Invalid option: -m%s\n", optarg ); + break; case 'f': if (*optarg != 'o') error("Unknown option: -f%s\n", optarg); optarg++; @@ -449,12 +470,9 @@ int main(int argc,char *argv[]) else error("Too many output files.\n"); break; case 'O': - if (strcmp(optarg, "res16") == 0) - { - win32 = 0; - wpp_del_define("__WIN32__"); - wpp_del_define("__FLAT__"); - } + if (strcmp(optarg, "po") == 0) po_mode = 1; + else if (strcmp(optarg, "pot") == 0) po_mode = 2; + else if (strcmp(optarg, "res16") == 0) win32 = 0; else if (strcmp(optarg, "res")) warning("Output format %s not supported.\n", optarg); break; case 'r': @@ -478,18 +496,26 @@ int main(int argc,char *argv[]) return 1; } + if (win32) + { + wpp_add_cmdline_define("_WIN32=1"); + if (pointer_size == 8) wpp_add_cmdline_define("_WIN64=1"); + } + /* If we do need to search standard includes, add them to the path */ if (stdinc) { + /* ReactOS doesn't use this feature wpp_add_include_path(INCLUDEDIR"/msvcrt"); wpp_add_include_path(INCLUDEDIR"/windows"); + */ } /* Kill io buffering when some kind of debuglevel is enabled */ if(debuglevel) { - setbuf(stdout,0); - setbuf(stderr,0); + setbuf(stdout, NULL); + setbuf(stderr, NULL); } parser_debug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0; @@ -510,20 +536,10 @@ int main(int argc,char *argv[]) for (i = 0; i < nb_files; i++) { input_name = files[i]; - if(!output_name && !preprocess_only) - { - output_name = dup_basename(input_name, ".rc"); - strcat(output_name, ".res"); - } if (load_file( input_name, output_name )) exit(1); } /* stdin special case. NULL means "stdin" for wpp. */ - if (nb_files == 0) - { - if(!output_name && !preprocess_only) - output_name = strdup("wrc.tab.res"); - if (load_file( NULL, output_name )) exit(1); - } + if (nb_files == 0 && load_file( NULL, output_name )) exit(1); if(debuglevel & DEBUGLEVEL_DUMP) dump_resources(resource_top); @@ -533,11 +549,32 @@ int main(int argc,char *argv[]) verify_translations(resource_top); exit(0); } + if (po_mode) + { + if (po_mode == 2) /* pot file */ + { + if (!output_name) + { + output_name = dup_basename( nb_files ? files[0] : NULL, ".rc" ); + strcat( output_name, ".pot" ); + } + write_pot_file( output_name ); + } + else write_po_files( output_name ); + output_name = NULL; + exit(0); + } + if (po_dir) add_translations( po_dir ); /* Convert the internal lists to binary data */ resources2res(resource_top); chat("Writing .res-file\n"); + if (!output_name) + { + output_name = dup_basename( nb_files ? files[0] : NULL, ".rc" ); + strcat(output_name, ".res"); + } write_resfile(output_name, resource_top); output_name = NULL; diff --git a/reactos/tools/wrc/wrc.h b/reactos/tools/wrc/wrc.h index 02835469337..a103ea363ff 100644 --- a/reactos/tools/wrc/wrc.h +++ b/reactos/tools/wrc/wrc.h @@ -45,7 +45,6 @@ extern int preprocess_only; extern int no_preprocess; extern int check_utf8; -extern char *output_name; extern char *input_name; extern char *cmdline; extern time_t now; @@ -57,6 +56,21 @@ extern resource_t *resource_top; extern language_t *currentlanguage; void verify_translations(resource_t *top); +void write_pot_file( const char *outname ); +void write_po_files( const char *outname ); +void add_translations( const char *po_dir ); void write_resfile(char *outname, resource_t *top); +static inline void set_location( location_t *loc ) +{ + loc->file = input_name; + loc->line = line_number; + loc->col = char_number; +} + +static inline void print_location( const location_t *loc ) +{ + if (loc->file) fprintf(stderr, "%s:%d:%d: ", loc->file, loc->line, loc->col ); +} + #endif diff --git a/reactos/tools/wrc/wrc.rbuild b/reactos/tools/wrc/wrc.rbuild index 0bbfb1cfe82..dd66d8c5aa9 100644 --- a/reactos/tools/wrc/wrc.rbuild +++ b/reactos/tools/wrc/wrc.rbuild @@ -6,6 +6,7 @@ dumpres.c genres.c newstruc.c + po.c readres.c translation.c utils.c diff --git a/reactos/tools/wrc/wrcrostypes.h b/reactos/tools/wrc/wrcrostypes.h index 87802ff18af..8d20f7d12f4 100644 --- a/reactos/tools/wrc/wrcrostypes.h +++ b/reactos/tools/wrc/wrcrostypes.h @@ -115,4 +115,33 @@ typedef struct { DWORD bV4GammaBlue; } BITMAPV4HEADER,*LPBITMAPV4HEADER,*PBITMAPV4HEADER; +typedef struct { + DWORD bV5Size; + LONG bV5Width; + LONG bV5Height; + WORD bV5Planes; + WORD bV5BitCount; + DWORD bV5Compression; + DWORD bV5SizeImage; + LONG bV5XPelsPerMeter; + LONG bV5YPelsPerMeter; + DWORD bV5ClrUsed; + DWORD bV5ClrImportant; + DWORD bV5RedMask; + DWORD bV5GreenMask; + DWORD bV5BlueMask; + DWORD bV5AlphaMask; + DWORD bV5CSType; + CIEXYZTRIPLE bV5Endpoints; + DWORD bV5GammaRed; + DWORD bV5GammaGreen; + DWORD bV5GammaBlue; + DWORD bV5Intent; + DWORD bV5ProfileData; + DWORD bV5ProfileSize; + DWORD bV5Reserved; +} BITMAPV5HEADER, *PBITMAPV5HEADER; + +#define SS_TYPEMASK 0x0000001FL + #endif diff --git a/reactos/tools/wrc/wrctypes.h b/reactos/tools/wrc/wrctypes.h index 28792ebe4ee..3da646738cf 100644 --- a/reactos/tools/wrc/wrctypes.h +++ b/reactos/tools/wrc/wrctypes.h @@ -74,6 +74,13 @@ #define BYTESWAP_WORD(w) ((WORD)(((WORD)WRC_LOBYTE(w) << 8) + (WORD)WRC_HIBYTE(w))) #define BYTESWAP_DWORD(d) ((DWORD)(((DWORD)BYTESWAP_WORD(WRC_LOWORD(d)) << 16) + ((DWORD)BYTESWAP_WORD(WRC_HIWORD(d))))) +typedef struct +{ + const char *file; + int line; + int col; +} location_t; + /* Binary resource structure */ #define RES_BLOCKSIZE 512 @@ -94,6 +101,7 @@ typedef struct string { char *cstr; WCHAR *wstr; } str; + location_t loc; } string_t; /* Resources are identified either by name or by number */ @@ -174,9 +182,7 @@ enum res_e { res_dlginit = WRC_RT_DLGINIT, /* 240 */ res_toolbar = WRC_RT_TOOLBAR, /* 241 */ - res_menex = 256 + 4, - res_dlgex, - res_usr + res_usr = 256 + 6 }; /* Raw bytes in a row... */ @@ -214,8 +220,11 @@ typedef struct dialog { int height; style_t *style; /* Style */ style_t *exstyle; + DWORD helpid; /* EX: */ int gotstyle; /* Used to determine whether the default */ int gotexstyle; /* styles must be set */ + int gothelpid; + int is_ex; name_id_t *menu; name_id_t *dlgclass; string_t *title; @@ -224,49 +233,12 @@ typedef struct dialog { control_t *controls; } dialog_t; -/* DialogEx structures */ -typedef struct dialogex { - DWORD memopt; - int x; /* Position */ - int y; - int width; /* Size */ - int height; - style_t *style; /* Style */ - style_t *exstyle; - DWORD helpid; /* EX: */ - int gotstyle; /* Used to determine whether the default */ - int gotexstyle; /* styles must be set */ - int gothelpid; - name_id_t *menu; - name_id_t *dlgclass; - string_t *title; - font_id_t *font; - lvc_t lvc; - control_t *controls; -} dialogex_t; - /* Menu structures */ typedef struct menu_item { struct menu_item *next; struct menu_item *prev; struct menu_item *popup; int id; - DWORD state; - string_t *name; -} menu_item_t; - -typedef struct menu { - DWORD memopt; - lvc_t lvc; - menu_item_t *items; -} menu_t; - -/* MenuEx structures */ -typedef struct menuex_item { - struct menuex_item *next; - struct menuex_item *prev; - struct menuex_item *popup; - int id; DWORD type; DWORD state; int helpid; @@ -275,13 +247,14 @@ typedef struct menuex_item { int gottype; int gotstate; int gothelpid; -} menuex_item_t; +} menu_item_t; -typedef struct menuex { +typedef struct menu { DWORD memopt; lvc_t lvc; - menuex_item_t *items; -} menuex_t; + int is_ex; + menu_item_t *items; +} menu_t; typedef struct itemex_opt { @@ -602,14 +575,12 @@ typedef struct resource { cursor_t *cur; cursor_group_t *curg; dialog_t *dlg; - dialogex_t *dlgex; dlginit_t *dlgi; font_t *fnt; fontdir_t *fnd; icon_t *ico; icon_group_t *icog; menu_t *men; - menuex_t *menex; messagetable_t *msg; html_t *html; rcdata_t *rdt;