mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-11 03:35:15 +00:00
Compare commits
173
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b85481146a | ||
|
|
b219268ad8 | ||
|
|
a05fafb944 | ||
|
|
c20cd1facb | ||
|
|
8a9566d401 | ||
|
|
b756bb754c | ||
|
|
0c76a0c911 | ||
|
|
71cd15d49b | ||
|
|
8c6d399ada | ||
|
|
2b7ed18a60 | ||
|
|
34a89c5066 | ||
|
|
969e2ed98b | ||
|
|
0dd1580afc | ||
|
|
b98ec53ee4 | ||
|
|
b4cbf822eb | ||
|
|
c47dc59adc | ||
|
|
83c1796f41 | ||
|
|
cf44a9aea7 | ||
|
|
5c0a0514da | ||
|
|
1207eeacc2 | ||
|
|
8e521837dc | ||
|
|
08e49d20f0 | ||
|
|
e91ff6ce3d | ||
|
|
7655146399 | ||
|
|
216eb8c9f2 | ||
|
|
78ab8f674f | ||
|
|
133c20e252 | ||
|
|
9515e8a7f8 | ||
|
|
23c5a17453 | ||
|
|
5fbb0954b8 | ||
|
|
4f940944da | ||
|
|
69991a5827 | ||
|
|
20c37f213a | ||
|
|
3ded9a63e3 | ||
|
|
e0c471a9e6 | ||
|
|
6b44f458f2 | ||
|
|
01c56de45c | ||
|
|
8b3ba7ff05 | ||
|
|
d1a6f01efb | ||
|
|
c2a6d50e58 | ||
|
|
f294a2c217 | ||
|
|
4358321afa | ||
|
|
45a44d49bf | ||
|
|
fecc10cd95 | ||
|
|
01e5c81773 | ||
|
|
eaff5ee3c5 | ||
|
|
aef1ffd56f | ||
|
|
51dec47b37 | ||
|
|
007a50a493 | ||
|
|
491bdd7ae5 | ||
|
|
73b0698996 | ||
|
|
06446ccf94 | ||
|
|
62a3e4f0c5 | ||
|
|
355e7c1cd1 | ||
|
|
bb88b0fc9e | ||
|
|
9a636f47ce | ||
|
|
0e95c1ddc1 | ||
|
|
df33b92836 | ||
|
|
680e8701b5 | ||
|
|
817e9f41d1 | ||
|
|
5123689ba0 | ||
|
|
f3849179e5 | ||
|
|
bd02036a4e | ||
|
|
db8837cbe1 | ||
|
|
72a23c9797 | ||
|
|
280a38c306 | ||
|
|
03b31c0ce8 | ||
|
|
8b3df748a3 | ||
|
|
e601aa1d35 | ||
|
|
b0299a2ebb | ||
|
|
d7e1f00c13 | ||
|
|
cc9305dd68 | ||
|
|
b0940840ac | ||
|
|
643a599471 | ||
|
|
b4c4ccc2b3 | ||
|
|
bba97eb2c1 | ||
|
|
c3b407f430 | ||
|
|
c307773eec | ||
|
|
a31932aa0b | ||
|
|
aa96fda183 | ||
|
|
588db0a892 | ||
|
|
4416fcdb02 | ||
|
|
11652ab3dc | ||
|
|
26b23c1a49 | ||
|
|
18bcecb07d | ||
|
|
fa770c8662 | ||
|
|
d9b739c32f | ||
|
|
9901390012 | ||
|
|
e966383bf4 | ||
|
|
cd6a695eb9 | ||
|
|
0f8d586a9f | ||
|
|
8d6c48b983 | ||
|
|
b4e4c0d14a | ||
|
|
e53c632297 | ||
|
|
21db0b2a65 | ||
|
|
5b041382df | ||
|
|
9ffbeca717 | ||
|
|
cf3b4b64d0 | ||
|
|
fd6748e22c | ||
|
|
9651150243 | ||
|
|
642cb8f829 | ||
|
|
3c31a486e7 | ||
|
|
0d8bed5636 | ||
|
|
01228b70de | ||
|
|
9208d17fa9 | ||
|
|
af27eacb6a | ||
|
|
e69bfebb45 | ||
|
|
bcae0fce72 | ||
|
|
9101a31079 | ||
|
|
c3937ec780 | ||
|
|
fff9bf0b8d | ||
|
|
64dba31e7f | ||
|
|
c1a29a5b2d | ||
|
|
374f5a14de | ||
|
|
bfcf1f3af0 | ||
|
|
65ccf9fc1d | ||
|
|
d0039cbcf8 | ||
|
|
345cea780a | ||
|
|
564801f795 | ||
|
|
b23e820381 | ||
|
|
e5352bc7bf | ||
|
|
914feea9d0 | ||
|
|
f0250de62e | ||
|
|
ef01750240 | ||
|
|
7651439487 | ||
|
|
550245801e | ||
|
|
f9abaa2c4c | ||
|
|
0e721e7569 | ||
|
|
0fb1ffb1bf | ||
|
|
b86796bf87 | ||
|
|
602bbf31c1 | ||
|
|
d8a0245ce7 | ||
|
|
34ba97434f | ||
|
|
ed86e78c90 | ||
|
|
dfdb1797c3 | ||
|
|
7086e7071e | ||
|
|
98254360e3 | ||
|
|
a75c057f10 | ||
|
|
dc2546ac9f | ||
|
|
ad950f8307 | ||
|
|
2794679661 | ||
|
|
06b00abcdd | ||
|
|
70e7d534a9 | ||
|
|
0b3551fbee | ||
|
|
abe017f60d | ||
|
|
381fb12e1e | ||
|
|
10b6b2be55 | ||
|
|
6f38107f80 | ||
|
|
0179dd6542 | ||
|
|
45119af166 | ||
|
|
e4e1a4dcb4 | ||
|
|
80cce3da95 | ||
|
|
842e86794f | ||
|
|
3309b786a3 | ||
|
|
4bda3f10ca | ||
|
|
bd16a5dcf5 | ||
|
|
4162fa07ae | ||
|
|
b418ecd84f | ||
|
|
8d69a1a3ae | ||
|
|
616429b508 | ||
|
|
9b2d067768 | ||
|
|
69e2658bf6 | ||
|
|
4aacc3a71d | ||
|
|
762a801e00 | ||
|
|
4bb2bc3f61 | ||
|
|
9f007dfecc | ||
|
|
6b45a3ca82 | ||
|
|
50997c6eeb | ||
|
|
0d76958cf7 | ||
|
|
11ee57d90c | ||
|
|
ea6cfe9ebd | ||
|
|
3f3eed2770 | ||
|
|
be2a1a68ef |
@@ -1,3 +1,838 @@
|
||||
2002-05-02 Akim Demaille <[email protected]>
|
||||
|
||||
Version 1.49a.
|
||||
|
||||
2002-05-01 Akim Demaille <[email protected]>
|
||||
|
||||
* src/skeleton.h: Remove.
|
||||
|
||||
2002-05-01 Akim Demaille <[email protected]>
|
||||
|
||||
* src/skeleton.h: Fix the #endif.
|
||||
Reported by Magnus Fromreide.
|
||||
|
||||
2002-04-26 Paul Eggert <[email protected]>
|
||||
|
||||
* data/bison.simple (YYSTYPE_IS_TRIVIAL, YYLTYPE_IS_TRIVIAL):
|
||||
Define if we define YYSTYPE and YYLTYPE, respectively.
|
||||
(YYCOPY): Fix [] quoting problem in the non-GCC case.
|
||||
|
||||
2002-04-25 Robert Anisko <[email protected]>
|
||||
|
||||
* src/scan-skel.l: Postprocess quadrigraphs.
|
||||
|
||||
* src/reader.c (copy_character): New function, used to output
|
||||
single characters while replacing `[' and `]' with quadrigraphs, to
|
||||
avoid troubles with M4 quotes.
|
||||
(copy_comment): Output characters with copy_character.
|
||||
(read_additionnal_code): Likewise.
|
||||
(copy_string2): Likewise.
|
||||
(copy_definition): Likewise.
|
||||
|
||||
* tests/calc.at: Exercise M4 quoting.
|
||||
|
||||
2002-04-25 Akim Demaille <[email protected]>
|
||||
|
||||
* tests/sets.at (AT_EXTRACT_SETS): Sed portability issue: no space
|
||||
between `!' and the command.
|
||||
Reported by Paul Eggert.
|
||||
|
||||
2002-04-24 Robert Anisko <[email protected]>
|
||||
|
||||
* tests/calc.at: Exercise prologue splitting.
|
||||
|
||||
* data/bison.simple, data/bison.c++: Use `b4_pre_prologue' and
|
||||
`b4_post_prologue' instead of `b4_prologue'.
|
||||
|
||||
* src/output.c (prepare): Add the `pre_prologue' and `post_prologue'
|
||||
muscles.
|
||||
(output): Free pre_prologue_obstack and post_prologue_obstack.
|
||||
* src/files.h, src/files.c (attrs_obstack): Remove.
|
||||
(pre_prologue_obstack, post_prologue_obstack): New.
|
||||
* src/reader.c (copy_definition): Add a parameter to specify the
|
||||
obstack to fill, instead of using attrs_obstack unconditionally.
|
||||
(read_declarations): Pass pre_prologue_obstack to copy_definition if
|
||||
`%union' has not yet been seen, pass post_prologue_obstack otherwise.
|
||||
|
||||
2002-04-23 Paul Eggert <[email protected]>
|
||||
|
||||
* data/bison.simple: Remove unnecessary commentary and white
|
||||
space differences from 1_29-branch.
|
||||
Depend on YYERROR_VERBOSE, not defined (YYERROR_VERBOSE).
|
||||
|
||||
(union yyalloc, YYSTACK_GAP_MAX, YYSTACK_BYTES, YYCOPY,
|
||||
YYSTACK_RELOCATE): Do not define if yyoverflow is defined, or
|
||||
if this is a C++ parser and YYSTYPE or YYLTYPE has nontrivial
|
||||
constructors or destructors.
|
||||
|
||||
(yyparse) [! defined YYSTACK_RELOCATE]: Do not relocate the stack.
|
||||
|
||||
2002-04-23 Akim Demaille <[email protected]>
|
||||
|
||||
* tests/sets.at (AT_EXTRACT_SETS): Don't use 8 char long sed labels.
|
||||
* tests/synclines.at (AT_TEST_SYNCLINE): Be robust to GCC's
|
||||
location with columns.
|
||||
* tests/conflicts.at (%nonassoc and eof): Don't use `error.h'.
|
||||
All reported by Paul Eggert.
|
||||
|
||||
2002-04-22 Akim Demaille <[email protected]>
|
||||
|
||||
* src/reduce.c (dump_grammar): Move to...
|
||||
* src/gram.h, src/gram.c (grammar_dump): here.
|
||||
Be sure to separate long item numbers.
|
||||
Don't read the members of a rule's prec if its nil.
|
||||
|
||||
2002-04-22 Akim Demaille <[email protected]>
|
||||
|
||||
* src/output.c (table_size, table_grow): New.
|
||||
(MAXTABLE): Remove, replace uses with table_size.
|
||||
(pack_vector): Instead of dying when the table is too big, grow it.
|
||||
|
||||
2002-04-22 Akim Demaille <[email protected]>
|
||||
|
||||
* data/bison.simple (yyr1): Its type is that of a token number.
|
||||
* data/bison.c++ (r1_): Likewise.
|
||||
* tests/regression.at (Web2c Actions): Adjust.
|
||||
|
||||
2002-04-22 Akim Demaille <[email protected]>
|
||||
|
||||
* src/reader.c (token_translations_init): 256 is now the default
|
||||
value for the error token, i.e., it will be assigned another
|
||||
number if the user assigned 256 to one of her tokens.
|
||||
(reader): Don't force 256 to error.
|
||||
* doc/bison.texinfo (Symbols): Adjust.
|
||||
* tests/torture.at (AT_DATA_HORIZONTAL_GRAMMAR)
|
||||
(AT_DATA_TRIANGULAR_GRAMMAR): Number the tokens as 1, 2, 3
|
||||
etc. instead of 10, 20, 30 (which was used to `jump' over error
|
||||
(256) and undefined (2)).
|
||||
|
||||
2002-04-22 Akim Demaille <[email protected]>
|
||||
|
||||
Propagate more token_number_t.
|
||||
|
||||
* src/gram.h (token_number_as_item_number)
|
||||
(item_number_as_token_number): New.
|
||||
* src/output.c (GENERATE_OUTPUT_TABLE): New.
|
||||
Use it to create output_item_number_table and
|
||||
output_token_number_table.
|
||||
* src/LR0.c, src/derives.c, src/gram.c, src/gram.h, src/lalr.c,
|
||||
* src/lex.c, src/nullable.c, src/output.c, src/print.c,
|
||||
* src/print_graph.c, src/reader.c, src/reduce.c, src/state.h,
|
||||
* src/symtab.c, src/symtab.h: Use token_number_t instead of shorts.
|
||||
|
||||
2002-04-22 Akim Demaille <[email protected]>
|
||||
|
||||
* src/output.h, src/output.c (get_lines_number): Remove.
|
||||
|
||||
2002-04-19 Akim Demaille <[email protected]>
|
||||
|
||||
* doc/bison.texinfo (Actions): Make clear that `|' is not the same
|
||||
as Lex/Flex'.
|
||||
(Debugging): More details about enabling the debugging features.
|
||||
(Table of Symbols): Describe $$, $n, @$, and @n.
|
||||
Suggested by Tim Josling.
|
||||
|
||||
2002-04-19 Akim Demaille <[email protected]>
|
||||
|
||||
* doc/bison.texinfo: Remove the uses of the obsolete @refill.
|
||||
|
||||
2002-04-10 Akim Demaille <[email protected]>
|
||||
|
||||
* src/system.h: Rely on HAVE_LIMITS_H.
|
||||
Suggested by Paul Eggert.
|
||||
|
||||
2002-04-09 Akim Demaille <[email protected]>
|
||||
|
||||
* tests/calc.at (_AT_CHECK_CALC_ERROR): Receive as argument the
|
||||
full stderr, and strip it according to the bison options, instead
|
||||
of composing the error message from different bits.
|
||||
This makes it easier to check for several error messages.
|
||||
Adjust all the invocations.
|
||||
Add an invocation exercising the error token.
|
||||
Add an invocation demonstrating a stupid error message.
|
||||
(_AT_DATA_CALC_Y): Follow the GCS: initial column is 1, not 0.
|
||||
Adjust the tests.
|
||||
Error message are for stderr, not stdout.
|
||||
|
||||
2002-04-09 Akim Demaille <[email protected]>
|
||||
|
||||
* src/gram.h, src/gram.c (error_token_number): Remove, use
|
||||
errtoken->number.
|
||||
* src/reader.c (reader): Don't specify the user token number (2)
|
||||
for $undefined, as it uselessly prevents using it.
|
||||
* src/gram.h (token_number_t): Move to...
|
||||
* src/symtab.h: here.
|
||||
(state_t.number): Is a token_number_t.
|
||||
* src/print.c, src/reader.c: Use undeftoken->number instead of
|
||||
hard coded 2.
|
||||
(Even though this 2 is not the same as above: the number of the
|
||||
undeftoken remains being 2, it is its user token number which
|
||||
might not be 2).
|
||||
* src/output.c (prepare_tokens): Rename the `maxtok' muscle with
|
||||
`user_token_number_max'.
|
||||
Output `undef_token_number'.
|
||||
* data/bison.simple, data/bison.c++: Use them.
|
||||
Be sure to map invalid yylex return values to
|
||||
`undef_token_number'. This saves us from gratuitous SEGV.
|
||||
|
||||
* tests/conflicts.at (Solved SR Conflicts)
|
||||
(Unresolved SR Conflicts): Adjust.
|
||||
* tests/regression.at (Web2c Actions): Adjust.
|
||||
|
||||
2002-04-08 Akim Demaille <[email protected]>
|
||||
|
||||
* data/bison.c++: s/b4_item_number_max/b4_rhs_number_max/.
|
||||
Adding #line.
|
||||
Remove the duplicate `typedefs'.
|
||||
(RhsNumberType): Fix the declaration and various other typos.
|
||||
Use __ofile__.
|
||||
* data/bison.simple: Use __ofile__.
|
||||
* src/scan-skel.l: Handle __ofile__.
|
||||
|
||||
2002-04-08 Akim Demaille <[email protected]>
|
||||
|
||||
* src/gram.h (item_number_t): New, the type of item numbers in
|
||||
RITEM. Note that it must be able to code symbol numbers as
|
||||
positive number, and the negation of rule numbers as negative
|
||||
numbers.
|
||||
Adjust all dependencies (pretty many).
|
||||
* src/reduce.c (rule): Remove this `short *' pointer: use
|
||||
item_number_t.
|
||||
* src/system.h (MINSHORT, MAXSHORT): Remove.
|
||||
Include `limits.h'.
|
||||
Adjust dependencies to using SHRT_MAX and SHRT_MIN.
|
||||
(shortcpy): Remove.
|
||||
(MAXTABLE): Move to...
|
||||
* src/output.c (MAXTABLE): here.
|
||||
(prepare_rules): Use output_int_table to output rhs.
|
||||
* data/bison.simple, data/bison.c++: Adjust.
|
||||
* tests/torture.at (Big triangle): Move the limit from 254 to
|
||||
500.
|
||||
* tests/regression.at (Web2c Actions): Ajust.
|
||||
|
||||
Trying with bigger grammars shows various phenomena: at 3000 (28Mb
|
||||
of grammar file) bison is killed by my system, at 2000 (12Mb) bison
|
||||
passes, but produces negative #line number, once fixed, GCC is
|
||||
killed while compiling 14Mb, at 1500 (6.7 Mb of grammar, 8.2Mb of
|
||||
C), it passes.
|
||||
* src/state.h (state_h): Code input lines on ints, not shorts.
|
||||
|
||||
2002-04-08 Akim Demaille <[email protected]>
|
||||
|
||||
* src/reduce.c (reduce_grammar): First reduce the nonterminals,
|
||||
and then the grammar.
|
||||
|
||||
2002-04-08 Akim Demaille <[email protected]>
|
||||
|
||||
* src/system.h: No longer using strndup.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* src/muscle_tab.h (MUSCLE_INSERT_LONG_INT): New.
|
||||
* src/output.c (output_table_data): Return the longest number.
|
||||
(prepare_tokens): Output `token_number_max').
|
||||
* data/bison.simple, data/bison.c++ (b4_sint_type, b4_uint_type):
|
||||
New.
|
||||
Use them to define yy_token_number_type/TokenNumberType.
|
||||
Use this type for yytranslate.
|
||||
* tests/torture.at (Big triangle): Push the limit from 124 to
|
||||
253.
|
||||
* tests/regression.at (Web2c Actions): Adjust.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* tests/torture.at (Big triangle): New.
|
||||
(GNU AWK Grammar, GNU Cim Grammar): Move to...
|
||||
* tests/existing.at: here.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* src/gram.h, src/gram.c (nitems): Remove, it is an alias of
|
||||
nritems.
|
||||
Adjust dependencies.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* src/reader.c: Normalize increments to prefix form.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* src/reader.c, symtab.c: Remove debugging code.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
Rename all the `bucket's as `symbol_t'.
|
||||
|
||||
* src/gram.c, src/gram.h, src/lex.c, src/lex.h, src/output.c,
|
||||
* src/reader.c, src/reader.h, src/reduce.c, src/state.h,
|
||||
* src/symtab.c, src/symtab.h (bucket): Rename as...
|
||||
(symbol_t): this.
|
||||
(symbol_list_new, bucket_check_defined, bucket_make_alias)
|
||||
(bucket_check_alias_consistence, bucket_pack, bucket_translation)
|
||||
(bucket_new, bucket_free, hash_compare_bucket, hash_bucket)
|
||||
(buckets_new, buckets_free, buckets_do): Rename as...
|
||||
(symbol_list_new, symbol_check_defined, symbol_make_alias)
|
||||
(symbol_check_alias_consistence, symbol_pack, symbol_translation)
|
||||
(symbol_new, symbol_free, hash_compare_symbol_t, hash_symbol_t)
|
||||
(symbols_new, symbols_free, symbols_do): these.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
Use lib/hash for the symbol table.
|
||||
|
||||
* src/gram.c (ntokens): Initialize to 1, to reserve a slot for
|
||||
EOF.
|
||||
* src/lex.c (lex): Set the `number' member of new terminals.
|
||||
* src/reader.c (bucket_check_defined, bucket_make_alias)
|
||||
(bucket_check_alias_consistence, bucket_translation): New.
|
||||
(reader, grammar_free, readgram, token_translations_init)
|
||||
(packsymbols): Adjust.
|
||||
(reader): Number the predefined tokens.
|
||||
* src/reduce.c (inaccessable_symbols): Just use hard coded numbers
|
||||
for predefined tokens.
|
||||
* src/symtab.h (bucket): Remove all the hash table related
|
||||
members.
|
||||
* src/symtab.c (symtab): Replace by...
|
||||
(bucket_table): this.
|
||||
(bucket_new, bucket_free, hash_compare_bucket, hash_bucket)
|
||||
(buckets_new, buckets_do): New.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* src/gram.c (nitems, nrules, nsyms, ntokens, nvars, nritems)
|
||||
(start_symbol, max_user_token_number, semantic_parser)
|
||||
(error_token_number): Initialize.
|
||||
* src/reader.c (grammar, start_flag, startval, typed, lastprec):
|
||||
Initialize.
|
||||
(reader): Don't.
|
||||
(errtoken, eoftoken, undeftoken, axiom): Extern.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* src/gram.h (rule_s): prec and precsym are now pointers
|
||||
to the bucket giving the priority/associativity.
|
||||
Member `associativity' removed: useless.
|
||||
* src/reduce.c, src/conflicts.c: Adjust.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* src/lalr.c, src/LR0.c, src/closure.c, src/gram.c, src/reduce.c:
|
||||
Properly escape the symbols' TAG when outputting them.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* src/lalr.h (LA): Is a bitsetv, not bitset*.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* src/lalr.h, src/lalr.c (LAruleno): Replace with...
|
||||
(LArule): this, which is an array to rule_t*.
|
||||
* src/print.c, src/conflicts.c: Adjust.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* src/gram.h (rule_t): Rename `number' as `user_number'.
|
||||
`number' is a new member.
|
||||
Adjust dependencies.
|
||||
* src/reduce.c (reduce_grammar_tables): Renumber rule_t.number.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
As a result of the previous patch, it is no longer needed
|
||||
to reorder ritem itself.
|
||||
|
||||
* src/reduce.c (reduce_grammar_tables): Don't sort RITEM.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
Be sure never to walk through RITEMS, but use only data related to
|
||||
the rules themselves. RITEMS should be banished.
|
||||
|
||||
* src/output.c (output_token_translations): Rename as...
|
||||
(prepare_tokens): this.
|
||||
In addition to `translate', prepare the muscles `tname' and
|
||||
`toknum', which were handled by...
|
||||
(output_rule_data): this.
|
||||
Remove, and move the remainder of its outputs into...
|
||||
(prepare_rules): this new routines, which also merges content from
|
||||
(output_gram): this.
|
||||
(prepare_rules): Be sure never to walk through RITEMS.
|
||||
(output_stos): Rename as...
|
||||
(prepare_stos): this.
|
||||
(output): Always invoke prepare_states, after all, just don't use it
|
||||
in the output if you don't need it.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* src/LR0.c (new_state): Display `nstates' as the name of the
|
||||
newly created state.
|
||||
Adjust to initialize first_state and last_state if needed.
|
||||
Be sure to distinguish the initial from the final state.
|
||||
(new_states): Create the itemset of the initial state, and use
|
||||
new_state.
|
||||
* src/closure.c (closure): Now that the initial state has its
|
||||
items properly set, there is no need for a special case when
|
||||
creating `ruleset'.
|
||||
|
||||
As a result, now the rule 0, reducing to $axiom, is visible in the
|
||||
outputs. Adjust the test suite.
|
||||
|
||||
* tests/conflicts.at (Solved SR Conflicts)
|
||||
(Unresolved SR Conflicts): Adjust.
|
||||
* tests/regression.at (Web2c Report, Rule Line Numbers): Idem.
|
||||
* tests/conflicts.at (S/R in initial): New.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* src/LR0.c (allocate_itemsets): Don't loop over ritem: loop over
|
||||
the RHS of the rules.
|
||||
* src/output.c (output_gram): Likewise.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* src/gram.h (rule_t): `lhs' is now a pointer to the symbol's
|
||||
bucket.
|
||||
Adjust all dependencies.
|
||||
* src/reduce.c (nonterminals_reduce): Don't forget to renumber the
|
||||
`number' of the buckets too.
|
||||
* src/gram.h: Include `symtab.h'.
|
||||
(associativity): Move to...
|
||||
* src/symtab.h: here.
|
||||
No longer include `gram.h'.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* src/gram.h, src/gram.c (rules_rhs_length): New.
|
||||
(ritem_longest_rhs): Use it.
|
||||
* src/gram.h (rule_t): `number' is a new member.
|
||||
* src/reader.c (packgram): Set it.
|
||||
* src/reduce.c (reduce_grammar_tables): Move the useless rules at
|
||||
the end of `rules', and count them out of `nrules'.
|
||||
(reduce_output, dump_grammar): Adjust.
|
||||
* src/print.c (print_grammar): It is no longer needed to check for
|
||||
the usefulness of a rule, as useless rules are beyond `nrules + 1'.
|
||||
* tests/reduce.at (Reduced Automaton): New test.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* src/reduce.c (inaccessable_symbols): Fix a buglet: because of a
|
||||
lacking `+ 1' to nrules, Bison reported as useless a token if it
|
||||
was used solely to set the precedence of the last rule...
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* data/bison.c++, data/bison.simple: Don't output the current file
|
||||
name in #line, to avoid useless diffs between two identical
|
||||
outputs under different names.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* src/closure.c, src/print.c, src/reader.c, src/reduce.c:
|
||||
Normalize loops to using `< nrules + 1', not `<= nrules'.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* TODO: Update.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* src/output.c, src/reader.c, src/symtab.c, src/symtab.h: Rename
|
||||
bucket.value as bucket.number.
|
||||
|
||||
2002-04-07 Akim Demaille <[email protected]>
|
||||
|
||||
* src/closure.c, src/derives.c, src/gram.h, src/lalr.c,
|
||||
* src/nullable.c, src/output.c, src/print.c, src/print_graph.c,
|
||||
* src/reader.c, src/reduce.c: Let rule_t.rhs point directly to the
|
||||
RHS, instead of being an index in RITEMS.
|
||||
|
||||
2002-04-04 Paul Eggert <[email protected]>
|
||||
|
||||
* doc/bison.texinfo: Update copyright date.
|
||||
(Rpcalc Lexer, Symbols, Token Decl): Don't assume ASCII.
|
||||
(Symbols): Warn about running Bison in one character set,
|
||||
but compiling and/or running in an incompatible one.
|
||||
Warn about character code 256, too.
|
||||
|
||||
2002-04-03 Paul Eggert <[email protected]>
|
||||
|
||||
* src/bison.data (YYSTACK_ALLOC): Depend on whether
|
||||
YYERROR_VERBOSE is nonzero, not whether it is defined.
|
||||
|
||||
Merge changes from bison-1_29-branch.
|
||||
|
||||
2002-03-20 Paul Eggert <[email protected]>
|
||||
|
||||
Merge fixes from Debian bison_1.34-1.diff.
|
||||
|
||||
* configure.in (AC_PREREQ): 2.53.
|
||||
|
||||
2002-03-20 Akim Demaille <[email protected]>
|
||||
|
||||
* src/conflicts.c (log_resolution): Argument `resolution' is const.
|
||||
|
||||
2002-03-19 Paul Eggert <[email protected]>
|
||||
|
||||
* src/bison.simple (YYCOPY): New macro.
|
||||
(YYSTACK_RELOCATE): Use it.
|
||||
Remove Type arg; no longer needed. All callers changed.
|
||||
(yymemcpy): Remove; no longer needed.
|
||||
|
||||
* Makefile.am (AUTOMAKE_OPTIONS): 1.6.
|
||||
* doc/Makefile.am (AUTOMAKE_OPTIONS): Remove.
|
||||
|
||||
2002-03-19 Akim Demaille <[email protected]>
|
||||
|
||||
Test and fix the #line outputs.
|
||||
|
||||
* tests/atlocal.at (GCC): New.
|
||||
* tests/synclines.at (AT_TEST_SYNCLINE): New macro.
|
||||
(Prologue synch line, ,%union synch line, Postprologue synch line)
|
||||
(Action synch line, Epilogue synch line): New tests.
|
||||
* src/reader.c (parse_union_decl): Define the muscle stype_line.
|
||||
* data/bison.simple, data/bison.c++: Use it.
|
||||
|
||||
2002-03-19 Akim Demaille <[email protected]>
|
||||
|
||||
* tests/regression.at (%nonassoc and eof, Unresolved SR Conflicts)
|
||||
(Solved SR Conflicts, %expect not enough, %expect right)
|
||||
(%expect too much): Move to...
|
||||
* tests/conflicts.at: this new file.
|
||||
|
||||
2002-03-19 Akim Demaille <[email protected]>
|
||||
|
||||
* data/m4sugar/m4sugar.m4: Update from CVS Autoconf.
|
||||
* data/bison.simple, data/bison.c++: Handle the `#define' part, so
|
||||
that we can move to enums for instance.
|
||||
* src/output.c (token_definitions_output): Output a list of
|
||||
`token-name, token-number' instead of the #define.
|
||||
(output_skeleton): Name this list `b4_tokens', not `b4_tokendefs'.
|
||||
|
||||
2002-03-14 Akim Demaille <[email protected]>
|
||||
|
||||
Use Gettext 0.11.1.
|
||||
|
||||
2002-03-09 Robert Anisko <[email protected]>
|
||||
|
||||
* data/bison.c++: Make the user able to add members to the generated
|
||||
parser by subclassing.
|
||||
|
||||
2002-03-05 Robert Anisko <[email protected]>
|
||||
|
||||
* src/reader.c (read_additionnal_code): `c' should be an integer, not
|
||||
a character.
|
||||
Reported by Nicolas Tisserand and Nicolas Burrus.
|
||||
|
||||
2002-03-04 Robert Anisko <[email protected]>
|
||||
|
||||
* src/reader.c: Warn about lacking semi-colons, do not complain.
|
||||
|
||||
2002-03-04 Robert Anisko <[email protected]>
|
||||
|
||||
* data/bison.c++: Remove a debug line.
|
||||
|
||||
2002-03-04 Robert Anisko <[email protected]>
|
||||
|
||||
* data/bison.c++: Unmerge value as yylval and value as yyval. Unmerge
|
||||
location as yylloc and location as yyloc. Use YYLLOC_DEFAULT, and
|
||||
provide a default implementation.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
* tests/input.at (Invalid $n, Invalid @n): Add the ending `;'.
|
||||
* tests/output.at (AT_CHECK_OUTPUT): Likewise.
|
||||
* tests/headers.at (AT_TEST_CPP_GUARD_H): Ditto.
|
||||
* tests/semantic.at (Parsing Guards): Similarly.
|
||||
* src/reader.at (readgram): Complain if the last rule is not ended
|
||||
with a semi-colon.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
* src/warshall.h, src/warshall.c (bitmatrix_print): Move to...
|
||||
* src/closure.c: here.
|
||||
(set_firsts): Use bitsetv_reflexive_transitive_closure instead of
|
||||
RTC.
|
||||
* src/warshall.h, src/warshall.c: Remove.
|
||||
* tests/sets.at (Broken Closure): Adjust.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
* src/output.c (output_skeleton): tempdir is const.
|
||||
bytes_read is unused.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
* lib/bbitset.h, lib/bitset.c, lib/bitset.h, lib/bitsetv.c,
|
||||
* lib/bitsetv.h, lib/ebitset.c, lib/lbitset.c, lib/sbitset.c:
|
||||
Update.
|
||||
From Michael Hayes.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
* src/closure.c (closure): `r' is unused.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
* tests/sets.at (Broken Closure): Add the ending `;'.
|
||||
* src/reader.at (readgram): Complain if a rule is not ended with a
|
||||
semi-colon.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
* src/conflicts.c (set_conflicts): Use bitset_disjoint_p.
|
||||
(count_sr_conflicts): Use bitset_count.
|
||||
* src/reduce.c (inaccessable_symbols): Ditto.
|
||||
(bits_size): Remove.
|
||||
* src/warshall.h, src/warshall.c: Convert to bitsetv.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
* src/closure.c, src/conflicts.c, src/lalr.c, src/print.c,
|
||||
* src/reduce.c: Remove the `bitset_zero's following the
|
||||
`bitset_create's, as now it is performed by the latter.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
* lib/bitset.c, lib/bitset.h, lib/bitsetv.c, lib/bitsetv.h,
|
||||
* lib/ebitset.c, lib/ebitset.h, lib/lbitset.c, lib/lbitset.h,
|
||||
* lib/sbitset.c, lib/sbitset.h, lib/bbitset.h: Update from the
|
||||
latest sources from Michael.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
* src/output.c (output): Don't free the grammar.
|
||||
* src/reader.c (grammar_free): New.
|
||||
* src/main.c (main): Call it and don't free symtab here.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
* src/lex.c (parse_percent_token): Be sure to 0-end token_buffer
|
||||
before returning.
|
||||
Reported by Benoit Perrot.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
Use bitset operations when possible, not loops over bits.
|
||||
|
||||
* src/conflicts.c (set_conflicts, count_sr_conflicts): Use
|
||||
bitset_or.
|
||||
* src/print.c (print_reductions): Use bitset_and, bitset_andn.
|
||||
* src/reduce.c (useless_nonterminals): Formatting changes.
|
||||
* src/warshall.c (TC): Use bitset_or.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
* src/lalr.h, src/lalr.c (tokensetsize): Remove, unused.
|
||||
* src/system.h (BITS_PER_WORD, WORDSIZE, SETBIT, RESETBIT, BITISSET):
|
||||
Ditto.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
* src/lalr.c (F): Now a bitset*.
|
||||
Adjust all dependencies.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
* src/conflicts.c (shiftset, lookaheadset): Now bitset.
|
||||
Adjust all dependencies.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
* src/L0.c, src/LR0.h (nstates): Be size_t.
|
||||
Adjust comparisons (signed vs unsigned).
|
||||
* src/conflics.c, src/lalr.c, src/lalr.h, src/output.c (LA): Now a
|
||||
bitset*.
|
||||
Adjust all dependencies.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
* src/closure.c (firsts): Now, also a bitset.
|
||||
Adjust all dependencies.
|
||||
(varsetsize): Remove, now unused.
|
||||
* src/warshall.h, src/warshall.c: Now work on arrays of bitsets.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
* src/print.c: Convert to use bitset.h, not hand coded iterations
|
||||
over ints.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
* src/reduce.c: Convert to use bitset.h, not hand coded BSet.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
* src/closure.c (ruleset): Be a bitset.
|
||||
(rulesetsize): Remove.
|
||||
|
||||
2002-03-04 Akim Demaille <[email protected]>
|
||||
|
||||
* lib/bitset-int.h, lib/bitset.c, lib/bitset.h, lib/bitsetv.c,
|
||||
* lib/bitsetv.h, lib/ebitset.c, lib/ebitset.h, lib/lbitset.c,
|
||||
* lib/lbitset.h, lib/sbitset.c, lib/sbitset.h: New.
|
||||
* src/closure.c (fderives): Be an array of bitsets.
|
||||
|
||||
2002-02-28 Robert Anisko <[email protected]>
|
||||
|
||||
* data/bison.c++: Merge the two generated headers. Insert a copyright
|
||||
notice in each output file.
|
||||
|
||||
2002-02-28 Akim Demaille <[email protected]>
|
||||
|
||||
* data/bison.c++: Copy the prologue of bison.simple to fetch
|
||||
useful M4 definitions, such as b4_header_guard.
|
||||
|
||||
2002-02-25 Akim Demaille <[email protected]>
|
||||
|
||||
* src/getargs.c (version): Give the name of the authors, and use a
|
||||
translator friendly scheme for the bgr
|
||||
copyright notice.
|
||||
|
||||
2002-02-25 Akim Demaille <[email protected]>
|
||||
|
||||
* src/output.c (header_output): Remove, now handled completely via
|
||||
M4.
|
||||
|
||||
2002-02-25 Akim Demaille <[email protected]>
|
||||
|
||||
* m4/m4.m4: New, from CVS Autoconf.
|
||||
* configure.in: Invoke it.
|
||||
* src/output.c (output_skeleton): Use its result instead of the
|
||||
hard coded name.
|
||||
|
||||
2002-02-25 Akim Demaille <[email protected]>
|
||||
|
||||
* lib/tempname.c, lib/mkstemp.c, m4/mkstemp.m4: New, stolen from
|
||||
Fileutils 4.1.5.
|
||||
* configure.in: Invoke UTILS_FUNC_MKSTEMP.
|
||||
* src/output.c (output_skeleton): Use mkstemp to create a real
|
||||
temporary file.
|
||||
Move the filling of `skeleton' and its muscle to...
|
||||
(prepare): here.
|
||||
(output): Move the definition of the prologue muscle to...
|
||||
(prepare): here.
|
||||
* src/system.h (DEFAULT_TMPDIR): New.
|
||||
|
||||
2002-02-14 Paul Eggert <[email protected]>
|
||||
|
||||
Remove the support for C++ namespace cleanliness; it was
|
||||
causing more problems than it was curing, since it didn't work
|
||||
properly on some nonstandard C++ compilers. This can wait
|
||||
for a proper C++ parser.
|
||||
|
||||
* NEWS: Document this.
|
||||
* doc/bison.texinfo (Bison Parser, Debugging): Remove special mention
|
||||
of C++, as it's treated like C now.
|
||||
* src/bison.simple (YYSTD): Remove.
|
||||
(YYSIZE_T, YYFPRINTF, YYPARSE_PARAM_ARG, YYPARSE_PARAM_DECL):
|
||||
Treat C++ just like Standard C instead of trying to support
|
||||
namespace cleanliness.
|
||||
|
||||
2002-02-14 Akim Demaille <[email protected]>
|
||||
|
||||
* tests/regression.at (else): Adjust to Andreas' change.
|
||||
|
||||
2002-02-14 Akim Demaille <[email protected]>
|
||||
|
||||
* lib/Makefile.am (EXTRA_DIST): Ship strnlen.c.
|
||||
|
||||
2002-02-13 Andreas Schwab <[email protected]>
|
||||
|
||||
* src/output.c (output_rule_data): Don't output NULL, it might
|
||||
not be defined yet.
|
||||
|
||||
2002-02-11 Robert Anisko <[email protected]>
|
||||
|
||||
* data/bison.c++ (YYDEBUG, YYERROR_VERBOSE): After the prologue.
|
||||
(Copyright notice): Update.
|
||||
|
||||
2002-02-11 Akim Demaille <[email protected]>
|
||||
|
||||
* tests/regression.at (%nonassoc and eof): Don't include
|
||||
nonportable headers.
|
||||
|
||||
2002-02-08 Robert Anisko <[email protected]>
|
||||
|
||||
* data/bison.c++: Correct error recovery. Make the user able to
|
||||
initialize the starting location.
|
||||
|
||||
2002-02-07 Akim Demaille <[email protected]>
|
||||
|
||||
* tests/input.at: New.
|
||||
|
||||
2002-02-07 Robert Anisko <[email protected]>
|
||||
|
||||
* data/bison.c++: Replace some direct m4 expansions by constants. Be
|
||||
more consistent when naming methods and variables. Put preprocessor
|
||||
directives around tables only needed for debugging.
|
||||
|
||||
2002-02-07 Robert Anisko <[email protected]>
|
||||
|
||||
* data/bison.c++ (yy::b4_name::print_): New method, replaces yyprint in
|
||||
C++ parsers.
|
||||
(yy::b4_name::parse): Use print_.
|
||||
|
||||
2002-02-07 Robert Anisko <[email protected]>
|
||||
|
||||
* data/bison.c++ (yy::b4_name::parse): Error recovery is back.
|
||||
|
||||
2002-02-07 Robert Anisko <[email protected]>
|
||||
|
||||
* data/bison.c++ (yy::b4_name::error_): New method, replaces yyerror in
|
||||
C++ parsers.
|
||||
(yy::b4_name::parse): Build verbose error messages, and use error_.
|
||||
|
||||
2002-02-06 Robert Anisko <[email protected]>
|
||||
|
||||
* data/bison.c++: Fix m4 quoting in comments.
|
||||
|
||||
2002-02-06 Robert Anisko <[email protected]>
|
||||
|
||||
* data/bison.c++: Adjust the parser code. Fix some muscles that were
|
||||
not expanded by m4.
|
||||
|
||||
2002-02-05 Akim Demaille <[email protected]>
|
||||
|
||||
* data/bison.c++: Adjust to the M4 back end.
|
||||
More is certainly needed.
|
||||
|
||||
2002-02-05 Akim Demaille <[email protected]>
|
||||
|
||||
Give a try to M4 as a back end.
|
||||
|
||||
* lib/readpipe.c: New, from wdiff.
|
||||
* src/Makefile.am (DEFS): Define PKGDATADIR, not BISON_SIMPLE and
|
||||
BISON_HAIRY.
|
||||
* src/system.h (BISON_HAIRY, BISON_SIMPLE): Remove the DOS and VMS
|
||||
specific values. Now it is m4 that performs the lookup.
|
||||
* src/parse-skel.y: Remove.
|
||||
* src/muscle_tab.c, src/muscle_tab.h (muscles_m4_output): New.
|
||||
* src/output.c (actions_output, guards_output)
|
||||
(token_definitions_output): No longer keeps track of the output
|
||||
line number, hence remove the second argument.
|
||||
(guards_output): Check against the guard member of a rule, not the
|
||||
action member.
|
||||
Adjust callers.
|
||||
(output_skeleton): Don't look for the skeleton location, let m4 do
|
||||
that.
|
||||
Create `/tmp/muscles.m4'. This is temporary, a proper temporary
|
||||
file will be used.
|
||||
Invoke `m4' on m4sugar.m4, muscles.m4, and the skeleton.
|
||||
(prepare): Given that for the time being changesyntax is not
|
||||
usable in M4, rename the muscles using `-' to `_'.
|
||||
Define `defines_flag', `output_parser_name' and `output_header_name'.
|
||||
* src/output.h (actions_output, guards_output)
|
||||
(token_definitions_output): Adjust prototypes.
|
||||
* src/scan-skel.l: Instead of scanning the skeletons, it now
|
||||
processes the output of m4: `__oline__' and `#output'.
|
||||
* data/bison.simple: Adjust to be used by M4(sugar).
|
||||
* tests/Makefile.am: Use check_SCRIPTS to make sure `bison' is up
|
||||
to date.
|
||||
* tests/bison.in: Use the secrete envvar `BISON_PKGDATADIR'
|
||||
instead of the dead `BISON_SIMPLE' and `BISON_HAIRY'.
|
||||
* data/m4sugar/m4sugar.m4, data/m4sugar/version.m4: New,
|
||||
shamelessly stolen from CVS Autoconf.
|
||||
|
||||
2002-02-05 Akim Demaille <[email protected]>
|
||||
|
||||
* lib/hash.c, lib/hash.h: Replace with Fileutils 4.1's version.
|
||||
@@ -5463,3 +6298,23 @@
|
||||
1987-12-16 Richard Stallman <[email protected]>
|
||||
|
||||
* REFERENCES: entered into RCS
|
||||
-----
|
||||
|
||||
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Autoconf.
|
||||
|
||||
GNU Autoconf 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.
|
||||
|
||||
GNU Autoconf 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 autoconf; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
|
||||
+2
-2
@@ -16,13 +16,13 @@
|
||||
## 02111-1307 USA
|
||||
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||
AUTOMAKE_OPTIONS = 1.5 check-news readme-alpha dist-bzip2
|
||||
AUTOMAKE_OPTIONS = 1.6 check-news readme-alpha dist-bzip2
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = config intl po lib data src doc m4 tests
|
||||
|
||||
EXTRA_DIST = REFERENCES configure.bat OChangeLog Makefile.maint GNUmakefile
|
||||
EXTRA_DIST = config/config.rpath REFERENCES configure.bat OChangeLog Makefile.maint GNUmakefile
|
||||
|
||||
DISTCLEANFILES = intl/libintl.h
|
||||
|
||||
|
||||
@@ -3,6 +3,46 @@ Bison News
|
||||
|
||||
Changes in version 1.49a:
|
||||
|
||||
* Undefined token
|
||||
The undefined token was systematically mapped to 2 which prevented
|
||||
the use of 2 from the user. This is no longer the case.
|
||||
|
||||
* Undefined token
|
||||
If yylex returned a code out of range, yyparse could die. This is
|
||||
no longer the case.
|
||||
|
||||
* Error token
|
||||
According to POSIX, the error token should be numbered as 256.
|
||||
Bison extends this requirement by making it a preference: *if* the
|
||||
user specified that one of her tokens is numbered 256, then error
|
||||
will be mapped onto another number.
|
||||
|
||||
* Large grammars
|
||||
Are now supported (large token numbers, large grammar size (= sum of
|
||||
the LHS and RHS lengths), large LALR tables).
|
||||
|
||||
* The initial rule is explicit.
|
||||
Bison used to play hacks with the initial rule, which the user does
|
||||
not write. It is now explicit, and visible in the reports and
|
||||
graphs as rule 0.
|
||||
|
||||
* Useless rules are actually removed.
|
||||
Before, Bison reported the useless rules, but, although not used,
|
||||
included them in the parsers.
|
||||
|
||||
* False `Token not used' report fixed.
|
||||
On a grammar such as
|
||||
|
||||
%token useless useful
|
||||
%%
|
||||
exp: '0' %prec useful;
|
||||
|
||||
where a token was used to set the precedence of the last rule,
|
||||
bison reported both `useful' and `useless' as useless tokens.
|
||||
|
||||
* Revert the C++ namespace changes introduced in 1.31, as they caused too
|
||||
many portability hassles.
|
||||
|
||||
* Items overflow
|
||||
Bison no longer dumps core when there are too many items, it just
|
||||
dies.
|
||||
@@ -16,6 +56,59 @@ Changes in version 1.49a:
|
||||
or
|
||||
%token YYEOF 0 "end of file"
|
||||
|
||||
Changes in version 1.35, 2002-03-25:
|
||||
|
||||
* C Skeleton
|
||||
Some projects use Bison's C parser with C++ compilers, and define
|
||||
YYSTYPE as a class. The recent adjustment of C parsers for data
|
||||
alignment and 64 bit architectures made this impossible.
|
||||
|
||||
Because for the time being no real solution for C++ parser
|
||||
generation exists, kludges were implemented in the parser to
|
||||
maintain this use. In the future, when Bison has C++ parsers, this
|
||||
kludge will be disabled.
|
||||
|
||||
This kludge also addresses some C++ problems when the stack was
|
||||
extended.
|
||||
|
||||
|
||||
Changes in version 1.34, 2002-03-12:
|
||||
|
||||
* File name clashes are detected
|
||||
$ bison foo.y -d -o foo.x
|
||||
fatal error: header and parser would both be named `foo.x'
|
||||
|
||||
* A missing `;' at the end of a rule triggers a warning
|
||||
In accordance with POSIX, and in agreement with other
|
||||
Yacc implementations, Bison will mandate this semicolon in the near
|
||||
future. This eases the implementation of a Bison parser of Bison
|
||||
grammars by making this grammar LALR(1) instead of LR(2). To
|
||||
facilitate the transition, this release introduces a warning.
|
||||
|
||||
* Revert the C++ namespace changes introduced in 1.31, as they caused too
|
||||
many portability hassles.
|
||||
|
||||
* DJGPP support added.
|
||||
|
||||
* Fix test suite portability problems.
|
||||
|
||||
Changes in version 1.33, 2002-02-07:
|
||||
|
||||
* Fix C++ issues
|
||||
Groff could not be compiled for the definition of size_t was lacking
|
||||
under some conditions.
|
||||
|
||||
* Catch invalid @n
|
||||
As is done with $n.
|
||||
|
||||
Changes in version 1.32, 2002-01-23:
|
||||
|
||||
* Fix Yacc output file names
|
||||
|
||||
* Portability fixes
|
||||
|
||||
* Italian, Dutch translations
|
||||
|
||||
Changes in version 1.31, 2002-01-14:
|
||||
|
||||
* Many Bug Fixes
|
||||
@@ -43,6 +136,7 @@ Changes in version 1.31, 2002-01-14:
|
||||
|
||||
* Better C++ compliance
|
||||
The output parsers try to respect C++ namespaces.
|
||||
[This turned out to be a failed experiment, and it was reverted later.]
|
||||
|
||||
* Reduced Grammars
|
||||
Fixed bugs when reporting useless nonterminals.
|
||||
@@ -100,7 +194,7 @@ Changes in version 1.31, 2002-01-14:
|
||||
* --output
|
||||
New, aliasing `--output-file'.
|
||||
|
||||
Changes in version 1.30:
|
||||
Changes in version 1.30, 2001-10-26:
|
||||
|
||||
* `--defines' and `--graph' have now an optionnal argument which is the
|
||||
output file name. `-d' and `-g' do not change, they do not take any
|
||||
@@ -223,3 +317,24 @@ Output file does not redefine const for C++.
|
||||
Local Variables:
|
||||
mode: outline
|
||||
End:
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Autoconf.
|
||||
|
||||
GNU Autoconf 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.
|
||||
|
||||
GNU Autoconf 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 autoconf; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
These notes intend to help people working on the CVS versions of
|
||||
Bison. Only the sources are installed in the CVS repository (to ease
|
||||
the maintenance, merges etc.), therefore you will have to the
|
||||
maintainer tools we depend upon:
|
||||
|
||||
- Automake 1.6 or 1.6.1
|
||||
- Autoconf 2.53a or better
|
||||
ftp://alpha.gnu.org/gnu/autoconf/autoconf-2.53a.tar.gz (992 kB)
|
||||
ftp://alpha.gnu.org/gnu/autoconf/autoconf-2.53a.tar.bz2 (756 kB)
|
||||
- Gettext 0.10.1
|
||||
|
||||
Only building the initial full source tree will be a bit painful,
|
||||
later, a plain `cvs update -P & make' should be sufficient.
|
||||
|
||||
* First CVS checkout
|
||||
|
||||
Obviously, if you are reading these notes, you did manage to check out
|
||||
Bison from CVS. For the records, you will find all the relevant
|
||||
information on:
|
||||
|
||||
http://savannah.gnu.org/cvs/?group_id=56
|
||||
|
||||
The next step is asking the installation of all the missing files:
|
||||
|
||||
$ ./bootstrap
|
||||
|
||||
And there you are! Just
|
||||
|
||||
$ ./configure && make && make check
|
||||
|
||||
At this point, there should be no difference between your local copy,
|
||||
and the CVS master copy:
|
||||
|
||||
$ cvs diff
|
||||
|
||||
should output no difference, except maybe the date in po/*.po files.
|
||||
|
||||
Enjoy!
|
||||
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Autoconf.
|
||||
|
||||
GNU Autoconf 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.
|
||||
|
||||
GNU Autoconf 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 autoconf; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
@@ -5,7 +5,10 @@ Airy Andre [email protected]
|
||||
Akim Demaille [email protected]
|
||||
Albert Chin-A-Young [email protected]
|
||||
Alexander Belopolsky [email protected]
|
||||
Andreas Schwab [email protected]
|
||||
Arnold Robbins [email protected]
|
||||
Benoit Perrot [email protected]
|
||||
Bruce Lilly [email protected]
|
||||
Cris van Pelt [email protected]
|
||||
Daniel Hagerty [email protected]
|
||||
David J. MacKenzie [email protected]
|
||||
@@ -13,6 +16,7 @@ Dick Streefland [email protected]
|
||||
Enrico Scholz [email protected]
|
||||
Evgeny Stambulchik [email protected]
|
||||
Fabrice Bauzac [email protected]
|
||||
Florian Krohm [email protected]
|
||||
H. Merijn Brand [email protected]
|
||||
Hans Aberg [email protected]
|
||||
Jesse Thilo [email protected]
|
||||
@@ -21,10 +25,14 @@ Juan Manuel Guerrero [email protected]
|
||||
Kees Zeelenberg [email protected]
|
||||
Keith Browne [email protected]
|
||||
Laurent Mascherpa [email protected]
|
||||
Magnus Fromreide [email protected]
|
||||
Marc Autret [email protected]
|
||||
Michael Hayes [email protected]
|
||||
Mike Castle [email protected]
|
||||
Neil Booth [email protected]
|
||||
Nelson H. F. Beebe [email protected]
|
||||
Nicolas Burrus [email protected]
|
||||
Nicolas Tisserand [email protected]
|
||||
Noah Friedman [email protected]
|
||||
Pascal Bart [email protected]
|
||||
Paul Eggert [email protected]
|
||||
@@ -34,6 +42,7 @@ Piotr Gackiewicz [email protected]
|
||||
Richard Stallman [email protected]
|
||||
Robert Anisko [email protected]
|
||||
Shura [email protected]
|
||||
Tim Josling [email protected]
|
||||
Tom Lane [email protected]
|
||||
Tom Tromey [email protected]
|
||||
Wayne Green [email protected]
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
-*- outline -*-
|
||||
|
||||
* NEWS
|
||||
Sort from 1.31 NEWS.
|
||||
|
||||
* Prologue
|
||||
* URGENT: Prologue
|
||||
The %union is declared after the user C declarations. It can be
|
||||
a problem if YYSTYPE is declared after the user part. []
|
||||
a problem if YYSTYPE is declared after the user part.
|
||||
|
||||
Actually, the real problem seems that the %union ought to be output
|
||||
where it was defined. For instance, in gettext/intl/plural.y, we
|
||||
@@ -32,6 +30,222 @@ have:
|
||||
Where the first part defines struct expression, the second uses it to
|
||||
define YYSTYPE, and the last uses YYSTYPE. Only this order is valid.
|
||||
|
||||
Note that we have the same problem with GCC.
|
||||
|
||||
I suggest splitting the prologue into pre-prologue and post-prologue.
|
||||
The reason is that:
|
||||
|
||||
1. we keep language independance as it is the skeleton that joins the
|
||||
two prologues (there is no need for the engine to encode union yystype
|
||||
and to output it inside the prologue, which breaks the language
|
||||
independance of the generator)
|
||||
|
||||
2. that makes it possible to have several %union in input. I think
|
||||
this is a pleasant (but useless currently) feature, but in the future,
|
||||
I want a means to %include other bits of grammars, and _then_ it will
|
||||
be important for the various bits to define their needs in %union.
|
||||
|
||||
When implementing multiple-%union support, bare the following in mind:
|
||||
|
||||
- when --yacc, this must be flagged as an error. Don't make it fatal
|
||||
though.
|
||||
|
||||
- The #line must now appear *inside* the definition of yystype.
|
||||
Something like
|
||||
|
||||
{
|
||||
#line 12 "foo.y"
|
||||
int ival;
|
||||
#line 23 "foo.y"
|
||||
char *sval;
|
||||
}
|
||||
|
||||
* Language independent actions
|
||||
|
||||
Currently bison, the generator, transforms $1, $$ and so forth into
|
||||
direct C code, manipulating the stacks. This is problematic, because
|
||||
(i) it means that if we want more languages, we need to update the
|
||||
generator, and (ii), it forces names everywhere (e.g., the C++
|
||||
skeleton would be happy to use other naming schemes, and actually,
|
||||
even other accessing schemes).
|
||||
|
||||
Therefore we want
|
||||
|
||||
1. the generator to replace $1, etc. by M4 macro invocations
|
||||
(b4_dollar(1), b4_at(3), b4_dollar_dollar) etc.
|
||||
|
||||
2. the skeletons to define these macros.
|
||||
|
||||
But currently the actions are double-quoted, to protect them from M4
|
||||
evaluation. So we need to:
|
||||
|
||||
3. stop quoting them
|
||||
|
||||
4. change the [ and ] in the actions into @<:@ and @:>@
|
||||
|
||||
5. extend the postprocessor to maps these back onto [ and ].
|
||||
|
||||
* Coding system independence
|
||||
Paul notes:
|
||||
|
||||
Currently Bison assumes 8-bit bytes (i.e. that UCHAR_MAX is
|
||||
255). It also assumes that the 8-bit character encoding is
|
||||
the same for the invocation of 'bison' as it is for the
|
||||
invocation of 'cc', but this is not necessarily true when
|
||||
people run bison on an ASCII host and then use cc on an EBCDIC
|
||||
host. I don't think these topics are worth our time
|
||||
addressing (unless we find a gung-ho volunteer for EBCDIC or
|
||||
PDP-10 ports :-) but they should probably be documented
|
||||
somewhere.
|
||||
|
||||
* Using enums instead of int for tokens.
|
||||
Paul suggests:
|
||||
|
||||
#ifndef YYTOKENTYPE
|
||||
# if defined (__STDC__) || defined (__cplusplus)
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
FOO = 256,
|
||||
BAR,
|
||||
...
|
||||
};
|
||||
/* POSIX requires `int' for tokens in interfaces. */
|
||||
# define YYTOKENTYPE int
|
||||
# endif
|
||||
#endif
|
||||
#define FOO 256
|
||||
#define BAR 257
|
||||
...
|
||||
|
||||
* Output directory
|
||||
Akim:
|
||||
|
||||
| I consider this to be a bug in bison:
|
||||
|
|
||||
| /tmp % mkdir src
|
||||
| /tmp % cp ~/src/bison/tests/calc.y src
|
||||
| /tmp % mkdir build && cd build
|
||||
| /tmp/build % bison ../src/calc.y
|
||||
| /tmp/build % cd ..
|
||||
| /tmp % ls -l build src
|
||||
| build:
|
||||
| total 0
|
||||
|
|
||||
| src:
|
||||
| total 32
|
||||
| -rw-r--r-- 1 akim lrde 27553 oct 2 16:31 calc.tab.c
|
||||
| -rw-r--r-- 1 akim lrde 3335 oct 2 16:31 calc.y
|
||||
|
|
||||
|
|
||||
| Would it be safe to change this behavior to something more reasonable?
|
||||
| Do you think some people depend upon this?
|
||||
|
||||
Jim:
|
||||
|
||||
Is it that behavior documented?
|
||||
If so, then it's probably not reasonable to change it.
|
||||
I've Cc'd the automake list, because some of automake's
|
||||
rules use bison through $(YACC) -- though I'll bet they
|
||||
all use it in yacc-compatible mode.
|
||||
|
||||
Pavel:
|
||||
|
||||
Hello, Jim and others!
|
||||
|
||||
> Is it that behavior documented?
|
||||
> If so, then it's probably not reasonable to change it.
|
||||
> I've Cc'd the automake list, because some of automake's
|
||||
> rules use bison through $(YACC) -- though I'll bet they
|
||||
> all use it in yacc-compatible mode.
|
||||
|
||||
Yes, Automake currently used bison in Automake-compatible mode, but it
|
||||
would be fair for Automake to switch to the native mode as long as the
|
||||
processed files are distributed and "missing" emulates bison.
|
||||
|
||||
In any case, the makefiles should specify the output file explicitly
|
||||
instead of relying on weird defaults.
|
||||
|
||||
> | src:
|
||||
> | total 32
|
||||
> | -rw-r--r-- 1 akim lrde 27553 oct 2 16:31 calc.tab.c
|
||||
> | -rw-r--r-- 1 akim lrde 3335 oct 2 16:31 calc.y
|
||||
|
||||
This is not _that_ ugly as it seems - with Automake you want to put
|
||||
sources where they belong - to the source directory.
|
||||
|
||||
> | This is not _that_ ugly as it seems - with Automake you want to put
|
||||
> | sources where they belong - to the source directory.
|
||||
>
|
||||
> The difference source/build you are referring to is based on Automake
|
||||
> concepts. They have no sense at all for tools such as bison or gcc
|
||||
> etc. They have input and output. I do not want them to try to grasp
|
||||
> source/build. I want them to behave uniformly: output *here*.
|
||||
|
||||
I realize that.
|
||||
|
||||
It's unfortunate that the native mode of Bison behaves in a less uniform
|
||||
way than the yacc mode. I agree with your point. Bison maintainters may
|
||||
want to fix it along with the documentation.
|
||||
|
||||
|
||||
* Unit rules
|
||||
Maybe we could expand unit rules, i.e., transform
|
||||
|
||||
exp: arith | bool;
|
||||
arith: exp '+' exp;
|
||||
bool: exp '&' exp;
|
||||
|
||||
into
|
||||
|
||||
exp: exp '+' exp | exp '&' exp;
|
||||
|
||||
when there are no actions. This can significantly speed up some
|
||||
grammars.
|
||||
|
||||
* Stupid error messages
|
||||
An example shows it easily:
|
||||
|
||||
src/bison/tests % ./testsuite -k calc,location,error-verbose -l
|
||||
GNU Bison 1.49a test suite test groups:
|
||||
|
||||
NUM: FILENAME:LINE TEST-GROUP-NAME
|
||||
KEYWORDS
|
||||
|
||||
51: calc.at:440 Calculator --locations --yyerror-verbose
|
||||
52: calc.at:442 Calculator --defines --locations --name-prefix=calc --verbose --yacc --yyerror-verbose
|
||||
54: calc.at:445 Calculator --debug --defines --locations --name-prefix=calc --verbose --yacc --yyerror-verbose
|
||||
src/bison/tests % ./testsuite 51 -d
|
||||
## --------------------------- ##
|
||||
## GNU Bison 1.49a test suite. ##
|
||||
## --------------------------- ##
|
||||
51: calc.at:440 ok
|
||||
## ---------------------------- ##
|
||||
## All 1 tests were successful. ##
|
||||
## ---------------------------- ##
|
||||
src/bison/tests % cd ./testsuite.dir/51
|
||||
tests/testsuite.dir/51 % echo "()" | ./calc
|
||||
1.2-1.3: parse error, unexpected ')', expecting error or "number" or '-' or '('
|
||||
|
||||
* yyerror, yyprint interface
|
||||
It should be improved, in particular when using Bison features such as
|
||||
locations, and YYPARSE_PARAMS. For the time being, it is recommended
|
||||
to #define yyerror and yyprint to steal internal variables...
|
||||
|
||||
* read_pipe.c
|
||||
This is not portable to DOS for instance. Implement a more portable
|
||||
scheme. Sources of inspiration include GNU diff, and Free Recode.
|
||||
|
||||
* Memory leaks in the generator
|
||||
A round of memory leak clean ups would be most welcome. Dmalloc,
|
||||
Checker GCC, Electric Fence, or Valgrind: you chose your tool.
|
||||
|
||||
* Memory leaks in the parser
|
||||
The same applies to the generated parsers. In particular, this is
|
||||
critical for user data: when aborting a parsing, when handling the
|
||||
error token etc., we often throw away yylval without giving a chance
|
||||
of cleaning it up to the user.
|
||||
|
||||
* --graph
|
||||
Show reductions. []
|
||||
|
||||
@@ -66,3 +280,197 @@ skeleton muscles. []
|
||||
* testsuite
|
||||
** tests/pure-parser.at []
|
||||
New tests.
|
||||
|
||||
* Debugging parsers
|
||||
|
||||
From Greg McGary:
|
||||
|
||||
akim demaille <[email protected]> writes:
|
||||
|
||||
> With great pleasure! Nonetheless, things which are debatable
|
||||
> (or not, but just `big') should be discuss in `public': something
|
||||
> like help- or [email protected] is just fine. Jesse and I are there,
|
||||
> but there is also Jim and some other people.
|
||||
|
||||
I have no idea whether it qualifies as big or controversial, so I'll
|
||||
just summarize for you. I proposed this change years ago and was
|
||||
surprised that it was met with utter indifference!
|
||||
|
||||
This debug feature is for the programs/grammars one develops with
|
||||
bison, not for debugging bison itself. I find that the YYDEBUG
|
||||
output comes in a very inconvenient format for my purposes.
|
||||
When debugging gcc, for instance, what I want is to see a trace of
|
||||
the sequence of reductions and the line#s for the semantic actions
|
||||
so I can follow what's happening. Single-step in gdb doesn't cut it
|
||||
because to move from one semantic action to the next takes you through
|
||||
lots of internal machinery of the parser, which is uninteresting.
|
||||
|
||||
The change I made was to the format of the debug output, so that it
|
||||
comes out in the format of C error messages, digestible by emacs
|
||||
compile mode, like so:
|
||||
|
||||
grammar.y:1234: foo: bar(0x123456) baz(0x345678)
|
||||
|
||||
where "foo: bar baz" is the reduction rule, whose semantic action
|
||||
appears on line 1234 of the bison grammar file grammar.y. The hex
|
||||
numbers on the rhs tokens are the parse-stack values associated with
|
||||
those tokens. Of course, yytype might be something totally
|
||||
incompatible with that representation, but for the most part, yytype
|
||||
values are single words (scalars or pointers). In the case of gcc,
|
||||
they're most often pointers to tree nodes. Come to think of it, the
|
||||
right thing to do is to make the printing of stack values be
|
||||
user-definable. It would also be useful to include the filename &
|
||||
line# of the file being parsed, but the main filename & line# should
|
||||
continue to be that of grammar.y
|
||||
|
||||
Anyway, this feature has saved my life on numerous occasions. The way
|
||||
I customarily use it is to first run bison with the traces on, isolate
|
||||
the sequence of reductions that interests me, put those traces in a
|
||||
buffer and force it into compile-mode, then visit each of those lines
|
||||
in the grammar and set breakpoints with C-x SPACE. Then, I can run
|
||||
again under the control of gdb and stop at each semantic action.
|
||||
With the hex addresses of tree nodes, I can inspect the values
|
||||
associated with any rhs token.
|
||||
|
||||
You like?
|
||||
|
||||
* input synclines
|
||||
Some users create their foo.y files, and equip them with #line. Bison
|
||||
should recognize these, and preserve them.
|
||||
|
||||
* BTYacc
|
||||
See if we can integrate backtracking in Bison. Contact the BTYacc
|
||||
maintainers.
|
||||
|
||||
* Automaton report
|
||||
Display more clearly the lookaheads for each item.
|
||||
|
||||
* RR conflicts
|
||||
See if we can use precedence between rules to solve RR conflicts. See
|
||||
what POSIX says.
|
||||
|
||||
* Precedence
|
||||
It is unfortunate that there is a total order for precedence. It
|
||||
makes it impossible to have modular precedence information. We should
|
||||
move to partial orders.
|
||||
|
||||
* Parsing grammars
|
||||
Rewrite the reader in Bison.
|
||||
|
||||
* Problems with aliases
|
||||
From: "Baum, Nathan I" <[email protected]>
|
||||
Subject: Token Alias Bug
|
||||
To: "'[email protected]'" <[email protected]>
|
||||
|
||||
I've noticed a bug in bison. Sadly, our eternally wise sysadmins won't let
|
||||
us use CVS, so I can't find out if it's been fixed already...
|
||||
|
||||
Basically, I made a program (in flex) that went through a .y file looking
|
||||
for "..."-tokens, and then outputed a %token
|
||||
line for it. For single-character ""-tokens, I reasoned, I could just use
|
||||
[%token 'A' "A"]. However, this causes Bison to output a [#define 'A' 65],
|
||||
which cppp chokes on, not unreasonably. (And even if cppp didn't choke, I
|
||||
obviously wouldn't want (char)'A' to be replaced with (int)65 throughout my
|
||||
code.
|
||||
|
||||
Bison normally forgoes outputing a #define for a character token. However,
|
||||
it always outputs an aliased token -- even if the token is an alias for a
|
||||
character token. We don't want that. The problem is in /output.c/, as I
|
||||
recall. When it outputs the token definitions, it checks for a character
|
||||
token, and then checks for an alias token. If the character token check is
|
||||
placed after the alias check, then it works correctly.
|
||||
|
||||
Alias tokens seem to be something of a kludge. What about an [%alias "..."]
|
||||
command...
|
||||
|
||||
%alias T_IF "IF"
|
||||
|
||||
Hmm. I can't help thinking... What about a --generate-lex option that
|
||||
creates an .l file for the alias tokens used... (Or an option to make a
|
||||
gperf file, etc...)
|
||||
|
||||
* Presentation of the report file
|
||||
From: "Baum, Nathan I" <[email protected]>
|
||||
Subject: Token Alias Bug
|
||||
To: "'[email protected]'" <[email protected]>
|
||||
|
||||
I've also noticed something, that whilst not *wrong*, is inconvienient: I
|
||||
use the verbose mode to help find the causes of unresolved shift/reduce
|
||||
conflicts. However, this mode insists on starting the .output file with a
|
||||
list of *resolved* conflicts, something I find quite useless. Might it be
|
||||
possible to define a -v mode, and a -vv mode -- Where the -vv mode shows
|
||||
everything, but the -v mode only tells you what you need for examining
|
||||
conflicts? (Or, perhaps, a "*** This state has N conflicts ***" marker above
|
||||
each state with conflicts.)
|
||||
|
||||
|
||||
* $undefined
|
||||
From Hans:
|
||||
- If the Bison generated parser experiences an undefined number in the
|
||||
character range, that character is written out in diagnostic messages, an
|
||||
addition to the $undefined value.
|
||||
|
||||
Suggest: Change the name $undefined to undefined; looks better in outputs.
|
||||
|
||||
* Default Action
|
||||
From Hans:
|
||||
- For use with my C++ parser, I transported the "switch (yyn)" statement
|
||||
that Bison writes to the bison.simple skeleton file. This way, I can remove
|
||||
the current default rule $$ = $1 implementation, which causes a double
|
||||
assignment to $$ which may not be OK under C++, replacing it with a
|
||||
"default:" part within the switch statement.
|
||||
|
||||
Note that the default rule $$ = $1, when typed, is perfectly OK under C,
|
||||
but in the C++ implementation I made, this rule is different from
|
||||
$<type_name>$ = $<type_name>1. I therefore think that one should implement
|
||||
a Bison option where every typed default rule is explicitly written out
|
||||
(same typed ruled can of course be grouped together).
|
||||
|
||||
* Pre and post actions.
|
||||
From: Florian Krohm <[email protected]>
|
||||
Subject: YYACT_EPILOGUE
|
||||
To: [email protected]
|
||||
X-Sent: 1 week, 4 days, 14 hours, 38 minutes, 11 seconds ago
|
||||
|
||||
The other day I had the need for explicitly building the parse tree. I
|
||||
used %locations for that and defined YYLLOC_DEFAULT to call a function
|
||||
that returns the tree node for the production. Easy. But I also needed
|
||||
to assign the S-attribute to the tree node. That cannot be done in
|
||||
YYLLOC_DEFAULT, because it is invoked before the action is executed.
|
||||
The way I solved this was to define a macro YYACT_EPILOGUE that would
|
||||
be invoked after the action. For reasons of symmetry I also added
|
||||
YYACT_PROLOGUE. Although I had no use for that I can envision how it
|
||||
might come in handy for debugging purposes.
|
||||
All is needed is to add
|
||||
|
||||
#if YYLSP_NEEDED
|
||||
YYACT_EPILOGUE (yyval, (yyvsp - yylen), yylen, yyloc, (yylsp - yylen));
|
||||
#else
|
||||
YYACT_EPILOGUE (yyval, (yyvsp - yylen), yylen);
|
||||
#endif
|
||||
|
||||
at the proper place to bison.simple. Ditto for YYACT_PROLOGUE.
|
||||
|
||||
I was wondering what you think about adding YYACT_PROLOGUE/EPILOGUE
|
||||
to bison. If you're interested, I'll work on a patch.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Autoconf.
|
||||
|
||||
GNU Autoconf 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.
|
||||
|
||||
GNU Autoconf 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 autoconf; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#! /bin/sh
|
||||
|
||||
echo "Bootstrapping CVS Bison..."
|
||||
|
||||
# This will run gettextize which will patch some files, and cause
|
||||
# autoconf to choke (because for instance intl/Makefile is registered
|
||||
# several times).
|
||||
autoreconf --verbose --install --force
|
||||
|
||||
# gettextize modified these files: restore them.
|
||||
for f in m4/Makefile.am Makefile.am configure.in
|
||||
do
|
||||
if test -f "$f~"; then
|
||||
mv -f "$f~" "$f"
|
||||
fi
|
||||
done
|
||||
rm -f po/Makevars.template
|
||||
|
||||
# Since some files were restored, some files must probably be remade.
|
||||
# But automake could not install all of its files, so pass --install
|
||||
# for it.
|
||||
autoreconf --verbose --install
|
||||
+29
-4
@@ -31,7 +31,16 @@ if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
fi
|
||||
# `libtool' can also be set to `yes' or `no'.
|
||||
|
||||
depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`}
|
||||
if test -z "$depfile"; then
|
||||
base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
|
||||
dir=`echo "$object" | sed 's,/.*$,/,'`
|
||||
if test "$dir" = "$object"; then
|
||||
dir=
|
||||
fi
|
||||
# FIXME: should be _deps on DOS.
|
||||
depfile="$dir.deps/$base"
|
||||
fi
|
||||
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
@@ -204,8 +213,9 @@ tru64)
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
|
||||
tmpdepfile1="$object.d"
|
||||
tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'`
|
||||
base=`echo "$object" | sed -e 's/\.o$/.d/' -e 's/\.lo$/.d/'`
|
||||
tmpdepfile1="$base.o.d"
|
||||
tmpdepfile2="$base.d"
|
||||
if test "$libtool" = yes; then
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
@@ -314,7 +324,7 @@ makedepend)
|
||||
if test "$stat" != 0; then exit $stat; fi
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tail +3 "$tmpdepfile" | tr ' ' '
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
@@ -382,6 +392,21 @@ msvisualcpp)
|
||||
done
|
||||
;;
|
||||
esac
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
||||
) &
|
||||
|
||||
+17
-17
@@ -109,7 +109,7 @@ then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
:
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
@@ -120,7 +120,7 @@ if [ x"$dir_arg" != x ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=mkdir
|
||||
instcmd=$mkdirprog
|
||||
fi
|
||||
else
|
||||
|
||||
@@ -130,7 +130,7 @@ else
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
:
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
@@ -141,7 +141,7 @@ else
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
:
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
@@ -151,7 +151,7 @@ else
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
:
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -163,8 +163,8 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
@@ -183,7 +183,7 @@ while [ $# -ne 0 ] ; do
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
:
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
@@ -194,10 +194,10 @@ if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
@@ -216,7 +216,7 @@ else
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
:
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
@@ -235,10 +235,10 @@ else
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
|
||||
+9
-3
@@ -1,6 +1,6 @@
|
||||
# Configure template for GNU Bison. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright 2001, 2002 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001, 2002 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
|
||||
@@ -18,7 +18,7 @@
|
||||
# 02111-1307 USA
|
||||
|
||||
# We need a recent Autoconf to run a recent Autotest.
|
||||
AC_PREREQ(2.52g)
|
||||
AC_PREREQ(2.53)
|
||||
|
||||
AC_INIT([GNU Bison], [1.49a], [[email protected]])
|
||||
AC_CONFIG_AUX_DIR(config)
|
||||
@@ -42,6 +42,11 @@ AC_ISC_POSIX
|
||||
AM_PROG_CC_STDC
|
||||
AC_PROG_RANLIB
|
||||
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
||||
BISON_PROG_GNU_M4
|
||||
if test x"$ac_cv_prog_gnu_m4" != xyes; then
|
||||
AC_MSG_ERROR([GNU M4 1.4 is required])
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 executable name.])
|
||||
|
||||
AC_ARG_ENABLE(gcc-warnings,
|
||||
[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended)],
|
||||
@@ -89,7 +94,8 @@ AC_FUNC_ALLOCA
|
||||
AC_FUNC_OBSTACK
|
||||
AC_FUNC_ERROR_AT_LINE
|
||||
AC_FUNC_STRNLEN
|
||||
AC_CHECK_FUNCS(mkstemp setlocale)
|
||||
UTILS_FUNC_MKSTEMP
|
||||
AC_CHECK_FUNCS(setlocale)
|
||||
AC_CHECK_DECLS([free, stpcpy, strchr, strspn, strnlen, malloc, memchr, memrchr])
|
||||
AC_REPLACE_FUNCS(stpcpy strchr strspn memchr memrchr)
|
||||
jm_FUNC_MALLOC
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
Makefile.in
|
||||
Makefile
|
||||
@@ -16,3 +16,6 @@
|
||||
## 02111-1307 USA
|
||||
|
||||
dist_pkgdata_DATA = bison.simple bison.hairy bison.c++
|
||||
|
||||
m4sugardir = $(pkgdatadir)/m4sugar
|
||||
dist_m4sugar_DATA = m4sugar/m4sugar.m4 m4sugar/version.m4
|
||||
|
||||
+574
-219
File diff suppressed because it is too large
Load Diff
+258
-175
@@ -1,11 +1,66 @@
|
||||
%%{section} %%{output-prefix} %%{output-infix} %%".c"
|
||||
/* -*- C -*- */
|
||||
m4_divert(-1) -*- C -*-
|
||||
|
||||
/* A Bison parser, made from %%{filename}
|
||||
by GNU bison %%{version}. */
|
||||
# b4_sint_type(MAX)
|
||||
# -----------------
|
||||
# Return the smallest signed int type able to handle the number MAX.
|
||||
m4_define([b4_sint_type],
|
||||
[m4_if(m4_eval([$1 <= 127]), [1], [signed char],
|
||||
m4_eval([$1 <= 32767]), [1], [signed short],
|
||||
m4_eval([$1 <= 2147483647]), [1], [signed int],
|
||||
[m4_fatal([no signed int type for $1])])])
|
||||
|
||||
/* Skeleton output parser for bison,
|
||||
|
||||
# b4_uint_type(MAX)
|
||||
# -----------------
|
||||
# Return the smallest unsigned int type able to handle the number MAX.
|
||||
m4_define([b4_uint_type],
|
||||
[m4_if(m4_eval([$1 <= 255]), [1], [unsigned char],
|
||||
m4_eval([$1 <= 65535]), [1], [unsigned short],
|
||||
m4_eval([$1 <= 4294967295]), [1], [unsigned int],
|
||||
[m4_fatal([no unsigned int type for $1])])])
|
||||
|
||||
|
||||
m4_define_default([b4_input_suffix], [.y])
|
||||
|
||||
m4_define_default([b4_output_parser_suffix],
|
||||
[m4_translit(b4_input_suffix, [yY], [cC])])
|
||||
|
||||
m4_define_default([b4_output_parser_name],
|
||||
[b4_output_prefix[]b4_output_infix[]b4_output_parser_suffix[]])
|
||||
|
||||
|
||||
m4_define_default([b4_output_header_suffix],
|
||||
[m4_translit(b4_input_suffix, [yY], [hH])])
|
||||
|
||||
m4_define_default([b4_output_header_name],
|
||||
[b4_output_prefix[]b4_output_infix[]b4_output_header_suffix[]])
|
||||
|
||||
m4_define_default([b4_header_guard],
|
||||
[m4_bpatsubst(m4_toupper([BISON_]b4_output_header_name),
|
||||
[[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]], [_])])
|
||||
|
||||
|
||||
# b4_token_defines(TOKEN-NAME, TOKEN-NUMBER)
|
||||
# ------------------------------------------
|
||||
# Output the definition of this token as #define.
|
||||
m4_define([b4_token_define],
|
||||
[#define $1 $2
|
||||
])
|
||||
|
||||
|
||||
# b4_token_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||
# -------------------------------------------------------
|
||||
# Output the definition of the tokens as #define.
|
||||
m4_define([b4_token_defines],
|
||||
[m4_map([b4_token_define], [$@])])
|
||||
|
||||
|
||||
m4_divert(0)dnl
|
||||
#output "b4_output_parser_name"
|
||||
/* A Bison parser, made from b4_filename
|
||||
by GNU bison b4_version. */
|
||||
|
||||
/* Skeleton output parser for Bison,
|
||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
@@ -34,35 +89,43 @@
|
||||
It was written by Richard Stallman by simplifying the hairy parser
|
||||
used when %semantic_parser is specified. */
|
||||
|
||||
/* All symbols defined below should begin with yy or YY, to avoid
|
||||
infringing on user name space. This should be done even for local
|
||||
variables, as they might otherwise be expanded by user macros.
|
||||
There are some unavoidable exceptions within include files to
|
||||
define necessary library symbols; they are noted "INFRINGES ON
|
||||
USER NAME SPACE" below. */
|
||||
|
||||
/* Identify Bison output. */
|
||||
#define YYBISON 1
|
||||
|
||||
/* Pure parsers. */
|
||||
#define YYPURE %%{pure}
|
||||
#define YYPURE b4_pure
|
||||
|
||||
/* Using locations. */
|
||||
#define YYLSP_NEEDED %%{locations-flag}
|
||||
#define YYLSP_NEEDED b4_locations_flag
|
||||
|
||||
/* If NAME_PREFIX is specified substitute the variables and functions
|
||||
m4_if(b4_prefix[], [yy], [],
|
||||
[/* If NAME_PREFIX is specified substitute the variables and functions
|
||||
names. */
|
||||
#define yyparse %%{prefix}parse
|
||||
#define yylex %%{prefix}lex
|
||||
#define yyerror %%{prefix}error
|
||||
#define yylval %%{prefix}lval
|
||||
#define yychar %%{prefix}char
|
||||
#define yydebug %%{prefix}debug
|
||||
#define yynerrs %%{prefix}nerrs
|
||||
#define yyparse b4_prefix[]parse
|
||||
#define yylex b4_prefix[]lex
|
||||
#define yyerror b4_prefix[]error
|
||||
#define yylval b4_prefix[]lval
|
||||
#define yychar b4_prefix[]char
|
||||
#define yydebug b4_prefix[]debug
|
||||
#define yynerrs b4_prefix[]nerrs
|
||||
#if YYLSP_NEEDED
|
||||
# define yylloc %%{prefix}lloc
|
||||
# define yylloc b4_prefix[]lloc
|
||||
#endif
|
||||
])
|
||||
|
||||
|
||||
/* Copy the user declarations. */
|
||||
%%{prologue}
|
||||
/* Copy the first part of user declarations. */
|
||||
b4_pre_prologue
|
||||
|
||||
/* Enabling traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG %%{debug}
|
||||
# define YYDEBUG b4_debug
|
||||
#endif
|
||||
|
||||
/* Enabling verbose error messages. */
|
||||
@@ -70,12 +133,16 @@
|
||||
# undef YYERROR_VERBOSE
|
||||
# define YYERROR_VERBOSE 1
|
||||
#else
|
||||
# define YYERROR_VERBOSE %%{error-verbose}
|
||||
# define YYERROR_VERBOSE b4_error_verbose
|
||||
#endif
|
||||
|
||||
#ifndef YYSTYPE
|
||||
typedef %%{stype} yystype;
|
||||
m4_ifdef([b4_stype_line],
|
||||
[#line b4_stype_line "b4_filename"
|
||||
])dnl
|
||||
typedef b4_stype yystype;
|
||||
# define YYSTYPE yystype
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
#endif
|
||||
|
||||
#ifndef YYLTYPE
|
||||
@@ -86,26 +153,17 @@ typedef struct yyltype
|
||||
int last_line;
|
||||
int last_column;
|
||||
} yyltype;
|
||||
# define YYLTYPE %%{ltype}
|
||||
# define YYLTYPE b4_ltype
|
||||
# define YYLTYPE_IS_TRIVIAL 1
|
||||
#endif
|
||||
|
||||
/* Line %%{skeleton-line} of %%{skeleton}. */
|
||||
#line %%{line} "%%{parser-file-name}"
|
||||
/* Copy the second part of user declarations. */
|
||||
b4_post_prologue
|
||||
|
||||
/* All symbols defined below should begin with yy or YY, to avoid
|
||||
infringing on user name space. This should be done even for local
|
||||
variables, as they might otherwise be expanded by user macros.
|
||||
There are some unavoidable exceptions within include files to
|
||||
define necessary library symbols; they are noted "INFRINGES ON
|
||||
USER NAME SPACE" below. */
|
||||
/* Line __line__ of __file__. */
|
||||
#line __oline__ "__ofile__"
|
||||
|
||||
#ifdef __cplusplus
|
||||
# define YYSTD(x) std::x
|
||||
#else
|
||||
# define YYSTD(x) x
|
||||
#endif
|
||||
|
||||
#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
|
||||
#if ! defined (yyoverflow) || YYERROR_VERBOSE
|
||||
|
||||
/* The parser invokes alloca or malloc; define the necessary symbols. */
|
||||
|
||||
@@ -127,18 +185,19 @@ typedef struct yyltype
|
||||
/* Pacify GCC's `empty if-body' warning. */
|
||||
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
|
||||
# else
|
||||
# ifdef __cplusplus
|
||||
# include <cstdlib> /* INFRINGES ON USER NAME SPACE */
|
||||
# define YYSIZE_T std::size_t
|
||||
# else
|
||||
# ifdef __STDC__
|
||||
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
||||
# define YYSIZE_T size_t
|
||||
# endif
|
||||
# if defined (__STDC__) || defined (__cplusplus)
|
||||
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
||||
# define YYSIZE_T size_t
|
||||
# endif
|
||||
# define YYSTACK_ALLOC YYSTD (malloc)
|
||||
# define YYSTACK_FREE YYSTD (free)
|
||||
# define YYSTACK_ALLOC malloc
|
||||
# define YYSTACK_FREE free
|
||||
# endif
|
||||
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
|
||||
|
||||
|
||||
#if (! defined (yyoverflow) \
|
||||
&& (! defined (__cplusplus) \
|
||||
|| (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
|
||||
|
||||
/* A type that is properly aligned for any stack member. */
|
||||
union yyalloc
|
||||
@@ -157,146 +216,168 @@ union yyalloc
|
||||
N elements. */
|
||||
# if YYLSP_NEEDED
|
||||
# define YYSTACK_BYTES(N) \
|
||||
((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
|
||||
+ 2 * YYSTACK_GAP_MAX)
|
||||
((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
|
||||
+ 2 * YYSTACK_GAP_MAX)
|
||||
# else
|
||||
# define YYSTACK_BYTES(N) \
|
||||
((N) * (sizeof (short) + sizeof (YYSTYPE)) \
|
||||
+ YYSTACK_GAP_MAX)
|
||||
((N) * (sizeof (short) + sizeof (YYSTYPE)) \
|
||||
+ YYSTACK_GAP_MAX)
|
||||
# endif
|
||||
|
||||
/* Relocate the TYPE STACK from its old location to the new one. The
|
||||
/* Copy COUNT objects from FROM to TO. The source and destination do
|
||||
not overlap. */
|
||||
# ifndef YYCOPY
|
||||
# if 1 < __GNUC__
|
||||
# define YYCOPY(To, From, Count) \
|
||||
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
|
||||
# else
|
||||
# define YYCOPY(To, From, Count) \
|
||||
do \
|
||||
{ \
|
||||
register YYSIZE_T yyi; \
|
||||
for (yyi = 0; yyi < (Count); yyi++) \
|
||||
(To)[[yyi]] = (From)[[yyi]]; \
|
||||
} \
|
||||
while (0)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* Relocate STACK from its old location to the new one. The
|
||||
local variables YYSIZE and YYSTACKSIZE give the old and new number of
|
||||
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(Type, Stack) \
|
||||
# define YYSTACK_RELOCATE(Stack) \
|
||||
do \
|
||||
{ \
|
||||
YYSIZE_T yynewbytes; \
|
||||
yymemcpy ((char *) yyptr, (char *) (Stack), \
|
||||
yysize * (YYSIZE_T) sizeof (Type)); \
|
||||
YYCOPY (&yyptr->Stack, Stack, yysize); \
|
||||
Stack = &yyptr->Stack; \
|
||||
yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX; \
|
||||
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
|
||||
yyptr += yynewbytes / sizeof (*yyptr); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
|
||||
#endif
|
||||
|
||||
/* Tokens. */
|
||||
%%{tokendef}
|
||||
b4_token_defines(b4_tokens)
|
||||
|
||||
/* YYFINAL -- State number of the termination state. */
|
||||
#define YYFINAL %%{final}
|
||||
#define YYFLAG %%{flag}
|
||||
#define YYLAST %%{last}
|
||||
#define YYFINAL b4_final
|
||||
#define YYFLAG b4_flag
|
||||
#define YYLAST b4_last
|
||||
|
||||
/* YYNTOKENS -- Number of terminals. */
|
||||
#define YYNTOKENS %%{ntokens}
|
||||
#define YYNTOKENS b4_ntokens
|
||||
/* YYNNTS -- Number of nonterminals. */
|
||||
#define YYNNTS %%{nnts}
|
||||
#define YYNNTS b4_nnts
|
||||
/* YYNRULES -- Number of rules. */
|
||||
#define YYNRULES %%{nrules}
|
||||
#define YYNRULES b4_nrules
|
||||
/* YYNRULES -- Number of states. */
|
||||
#define YYNSTATES %%{nstates}
|
||||
#define YYMAXUTOK %%{maxtok}
|
||||
#define YYNSTATES b4_nstates
|
||||
|
||||
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||
#define YYTRANSLATE(x) ((unsigned)(x) <= %%{maxtok} ? yytranslate[x] : %%{nsym})
|
||||
#define YYUNDEFTOK b4_undef_token_number
|
||||
#define YYMAXUTOK b4_user_token_number_max
|
||||
|
||||
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
|
||||
static const char yytranslate[] =
|
||||
typedef b4_uint_type(b4_token_number_max) yy_token_number_type;
|
||||
#define YYTRANSLATE(X) \
|
||||
((unsigned)(X) <= YYMAXUTOK ? yytranslate[[X]] : YYUNDEFTOK)
|
||||
|
||||
/* YYTRANSLATE[[YYLEX]] -- Bison symbol number corresponding to YYLEX. */
|
||||
static const yy_token_number_type yytranslate[[]] =
|
||||
{
|
||||
%%{translate}
|
||||
b4_translate
|
||||
};
|
||||
|
||||
#if YYDEBUG
|
||||
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
|
||||
/* YYPRHS[[YYN]] -- Index of the first RHS symbol of rule number YYN in
|
||||
YYRHS. */
|
||||
static const short yyprhs[] =
|
||||
static const short yyprhs[[]] =
|
||||
{
|
||||
%%{prhs}
|
||||
b4_prhs
|
||||
};
|
||||
|
||||
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||
static const short yyrhs[] =
|
||||
typedef b4_sint_type(b4_rhs_number_max) yyrhs_t;
|
||||
static const yyrhs_t yyrhs[[]] =
|
||||
{
|
||||
%%{rhs}
|
||||
b4_rhs
|
||||
};
|
||||
|
||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||
static const short yyrline[] =
|
||||
/* YYRLINE[[YYN]] -- source line where rule number YYN was defined. */
|
||||
static const short yyrline[[]] =
|
||||
{
|
||||
%%{rline}
|
||||
b4_rline
|
||||
};
|
||||
#endif
|
||||
|
||||
#if (YYDEBUG) || YYERROR_VERBOSE
|
||||
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
||||
/* YYTNME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM.
|
||||
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
|
||||
static const char *const yytname[] =
|
||||
static const char *const yytname[[]] =
|
||||
{
|
||||
%%{tname}
|
||||
b4_tname
|
||||
};
|
||||
#endif
|
||||
|
||||
/* YYTOKNUM[YYN] -- Index in YYTNAME corresponding to YYLEX. */
|
||||
static const short yytoknum[] =
|
||||
/* YYTOKNUM[[YYN]] -- Index in YYTNAME corresponding to YYLEX. */
|
||||
static const short yytoknum[[]] =
|
||||
{
|
||||
%%{toknum}
|
||||
b4_toknum
|
||||
};
|
||||
|
||||
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||
static const short yyr1[] =
|
||||
/* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */
|
||||
static const yy_token_number_type yyr1[[]] =
|
||||
{
|
||||
%%{r1}
|
||||
b4_r1
|
||||
};
|
||||
|
||||
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||
static const short yyr2[] =
|
||||
/* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN. */
|
||||
static const short yyr2[[]] =
|
||||
{
|
||||
%%{r2}
|
||||
b4_r2
|
||||
};
|
||||
|
||||
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
|
||||
/* YYDEFACT[[S]] -- default rule to reduce with in state S when YYTABLE
|
||||
doesn't specify something else to do. Zero means the default is an
|
||||
error. */
|
||||
static const short yydefact[] =
|
||||
static const short yydefact[[]] =
|
||||
{
|
||||
%%{defact}
|
||||
b4_defact
|
||||
};
|
||||
|
||||
/* YYPGOTO[NTERM-NUM]. */
|
||||
static const short yydefgoto[] =
|
||||
/* YYPGOTO[[NTERM-NUM]]. */
|
||||
static const short yydefgoto[[]] =
|
||||
{
|
||||
%%{defgoto}
|
||||
b4_defgoto
|
||||
};
|
||||
|
||||
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||
/* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing
|
||||
STATE-NUM. */
|
||||
static const short yypact[] =
|
||||
static const short yypact[[]] =
|
||||
{
|
||||
%%{pact}
|
||||
b4_pact
|
||||
};
|
||||
|
||||
/* YYPGOTO[NTERM-NUM]. */
|
||||
static const short yypgoto[] =
|
||||
/* YYPGOTO[[NTERM-NUM]]. */
|
||||
static const short yypgoto[[]] =
|
||||
{
|
||||
%%{pgoto}
|
||||
b4_pgoto
|
||||
};
|
||||
|
||||
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||
/* 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. */
|
||||
static const short yytable[] =
|
||||
static const short yytable[[]] =
|
||||
{
|
||||
%%{table}
|
||||
b4_table
|
||||
};
|
||||
|
||||
static const short yycheck[] =
|
||||
static const short yycheck[[]] =
|
||||
{
|
||||
%%{check}
|
||||
b4_check
|
||||
};
|
||||
|
||||
|
||||
@@ -307,14 +388,9 @@ static const short yycheck[] =
|
||||
# define YYSIZE_T size_t
|
||||
#endif
|
||||
#if ! defined (YYSIZE_T)
|
||||
# ifdef __cplusplus
|
||||
# include <cstddef> /* INFRINGES ON USER NAME SPACE */
|
||||
# define YYSIZE_T std::size_t
|
||||
# else
|
||||
# ifdef __STDC__
|
||||
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
||||
# define YYSIZE_T size_t
|
||||
# endif
|
||||
# if defined (__STDC__) || defined (__cplusplus)
|
||||
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
||||
# define YYSIZE_T size_t
|
||||
# endif
|
||||
#endif
|
||||
#if ! defined (YYSIZE_T)
|
||||
@@ -367,8 +443,8 @@ while (0)
|
||||
|
||||
#ifndef YYLLOC_DEFAULT
|
||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||
Current.last_line = Rhs[N].last_line; \
|
||||
Current.last_column = Rhs[N].last_column;
|
||||
Current.last_line = Rhs[[N]].last_line; \
|
||||
Current.last_column = Rhs[[N]].last_column;
|
||||
#endif
|
||||
|
||||
/* YYLEX -- calling `yylex' with the right arguments. */
|
||||
@@ -395,12 +471,8 @@ while (0)
|
||||
#if YYDEBUG
|
||||
|
||||
# ifndef YYFPRINTF
|
||||
# ifdef __cplusplus
|
||||
# include <cstdio> /* INFRINGES ON USER NAME SPACE */
|
||||
# else
|
||||
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
|
||||
# endif
|
||||
# define YYFPRINTF YYSTD (fprintf)
|
||||
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
|
||||
# define YYFPRINTF fprintf
|
||||
# endif
|
||||
|
||||
# define YYDPRINTF(Args) \
|
||||
@@ -408,10 +480,8 @@ do { \
|
||||
if (yydebug) \
|
||||
YYFPRINTF Args; \
|
||||
} while (0)
|
||||
/* Nonzero means print parse trace. [The following comment makes no
|
||||
sense to me. Could someone clarify it? --akim] Since this is
|
||||
uninitialized, it does not stop multiple parsers from coexisting.
|
||||
*/
|
||||
/* Nonzero means print parse trace. It is left uninitialized so that
|
||||
multiple parsers can coexist. */
|
||||
int yydebug;
|
||||
#else /* !YYDEBUG */
|
||||
# define YYDPRINTF(Args)
|
||||
@@ -419,7 +489,7 @@ int yydebug;
|
||||
|
||||
/* YYINITDEPTH -- initial size of the parser's stacks. */
|
||||
#ifndef YYINITDEPTH
|
||||
# define YYINITDEPTH %%{initdepth}
|
||||
# define YYINITDEPTH b4_initdepth
|
||||
#endif
|
||||
|
||||
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
|
||||
@@ -434,38 +504,11 @@ int yydebug;
|
||||
#endif
|
||||
|
||||
#ifndef YYMAXDEPTH
|
||||
# define YYMAXDEPTH %%{maxdepth}
|
||||
# define YYMAXDEPTH b4_maxdepth
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if ! defined (yyoverflow) && ! defined (yymemcpy)
|
||||
# if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
|
||||
# define yymemcpy __builtin_memcpy
|
||||
# else /* not GNU C or C++ */
|
||||
|
||||
/* This is the most reliable way to avoid incompatibilities
|
||||
in available built-in functions on various systems. */
|
||||
static void
|
||||
# if defined (__STDC__) || defined (__cplusplus)
|
||||
yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount)
|
||||
# else
|
||||
yymemcpy (yyto, yyfrom, yycount)
|
||||
char *yyto;
|
||||
const char *yyfrom;
|
||||
YYSIZE_T yycount;
|
||||
# endif
|
||||
{
|
||||
register const char *yyf = yyfrom;
|
||||
register char *yyt = yyto;
|
||||
register YYSIZE_T yyi = yycount;
|
||||
|
||||
while (yyi-- != 0)
|
||||
*yyt++ = *yyf++;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if YYERROR_VERBOSE
|
||||
|
||||
# ifndef yystrlen
|
||||
@@ -528,13 +571,13 @@ yystpcpy (yydest, yysrc)
|
||||
to the proper pointer type. */
|
||||
|
||||
#ifdef YYPARSE_PARAM
|
||||
# ifdef __cplusplus
|
||||
# if defined (__STDC__) || defined (__cplusplus)
|
||||
# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
|
||||
# define YYPARSE_PARAM_DECL
|
||||
# else /* !__cplusplus */
|
||||
# else
|
||||
# define YYPARSE_PARAM_ARG YYPARSE_PARAM
|
||||
# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
|
||||
# endif /* !__cplusplus */
|
||||
# endif
|
||||
#else /* !YYPARSE_PARAM */
|
||||
# define YYPARSE_PARAM_ARG
|
||||
# define YYPARSE_PARAM_DECL
|
||||
@@ -582,7 +625,7 @@ YY_DECL_VARIABLES
|
||||
int
|
||||
yyparse (YYPARSE_PARAM_ARG)
|
||||
YYPARSE_PARAM_DECL
|
||||
{
|
||||
{[
|
||||
/* If reentrant, generate the variables here. */
|
||||
#if YYPURE
|
||||
YY_DECL_VARIABLES
|
||||
@@ -706,6 +749,9 @@ yyparse (YYPARSE_PARAM_ARG)
|
||||
yyvs = yyvs1;
|
||||
}
|
||||
#else /* no yyoverflow */
|
||||
# ifndef YYSTACK_RELOCATE
|
||||
goto yyoverflowlab;
|
||||
# else
|
||||
/* Extend the stack our own way. */
|
||||
if (yystacksize >= YYMAXDEPTH)
|
||||
goto yyoverflowlab;
|
||||
@@ -719,15 +765,16 @@ yyparse (YYPARSE_PARAM_ARG)
|
||||
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
|
||||
if (! yyptr)
|
||||
goto yyoverflowlab;
|
||||
YYSTACK_RELOCATE (short, yyss);
|
||||
YYSTACK_RELOCATE (YYSTYPE, yyvs);
|
||||
# if YYLSP_NEEDED
|
||||
YYSTACK_RELOCATE (YYLTYPE, yyls);
|
||||
# endif
|
||||
# undef YYSTACK_RELOCATE
|
||||
YYSTACK_RELOCATE (yyss);
|
||||
YYSTACK_RELOCATE (yyvs);
|
||||
# if YYLSP_NEEDED
|
||||
YYSTACK_RELOCATE (yyls);
|
||||
# endif
|
||||
# undef YYSTACK_RELOCATE
|
||||
if (yyss1 != yyssa)
|
||||
YYSTACK_FREE (yyss1);
|
||||
}
|
||||
# endif
|
||||
#endif /* no yyoverflow */
|
||||
|
||||
yyssp = yyss + yysize - 1;
|
||||
@@ -902,14 +949,14 @@ yyreduce:
|
||||
}
|
||||
#endif
|
||||
switch (yyn)
|
||||
{
|
||||
%%{actions}
|
||||
]{
|
||||
b4_actions
|
||||
}
|
||||
|
||||
/* Line %%{skeleton-line} of %%{skeleton}. */
|
||||
#line %%{line} "%%{parser-file-name}"
|
||||
/* Line __line__ of __file__. */
|
||||
#line __oline__ "__ofile__"
|
||||
|
||||
yyvsp -= yylen;
|
||||
[ yyvsp -= yylen;
|
||||
yyssp -= yylen;
|
||||
#if YYLSP_NEEDED
|
||||
yylsp -= yylen;
|
||||
@@ -1026,7 +1073,7 @@ yyerrlab1:
|
||||
/* Else will try to reuse lookahead token after shifting the error
|
||||
token. */
|
||||
|
||||
yyerrstatus = 3; /* Each real token shifted decrements this. */
|
||||
yyerrstatus = 3; /* Each real token shifted decrements this. */
|
||||
|
||||
goto yyerrhandle;
|
||||
|
||||
@@ -1136,6 +1183,42 @@ yyreturn:
|
||||
YYSTACK_FREE (yyss);
|
||||
#endif
|
||||
return yyresult;
|
||||
}
|
||||
]}
|
||||
|
||||
%%{epilogue}
|
||||
b4_epilogue
|
||||
m4_if(b4_defines_flag, 0, [],
|
||||
[#output "b4_output_header_name"
|
||||
#ifndef b4_header_guard
|
||||
# define b4_header_guard
|
||||
|
||||
b4_token_defines(b4_tokens)
|
||||
|
||||
#ifndef YYSTYPE
|
||||
m4_ifdef([b4_stype_line],
|
||||
[#line b4_stype_line "b4_filename"
|
||||
])dnl
|
||||
typedef b4_stype
|
||||
yystype;
|
||||
# define YYSTYPE yystype
|
||||
#endif
|
||||
|
||||
m4_if(b4_pure, [0],
|
||||
[extern YYSTYPE b4_prefix[]lval;])
|
||||
|
||||
m4_if(b4_locations_flag, [0], [],
|
||||
[#ifndef YYLTYPE
|
||||
typedef struct yyltype
|
||||
{
|
||||
int first_line;
|
||||
int first_column;
|
||||
int last_line;
|
||||
int last_column;
|
||||
} yyltype;
|
||||
# define YYLTYPE yyltype
|
||||
#endif
|
||||
|
||||
m4_if(b4_pure, [0],
|
||||
[extern YYLTYPE b4_prefix[]lloc;])
|
||||
])
|
||||
#endif /* not b4_header_guard */
|
||||
])
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
# This file is part of -*- Autoconf -*-.
|
||||
# Version of Autoconf.
|
||||
# Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
m4_define([m4_PACKAGE_NAME], [GNU Autoconf])
|
||||
m4_define([m4_PACKAGE_TARNAME], [autoconf])
|
||||
m4_define([m4_PACKAGE_VERSION], [2.52h])
|
||||
m4_define([m4_PACKAGE_STRING], [GNU Autoconf 2.52h])
|
||||
m4_define([m4_PACKAGE_BUGREPORT], [[email protected]])
|
||||
@@ -6,6 +6,7 @@ bison.dvi
|
||||
bison.fn
|
||||
bison.ky
|
||||
bison.log
|
||||
bison.pdf
|
||||
bison.pg
|
||||
bison.ps
|
||||
bison.toc
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||
AUTOMAKE_OPTIONS = 1.4
|
||||
|
||||
info_TEXINFOS = bison.texinfo
|
||||
man_MANS = bison.1
|
||||
|
||||
+108
-45
@@ -47,7 +47,7 @@ END-INFO-DIR-ENTRY
|
||||
This file documents the Bison parser generator.
|
||||
|
||||
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998, 1999,
|
||||
2000, 2001
|
||||
2000, 2001, 2002
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
@@ -89,7 +89,7 @@ instead of in the original English.
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998,
|
||||
1999, 2000, 2001
|
||||
1999, 2000, 2001, 2002
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
@sp 2
|
||||
@@ -433,7 +433,7 @@ smaller constructs according to grammatical rules are called
|
||||
@dfn{nonterminal symbols}; those which can't be subdivided are called
|
||||
@dfn{terminal symbols} or @dfn{token types}. We call a piece of input
|
||||
corresponding to a single terminal symbol a @dfn{token}, and a piece
|
||||
corresponding to a single nonterminal symbol a @dfn{grouping}.@refill
|
||||
corresponding to a single nonterminal symbol a @dfn{grouping}.
|
||||
|
||||
We can use the C language as an example of what symbols, terminal and
|
||||
nonterminal, mean. The tokens of C are identifiers, constants (numeric and
|
||||
@@ -565,7 +565,7 @@ if a rule mentions the terminal symbol `integer constant', it means that
|
||||
@emph{any} integer constant is grammatically valid in that position. The
|
||||
precise value of the constant is irrelevant to how to parse the input: if
|
||||
@samp{x+4} is grammatical then @samp{x+1} or @samp{x+3989} is equally
|
||||
grammatical.@refill
|
||||
grammatical.
|
||||
|
||||
But the precise value is very important for what the input means once it is
|
||||
parsed. A compiler is useless if it fails to distinguish between 4, 1 and
|
||||
@@ -577,7 +577,7 @@ The token type is a terminal symbol defined in the grammar, such as
|
||||
@code{INTEGER}, @code{IDENTIFIER} or @code{','}. It tells everything
|
||||
you need to know to decide where the token may validly appear and how to
|
||||
group it with other tokens. The grammar rules know nothing about tokens
|
||||
except their types.@refill
|
||||
except their types.
|
||||
|
||||
The semantic value has all the rest of the information about the
|
||||
meaning of the token, such as the value of an integer, or the name of an
|
||||
@@ -707,8 +707,7 @@ In some cases the Bison parser file includes system headers, and in
|
||||
those cases your code should respect the identifiers reserved by those
|
||||
headers. On some non-@sc{gnu} hosts, @code{<alloca.h>},
|
||||
@code{<stddef.h>}, and @code{<stdlib.h>} are included as needed to
|
||||
declare memory allocators and related types. In the same situation,
|
||||
C++ parsers may include @code{<cstddef>} and @code{<cstdlib>} instead.
|
||||
declare memory allocators and related types.
|
||||
Other system headers may be included if you define @code{YYDEBUG} to a
|
||||
nonzero value (@pxref{Debugging, ,Debugging Your Parser}).
|
||||
|
||||
@@ -767,7 +766,7 @@ general form of a Bison grammar file is as follows:
|
||||
|
||||
@example
|
||||
%@{
|
||||
@var{Prologue (declarations)}
|
||||
@var{Prologue}
|
||||
%@}
|
||||
|
||||
@var{Bison declarations}
|
||||
@@ -775,7 +774,7 @@ general form of a Bison grammar file is as follows:
|
||||
%%
|
||||
@var{Grammar rules}
|
||||
%%
|
||||
@var{Epilogue (additional code)}
|
||||
@var{Epilogue}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
@@ -1084,7 +1083,7 @@ The return value of the lexical analyzer function is a numeric code which
|
||||
represents a token type. The same text used in Bison rules to stand for
|
||||
this token type is also a C expression for the numeric code for the type.
|
||||
This works in two ways. If the token type is a character literal, then its
|
||||
numeric code is the ASCII code for that character; you can use the same
|
||||
numeric code is that of the character; you can use the same
|
||||
character literal in the lexical analyzer to express the number. If the
|
||||
token type is an identifier, that identifier is defined by Bison as a C
|
||||
macro whose definition is the appropriate number. In this example,
|
||||
@@ -1105,8 +1104,8 @@ Here is the code for the lexical analyzer:
|
||||
@example
|
||||
@group
|
||||
/* Lexical analyzer returns a double floating point
|
||||
number on the stack and the token NUM, or the ASCII
|
||||
character read if not a number. Skips all blanks
|
||||
number on the stack and the token NUM, or the numeric code
|
||||
of the character read if not a number. Skips all blanks
|
||||
and tabs, returns 0 for EOF. */
|
||||
|
||||
#include <ctype.h>
|
||||
@@ -1383,7 +1382,7 @@ upon to print its message as well.) The action executes the statement
|
||||
@code{yyerrok}, a macro defined automatically by Bison; its meaning is
|
||||
that error recovery is complete (@pxref{Error Recovery}). Note the
|
||||
difference between @code{yyerrok} and @code{yyerror}; neither one is a
|
||||
misprint.@refill
|
||||
misprint.
|
||||
|
||||
This form of error recovery deals with syntax errors. There are other
|
||||
kinds of errors; for example, division by zero, which raises an exception
|
||||
@@ -1882,7 +1881,7 @@ the name appears in the table, a pointer to its location and its type
|
||||
(@code{VAR} or @code{FNCT}) is returned to @code{yyparse}. If it is not
|
||||
already in the table, then it is installed as a @code{VAR} using
|
||||
@code{putsym}. Again, a pointer and its type (which must be @code{VAR}) is
|
||||
returned to @code{yyparse}.@refill
|
||||
returned to @code{yyparse}.
|
||||
|
||||
No change is needed in the handling of numeric values and arithmetic
|
||||
operators in @code{yylex}.
|
||||
@@ -2044,7 +2043,7 @@ Comments enclosed in @samp{/* @dots{} */} may appear in any of the sections.
|
||||
@cindex Prologue
|
||||
@cindex declarations
|
||||
|
||||
The @var{prologue} section contains macro definitions and
|
||||
The @var{Prologue} section contains macro definitions and
|
||||
declarations of functions and variables that are used in the actions in the
|
||||
grammar rules. These are copied to the beginning of the parser file so
|
||||
that they precede the definition of @code{yyparse}. You can use
|
||||
@@ -2080,8 +2079,8 @@ if it is the first thing in the file.
|
||||
@cindex epilogue
|
||||
@cindex C code, section for additional
|
||||
|
||||
The @var{epilogue} is copied verbatim to the end of the parser file, just as
|
||||
the @var{prologue} is copied to the beginning. This is the most convenient
|
||||
The @var{Epilogue} is copied verbatim to the end of the parser file, just as
|
||||
the @var{Prologue} is copied to the beginning. This is the most convenient
|
||||
place to put anything that you want to have in the parser file but which need
|
||||
not come before the definition of @code{yyparse}. For example, the
|
||||
definitions of @code{yylex} and @code{yyerror} often go here.
|
||||
@@ -2149,7 +2148,7 @@ your program will confuse other readers.
|
||||
|
||||
All the usual escape sequences used in character literals in C can be
|
||||
used in Bison as well, but you must not use the null character as a
|
||||
character literal because its ASCII code, zero, is the code @code{yylex}
|
||||
character literal because its numeric code, zero, is the code @code{yylex}
|
||||
returns for end-of-input (@pxref{Calling Convention, ,Calling Convention
|
||||
for @code{yylex}}).
|
||||
|
||||
@@ -2190,7 +2189,7 @@ on when the parser function returns that symbol.
|
||||
The value returned by @code{yylex} is always one of the terminal symbols
|
||||
(or 0 for end-of-input). Whichever way you write the token type in the
|
||||
grammar rules, you write it the same way in the definition of @code{yylex}.
|
||||
The numeric code for a character token type is simply the ASCII code for
|
||||
The numeric code for a character token type is simply the numeric code of
|
||||
the character, so @code{yylex} can use the identical character constant to
|
||||
generate the requisite code. Each named token type becomes a C macro in
|
||||
the parser file, so @code{yylex} can use the name to stand for the code.
|
||||
@@ -2203,9 +2202,25 @@ option when you run Bison, so that it will write these macro definitions
|
||||
into a separate header file @file{@var{name}.tab.h} which you can include
|
||||
in the other source files that need it. @xref{Invocation, ,Invoking Bison}.
|
||||
|
||||
The @code{yylex} function must use the same character set and encoding
|
||||
that was used by Bison. For example, if you run Bison in an
|
||||
@sc{ascii} environment, but then compile and run the resulting program
|
||||
in an environment that uses an incompatible character set like
|
||||
@sc{ebcdic}, the resulting program will probably not work because the
|
||||
tables generated by Bison will assume @sc{ascii} numeric values for
|
||||
character tokens. Portable grammars should avoid non-@sc{ascii}
|
||||
character tokens, as implementations in practice often use different
|
||||
and incompatible extensions in this area. However, it is standard
|
||||
practice for software distributions to contain C source files that
|
||||
were generated by Bison in an @sc{ascii} environment, so installers on
|
||||
platforms that are incompatible with @sc{ascii} must rebuild those
|
||||
files before compiling them.
|
||||
|
||||
The symbol @code{error} is a terminal symbol reserved for error recovery
|
||||
(@pxref{Error Recovery}); you shouldn't use it for any other purpose.
|
||||
In particular, @code{yylex} should never return this value.
|
||||
In particular, @code{yylex} should never return this value. The default
|
||||
value of the error token is 256, unless you explicitly assigned 256 to
|
||||
one of your tokens with a @code{%token} declaration.
|
||||
|
||||
@node Rules
|
||||
@section Syntax of Grammar Rules
|
||||
@@ -2486,7 +2501,19 @@ which are the first and third symbols on the right hand side of the rule.
|
||||
The sum is stored into @code{$$} so that it becomes the semantic value of
|
||||
the addition-expression just recognized by the rule. If there were a
|
||||
useful semantic value associated with the @samp{+} token, it could be
|
||||
referred to as @code{$2}.@refill
|
||||
referred to as @code{$2}.
|
||||
|
||||
Note that the vertical-bar character @samp{|} is really a rule
|
||||
separator, and actions are attached to a single rule. This is a
|
||||
difference with tools like Flex, for which @samp{|} stands for either
|
||||
``or'', or ``the same action as that of the next rule''. In the
|
||||
following example, the action is triggered only when @samp{b} is found:
|
||||
|
||||
@example
|
||||
@group
|
||||
a-or-b: 'a'|'b' @{ a_or_b_found = 1; @};
|
||||
@end group
|
||||
@end example
|
||||
|
||||
@cindex default action
|
||||
If you don't specify an action for a rule, Bison supplies a default:
|
||||
@@ -2532,7 +2559,7 @@ If you have used @code{%union} to specify a variety of data types, then you
|
||||
must declare a choice among these types for each terminal or nonterminal
|
||||
symbol that can have a semantic value. Then each time you use @code{$$} or
|
||||
@code{$@var{n}}, its data type is determined by which symbol it refers to
|
||||
in the rule. In this example,@refill
|
||||
in the rule. In this example,
|
||||
|
||||
@example
|
||||
@group
|
||||
@@ -2546,7 +2573,7 @@ exp: @dots{}
|
||||
@code{$1} and @code{$3} refer to instances of @code{exp}, so they all
|
||||
have the data type declared for the nonterminal symbol @code{exp}. If
|
||||
@code{$2} were used, it would have the data type declared for the
|
||||
terminal symbol @code{'+'}, whatever that might be.@refill
|
||||
terminal symbol @code{'+'}, whatever that might be.
|
||||
|
||||
Alternatively, you can specify the data type when you refer to the value,
|
||||
by inserting @samp{<@var{type}>} after the @samp{$} at the beginning of the
|
||||
@@ -2943,7 +2970,7 @@ an integer value in the field immediately following the token name:
|
||||
@noindent
|
||||
It is generally best, however, to let Bison choose the numeric codes for
|
||||
all token types. Bison will automatically select codes that don't conflict
|
||||
with each other or with ASCII characters.
|
||||
with each other or with normal characters.
|
||||
|
||||
In the event that the stack type is a union, you must augment the
|
||||
@code{%token} or other token declaration to include the data type
|
||||
@@ -3259,12 +3286,12 @@ type names defined in the grammar and the semantic value type
|
||||
@code{YYSTYPE}, as well as a few @code{extern} variable declarations.
|
||||
|
||||
If the parser output file is named @file{@var{name}.c} then this file
|
||||
is named @file{@var{name}.h}.@refill
|
||||
is named @file{@var{name}.h}.
|
||||
|
||||
This output file is essential if you wish to put the definition of
|
||||
@code{yylex} in a separate source file, because @code{yylex} needs to
|
||||
be able to refer to token type codes and the variable
|
||||
@code{yylval}. @xref{Token Values, ,Semantic Values of Tokens}.@refill
|
||||
@code{yylval}. @xref{Token Values, ,Semantic Values of Tokens}.
|
||||
|
||||
@item %file-prefix="@var{prefix}"
|
||||
Specify a prefix to use for all Bison output file names. The names are
|
||||
@@ -3367,11 +3394,11 @@ This file also describes all the conflicts, both those resolved by
|
||||
operator precedence and the unresolved ones.
|
||||
|
||||
The file's name is made by removing @samp{.tab.c} or @samp{.c} from
|
||||
the parser output file name, and adding @samp{.output} instead.@refill
|
||||
the parser output file name, and adding @samp{.output} instead.
|
||||
|
||||
Therefore, if the input file is @file{foo.y}, then the parser file is
|
||||
called @file{foo.tab.c} by default. As a consequence, the verbose
|
||||
output file is called @file{foo.output}.@refill
|
||||
output file is called @file{foo.output}.
|
||||
|
||||
@item %yacc
|
||||
Pretend the option @option{--yacc} was given, i.e., imitate Yacc,
|
||||
@@ -3477,7 +3504,7 @@ need to arrange for the token-type macro definitions to be available there.
|
||||
To do this, use the @samp{-d} option when you run Bison, so that it will
|
||||
write these macro definitions into a separate header file
|
||||
@file{@var{name}.tab.h} which you can include in the other source files
|
||||
that need it. @xref{Invocation, ,Invoking Bison}.@refill
|
||||
that need it. @xref{Invocation, ,Invoking Bison}.
|
||||
|
||||
@menu
|
||||
* Calling Convention:: How @code{yyparse} calls @code{yylex}.
|
||||
@@ -3827,7 +3854,7 @@ Types of Values in Actions}.
|
||||
@item $<@var{typealt}>@var{n}
|
||||
Like @code{$@var{n}} but specifies alternative @var{typealt} in the
|
||||
union specified by the @code{%union} declaration.
|
||||
@xref{Action Types, ,Data Types of Values in Actions}.@refill
|
||||
@xref{Action Types, ,Data Types of Values in Actions}.
|
||||
|
||||
@item YYABORT;
|
||||
Return immediately from @code{yyparse}, indicating failure.
|
||||
@@ -4285,7 +4312,7 @@ The Bison precedence declarations, @code{%left}, @code{%right} and
|
||||
@code{%nonassoc}, can only be used once for a given token; so a token has
|
||||
only one precedence declared in this way. For context-dependent
|
||||
precedence, you need to use an additional mechanism: the @code{%prec}
|
||||
modifier for rules.@refill
|
||||
modifier for rules.
|
||||
|
||||
The @code{%prec} modifier declares the precedence of a particular rule by
|
||||
specifying a terminal symbol whose precedence should be used for that rule.
|
||||
@@ -4931,7 +4958,6 @@ clear the flag.
|
||||
|
||||
@node Debugging
|
||||
@chapter Debugging Your Parser
|
||||
@findex YYDEBUG
|
||||
@findex yydebug
|
||||
@cindex debugging
|
||||
@cindex tracing the parser
|
||||
@@ -4939,24 +4965,39 @@ clear the flag.
|
||||
If a Bison grammar compiles properly but doesn't do what you want when it
|
||||
runs, the @code{yydebug} parser-trace feature can help you figure out why.
|
||||
|
||||
To enable compilation of trace facilities, you must define the macro
|
||||
@code{YYDEBUG} to a nonzero value when you compile the parser. You
|
||||
could use @samp{-DYYDEBUG=1} as a compiler option or you could put
|
||||
@samp{#define YYDEBUG 1} in the prologue of the grammar file
|
||||
(@pxref{Prologue, , The Prologue}). Alternatively, use the @samp{-t}
|
||||
option when you run Bison (@pxref{Invocation, ,Invoking Bison}) or the
|
||||
@code{%debug} declaration (@pxref{Decl Summary, ,Bison Declaration
|
||||
Summary}). We suggest that you always define @code{YYDEBUG} so that
|
||||
debugging is always possible.
|
||||
There are several means to enable compilation of trace facilities:
|
||||
|
||||
@table @asis
|
||||
@item the macro @code{YYDEBUG}
|
||||
@findex YYDEBUG
|
||||
Define the macro @code{YYDEBUG} to a nonzero value when you compile the
|
||||
parser. This is compliant with POSIX Yacc. You could use
|
||||
@samp{-DYYDEBUG=1} as a compiler option or you could put @samp{#define
|
||||
YYDEBUG 1} in the prologue of the grammar file (@pxref{Prologue, , The
|
||||
Prologue}).
|
||||
|
||||
@item the option @option{-t}, @option{--debug}
|
||||
Use the @samp{-t} option when you run Bison (@pxref{Invocation,
|
||||
,Invoking Bison}). This is POSIX compliant too.
|
||||
|
||||
@item the directive @samp{%debug}
|
||||
@findex %debug
|
||||
Add the @code{%debug} directive (@pxref{Decl Summary, ,Bison
|
||||
Declaration Summary}). This is a Bison extension, which will prove
|
||||
useful when Bison will output parsers for languages that don't use a
|
||||
preprocessor. Useless POSIX and Yacc portability matter to you, this is
|
||||
the preferred solution.
|
||||
@end table
|
||||
|
||||
We suggest that you always enable the debug option so that debugging is
|
||||
always possible.
|
||||
|
||||
The trace facility outputs messages with macro calls of the form
|
||||
@code{YYFPRINTF (stderr, @var{format}, @var{args})} where
|
||||
@var{format} and @var{args} are the usual @code{printf} format and
|
||||
arguments. If you define @code{YYDEBUG} to a nonzero value but do not
|
||||
define @code{YYFPRINTF}, @code{<stdio.h>} is automatically included
|
||||
and @code{YYPRINTF} is defined to @code{fprintf}. In the same
|
||||
situation, C++ parsers include @code{<cstdio>} and use
|
||||
@code{std::fprintf} instead.
|
||||
and @code{YYPRINTF} is defined to @code{fprintf}.
|
||||
|
||||
Once you have compiled the program with trace facilities, the way to
|
||||
request a trace is to store a nonzero value in the variable @code{yydebug}.
|
||||
@@ -5099,7 +5140,7 @@ Equivalent to @samp{-o y.tab.c}; the parser output file is called
|
||||
@file{y.tab.c}, and the other outputs are called @file{y.output} and
|
||||
@file{y.tab.h}. The purpose of this option is to imitate Yacc's output
|
||||
file name conventions. Thus, the following shell script can substitute
|
||||
for Yacc:@refill
|
||||
for Yacc:
|
||||
|
||||
@example
|
||||
bison -y $*
|
||||
@@ -5292,6 +5333,22 @@ would instead be named @file{foo_tab.c}.
|
||||
@cindex symbols in Bison, table of
|
||||
|
||||
@table @code
|
||||
@item @@$
|
||||
In an action, the location of the left-hand side of the rule.
|
||||
@xref{Locations, , Locations Overview}.
|
||||
|
||||
@item @@@var{n}
|
||||
In an action, the location of the @var{n}-th symbol of the right-hand
|
||||
side of the rule. @xref{Locations, , Locations Overview}.
|
||||
|
||||
@item $$
|
||||
In an action, the semantic value of the left-hand side of the rule.
|
||||
@xref{Actions}.
|
||||
|
||||
@item $@var{n}
|
||||
In an action, the semantic value of the @var{n}-th symbol of the
|
||||
right-hand side of the rule. @xref{Actions}.
|
||||
|
||||
@item error
|
||||
A token name reserved for error recovery. This token may be used in
|
||||
grammar rules so as to allow the Bison parser to recognize an error in
|
||||
@@ -5317,6 +5374,10 @@ read, by making @code{yyparse} return 0 immediately.
|
||||
Macro to discard a value from the parser stack and fake a look-ahead
|
||||
token. @xref{Action Features, ,Special Features for Use in Actions}.
|
||||
|
||||
@item YYDEBUG
|
||||
Macro to define to equip the parser with tracing code. @xref{Debugging,
|
||||
,Debugging Your Parser}.
|
||||
|
||||
@item YYERROR
|
||||
Macro to pretend that a syntax error has just been detected: call
|
||||
@code{yyerror} and then perform normal error recovery if possible
|
||||
@@ -5490,6 +5551,8 @@ Bison declaration to specify several possible data types for semantic
|
||||
values. @xref{Union Decl, ,The Collection of Value Types}.
|
||||
@end table
|
||||
|
||||
@sp 1
|
||||
|
||||
These are the punctuation and delimiters used in Bison input:
|
||||
|
||||
@table @samp
|
||||
|
||||
+13
-5
@@ -1,4 +1,4 @@
|
||||
## Copyright 2001, 2002 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2001, 2002 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
|
||||
@@ -30,16 +30,24 @@ INCLUDES = -I$(top_builddir)/intl \
|
||||
-I$(top_srcdir)/lib
|
||||
|
||||
# Heck, we are still using an old version of Automake which does not
|
||||
# understand LIBOBJ additions using $objext...
|
||||
|
||||
EXTRA_DIST = malloc.c realloc.c
|
||||
# understand inner AC_LIBOBJ (i.e., from Autoconf itself, not from
|
||||
# configure.in).
|
||||
EXTRA_DIST = malloc.c realloc.c strnlen.c
|
||||
|
||||
libbison_a_SOURCES = \
|
||||
gettext.h \
|
||||
basename.c dirname.h dirname.c \
|
||||
getopt.h getopt.c getopt1.c \
|
||||
hash.h hash.c \
|
||||
quote.h quote.c quotearg.h quotearg.c \
|
||||
xalloc.h xmalloc.c xstrdup.c xstrndup.c
|
||||
xalloc.h xmalloc.c xstrdup.c xstrndup.c \
|
||||
readpipe.c
|
||||
|
||||
# Implementation of bitsets
|
||||
libbison_a_SOURCES += \
|
||||
bbitset.h \
|
||||
bitset-int.h bitset.h bitsetv.h ebitset.h lbitset.h sbitset.h \
|
||||
bitset.c bitsetv.c ebitset.c lbitset.c sbitset.c
|
||||
|
||||
libbison_a_LIBADD = @LIBOBJS@ @ALLOCA@
|
||||
libbison_a_DEPENDENCIES = $(libbison_a_LIBADD)
|
||||
|
||||
+275
@@ -0,0 +1,275 @@
|
||||
/* Base bitset stuff.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
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 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _BBITSET_H
|
||||
#define _BBITSET_H
|
||||
|
||||
/* Bison modifications: BEGIN. */
|
||||
#define IN_BISON 1
|
||||
#if IN_BISON
|
||||
# if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
# endif
|
||||
# include <stdlib.h>
|
||||
|
||||
# define BITSET_STATS 1
|
||||
/* This file is the public interface to the bitset abstract data type.
|
||||
Only use the functions and macros defined in this file. */
|
||||
|
||||
# ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef __attribute__
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
|
||||
# define __attribute__(x)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef ATTRIBUTE_NORETURN
|
||||
# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
|
||||
# endif
|
||||
|
||||
# ifndef ATTRIBUTE_UNUSED
|
||||
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
||||
# endif
|
||||
# include "xalloc.h"
|
||||
#else /* ! IN_BISON */
|
||||
# include "libiberty.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
/* Currently we support three flavours of bitsets:
|
||||
BITSET_ARRAY: Array of bits (fixed size, faster).
|
||||
BITSET_LIST: Linked list of array of bits (variable size, least storage
|
||||
for large very sparse sets).
|
||||
BITSET_TABLE: Expandable table of pointers to array of bits
|
||||
(variable size, less storage for large sparse sets).
|
||||
*/
|
||||
enum bitset_type {BITSET_ARRAY, BITSET_LIST, BITSET_TABLE, BITSET_TYPE_NUM};
|
||||
#define BITSET_TYPE_NAMES {"sbitset", "lbitset", "ebitset"}
|
||||
|
||||
/* Non-zero to enable bitset caching. */
|
||||
#define BITSET_CACHE 1
|
||||
|
||||
/* Non-zero to use inline functions instead of macros. */
|
||||
#define BITSET_INLINE 0
|
||||
|
||||
/* Non-zero to enable bitset statistics gathering. */
|
||||
#define BITSET_STATS 1
|
||||
|
||||
/* Non-zero to enable bitset type checking. */
|
||||
#define BITSET_CHECK 1
|
||||
|
||||
/* Data type used to store a word of bits. */
|
||||
typedef unsigned long bitset_word;
|
||||
#define BITSET_WORD_BITS ((unsigned) CHAR_BIT * sizeof (bitset_word))
|
||||
|
||||
/* Bit index. */
|
||||
typedef unsigned long bitset_bindex;
|
||||
|
||||
/* Word index. */
|
||||
typedef unsigned long bitset_windex;
|
||||
|
||||
#define BITSET_INDEX_MAX ((1U << (BITSET_WORD_BITS - 1)))
|
||||
|
||||
#define BITSET_MSB (1U << (BITSET_WORD_BITS - 1))
|
||||
|
||||
#define BITSET_LIST_SIZE 1024
|
||||
|
||||
enum bitset_ops {BITSET_OP_ZERO, BITSET_OP_ONES,
|
||||
BITSET_OP_COPY, BITSET_OP_NOT,
|
||||
BITSET_OP_EMPTY_P, BITSET_OP_EQUAL_P,
|
||||
BITSET_OP_SUBSET_P, BITSET_OP_DISJOINT_P,
|
||||
BITSET_OP_AND, BITSET_OP_OR, BITSET_OP_XOR, BITSET_OP_ANDN,
|
||||
BITSET_OP_OR_AND, BITSET_OP_AND_OR, BITSET_OP_ANDN_OR};
|
||||
|
||||
/* Return size in bits of bitset SRC. */
|
||||
#define BITSET_SIZE_(SRC) (SRC)->b.ops->size (SRC)
|
||||
|
||||
/* Return type of bitset SRC. */
|
||||
#define BITSET_TYPE_(DST) (DST)->b.ops->type
|
||||
|
||||
/* Set bit BITNO in bitset DST. */
|
||||
#define BITSET_SET_(DST, BITNO) (DST)->b.ops->set (DST, BITNO)
|
||||
|
||||
/* Reset bit BITNO in bitset DST. */
|
||||
#define BITSET_RESET_(DST, BITNO) (DST)->b.ops->reset (DST, BITNO)
|
||||
|
||||
/* Return non-zero if bit BITNO in bitset SRC is set. */
|
||||
#define BITSET_TEST_(SRC, BITNO) (SRC)->b.ops->test (SRC, BITNO)
|
||||
|
||||
/* Free bitset SRC. */
|
||||
#define BITSET_FREE_(SRC)\
|
||||
((SRC)->b.ops->free ? (SRC)->b.ops->free (SRC) :(void)0)
|
||||
|
||||
/* Perform operation OP on DST. */
|
||||
#define BITSET_OP1_(DST, OP) (DST)->b.ops->op1 (DST, OP)
|
||||
|
||||
/* Perform operation OP on SRC and store in DST. */
|
||||
#define BITSET_OP2_(DST, SRC, OP) (DST)->b.ops->op2 (DST, SRC, OP)
|
||||
|
||||
/* DST = SRC1 OP SRC2. */
|
||||
#define BITSET_OP3_(DST, SRC1, SRC2, OP) \
|
||||
(DST)->b.ops->op3 (DST, SRC1, SRC2, OP)
|
||||
|
||||
/* DST = (SRC1 OP1 SRC2) OP2 SRC3. */
|
||||
#define BITSET_OP4_(DST, SRC1, SRC2, SRC3, OP) \
|
||||
(DST)->b.ops->op4 (DST, SRC1, SRC2, SRC3, OP)
|
||||
|
||||
/* DST = 0. */
|
||||
#define BITSET_ZERO_(DST) BITSET_OP1_ (DST, BITSET_OP_ZERO);
|
||||
|
||||
/* DST = ~0. */
|
||||
#define BITSET_ONES_(DST) BITSET_OP1_ (DST, BITSET_OP_ONES);
|
||||
|
||||
/* Return SRC == 0. */
|
||||
#define BITSET_EMPTY_P_(SRC) BITSET_OP1_ (SRC, BITSET_OP_EMPTY_P);
|
||||
|
||||
/* Return DST == SRC. */
|
||||
#define BITSET_EQUAL_P_(DST, SRC) BITSET_OP2_ (DST, SRC, BITSET_OP_EQUAL_P)
|
||||
|
||||
/* Return DST == DST | SRC. */
|
||||
#define BITSET_SUBSET_P_(DST, SRC) BITSET_OP2_ (DST, SRC, BITSET_OP_SUBSET_P)
|
||||
|
||||
/* Return DST & SRC == 0. */
|
||||
#define BITSET_DISJOINT_P_(DST, SRC)\
|
||||
BITSET_OP2_ (DST, SRC, BITSET_OP_DISJOINT_P)
|
||||
|
||||
/* DST = SRC. */
|
||||
#define BITSET_COPY_(DST, SRC) BITSET_OP2_ (DST, SRC, BITSET_OP_COPY)
|
||||
|
||||
/* DST = ~SRC. */
|
||||
#define BITSET_NOT_(DST, SRC) BITSET_OP2_ (DST, SRC, BITSET_OP_NOT)
|
||||
|
||||
/* DST = SRC1 | SRC2. */
|
||||
#define BITSET_OR_(DST, SRC1, SRC2) BITSET_OP3_ (DST, SRC1, SRC2,\
|
||||
BITSET_OP_OR)
|
||||
|
||||
/* DST = SRC1 ^ SRC2. */
|
||||
#define BITSET_XOR_(DST, SRC1, SRC2) BITSET_OP3_ (DST, SRC1, SRC2,\
|
||||
BITSET_OP_XOR)
|
||||
|
||||
/* DST = SRC1 & SRC2. */
|
||||
#define BITSET_AND_(DST, SRC1, SRC2) BITSET_OP3_ (DST, SRC1, SRC2, \
|
||||
BITSET_OP_AND)
|
||||
|
||||
/* DST = SRC1 & ~SRC2. */
|
||||
#define BITSET_ANDN_(DST, SRC1, SRC2) BITSET_OP3_ (DST, SRC1, SRC2, \
|
||||
BITSET_OP_ANDN)
|
||||
|
||||
/* DST = (SRC1 & SRC2) | SRC3. Return non-zero if
|
||||
DST != (SRC1 & SRC2) | SRC3. */
|
||||
#define BITSET_AND_OR_(DST, SRC1, SRC2, SRC3)\
|
||||
BITSET_OP4_ (DST, SRC1, SRC2, SRC3, BITSET_OP_AND_OR)
|
||||
|
||||
/* DST = (SRC1 | SRC2) & SRC3. Return non-zero if
|
||||
DST != (SRC1 | SRC2) & SRC3. */
|
||||
#define BITSET_OR_AND_(DST, SRC1, SRC2, SRC3)\
|
||||
BITSET_OP4_ (DST, SRC1, SRC2, SRC3, BITSET_OP_OR_AND)
|
||||
|
||||
/* DST = (SRC1 & ~SRC2) | SRC3. Return non-zero if
|
||||
DST != (SRC1 & ~SRC2) | SRC3. */
|
||||
#define BITSET_ANDN_OR_(DST, SRC1, SRC2, SRC3)\
|
||||
BITSET_OP4_ (DST, SRC1, SRC2, SRC3, BITSET_OP_ANDN_OR)
|
||||
|
||||
/* Find list of up to NUM bits set in BSET starting from and including
|
||||
*NEXT. Return with actual number of bits found and with *NEXT
|
||||
indicating where search stopped. */
|
||||
#define BITSET_LIST_(BSET, LIST, NUM, NEXT) \
|
||||
(BSET)->b.ops->list (BSET, LIST, NUM, NEXT)
|
||||
|
||||
/* Find reverse list of up to NUM bits set in BSET starting from and
|
||||
including NEXT. Return with actual number of bits found and with
|
||||
*NEXT indicating where search stopped. */
|
||||
#define BITSET_REVERSE_LIST_(BSET, LIST, NUM, NEXT) \
|
||||
(BSET)->b.ops->reverse_list (BSET, LIST, NUM, NEXT)
|
||||
|
||||
|
||||
struct bbitset_struct
|
||||
{
|
||||
struct bitset_ops_struct *ops;
|
||||
bitset_windex cindex; /* Cache word index. */
|
||||
bitset_windex csize; /* Cache size in words. */
|
||||
bitset_word *cdata; /* Cache data pointer. */
|
||||
/* Perhaps we could sacrifice another word to indicate
|
||||
that the bitset is known to be zero, that a bit has been set
|
||||
in the cache, and that a bit has been cleared in the cache.
|
||||
This would speed up some of the searches but slightly slow down
|
||||
bit set/reset operations of cached bits. */
|
||||
};
|
||||
|
||||
|
||||
typedef struct bitset_struct *bitset;
|
||||
|
||||
|
||||
/* The contents of this structure should be considered private. */
|
||||
struct bitset_ops_struct
|
||||
{
|
||||
void (*set) PARAMS ((struct bitset_struct *, bitset_bindex));
|
||||
void (*reset) PARAMS ((struct bitset_struct *, bitset_bindex));
|
||||
int (*test) PARAMS ((struct bitset_struct *, bitset_bindex));
|
||||
int (*size) PARAMS ((struct bitset_struct *));
|
||||
int (*op1) PARAMS ((struct bitset_struct *, enum bitset_ops));
|
||||
int (*op2) PARAMS ((struct bitset_struct *, struct bitset_struct *,
|
||||
enum bitset_ops));
|
||||
int (*op3) PARAMS ((struct bitset_struct *, struct bitset_struct *,
|
||||
struct bitset_struct *, enum bitset_ops));
|
||||
int (*op4) PARAMS ((struct bitset_struct *, struct bitset_struct *,
|
||||
struct bitset_struct *, struct bitset_struct *,
|
||||
enum bitset_ops));
|
||||
int (*list) PARAMS ((struct bitset_struct *, bitset_bindex *,
|
||||
bitset_bindex, bitset_bindex *));
|
||||
int (*reverse_list) PARAMS ((struct bitset_struct *, bitset_bindex *,
|
||||
bitset_bindex, bitset_bindex *));
|
||||
void (*free) PARAMS ((struct bitset_struct *));
|
||||
enum bitset_type type;
|
||||
};
|
||||
|
||||
#define BITSET_COMPATIBLE_(BSET1, BSET2) ((BSET1)->b.ops == (BSET2)->b.ops)
|
||||
|
||||
#if BITSET_CHECK
|
||||
#define BITSET_CHECK2_(DST, SRC) \
|
||||
if (!BITSET_COMPATIBLE_ (DST, SRC)) abort ();
|
||||
|
||||
#define BITSET_CHECK3_(DST, SRC1, SRC2) \
|
||||
if (!BITSET_COMPATIBLE_ (DST, SRC1) \
|
||||
|| !BITSET_COMPATIBLE_ (DST, SRC2)) abort ();
|
||||
|
||||
#define BITSET_CHECK4_(DST, SRC1, SRC2, SRC3) \
|
||||
if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
|
||||
|| !BITSET_COMPATIBLE_ (DST, SRC3)) abort ();
|
||||
#else
|
||||
#define BITSET_CHECK2_(DST, SRC)
|
||||
|
||||
#define BITSET_CHECK3_(DST, SRC1, SRC2)
|
||||
|
||||
#define BITSET_CHECK4_(DST, SRC1, SRC2, SRC3)
|
||||
#endif
|
||||
|
||||
extern int bitset_op4 PARAMS ((bitset, bitset, bitset, bitset,
|
||||
enum bitset_ops op));
|
||||
|
||||
#endif /* _BBITSET_H */
|
||||
@@ -0,0 +1,112 @@
|
||||
/* Internal bitset definitions.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
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 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _BITSET_INT_H
|
||||
#define _BITSET_INT_H
|
||||
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
/* Currently we support three flavours of bitsets:
|
||||
BITSET_ARRAY: Array of bits (fixed size, faster).
|
||||
BITSET_LIST: Linked list of array of bits (variable size, least storage
|
||||
for large very sparse sets).
|
||||
BITSET_TABLE: Expandable table of pointers to array of bits
|
||||
(variable size, less storage for large sparse sets).
|
||||
*/
|
||||
enum bitset_type {BITSET_ARRAY, BITSET_LIST, BITSET_TABLE, BITSET_TYPE_NUM};
|
||||
#define BITSET__TYPE_NAMES {"sbitset", "lbitset", "ebitset"}
|
||||
|
||||
/* Non-zero to enable bitset caching. */
|
||||
#define BITSET_CACHE 1
|
||||
|
||||
/* Non-zero to use inline functions instead of macros. */
|
||||
#define BITSET_INLINE 0
|
||||
|
||||
/* Non-zero to enable bitset statistics gathering. */
|
||||
#define BITSET_STATS 1
|
||||
|
||||
/* Non-zero to enable bitset type checking. */
|
||||
#define BITSET_CHECK 0
|
||||
|
||||
typedef unsigned long bitset_word;
|
||||
#define BITSET_WORD_BITS ((unsigned) CHAR_BIT * sizeof (bitset_word))
|
||||
|
||||
/* Bit index. */
|
||||
typedef unsigned long bitset_bindex;
|
||||
|
||||
/* Word index. */
|
||||
typedef unsigned long bitset_windex;
|
||||
|
||||
#define BITSET_INDEX_MAX ((1U << (BITSET_WORD_BITS - 1)))
|
||||
|
||||
#define BITSET_MSB (1U << (BITSET_WORD_BITS - 1))
|
||||
|
||||
#define BITSET_LIST_SIZE 1024
|
||||
|
||||
enum bitset_ops {BITSET_ZERO, BITSET_ONES, BITSET_EMPTY_P,
|
||||
BITSET_COPY, BITSET_EQUAL_P, BITSET_SUBSET_P, BITSET_NOT,
|
||||
BITSET_AND, BITSET_OR, BITSET_XOR, BITSET_ANDN, BITSET_ORN,
|
||||
BITSET_OR_AND, BITSET_AND_OR, BITSET_ANDN_OR};
|
||||
|
||||
/* Return size in bits of bitset SRC. */
|
||||
#define BITSET__SIZE(SRC) (SRC)->ops->size (SRC)
|
||||
|
||||
/* Set bit BITNO in bitset DST. */
|
||||
#define BITSET__SET(DST, BITNO) (DST)->ops->set (DST, BITNO)
|
||||
|
||||
/* Reset bit BITNO in bitset DST. */
|
||||
#define BITSET__RESET(DST, BITNO) (DST)->ops->reset (DST, BITNO)
|
||||
|
||||
/* Return non-zero if bit BITNO in bitset SRC is set. */
|
||||
#define BITSET__TEST(SRC, BITNO) (SRC)->ops->test (SRC, BITNO)
|
||||
|
||||
/* Free bitset SRC. */
|
||||
#define BITSET__FREE(SRC) ((SRC)->ops->free) (SRC)
|
||||
|
||||
/* Perform operation OP on DST. */
|
||||
#define BITSET__OP1(DST, OP) (DST)->ops->op1 (DST, OP)
|
||||
|
||||
/* Perform operation OP on SRC and store in DST. */
|
||||
#define BITSET__OP2(DST, SRC, OP) (DST)->ops->op2 (DST, SRC, OP)
|
||||
|
||||
/* DST = SRC1 OP SRC2. */
|
||||
#define BITSET__OP3(DST, SRC1, SRC2, OP) \
|
||||
(DST)->ops->op3 (DST, SRC1, SRC2, OP)
|
||||
|
||||
/* DST = (SRC1 OP1 SRC2) OP2 SRC3. */
|
||||
#define BITSET__OP4(DST, SRC1, SRC2, SRC3, OP) \
|
||||
(DST)->ops->op4 (DST, SRC1, SRC2, SRC3, OP)
|
||||
|
||||
/* DST = SRC. */
|
||||
#define BITSET__COPY(DST, SRC) BITSET__OP2 (DST, SRC, BITSET_COPY)
|
||||
|
||||
/* Find list of up to NUM bits set in BSET starting from and including
|
||||
*NEXT. Return with actual number of bits found and with *NEXT
|
||||
indicating where search stopped. */
|
||||
#define BITSET__LIST(BSET, LIST, NUM, NEXT) \
|
||||
(BSET)->ops->list (BSET, LIST, NUM, NEXT)
|
||||
|
||||
/* Find reverse list of up to NUM bits set in BSET starting from and
|
||||
including NEXT. Return with actual number of bits found and with
|
||||
*NEXT indicating where search stopped. */
|
||||
#define BITSET__REVERSE_LIST(BSET, LIST, NUM, NEXT) \
|
||||
(BSET)->ops->reverse_list (BSET, LIST, NUM, NEXT)
|
||||
|
||||
#endif /* _BITSET_INT_H */
|
||||
+936
@@ -0,0 +1,936 @@
|
||||
/* General bitsets.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
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 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "bitset.h"
|
||||
#include "sbitset.h"
|
||||
#include "lbitset.h"
|
||||
#include "ebitset.h"
|
||||
#include "obstack.h"
|
||||
|
||||
static void bitset_print PARAMS ((FILE *, bitset, int));
|
||||
|
||||
#if BITSET_STATS
|
||||
#define BITSET_STATS_FILE "bitset.dat"
|
||||
|
||||
#define BITSET_LOG_COUNT_BINS 10
|
||||
#define BITSET_LOG_SIZE_BINS 16
|
||||
#define BITSET_DENSITY_BINS 20
|
||||
|
||||
struct bitset_type_stats_struct
|
||||
{
|
||||
unsigned int xmallocs;
|
||||
unsigned int xfrees;
|
||||
unsigned int oballocs;
|
||||
unsigned int obfrees;
|
||||
unsigned int lists;
|
||||
unsigned int list_counts[BITSET_LOG_COUNT_BINS];
|
||||
unsigned int list_sizes[BITSET_LOG_SIZE_BINS];
|
||||
unsigned int list_density[BITSET_DENSITY_BINS];
|
||||
};
|
||||
|
||||
struct bitset_stats_struct
|
||||
{
|
||||
unsigned int runs;
|
||||
struct bitset_type_stats_struct types[BITSET_TYPE_NUM];
|
||||
};
|
||||
|
||||
struct bitset_stats_struct bitset_stats_data;
|
||||
struct bitset_stats_struct *bitset_stats;
|
||||
|
||||
static void bitset_percent_histogram_print PARAMS ((FILE *, const char *,
|
||||
const char *,
|
||||
unsigned int,
|
||||
unsigned int *));
|
||||
static void bitset_log_histogram_print PARAMS ((FILE *, const char *,
|
||||
const char *,
|
||||
unsigned int,
|
||||
unsigned int *));
|
||||
static void bitset_stats_print_1
|
||||
PARAMS ((FILE *, const char *, struct bitset_type_stats_struct *));
|
||||
static void bitset_stats_print PARAMS ((FILE *, int));
|
||||
static void bitset_stats_read PARAMS ((void));
|
||||
static void bitset_stats_write PARAMS ((void));
|
||||
|
||||
#define BITSET_STATS_XMALLOCS_INC(TYPE) \
|
||||
if (bitset_stats) \
|
||||
bitset_stats->types[(TYPE)].xmallocs++
|
||||
|
||||
#define BITSET_STATS_XFREES_INC(BSET) \
|
||||
if (bitset_stats) \
|
||||
bitset_stats->types[BITSET_TYPE_ (BSET)].xfrees++
|
||||
|
||||
#define BITSET_STATS_OBALLOCS_INC(TYPE) \
|
||||
if (bitset_stats) \
|
||||
bitset_stats->types[(TYPE)].oballocs++
|
||||
|
||||
#define BITSET_STATS_OBFREES_INC(BSET) \
|
||||
if (bitset_stats) \
|
||||
bitset_stats->types[BITSET_TYPE_ (BSET)].obfrees++
|
||||
|
||||
#define BITSET_STATS_LISTS_INC(BSET) \
|
||||
if (bitset_stats) \
|
||||
bitset_stats->types[BITSET_TYPE_ (BSET)].lists++
|
||||
|
||||
#define BITSET_STATS_LIST_COUNTS_INC(BSET, I) \
|
||||
if (bitset_stats) \
|
||||
bitset_stats->types[BITSET_TYPE_ (BSET)].list_counts[(I)]++
|
||||
|
||||
#define BITSET_STATS_LIST_SIZES_INC(BSET, I) \
|
||||
if (bitset_stats) \
|
||||
bitset_stats->types[BITSET_TYPE_ (BSET)].list_sizes[(I)]++
|
||||
|
||||
#define BITSET_STATS_LIST_DENSITY_INC(BSET, I) \
|
||||
if (bitset_stats) \
|
||||
bitset_stats->types[BITSET_TYPE_ (BSET)].list_density[(I)]++
|
||||
|
||||
#else
|
||||
#define BITSET_STATS_XMALLOCS_INC(TYPE)
|
||||
|
||||
#define BITSET_STATS_XFREES_INC(BSET)
|
||||
|
||||
#define BITSET_STATS_OBALLOCS_INC(TYPE)
|
||||
|
||||
#define BITSET_STATS_OBFREES_INC(BSET)
|
||||
|
||||
#define BITSET_STATS_LISTS_INC(BSET)
|
||||
|
||||
#define BITSET_STATS_LIST_COUNTS_INC(BSET, I)
|
||||
|
||||
#define BITSET_STATS_LIST_SIZES_INC(BSET, I)
|
||||
|
||||
#define BITSET_STATS_LIST_DENSITY_INC(BSET, I)
|
||||
#endif /* BITSET_STATS */
|
||||
|
||||
|
||||
/* Return number of bytes required to create a N_BIT bitset
|
||||
of TYPE. The bitset may grow to require more bytes than this. */
|
||||
int
|
||||
bitset_bytes (type, n_bits)
|
||||
enum bitset_type type;
|
||||
bitset_bindex n_bits;
|
||||
{
|
||||
unsigned int bytes;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case BITSET_ARRAY:
|
||||
bytes = sbitset_bytes (n_bits);
|
||||
break;
|
||||
|
||||
case BITSET_LIST:
|
||||
bytes = lbitset_bytes (n_bits);
|
||||
break;
|
||||
|
||||
case BITSET_TABLE:
|
||||
bytes = ebitset_bytes (n_bits);
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
||||
/* Initialise bitset BSET of TYPE for N_BITS. */
|
||||
bitset
|
||||
bitset_init (bset, n_bits, type)
|
||||
bitset bset;
|
||||
bitset_bindex n_bits;
|
||||
enum bitset_type type;
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case BITSET_ARRAY:
|
||||
return sbitset_init (bset, n_bits);
|
||||
|
||||
case BITSET_LIST:
|
||||
return lbitset_init (bset, n_bits);
|
||||
|
||||
case BITSET_TABLE:
|
||||
return ebitset_init (bset, n_bits);
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Select a bitset type for a set of N_BITS and with attribute hints
|
||||
specified by ATTR. For variable size bitsets, N_BITS is only a
|
||||
hint and may be zero. */
|
||||
enum bitset_type
|
||||
bitset_type_choose (n_bits, attr)
|
||||
bitset_bindex n_bits ATTRIBUTE_UNUSED;
|
||||
unsigned int attr;
|
||||
{
|
||||
enum bitset_type type;
|
||||
|
||||
#if BITSET_CHECK
|
||||
/* Check attributes. */
|
||||
if (attr & BITSET_FIXED && attr & BITSET_VARIABLE)
|
||||
abort ();
|
||||
if (attr & BITSET_SPARSE && attr & BITSET_DENSE)
|
||||
abort ();
|
||||
|
||||
/* Note that sometimes we will be asked for a zero length
|
||||
fixed size bitset. */
|
||||
#endif
|
||||
|
||||
/* Choose the type of bitset. */
|
||||
|
||||
type = BITSET_ARRAY;
|
||||
/* Currently, the simple bitsets do not support a variable size. */
|
||||
if (attr & BITSET_VARIABLE || attr & BITSET_SPARSE)
|
||||
{
|
||||
type = BITSET_LIST;
|
||||
if (attr & BITSET_DENSE || attr & BITSET_GREEDY)
|
||||
type = BITSET_TABLE;
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
/* Create a bitset of N_BITS of type TYPE. */
|
||||
bitset
|
||||
bitset_alloc (n_bits, type)
|
||||
bitset_bindex n_bits;
|
||||
enum bitset_type type;
|
||||
{
|
||||
unsigned int bytes;
|
||||
bitset bset;
|
||||
|
||||
BITSET_STATS_XMALLOCS_INC (type);
|
||||
|
||||
bytes = bitset_bytes (type, n_bits);
|
||||
|
||||
bset = (bitset) xcalloc (1, bytes);
|
||||
|
||||
/* The cache is disabled until some elements are allocated. If we
|
||||
have variable length arrays, then we may need to allocate dummy
|
||||
element. */
|
||||
|
||||
return bitset_init (bset, n_bits, type);
|
||||
}
|
||||
|
||||
|
||||
/* Create a bitset of N_BITS of type TYPE. */
|
||||
bitset
|
||||
bitset_obstack_alloc (bobstack, n_bits, type)
|
||||
struct obstack *bobstack;
|
||||
bitset_bindex n_bits;
|
||||
enum bitset_type type;
|
||||
{
|
||||
unsigned int bytes;
|
||||
bitset bset;
|
||||
|
||||
BITSET_STATS_OBALLOCS_INC (type);
|
||||
|
||||
bytes = bitset_bytes (type, n_bits);
|
||||
|
||||
bset = obstack_alloc (bobstack, bytes);
|
||||
memset (bset, 0, bytes);
|
||||
|
||||
return bitset_init (bset, n_bits, type);
|
||||
}
|
||||
|
||||
|
||||
/* Create a bitset of N_BITS and with attribute hints specified by
|
||||
ATTR. */
|
||||
bitset
|
||||
bitset_create (n_bits, attr)
|
||||
bitset_bindex n_bits;
|
||||
unsigned int attr;
|
||||
{
|
||||
enum bitset_type type;
|
||||
|
||||
type = bitset_type_choose (n_bits, attr);
|
||||
|
||||
return bitset_alloc (n_bits, type);
|
||||
}
|
||||
|
||||
|
||||
/* Free bitset BSET. */
|
||||
void
|
||||
bitset_free (bset)
|
||||
bitset bset;
|
||||
{
|
||||
BITSET_STATS_XFREES_INC (bset);
|
||||
|
||||
BITSET_FREE_ (bset);
|
||||
free (bset);
|
||||
}
|
||||
|
||||
|
||||
/* Free bitset BSET allocated on obstack. */
|
||||
void
|
||||
bitset_obstack_free (bset)
|
||||
bitset bset;
|
||||
{
|
||||
BITSET_STATS_OBFREES_INC (bset);
|
||||
|
||||
BITSET_FREE_ (bset);
|
||||
}
|
||||
|
||||
|
||||
/* Find next bit set in SRC starting from and including BITNO.
|
||||
Return -1 if SRC empty. */
|
||||
int
|
||||
bitset_next (src, bitno)
|
||||
bitset src;
|
||||
bitset_bindex bitno;
|
||||
{
|
||||
bitset_bindex val;
|
||||
bitset_bindex next = bitno;
|
||||
|
||||
if (!bitset_list (src, &val, 1, &next))
|
||||
return -1;
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
/* Find previous bit set in SRC starting from and including BITNO.
|
||||
Return -1 if SRC empty. */
|
||||
int
|
||||
bitset_prev (src, bitno)
|
||||
bitset src;
|
||||
bitset_bindex bitno;
|
||||
{
|
||||
bitset_bindex val;
|
||||
bitset_bindex next = bitno;
|
||||
|
||||
if (!bitset_reverse_list (src, &val, 1, &next))
|
||||
return -1;
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
/* Find first set bit. */
|
||||
int
|
||||
bitset_first (src)
|
||||
bitset src;
|
||||
{
|
||||
return bitset_next (src, 0);
|
||||
}
|
||||
|
||||
|
||||
/* Find last set bit. */
|
||||
int
|
||||
bitset_last (src)
|
||||
bitset src;
|
||||
{
|
||||
return bitset_prev (src, 0);
|
||||
}
|
||||
|
||||
|
||||
/* Return non-zero if BITNO in SRC is the only set bit. */
|
||||
int
|
||||
bitset_only_set_p (src, bitno)
|
||||
bitset src;
|
||||
bitset_bindex bitno;
|
||||
{
|
||||
bitset_bindex val[2];
|
||||
bitset_bindex next = 0;
|
||||
|
||||
if (bitset_list (src, val, 2, &next) != 1)
|
||||
return 0;
|
||||
return val[0] == bitno;
|
||||
}
|
||||
|
||||
|
||||
/* Toggle bit BITNO in bitset BSET and return non-zero if now set. */
|
||||
int
|
||||
bitset_toggle (bset, bitno)
|
||||
bitset bset;
|
||||
bitset_bindex bitno;
|
||||
{
|
||||
/* This routine is for completeness. It could be optimized if
|
||||
required. */
|
||||
if (bitset_test (bset, bitno))
|
||||
{
|
||||
bitset_reset (bset, bitno);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
bitset_set (bset, bitno);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Print contents of bitset BSET to FILE. */
|
||||
static void
|
||||
bitset_print (file, bset, verbose)
|
||||
FILE *file;
|
||||
bitset bset;
|
||||
int verbose;
|
||||
{
|
||||
unsigned int i, pos;
|
||||
|
||||
if (verbose)
|
||||
fprintf (file, "n_bits = %d, set = {", bitset_size (bset));
|
||||
|
||||
pos = 30;
|
||||
BITSET_EXECUTE (bset, 0, i,
|
||||
{
|
||||
if (pos > 70)
|
||||
{
|
||||
fprintf (file, "\n");
|
||||
pos = 0;
|
||||
}
|
||||
|
||||
fprintf (file, "%d ", i);
|
||||
pos += 1 + (i >= 10) + (i >= 100);
|
||||
});
|
||||
|
||||
if (verbose)
|
||||
fprintf (file, "}\n");
|
||||
}
|
||||
|
||||
|
||||
/* DST = SRC. Return non-zero if DST != SRC. */
|
||||
int
|
||||
bitset_copy (dst, src)
|
||||
bitset dst;
|
||||
bitset src;
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (BITSET_COMPATIBLE_ (dst, src))
|
||||
return BITSET_COPY_ (dst, src);
|
||||
|
||||
/* Convert bitset types. We assume that the DST bitset
|
||||
is large enough to hold the SRC bitset. */
|
||||
bitset_zero (dst);
|
||||
BITSET_EXECUTE (src, 0, i,
|
||||
{
|
||||
bitset_set (dst, i);
|
||||
});
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Return size in bits of bitset SRC. */
|
||||
int
|
||||
bitset_size (src)
|
||||
bitset src;
|
||||
{
|
||||
return BITSET_SIZE_ (src);
|
||||
}
|
||||
|
||||
|
||||
/* Return number of bits set in bitset SRC. */
|
||||
int
|
||||
bitset_count (src)
|
||||
bitset src;
|
||||
{
|
||||
bitset_bindex list[BITSET_LIST_SIZE];
|
||||
bitset_bindex next;
|
||||
int num;
|
||||
int count;
|
||||
|
||||
next = 0;
|
||||
for (count = 0; (num = bitset_list (src, list, BITSET_LIST_SIZE, &next));
|
||||
count += num)
|
||||
continue;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
/* DST = 0. */
|
||||
int
|
||||
bitset_zero (dst)
|
||||
bitset dst;
|
||||
{
|
||||
return BITSET_ZERO_ (dst);
|
||||
}
|
||||
|
||||
|
||||
/* DST = ~0. */
|
||||
int
|
||||
bitset_ones (dst)
|
||||
bitset dst;
|
||||
{
|
||||
return BITSET_ONES_ (dst);
|
||||
}
|
||||
|
||||
|
||||
/* Return SRC == 0. */
|
||||
int
|
||||
bitset_empty_p (src)
|
||||
bitset src;
|
||||
{
|
||||
return BITSET_EMPTY_P_ (src);
|
||||
}
|
||||
|
||||
|
||||
/* Return DST == DST | SRC. */
|
||||
int
|
||||
bitset_subset_p (dst, src)
|
||||
bitset dst;
|
||||
bitset src;
|
||||
{
|
||||
BITSET_CHECK2_ (dst, src);
|
||||
return BITSET_SUBSET_P_ (dst, src);
|
||||
}
|
||||
|
||||
|
||||
/* Return DST == SRC. */
|
||||
int
|
||||
bitset_equal_p (dst, src)
|
||||
bitset dst;
|
||||
bitset src;
|
||||
{
|
||||
BITSET_CHECK2_ (dst, src);
|
||||
return BITSET_EQUAL_P_ (dst, src);
|
||||
}
|
||||
|
||||
|
||||
/* Return DST & SRC == 0. */
|
||||
int
|
||||
bitset_disjoint_p (dst, src)
|
||||
bitset dst;
|
||||
bitset src;
|
||||
{
|
||||
BITSET_CHECK2_ (dst, src);
|
||||
return BITSET_DISJOINT_P_ (dst, src);
|
||||
}
|
||||
|
||||
|
||||
/* DST = ~SRC. */
|
||||
int
|
||||
bitset_not (dst, src)
|
||||
bitset dst;
|
||||
bitset src;
|
||||
{
|
||||
BITSET_CHECK2_ (dst, src);
|
||||
return BITSET_NOT_ (dst, src);
|
||||
}
|
||||
|
||||
|
||||
/* DST = SRC1 | SRC2. Return non-zero if DST != SRC1 | SRC2. */
|
||||
int
|
||||
bitset_or (dst, src1, src2)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
{
|
||||
BITSET_CHECK3_ (dst, src1, src2);
|
||||
return BITSET_OR_ (dst, src1, src2);
|
||||
}
|
||||
|
||||
|
||||
/* DST = SRC1 & SRC2. Return non-zero if DST != SRC1 & SRC2. */
|
||||
int
|
||||
bitset_and (dst, src1, src2)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
{
|
||||
BITSET_CHECK3_ (dst, src1, src2);
|
||||
return BITSET_AND_ (dst, src1, src2);
|
||||
}
|
||||
|
||||
|
||||
/* DST = SRC1 ^ SRC2. Return non-zero if DST != SRC1 ^ SRC2. */
|
||||
int
|
||||
bitset_xor (dst, src1, src2)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
{
|
||||
BITSET_CHECK3_ (dst, src1, src2);
|
||||
return BITSET_XOR_ (dst, src1, src2);
|
||||
}
|
||||
|
||||
|
||||
/* DST = SRC1 & ~SRC2. Return non-zero if DST != SRC1 & ~SRC2. */
|
||||
int
|
||||
bitset_andn (dst, src1, src2)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
{
|
||||
BITSET_CHECK3_ (dst, src1, src2);
|
||||
return BITSET_ANDN_ (dst, src1, src2);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
bitset_op4 (dst, src1, src2, src3, op)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
bitset src3;
|
||||
enum bitset_ops op;
|
||||
{
|
||||
int changed = 0;
|
||||
bitset tmp;
|
||||
|
||||
/* Create temporary bitset. */
|
||||
tmp = bitset_alloc (0, BITSET_TYPE_ (dst));
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case BITSET_OP_OR_AND:
|
||||
BITSET_OR_ (tmp, src1, src2);
|
||||
changed = BITSET_AND_ (dst, src3, tmp);
|
||||
break;
|
||||
|
||||
case BITSET_OP_AND_OR:
|
||||
BITSET_AND_ (tmp, src1, src2);
|
||||
changed = BITSET_OR_ (dst, src3, tmp);
|
||||
break;
|
||||
|
||||
case BITSET_OP_ANDN_OR:
|
||||
BITSET_ANDN_ (tmp, src1, src2);
|
||||
changed = BITSET_OR_ (dst, src3, tmp);
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
bitset_free (tmp);
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
/* DST = (SRC1 | SRC2) & SRC3. Return non-zero if
|
||||
DST != (SRC1 | SRC2) & SRC3. */
|
||||
int
|
||||
bitset_or_and (dst, src1, src2, src3)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
bitset src3;
|
||||
{
|
||||
BITSET_CHECK4_ (dst, src1, src2, src3);
|
||||
return BITSET_OR_AND_ (dst, src1, src2, src3);
|
||||
}
|
||||
|
||||
|
||||
/* DST = (SRC1 & SRC2) | SRC3. Return non-zero if
|
||||
DST != (SRC1 & SRC2) | SRC3. */
|
||||
int
|
||||
bitset_and_or (dst, src1, src2, src3)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
bitset src3;
|
||||
{
|
||||
BITSET_CHECK4_ (dst, src1, src2, src3);
|
||||
return BITSET_AND_OR_ (dst, src1, src2, src3);
|
||||
}
|
||||
|
||||
|
||||
/* DST = (SRC1 & ~SRC2) | SRC3. Return non-zero if
|
||||
DST != (SRC1 & ~SRC2) | SRC3. */
|
||||
int
|
||||
bitset_andn_or (dst, src1, src2, src3)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
bitset src3;
|
||||
{
|
||||
BITSET_CHECK4_ (dst, src1, src2, src3);
|
||||
return BITSET_ANDN_OR_ (dst, src1, src2, src3);
|
||||
}
|
||||
|
||||
|
||||
/* Dump bitset BSET to FILE. */
|
||||
void
|
||||
bitset_dump (file, bset)
|
||||
FILE *file;
|
||||
bitset bset;
|
||||
{
|
||||
bitset_print (file, bset, 0);
|
||||
}
|
||||
|
||||
|
||||
/* Function to be called from debugger to print bitset. */
|
||||
void
|
||||
debug_bitset (bset)
|
||||
bitset bset;
|
||||
{
|
||||
if (bset)
|
||||
bitset_print (stderr, bset, 1);
|
||||
}
|
||||
|
||||
|
||||
/* Release memory associated with bitsets. */
|
||||
void
|
||||
bitset_release_memory ()
|
||||
{
|
||||
lbitset_release_memory ();
|
||||
ebitset_release_memory ();
|
||||
}
|
||||
|
||||
|
||||
#if BITSET_STATS
|
||||
int
|
||||
bitset_list (bset, list, num, next)
|
||||
bitset bset;
|
||||
bitset_bindex *list;
|
||||
bitset_bindex num;
|
||||
bitset_bindex *next;
|
||||
{
|
||||
bitset_bindex count;
|
||||
|
||||
count = BITSET_LIST_ (bset, list, num, next);
|
||||
|
||||
if (bitset_stats)
|
||||
{
|
||||
bitset_bindex tmp;
|
||||
bitset_bindex size;
|
||||
bitset_bindex i;
|
||||
enum bitset_type type;
|
||||
|
||||
type = BITSET_TYPE_ (bset);
|
||||
BITSET_STATS_LISTS_INC (bset);
|
||||
|
||||
/* Log histogram of number of set bits. */
|
||||
for (i = 0, tmp = count; tmp; tmp >>= 1, i++)
|
||||
continue;
|
||||
if (i >= BITSET_LOG_COUNT_BINS)
|
||||
i = BITSET_LOG_COUNT_BINS - 1;
|
||||
BITSET_STATS_LIST_COUNTS_INC (bset, i);
|
||||
|
||||
/* Log histogram of number of bits in set. */
|
||||
size = bitset_size (bset);
|
||||
for (i = 0, tmp = size; tmp; tmp >>= 1, i++)
|
||||
continue;
|
||||
if (i >= BITSET_LOG_SIZE_BINS)
|
||||
i = BITSET_LOG_SIZE_BINS - 1;
|
||||
BITSET_STATS_LIST_SIZES_INC (bset, i);
|
||||
|
||||
/* Histogram of fraction of bits set. */
|
||||
i = size ? (count * BITSET_DENSITY_BINS) / size : 0;
|
||||
if (i >= BITSET_DENSITY_BINS)
|
||||
i = BITSET_DENSITY_BINS - 1;
|
||||
BITSET_STATS_LIST_DENSITY_INC (bset, i);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
/* Print a percentage histogram with message MSG to FILE. */
|
||||
static void
|
||||
bitset_percent_histogram_print (file, name, msg, n_bins, bins)
|
||||
FILE *file;
|
||||
const char *name;
|
||||
const char *msg;
|
||||
unsigned int n_bins;
|
||||
unsigned int *bins;
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int total;
|
||||
|
||||
total = 0;
|
||||
for (i = 0; i < n_bins; i++)
|
||||
total += bins[i];
|
||||
|
||||
if (!total)
|
||||
return;
|
||||
|
||||
fprintf (file, "%s %s", name, msg);
|
||||
for (i = 0; i < n_bins; i++)
|
||||
fprintf (file, "%.0f-%.0f%%\t%8d (%5.1f%%)\n",
|
||||
i * 100.0 / n_bins,
|
||||
(i + 1) * 100.0 / n_bins, bins[i],
|
||||
(100.0 * bins[i]) / total);
|
||||
}
|
||||
|
||||
|
||||
/* Print a log histogram with message MSG to FILE. */
|
||||
static void
|
||||
bitset_log_histogram_print (file, name, msg, n_bins, bins)
|
||||
FILE *file;
|
||||
const char *name;
|
||||
const char *msg;
|
||||
unsigned int n_bins;
|
||||
unsigned int *bins;
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int total;
|
||||
unsigned int max_width;
|
||||
|
||||
total = 0;
|
||||
for (i = 0; i < n_bins; i++)
|
||||
total += bins[i];
|
||||
|
||||
if (!total)
|
||||
return;
|
||||
|
||||
/* 2 * ceil (log10(2) * (N - 1)) + 1 */
|
||||
max_width = 2 * (unsigned int) (0.30103 * (n_bins - 1) + 0.9999) + 1;
|
||||
|
||||
fprintf (file, "%s %s", name, msg);
|
||||
for (i = 0; i < 2; i++)
|
||||
fprintf (file, "%*d\t%8d (%5.1f%%)\n",
|
||||
max_width, i, bins[i], 100.0 * bins[i] / total);
|
||||
|
||||
/* Perhaps we should bail out once the histogram goes to zero. */
|
||||
for (; i < n_bins; i++)
|
||||
fprintf (file, "%*d-%d\t%8d (%5.1f%%)\n",
|
||||
max_width - ((unsigned int) (0.30103 * (i) + 0.9999) + 1),
|
||||
1 << (i - 1), (1 << i) - 1, bins[i],
|
||||
(100.0 * bins[i]) / total);
|
||||
}
|
||||
|
||||
|
||||
/* Print bitset statistics to FILE. */
|
||||
static void
|
||||
bitset_stats_print_1 (file, name, stats)
|
||||
FILE *file;
|
||||
const char *name;
|
||||
struct bitset_type_stats_struct *stats;
|
||||
{
|
||||
if (!stats)
|
||||
return;
|
||||
|
||||
fprintf (file, "%d %ss xmalloced, %d freed.\n",
|
||||
stats->xmallocs, name, stats->xfrees);
|
||||
fprintf (file, "%d %ss oballoced, %d freed.\n",
|
||||
stats->oballocs, name, stats->obfrees);
|
||||
|
||||
fprintf (file, "%d bitset_lists\n", stats->lists);
|
||||
|
||||
bitset_log_histogram_print (file, name, "count log histogram\n",
|
||||
BITSET_LOG_COUNT_BINS, stats->list_counts);
|
||||
|
||||
bitset_log_histogram_print (file, name, "size log histogram\n",
|
||||
BITSET_LOG_SIZE_BINS, stats->list_sizes);
|
||||
|
||||
bitset_percent_histogram_print (file, name, "density histogram\n",
|
||||
BITSET_DENSITY_BINS, stats->list_density);
|
||||
}
|
||||
|
||||
|
||||
/* Print all bitset statistics to FILE. */
|
||||
static void
|
||||
bitset_stats_print (file, verbose)
|
||||
FILE *file;
|
||||
int verbose ATTRIBUTE_UNUSED;
|
||||
{
|
||||
int i;
|
||||
static const char *names[] = BITSET_TYPE_NAMES;
|
||||
|
||||
if (!bitset_stats)
|
||||
return;
|
||||
|
||||
fprintf (file, "Bitset statistics:\n\n");
|
||||
|
||||
if (bitset_stats->runs > 1)
|
||||
fprintf (file, "Accumulated runs = %d\n", bitset_stats->runs);
|
||||
|
||||
for (i = 0; i < BITSET_TYPE_NUM; i++)
|
||||
bitset_stats_print_1 (file, names[i], &bitset_stats->types[i]);
|
||||
}
|
||||
#endif /* BITSET_STATS */
|
||||
|
||||
|
||||
/* Initialise bitset statistics logging. */
|
||||
void
|
||||
bitset_stats_init ()
|
||||
{
|
||||
#if BITSET_STATS
|
||||
bitset_stats = &bitset_stats_data;
|
||||
bitset_stats_read ();
|
||||
#endif /* BITSET_STATS */
|
||||
}
|
||||
|
||||
|
||||
/* Read bitset statistics file. */
|
||||
static void
|
||||
bitset_stats_read ()
|
||||
{
|
||||
FILE *file;
|
||||
|
||||
if (!bitset_stats)
|
||||
return;
|
||||
|
||||
file = fopen (BITSET_STATS_FILE, "r");
|
||||
if (file)
|
||||
{
|
||||
if (fread (&bitset_stats_data, sizeof (bitset_stats_data),
|
||||
1, file) != 1)
|
||||
{
|
||||
if (ferror (file))
|
||||
perror ("Could not read stats file.");
|
||||
else
|
||||
fprintf (stderr, "Bad stats file size.\n");
|
||||
}
|
||||
fclose (file);
|
||||
}
|
||||
bitset_stats_data.runs++;
|
||||
}
|
||||
|
||||
|
||||
/* Write bitset statistics file. */
|
||||
static void
|
||||
bitset_stats_write ()
|
||||
{
|
||||
FILE *file;
|
||||
|
||||
if (!bitset_stats)
|
||||
return;
|
||||
|
||||
file = fopen (BITSET_STATS_FILE, "w");
|
||||
if (file)
|
||||
{
|
||||
if (fwrite (&bitset_stats_data, sizeof (bitset_stats_data),
|
||||
1, file) != 1)
|
||||
perror ("Could not write stats file.");
|
||||
fclose (file);
|
||||
}
|
||||
else
|
||||
perror ("Could not open stats file for writing.");
|
||||
}
|
||||
|
||||
|
||||
/* Dump bitset statistics to FILE. */
|
||||
void
|
||||
bitset_stats_dump (file)
|
||||
FILE *file;
|
||||
{
|
||||
#if BITSET_STATS
|
||||
bitset_stats_print (file, 0);
|
||||
bitset_stats_write ();
|
||||
#endif /* BITSET_STATS */
|
||||
}
|
||||
|
||||
|
||||
/* Function to be called from debugger to print bitset stats. */
|
||||
void
|
||||
debug_bitset_stats (void)
|
||||
{
|
||||
#if BITSET_STATS
|
||||
bitset_stats_print (stderr, 1);
|
||||
#endif /* BITSET_STATS */
|
||||
}
|
||||
+341
@@ -0,0 +1,341 @@
|
||||
/* Generic bitsets.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
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 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _BITSET_H
|
||||
#define _BITSET_H
|
||||
|
||||
/* This file is the public interface to the bitset abstract data type.
|
||||
Only use the functions and macros defined in this file. */
|
||||
|
||||
#include "bbitset.h"
|
||||
#include "obstack.h"
|
||||
#include <stdio.h>
|
||||
|
||||
/* Attributes used to select a bitset implementation. */
|
||||
enum bitset_attr {BITSET_FIXED = 1, /* Bitset size fixed. */
|
||||
BITSET_VARIABLE = 2, /* Bitset size variable. */
|
||||
BITSET_DENSE = 4, /* Bitset dense. */
|
||||
BITSET_SPARSE = 8, /* Bitset sparse. */
|
||||
BITSET_FRUGAL = 16, /* Prefer most compact. */
|
||||
BITSET_GREEDY = 32}; /* Prefer fastest. */
|
||||
|
||||
typedef unsigned int bitset_attrs;
|
||||
|
||||
/* The contents of the structure should be considered to be private.
|
||||
While I would like to make this structure opaque, it needs to be
|
||||
visible for the inline bit set/test functions. */
|
||||
struct bitset_struct
|
||||
{
|
||||
struct bbitset_struct b;
|
||||
};
|
||||
|
||||
/* Return bytes required for bitset of desired type and size. */
|
||||
extern int bitset_bytes PARAMS ((enum bitset_type, bitset_bindex));
|
||||
|
||||
/* Initialise a bitset with desired type and size. */
|
||||
extern bitset bitset_init PARAMS ((bitset, bitset_bindex, enum bitset_type));
|
||||
|
||||
/* Select an implementation type based on the desired bitset size
|
||||
and attributes. */
|
||||
extern enum bitset_type bitset_type_choose PARAMS ((bitset_bindex,
|
||||
bitset_attrs));
|
||||
|
||||
/* Create a bitset of desired type and size. The bitset is zeroed. */
|
||||
extern bitset bitset_alloc PARAMS ((bitset_bindex, enum bitset_type));
|
||||
|
||||
/* Free bitset. */
|
||||
extern void bitset_free PARAMS ((bitset));
|
||||
|
||||
/* Create a bitset of desired type and size using an obstack. The
|
||||
bitset is zeroed. */
|
||||
extern bitset bitset_obstack_alloc PARAMS ((struct obstack *bobstack,
|
||||
bitset_bindex, enum bitset_type));
|
||||
|
||||
/* Free bitset allocated on obstack. */
|
||||
extern void bitset_obstack_free PARAMS ((bitset));
|
||||
|
||||
/* Create a bitset of desired size and attributes. The bitset is zeroed. */
|
||||
extern bitset bitset_create PARAMS ((bitset_bindex, bitset_attrs));
|
||||
|
||||
/* Return size in bits of bitset SRC. */
|
||||
extern int bitset_size PARAMS ((bitset));
|
||||
|
||||
/* Return number of bits set in bitset SRC. */
|
||||
extern int bitset_count PARAMS ((bitset));
|
||||
|
||||
#if BITSET_CACHE && BITSET_INLINE
|
||||
static inline void bitset_set PARAMS ((bitset, bitset_bindex));
|
||||
static inline void bitset_reset PARAMS ((bitset, bitset_bindex));
|
||||
static inline int bitset_test PARAMS ((bitset, bitset_bindex));
|
||||
|
||||
/* Set bit BITNO in bitset BSET. */
|
||||
static inline void bitset_set (bset, bitno)
|
||||
bitset bset;
|
||||
bitset_bindex bitno;
|
||||
{
|
||||
bitset_windex index = bitno / BITSET_WORD_BITS;
|
||||
bitset_windex offset = index - bset->b.cindex;
|
||||
|
||||
if (offset < bset->b.csize)
|
||||
bset->b.cdata[offset] |= (1 << (bitno % BITSET_WORD_BITS));
|
||||
else
|
||||
BITSET_SET_ (bset, bitno);
|
||||
}
|
||||
|
||||
|
||||
/* Reset bit BITNO in bitset BSET. */
|
||||
static inline void bitset_reset (bset, bitno)
|
||||
bitset bset;
|
||||
bitset_bindex bitno;
|
||||
{
|
||||
bitset_windex index = bitno / BITSET_WORD_BITS;
|
||||
bitset_windex offset = index - bset->b.cindex;
|
||||
|
||||
if (offset < bset->b.csize)
|
||||
bset->b.cdata[offset] &= ~(1 << (bitno % BITSET_WORD_BITS));
|
||||
else
|
||||
BITSET_RESET_ (bset, bitno);
|
||||
}
|
||||
|
||||
|
||||
/* Test bit BITNO in bitset BSET. */
|
||||
static inline int bitset_test (bset, bitno)
|
||||
bitset bset;
|
||||
bitset_bindex bitno;
|
||||
{
|
||||
bitset_windex index = bitno / BITSET_WORD_BITS;
|
||||
bitset_windex offset = index - bset->b.cindex;
|
||||
|
||||
if (offset < bset->b.csize)
|
||||
return (bset->b.cdata[offset] >> (bitno % BITSET_WORD_BITS)) & 1;
|
||||
else
|
||||
return BITSET_TEST_ (bset, bitno);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BITSET_CACHE && ! BITSET_INLINE
|
||||
|
||||
/* Set bit BITNO in bitset BSET. */
|
||||
#define bitset_set(bset, bitno) \
|
||||
do \
|
||||
{ \
|
||||
bitset_bindex _bitno = (bitno); \
|
||||
bitset_windex _index = _bitno / BITSET_WORD_BITS; \
|
||||
bitset_windex _offset = _index - (bset)->b.cindex; \
|
||||
\
|
||||
if (_offset < (bset)->b.csize) \
|
||||
(bset)->b.cdata[_offset] |= (1 << (_bitno % BITSET_WORD_BITS)); \
|
||||
else \
|
||||
BITSET_SET_ ((bset), _bitno); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/* Reset bit BITNO in bitset BSET. */
|
||||
#define bitset_reset(bset, bitno) \
|
||||
do \
|
||||
{ \
|
||||
bitset_bindex _bitno = (bitno); \
|
||||
bitset_windex _index = _bitno / BITSET_WORD_BITS; \
|
||||
bitset_windex _offset = _index - (bset)->b.cindex; \
|
||||
\
|
||||
if (_offset < (bset)->b.csize) \
|
||||
(bset)->b.cdata[_offset] &= ~(1 << (_bitno % BITSET_WORD_BITS)); \
|
||||
else \
|
||||
BITSET_RESET_ ((bset), _bitno); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/* Test bit BITNO in bitset BSET. */
|
||||
#define bitset_test(bset, bitno) \
|
||||
(((((bitno) / BITSET_WORD_BITS) - (bset)->b.cindex) < (bset)->b.csize) \
|
||||
? ((bset)->b.cdata[(((bitno) / BITSET_WORD_BITS) - (bset)->b.cindex)] \
|
||||
>> ((bitno) % BITSET_WORD_BITS)) & 1 \
|
||||
: (unsigned int) BITSET_TEST_ ((bset), (bitno)))
|
||||
#endif
|
||||
|
||||
#if ! BITSET_CACHE
|
||||
/* Set bit BITNO in bitset SRC. */
|
||||
#define bitset_set(SRC, BITNO) BITSET_SET_ (SRC, BITNO)
|
||||
|
||||
/* Reset bit BITNO in bitset SRC. */
|
||||
#define bitset_reset(SRC, BITNO) BITSET_RESET_ (SRC, BITNO)
|
||||
|
||||
/* Return non-zero if bit BITNO in bitset SRC is set. */
|
||||
#define bitset_test(SRC, BITNO) BITSET_TEST_ (SRC, BITNO)
|
||||
#endif
|
||||
|
||||
/* Toggle bit BITNO in bitset BSET and return non-zero if now set. */
|
||||
extern int bitset_toggle PARAMS ((bitset, bitset_bindex));
|
||||
|
||||
/* DST = 0. */
|
||||
extern int bitset_zero PARAMS ((bitset));
|
||||
|
||||
/* DST = ~0. */
|
||||
extern int bitset_ones PARAMS ((bitset));
|
||||
|
||||
/* Return non-zero if all bits in bitset SRC are reset. */
|
||||
extern int bitset_empty_p PARAMS ((bitset));
|
||||
|
||||
/* Return DST == DST | SRC. */
|
||||
extern int bitset_subset_p PARAMS ((bitset, bitset));
|
||||
|
||||
/* Return DST == SRC. */
|
||||
extern int bitset_equal_p PARAMS ((bitset, bitset));
|
||||
|
||||
/* Return DST & SRC == 0. */
|
||||
extern int bitset_disjoint_p PARAMS ((bitset, bitset));
|
||||
|
||||
/* DST == SRC. */
|
||||
extern int bitset_copy PARAMS ((bitset, bitset));
|
||||
|
||||
/* DST = ~SRC. */
|
||||
extern int bitset_not PARAMS ((bitset, bitset));
|
||||
|
||||
/* DST = SRC1 | SRC2. Return non-zero if DST != SRC1 | SRC2. */
|
||||
extern int bitset_or PARAMS ((bitset, bitset, bitset));
|
||||
|
||||
/* DST = SRC1 & SRC2. Return non-zero if DST != SRC1 & SRC2. */
|
||||
extern int bitset_and PARAMS ((bitset, bitset, bitset));
|
||||
|
||||
/* DST = SRC1 ^ SRC2. Return non-zero if DST != SRC1 ^ SRC2. */
|
||||
extern int bitset_xor PARAMS ((bitset, bitset, bitset));
|
||||
|
||||
/* DST = SRC1 & ~SRC2. Return non-zero if DST != SRC1 & ~SRC2. */
|
||||
extern int bitset_andn PARAMS ((bitset, bitset, bitset));
|
||||
|
||||
/* DST = (SRC1 | SRC2) & SRC3. Return non-zero if
|
||||
DST != (SRC1 | SRC2) & SRC3. */
|
||||
extern int bitset_or_and PARAMS ((bitset, bitset, bitset, bitset));
|
||||
|
||||
/* DST = (SRC1 & SRC2) | SRC3. Return non-zero if
|
||||
DST != (SRC1 & SRC2) | SRC3. */
|
||||
extern int bitset_and_or PARAMS ((bitset, bitset, bitset, bitset));
|
||||
|
||||
/* DST = (SRC1 & ~SRC2) | SRC3. Return non-zero if
|
||||
DST != (SRC1 & ~SRC2) | SRC3. */
|
||||
extern int bitset_andn_or PARAMS ((bitset, bitset, bitset, bitset));
|
||||
|
||||
/* Find next bit set in BSET starting from and including BITNO. */
|
||||
extern int bitset_next PARAMS ((bitset, bitset_bindex));
|
||||
|
||||
/* Find previous bit set in BSET starting from and including BITNO. */
|
||||
extern int bitset_prev PARAMS ((bitset, bitset_bindex));
|
||||
|
||||
/* Return non-zero if BITNO in SRC is the only set bit. */
|
||||
extern int bitset_only_set_p PARAMS ((bitset, bitset_bindex));
|
||||
|
||||
/* Find list of up to NUM bits set in BSET starting from and including
|
||||
*NEXT. Return with actual number of bits found and with *NEXT
|
||||
indicating where search stopped. */
|
||||
#if BITSET_STATS
|
||||
extern int bitset_list PARAMS ((bitset, bitset_bindex *, bitset_bindex,
|
||||
bitset_bindex *));
|
||||
#else
|
||||
#define bitset_list(BSET, LIST, NUM, NEXT) \
|
||||
BITSET_LIST_ (BSET, LIST, NUM, NEXT)
|
||||
#endif
|
||||
|
||||
/* Find reverse list of up to NUM bits set in BSET starting from and
|
||||
including NEXT. Return with actual number of bits found and with
|
||||
*NEXT indicating where search stopped. */
|
||||
#define bitset_reverse_list(BSET, LIST, NUM, NEXT) \
|
||||
BITSET_REVERSE_LIST_ (BSET, LIST, NUM, NEXT)
|
||||
|
||||
/* Find first set bit. */
|
||||
extern int bitset_first PARAMS ((bitset));
|
||||
|
||||
/* Find last set bit. */
|
||||
extern int bitset_last PARAMS ((bitset));
|
||||
|
||||
/* Dump bitset. */
|
||||
extern void bitset_dump PARAMS ((FILE *, bitset));
|
||||
|
||||
/* Loop over all elements of BSET, starting with MIN, executing CODE. */
|
||||
#define BITSET_EXECUTE(BSET, MIN, N, CODE) \
|
||||
do { \
|
||||
bitset_bindex _list[BITSET_LIST_SIZE]; \
|
||||
bitset_bindex _next = (MIN); \
|
||||
int _num; \
|
||||
\
|
||||
while ((_num = bitset_list ((BSET), _list, BITSET_LIST_SIZE, &_next)))\
|
||||
{ \
|
||||
int _i; \
|
||||
\
|
||||
for (_i = 0; _i < _num; _i++) \
|
||||
{ \
|
||||
(N) = _list[_i]; \
|
||||
CODE; \
|
||||
} \
|
||||
if (_num < BITSET_LIST_SIZE) \
|
||||
break; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
/* Loop over all elements of BSET, in reverse order starting with
|
||||
MIN, executing CODE. */
|
||||
#define BITSET_REVERSE_EXECUTE(BSET, MIN, N, CODE) \
|
||||
do { \
|
||||
bitset_bindex _list[BITSET_LIST_SIZE]; \
|
||||
bitset_bindex _next = (MIN); \
|
||||
int _num; \
|
||||
\
|
||||
while ((_num = bitset_reverse_list ((BSET), _list, \
|
||||
BITSET_LIST_SIZE, &_next))) \
|
||||
{ \
|
||||
int _i; \
|
||||
\
|
||||
for (_i = 0; _i < _num; _i++) \
|
||||
{ \
|
||||
(N) = _list[_i]; \
|
||||
CODE; \
|
||||
} \
|
||||
if (_num < BITSET_LIST_SIZE) \
|
||||
break; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
/* Define set operations in terms of logical operations. */
|
||||
|
||||
#define bitset_diff(DST, SRC1, SRC2) bitset_andn (DST, SRC1, SRC2)
|
||||
|
||||
#define bitset_intersection(DST, SRC1, SRC2) bitset_and (DST, SRC1, SRC2)
|
||||
|
||||
#define bitset_union(DST, SRC1, SRC2) bitset_or (DST, SRC1, SRC2)
|
||||
|
||||
#define bitset_diff_union(DST, SRC1, SRC2, SRC3) \
|
||||
bitset_andn_or (DST, SRC1, SRC2, SRC3)
|
||||
|
||||
|
||||
/* Release any memory tied up with bitsets. */
|
||||
extern void bitset_release_memory PARAMS ((void));
|
||||
|
||||
/* Initialise bitset stats. */
|
||||
extern void bitset_stats_init PARAMS ((void));
|
||||
|
||||
/* Dump bitset stats. */
|
||||
extern void bitset_stats_dump PARAMS ((FILE *));
|
||||
|
||||
/* Function to debug bitset from debugger. */
|
||||
extern void debug_bitset PARAMS ((bitset));
|
||||
|
||||
/* Function to debug bitset stats from debugger. */
|
||||
extern void debug_bitset_stats PARAMS ((void));
|
||||
|
||||
#endif /* _BITSET_H */
|
||||
+179
@@ -0,0 +1,179 @@
|
||||
/* Bitset vectors.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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.
|
||||
|
||||
GCC 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 GCC; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "bitsetv.h"
|
||||
|
||||
|
||||
/* Create a vector of N_VECS bitsets, each of N_BITS, and of
|
||||
type TYPE. */
|
||||
bitset *
|
||||
bitsetv_alloc (n_vecs, n_bits, type)
|
||||
unsigned int n_vecs;
|
||||
unsigned int n_bits;
|
||||
enum bitset_type type;
|
||||
{
|
||||
unsigned int vector_bytes;
|
||||
unsigned int bytes;
|
||||
bitset *bsetv;
|
||||
unsigned int i;
|
||||
|
||||
/* Determine number of bytes for each set. */
|
||||
bytes = bitset_bytes (type, n_bits);
|
||||
|
||||
/* Allocate vector table at head of bitset array. */
|
||||
vector_bytes = (n_vecs + 1) * sizeof (bitset);
|
||||
bsetv = (bitset *) xcalloc (1, vector_bytes + bytes * n_vecs);
|
||||
|
||||
for (i = 0; i < n_vecs; i++)
|
||||
{
|
||||
bsetv[i] = (bitset) ((char *) bsetv + vector_bytes + i * bytes);
|
||||
|
||||
bitset_init (bsetv[i], n_bits, type);
|
||||
}
|
||||
|
||||
/* Null terminate table. */
|
||||
bsetv[i] = 0;
|
||||
return bsetv;
|
||||
}
|
||||
|
||||
|
||||
/* Create a vector of N_VECS bitsets, each of N_BITS, and with
|
||||
attribute hints specified by ATTR. */
|
||||
bitset *
|
||||
bitsetv_create (n_vecs, n_bits, attr)
|
||||
unsigned int n_vecs;
|
||||
unsigned int n_bits;
|
||||
unsigned int attr;
|
||||
{
|
||||
enum bitset_type type;
|
||||
|
||||
type = bitset_type_choose (n_bits, attr);
|
||||
return bitsetv_alloc (n_vecs, n_bits, type);
|
||||
}
|
||||
|
||||
|
||||
/* Free bitset vector BSETV. */
|
||||
void
|
||||
bitsetv_free (bsetv)
|
||||
bitset *bsetv;
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; bsetv[i]; i++)
|
||||
BITSET_FREE_ (bsetv[i]);
|
||||
free (bsetv);
|
||||
}
|
||||
|
||||
|
||||
/* Zero a vector of bitsets. */
|
||||
void
|
||||
bitsetv_zero (bsetv)
|
||||
struct bitset_struct **bsetv;
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; bsetv[i]; i++)
|
||||
bitset_zero (bsetv[i]);
|
||||
}
|
||||
|
||||
|
||||
/* Set a vector of bitsets to ones. */
|
||||
void
|
||||
bitsetv_ones (bsetv)
|
||||
bitset *bsetv;
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; bsetv[i]; i++)
|
||||
bitset_ones (bsetv[i]);
|
||||
}
|
||||
|
||||
|
||||
/* Given a vector BSETV of N bitsets of size N, modify its contents to
|
||||
be the transitive closure of what was given. */
|
||||
void
|
||||
bitsetv_transitive_closure (bsetv)
|
||||
bitset *bsetv;
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int j;
|
||||
|
||||
for (i = 0; bsetv[i]; i++)
|
||||
for (j = 0; bsetv[j]; j++)
|
||||
if (bitset_test (bsetv[j], i))
|
||||
bitset_or (bsetv[j], bsetv[j], bsetv[i]);
|
||||
}
|
||||
|
||||
|
||||
/* Given a vector BSETV of N bitsets of size N, modify its contents to
|
||||
be the reflexive transitive closure of what was given. This is
|
||||
the same as transitive closure but with all bits on the diagonal
|
||||
of the bit matrix set. */
|
||||
void
|
||||
bitsetv_reflexive_transitive_closure (bitsetv bsetv)
|
||||
{
|
||||
int i;
|
||||
|
||||
bitsetv_transitive_closure (bsetv);
|
||||
for (i = 0; bsetv[i]; i++)
|
||||
bitset_set (bsetv[i], i);
|
||||
}
|
||||
|
||||
|
||||
/* Dump the contents of a bitset vector BSETV with N_VECS elements to
|
||||
FILE. */
|
||||
void
|
||||
bitsetv_dump (file, title, subtitle, bsetv)
|
||||
FILE *file;
|
||||
const char *title, *subtitle;
|
||||
bitset *bsetv;
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
fprintf (file, "%s\n", title);
|
||||
for (i = 0; bsetv[i]; i++)
|
||||
{
|
||||
fprintf (file, "%s %d\n", subtitle, i);
|
||||
bitset_dump (file, bsetv[i]);
|
||||
}
|
||||
|
||||
fprintf (file, "\n");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
debug_bitsetv (bsetv)
|
||||
bitset *bsetv;
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; bsetv[i]; i++)
|
||||
{
|
||||
fprintf (stderr, "%d: ", i);
|
||||
debug_bitset (bsetv[i]);
|
||||
}
|
||||
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/* Bitset vectors.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
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 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _BITSETV_H
|
||||
#define _BITSETV_H
|
||||
|
||||
#include "bitset.h"
|
||||
|
||||
typedef bitset * bitsetv;
|
||||
|
||||
/* Create a vector of N_VECS bitsets, each of N_BITS, and of
|
||||
type TYPE. */
|
||||
extern bitsetv bitsetv_alloc PARAMS ((unsigned int, unsigned int,
|
||||
enum bitset_type));
|
||||
|
||||
/* Create a vector of N_VECS bitsets, each of N_BITS, and with
|
||||
attribute hints specified by ATTR. */
|
||||
extern bitsetv bitsetv_create PARAMS ((unsigned int, unsigned int,
|
||||
unsigned int));
|
||||
|
||||
/* Free vector of bitsets. */
|
||||
extern void bitsetv_free PARAMS ((bitsetv));
|
||||
|
||||
/* Zero vector of bitsets. */
|
||||
extern void bitsetv_zero PARAMS ((bitsetv));
|
||||
|
||||
/* Set vector of bitsets. */
|
||||
extern void bitsetv_ones PARAMS ((bitsetv));
|
||||
|
||||
/* Given a vector BSETV of N bitsets of size N, modify its contents to
|
||||
be the transitive closure of what was given. */
|
||||
extern void bitsetv_transitive_closure PARAMS ((bitsetv));
|
||||
|
||||
/* Given a vector BSETV of N bitsets of size N, modify its contents to
|
||||
be the reflexive transitive closure of what was given. This is
|
||||
the same as transitive closure but with all bits on the diagonal
|
||||
of the bit matrix set. */
|
||||
extern void bitsetv_reflexive_transitive_closure PARAMS ((bitsetv));
|
||||
|
||||
/* Dump vector of bitsets. */
|
||||
extern void bitsetv_dump PARAMS ((FILE *, const char *,
|
||||
const char *, bitsetv));
|
||||
|
||||
/* Function to debug vector of bitsets from debugger. */
|
||||
extern void debug_bitsetv PARAMS ((bitsetv));
|
||||
|
||||
#endif /* _BITSETV_H */
|
||||
+1259
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
/* Functions to support ebitsets.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
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 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _EBITSET_H
|
||||
#define _EBITSET_H
|
||||
|
||||
#include "bbitset.h"
|
||||
|
||||
extern int ebitset_bytes PARAMS ((bitset_bindex));
|
||||
|
||||
extern bitset ebitset_init PARAMS ((bitset, bitset_bindex));
|
||||
|
||||
extern void ebitset_release_memory PARAMS ((void));
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,59 @@
|
||||
/* Convenience header for conditional use of GNU <libintl.h>.
|
||||
Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public License as published
|
||||
by the Free Software Foundation; either version 2, 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifndef _LIBGETTEXT_H
|
||||
#define _LIBGETTEXT_H 1
|
||||
|
||||
/* NLS can be disabled through the configure --disable-nls option. */
|
||||
#if ENABLE_NLS
|
||||
|
||||
/* Get declarations of GNU message catalog functions. */
|
||||
# include <libintl.h>
|
||||
|
||||
#else
|
||||
|
||||
/* Disabled NLS.
|
||||
The casts to 'const char *' serve the purpose of producing warnings
|
||||
for invalid uses of the value returned from these functions.
|
||||
On pre-ANSI systems without 'const', the config.h file is supposed to
|
||||
contain "#define const". */
|
||||
# define gettext(Msgid) ((const char *) (Msgid))
|
||||
# define dgettext(Domainname, Msgid) ((const char *) (Msgid))
|
||||
# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
|
||||
# define ngettext(Msgid1, Msgid2, N) \
|
||||
((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
|
||||
# define dngettext(Domainname, Msgid1, Msgid2, N) \
|
||||
((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
|
||||
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
|
||||
((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
|
||||
# define textdomain(Domainname) ((const char *) (Domainname))
|
||||
# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
|
||||
# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
|
||||
|
||||
#endif
|
||||
|
||||
/* A pseudo function call that serves as a marker for the automated
|
||||
extraction of messages, but does not call gettext(). The run-time
|
||||
translation is done at a different place in the code.
|
||||
The argument, String, should be a literal string. Concatenated strings
|
||||
and other string expressions won't work.
|
||||
The macro's expansion is not parenthesized, so that it is suitable as
|
||||
initializer for static 'char[]' or 'const char[]' variables. */
|
||||
#define gettext_noop(String) String
|
||||
|
||||
#endif /* _LIBGETTEXT_H */
|
||||
+1328
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
/* Functions to support lbitsets.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
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 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _LBITSET_H
|
||||
#define _LBITSET_H
|
||||
|
||||
#include "bbitset.h"
|
||||
|
||||
extern int lbitset_bytes PARAMS ((bitset_bindex));
|
||||
|
||||
extern bitset lbitset_init PARAMS ((bitset, bitset_bindex));
|
||||
|
||||
extern void lbitset_release_memory PARAMS ((void));
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
|
||||
This file is derived from the one in the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Disable the definition of mkstemp to rpl_mkstemp (from config.h) in this
|
||||
file. Otherwise, we'd get conflicting prototypes for rpl_mkstemp on
|
||||
most systems. */
|
||||
#undef mkstemp
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef __GT_FILE
|
||||
# define __GT_FILE 0
|
||||
#endif
|
||||
|
||||
int __gen_tempname ();
|
||||
|
||||
/* Generate a unique temporary file name from TEMPLATE.
|
||||
The last six characters of TEMPLATE must be "XXXXXX";
|
||||
they are replaced with a string that makes the filename unique.
|
||||
Then open the file and return a fd. */
|
||||
int
|
||||
rpl_mkstemp (char *template)
|
||||
{
|
||||
return __gen_tempname (template, __GT_FILE);
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/* Open a pipe to read from a program without intermediary sh.
|
||||
Copyright (C) 1992, 1997 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.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by David MacKenzie. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* Open a pipe to read from a program without intermediary sh. Checks
|
||||
PATH. Sample use:
|
||||
|
||||
stream = readpipe ("progname", "arg1", "arg2", (char *) 0);
|
||||
|
||||
Return 0 on error. */
|
||||
|
||||
#if __STDC__
|
||||
FILE *
|
||||
readpipe (char *progname, ...)
|
||||
#else
|
||||
FILE *
|
||||
readpipe (va_alist)
|
||||
#endif
|
||||
{
|
||||
#if ! __STDC__
|
||||
char *progname;
|
||||
#endif
|
||||
int fds[2];
|
||||
va_list ap;
|
||||
char *args[100];
|
||||
int argno = 0;
|
||||
|
||||
/* Copy arguments into `args'. */
|
||||
#if __STDC__
|
||||
va_start (ap, progname);
|
||||
#else
|
||||
va_start (ap);
|
||||
progname = va_arg (ap, char *);
|
||||
#endif
|
||||
args[argno++] = progname;
|
||||
while ((args[argno++] = va_arg (ap, char *)) != NULL)
|
||||
;
|
||||
va_end (ap);
|
||||
|
||||
if (pipe (fds) == -1)
|
||||
return 0;
|
||||
|
||||
switch (fork ())
|
||||
{
|
||||
case 0: /* Child. Write to pipe. */
|
||||
close (fds[0]); /* Not needed. */
|
||||
if (fds[1] != 1) /* Redirect 1 (stdout) only if needed. */
|
||||
{
|
||||
close (1); /* We don't want the old stdout. */
|
||||
if (dup (fds[1]) == 0)/* Maybe stdin was closed. */
|
||||
{
|
||||
dup (fds[1]); /* Guaranteed to dup to 1 (stdout). */
|
||||
close (0);
|
||||
}
|
||||
close (fds[1]); /* No longer needed. */
|
||||
}
|
||||
execvp (args[0], args);
|
||||
_exit (2); /* 2 for `cmp'. */
|
||||
case -1: /* Error. */
|
||||
return 0;
|
||||
default: /* Parent. Read from pipe. */
|
||||
close (fds[1]); /* Not needed. */
|
||||
return fdopen (fds[0], "r");
|
||||
}
|
||||
}
|
||||
+672
@@ -0,0 +1,672 @@
|
||||
/* Simple bitsets.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
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 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "sbitset.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* This file implements fixed size bitsets stored as an array
|
||||
of words. Any unused bits in the last word must be zero. */
|
||||
|
||||
typedef struct sbitset_struct
|
||||
{
|
||||
unsigned int n_bits; /* Number of bits. */
|
||||
bitset_word words[1]; /* The array of bits. */
|
||||
}
|
||||
*sbitset;
|
||||
|
||||
|
||||
struct bitset_struct
|
||||
{
|
||||
struct bbitset_struct b;
|
||||
struct sbitset_struct s;
|
||||
};
|
||||
|
||||
static void sbitset_unused_clear PARAMS ((bitset));
|
||||
|
||||
static int sbitset_small_list PARAMS ((bitset, bitset_bindex *, bitset_bindex,
|
||||
bitset_bindex *));
|
||||
|
||||
static void sbitset_set PARAMS ((bitset, bitset_bindex));
|
||||
static void sbitset_reset PARAMS ((bitset, bitset_bindex));
|
||||
static int sbitset_test PARAMS ((bitset, bitset_bindex));
|
||||
static int sbitset_size PARAMS ((bitset));
|
||||
static int sbitset_op1 PARAMS ((bitset, enum bitset_ops));
|
||||
static int sbitset_op2 PARAMS ((bitset, bitset, enum bitset_ops));
|
||||
static int sbitset_op3 PARAMS ((bitset, bitset, bitset, enum bitset_ops));
|
||||
static int sbitset_op4 PARAMS ((bitset, bitset, bitset, bitset,
|
||||
enum bitset_ops));
|
||||
static int sbitset_list PARAMS ((bitset, bitset_bindex *, bitset_bindex,
|
||||
bitset_bindex *));
|
||||
static int sbitset_reverse_list
|
||||
PARAMS ((bitset, bitset_bindex *, bitset_bindex, bitset_bindex *));
|
||||
|
||||
#define SBITSET_N_WORDS(N) (((N) + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS)
|
||||
#define SBITSET_WORDS(X) ((X)->s.words)
|
||||
#define SBITSET_N_BITS(X) ((X)->s.n_bits)
|
||||
|
||||
|
||||
/* Return size in bits of bitset SRC. */
|
||||
static int
|
||||
sbitset_size (src)
|
||||
bitset src;
|
||||
{
|
||||
return SBITSET_N_BITS (src);
|
||||
}
|
||||
|
||||
|
||||
/* Find list of up to NUM bits set in BSET starting from and including
|
||||
*NEXT and store in array LIST. Return with actual number of bits
|
||||
found and with *NEXT indicating where search stopped. */
|
||||
static int
|
||||
sbitset_small_list (src, list, num, next)
|
||||
bitset src;
|
||||
bitset_bindex *list;
|
||||
bitset_bindex num;
|
||||
bitset_bindex *next;
|
||||
{
|
||||
bitset_bindex bitno;
|
||||
bitset_bindex count;
|
||||
bitset_windex size;
|
||||
bitset_word word;
|
||||
|
||||
word = SBITSET_WORDS (src)[0];
|
||||
|
||||
/* Short circuit common case. */
|
||||
if (!word)
|
||||
return 0;
|
||||
|
||||
size = SBITSET_N_BITS (src);
|
||||
bitno = *next;
|
||||
if (bitno >= size)
|
||||
return 0;
|
||||
|
||||
word >>= bitno;
|
||||
|
||||
/* If num is 1, we could speed things up with a binary search
|
||||
of the word of interest. */
|
||||
|
||||
if (num >= BITSET_WORD_BITS)
|
||||
{
|
||||
for (count = 0; word; bitno++)
|
||||
{
|
||||
if (word & 1)
|
||||
list[count++] = bitno;
|
||||
word >>= 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (count = 0; word; bitno++)
|
||||
{
|
||||
if (word & 1)
|
||||
{
|
||||
list[count++] = bitno;
|
||||
if (count >= num)
|
||||
{
|
||||
bitno++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
word >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
*next = bitno;
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
/* Set bit BITNO in bitset DST. */
|
||||
static void
|
||||
sbitset_set (dst, bitno)
|
||||
bitset dst ATTRIBUTE_UNUSED;
|
||||
bitset_bindex bitno ATTRIBUTE_UNUSED;
|
||||
{
|
||||
/* This should never occur for sbitsets. */
|
||||
abort ();
|
||||
}
|
||||
|
||||
|
||||
/* Reset bit BITNO in bitset DST. */
|
||||
static void
|
||||
sbitset_reset (dst, bitno)
|
||||
bitset dst ATTRIBUTE_UNUSED;
|
||||
bitset_bindex bitno ATTRIBUTE_UNUSED;
|
||||
{
|
||||
/* This should never occur for sbitsets. */
|
||||
abort ();
|
||||
}
|
||||
|
||||
|
||||
/* Test bit BITNO in bitset SRC. */
|
||||
static int
|
||||
sbitset_test (src, bitno)
|
||||
bitset src ATTRIBUTE_UNUSED;
|
||||
bitset_bindex bitno ATTRIBUTE_UNUSED;
|
||||
{
|
||||
/* This should never occur for sbitsets. */
|
||||
abort ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Find list of up to NUM bits set in BSET in reverse order, starting
|
||||
from and including NEXT and store in array LIST. Return with
|
||||
actual number of bits found and with *NEXT indicating where search
|
||||
stopped. */
|
||||
static int
|
||||
sbitset_reverse_list (src, list, num, next)
|
||||
bitset src;
|
||||
bitset_bindex *list;
|
||||
bitset_bindex num;
|
||||
bitset_bindex *next;
|
||||
{
|
||||
bitset_bindex bitno;
|
||||
bitset_bindex rbitno;
|
||||
bitset_bindex count;
|
||||
bitset_windex windex;
|
||||
unsigned int bitcnt;
|
||||
bitset_bindex bitoff;
|
||||
bitset_word word;
|
||||
bitset_word *srcp = SBITSET_WORDS (src);
|
||||
bitset_bindex n_bits = SBITSET_N_BITS (src);
|
||||
|
||||
rbitno = *next;
|
||||
|
||||
/* If num is 1, we could speed things up with a binary search
|
||||
of the word of interest. */
|
||||
|
||||
if (rbitno >= n_bits)
|
||||
return 0;
|
||||
|
||||
count = 0;
|
||||
|
||||
bitno = n_bits - (rbitno + 1);
|
||||
|
||||
windex = bitno / BITSET_WORD_BITS;
|
||||
bitcnt = bitno % BITSET_WORD_BITS;
|
||||
bitoff = windex * BITSET_WORD_BITS;
|
||||
|
||||
for (; windex != ~0U; windex--, bitoff -= BITSET_WORD_BITS,
|
||||
bitcnt = BITSET_WORD_BITS - 1)
|
||||
{
|
||||
word = srcp[windex] << (BITSET_WORD_BITS - 1 - bitcnt);
|
||||
for (; word; bitcnt--)
|
||||
{
|
||||
if (word & BITSET_MSB)
|
||||
{
|
||||
list[count++] = bitoff + bitcnt;
|
||||
if (count >= num)
|
||||
{
|
||||
*next = n_bits - (bitoff + bitcnt);
|
||||
return count;
|
||||
}
|
||||
}
|
||||
word <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
*next = n_bits - (bitoff + 1);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
/* Find list of up to NUM bits set in BSET starting from and including
|
||||
*NEXT and store in array LIST. Return with actual number of bits
|
||||
found and with *NEXT indicating where search stopped. */
|
||||
static int
|
||||
sbitset_list (src, list, num, next)
|
||||
bitset src;
|
||||
bitset_bindex *list;
|
||||
bitset_bindex num;
|
||||
bitset_bindex *next;
|
||||
{
|
||||
bitset_bindex bitno;
|
||||
bitset_bindex count;
|
||||
bitset_windex windex;
|
||||
bitset_bindex bitoff;
|
||||
bitset_windex size = src->b.csize;
|
||||
bitset_word *srcp = SBITSET_WORDS (src);
|
||||
bitset_word word;
|
||||
|
||||
bitno = *next;
|
||||
|
||||
count = 0;
|
||||
if (!bitno)
|
||||
{
|
||||
/* Many bitsets are zero, so make this common case fast. */
|
||||
for (windex = 0; windex < size && !srcp[windex]; windex++)
|
||||
continue;
|
||||
if (windex >= size)
|
||||
return 0;
|
||||
|
||||
/* If num is 1, we could speed things up with a binary search
|
||||
of the current word. */
|
||||
|
||||
bitoff = windex * BITSET_WORD_BITS;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bitno >= SBITSET_N_BITS (src))
|
||||
return 0;
|
||||
|
||||
windex = bitno / BITSET_WORD_BITS;
|
||||
bitno = bitno % BITSET_WORD_BITS;
|
||||
|
||||
if (bitno)
|
||||
{
|
||||
/* Handle the case where we start within a word.
|
||||
Most often, this is executed with large bitsets
|
||||
with many set bits where we filled the array
|
||||
on the previous call to this function. */
|
||||
|
||||
bitoff = windex * BITSET_WORD_BITS;
|
||||
word = srcp[windex] >> bitno;
|
||||
for (bitno = bitoff + bitno; word; bitno++)
|
||||
{
|
||||
if (word & 1)
|
||||
{
|
||||
list[count++] = bitno;
|
||||
if (count >= num)
|
||||
{
|
||||
*next = bitno + 1;
|
||||
return count;
|
||||
}
|
||||
}
|
||||
word >>= 1;
|
||||
}
|
||||
windex++;
|
||||
}
|
||||
bitoff = windex * BITSET_WORD_BITS;
|
||||
}
|
||||
|
||||
for (; windex < size; windex++, bitoff += BITSET_WORD_BITS)
|
||||
{
|
||||
if (!(word = srcp[windex]))
|
||||
continue;
|
||||
|
||||
if ((count + BITSET_WORD_BITS) < num)
|
||||
{
|
||||
for (bitno = bitoff; word; bitno++)
|
||||
{
|
||||
if (word & 1)
|
||||
list[count++] = bitno;
|
||||
word >>= 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (bitno = bitoff; word; bitno++)
|
||||
{
|
||||
if (word & 1)
|
||||
{
|
||||
list[count++] = bitno;
|
||||
if (count >= num)
|
||||
{
|
||||
*next = bitno + 1;
|
||||
return count;
|
||||
}
|
||||
}
|
||||
word >>= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*next = bitoff;
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
/* Ensure that any unused bits within the last word are clear. */
|
||||
static inline void
|
||||
sbitset_unused_clear (dst)
|
||||
bitset dst;
|
||||
{
|
||||
unsigned int last_bit;
|
||||
|
||||
last_bit = SBITSET_N_BITS (dst) % BITSET_WORD_BITS;
|
||||
if (last_bit)
|
||||
SBITSET_WORDS (dst)[dst->b.csize - 1] &=
|
||||
(bitset_word) ((1 << last_bit) - 1);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
sbitset_op1 (dst, op)
|
||||
bitset dst;
|
||||
enum bitset_ops op;
|
||||
{
|
||||
unsigned int i;
|
||||
bitset_word *dstp = SBITSET_WORDS (dst);
|
||||
unsigned int bytes;
|
||||
|
||||
bytes = sizeof (bitset_word) * dst->b.csize;
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case BITSET_OP_ZERO:
|
||||
memset (dstp, 0, bytes);
|
||||
break;
|
||||
|
||||
case BITSET_OP_ONES:
|
||||
memset (dstp, ~0, bytes);
|
||||
sbitset_unused_clear (dst);
|
||||
break;
|
||||
|
||||
case BITSET_OP_EMPTY_P:
|
||||
for (i = 0; i < dst->b.csize; i++)
|
||||
if (dstp[i])
|
||||
return 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
sbitset_op2 (dst, src, op)
|
||||
bitset dst;
|
||||
bitset src;
|
||||
enum bitset_ops op;
|
||||
{
|
||||
unsigned int i;
|
||||
bitset_word *srcp = SBITSET_WORDS (src);
|
||||
bitset_word *dstp = SBITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
#ifdef ENABLE_CHECKING
|
||||
/* Check for compatiblity. */
|
||||
if (SBITSET_N_BITS (src) != SBITSET_N_BITS (dst))
|
||||
abort ();
|
||||
#endif
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case BITSET_OP_COPY:
|
||||
if (srcp == dstp)
|
||||
break;
|
||||
memcpy (dstp, srcp, sizeof (bitset_word) * size);
|
||||
break;
|
||||
|
||||
case BITSET_OP_NOT:
|
||||
for (i = 0; i < size; i++)
|
||||
*dstp++ = ~(*srcp++);
|
||||
sbitset_unused_clear (dst);
|
||||
break;
|
||||
|
||||
case BITSET_OP_EQUAL_P:
|
||||
for (i = 0; i < size; i++)
|
||||
if (*srcp++ != *dstp++)
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case BITSET_OP_SUBSET_P:
|
||||
for (i = 0; i < size; i++, dstp++, srcp++)
|
||||
if (*dstp != (*srcp | *dstp))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case BITSET_OP_DISJOINT_P:
|
||||
for (i = 0; i < size; i++)
|
||||
if (*srcp++ & *dstp++)
|
||||
return 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
sbitset_op3 (dst, src1, src2, op)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
enum bitset_ops op;
|
||||
{
|
||||
unsigned int i;
|
||||
int changed = 0;
|
||||
bitset_word *src1p = SBITSET_WORDS (src1);
|
||||
bitset_word *src2p = SBITSET_WORDS (src2);
|
||||
bitset_word *dstp = SBITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
#ifdef ENABLE_CHECKING
|
||||
/* Check for compatiblity. */
|
||||
if (SBITSET_N_BITS (src1) != SBITSET_N_BITS (dst)
|
||||
SBITSET_N_BITS (src2) != SBITSET_N_BITS (dst))
|
||||
abort ();
|
||||
#endif
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case BITSET_OP_OR:
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = *src1p++ | *src2p++;
|
||||
|
||||
if (*dstp != tmp)
|
||||
{
|
||||
changed = 1;
|
||||
*dstp = tmp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BITSET_OP_AND:
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = *src1p++ & *src2p++;
|
||||
|
||||
if (*dstp != tmp)
|
||||
{
|
||||
changed = 1;
|
||||
*dstp = tmp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BITSET_OP_XOR:
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = *src1p++ ^ *src2p++;
|
||||
|
||||
if (*dstp != tmp)
|
||||
{
|
||||
changed = 1;
|
||||
*dstp = tmp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BITSET_OP_ANDN:
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = *src1p++ & ~(*src2p++);
|
||||
|
||||
if (*dstp != tmp)
|
||||
{
|
||||
changed = 1;
|
||||
*dstp = tmp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
sbitset_op4 (dst, src1, src2, src3, op)
|
||||
bitset dst;
|
||||
bitset src1;
|
||||
bitset src2;
|
||||
bitset src3;
|
||||
enum bitset_ops op;
|
||||
{
|
||||
unsigned int i;
|
||||
int changed = 0;
|
||||
bitset_word *src1p = SBITSET_WORDS (src1);
|
||||
bitset_word *src2p = SBITSET_WORDS (src2);
|
||||
bitset_word *src3p = SBITSET_WORDS (src3);
|
||||
bitset_word *dstp = SBITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
#ifdef ENABLE_CHECKING
|
||||
/* Check for compatiblity. */
|
||||
if (SBITSET_N_BITS (src1) != SBITSET_N_BITS (dst)
|
||||
|| SBITSET_N_BITS (src2) != SBITSET_N_BITS (dst)
|
||||
|| SBITSET_N_BITS (src3) != SBITSET_N_BITS (dst))
|
||||
abort ();
|
||||
#endif
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case BITSET_OP_OR_AND:
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = (*src1p++ | *src2p++) & *src3p++;
|
||||
|
||||
if (*dstp != tmp)
|
||||
{
|
||||
changed = 1;
|
||||
*dstp = tmp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BITSET_OP_AND_OR:
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = (*src1p++ & *src2p++) | *src3p++;
|
||||
|
||||
if (*dstp != tmp)
|
||||
{
|
||||
changed = 1;
|
||||
*dstp = tmp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BITSET_OP_ANDN_OR:
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = (*src1p++ & ~(*src2p++)) | *src3p++;
|
||||
|
||||
if (*dstp != tmp)
|
||||
{
|
||||
changed = 1;
|
||||
*dstp = tmp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
/* Vector of operations for single word bitsets. */
|
||||
struct bitset_ops_struct sbitset_small_ops = {
|
||||
sbitset_set,
|
||||
sbitset_reset,
|
||||
sbitset_test,
|
||||
sbitset_size,
|
||||
sbitset_op1,
|
||||
sbitset_op2,
|
||||
sbitset_op3,
|
||||
sbitset_op4,
|
||||
sbitset_small_list,
|
||||
sbitset_reverse_list,
|
||||
NULL,
|
||||
BITSET_ARRAY
|
||||
};
|
||||
|
||||
|
||||
/* Vector of operations for multiple word bitsets. */
|
||||
struct bitset_ops_struct sbitset_ops = {
|
||||
sbitset_set,
|
||||
sbitset_reset,
|
||||
sbitset_test,
|
||||
sbitset_size,
|
||||
sbitset_op1,
|
||||
sbitset_op2,
|
||||
sbitset_op3,
|
||||
sbitset_op4,
|
||||
sbitset_list,
|
||||
sbitset_reverse_list,
|
||||
NULL,
|
||||
BITSET_ARRAY
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
sbitset_bytes (n_bits)
|
||||
bitset_bindex n_bits;
|
||||
{
|
||||
unsigned int bytes, size;
|
||||
|
||||
size = SBITSET_N_WORDS (n_bits);
|
||||
bytes = size * sizeof (bitset_word);
|
||||
return sizeof (struct bitset_struct) + bytes - sizeof (bitset_word);
|
||||
}
|
||||
|
||||
|
||||
bitset
|
||||
sbitset_init (bset, n_bits)
|
||||
bitset bset;
|
||||
bitset_bindex n_bits;
|
||||
{
|
||||
bitset_windex size;
|
||||
|
||||
size = SBITSET_N_WORDS (n_bits);
|
||||
SBITSET_N_BITS (bset) = n_bits;
|
||||
|
||||
/* Use optimized routines if bitset fits within a single word.
|
||||
There is probably little merit if using caching since
|
||||
the small bitset will always fit in the cache. */
|
||||
if (size == 1)
|
||||
bset->b.ops = &sbitset_small_ops;
|
||||
else
|
||||
bset->b.ops = &sbitset_ops;
|
||||
|
||||
bset->b.cindex = 0;
|
||||
bset->b.csize = size;
|
||||
bset->b.cdata = SBITSET_WORDS (bset);
|
||||
return bset;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/* Functions to support sbitsets.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
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 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _SBITSET_H
|
||||
#define _SBITSET_H
|
||||
|
||||
#include "bbitset.h"
|
||||
|
||||
extern int sbitset_bytes PARAMS ((bitset_bindex));
|
||||
|
||||
extern bitset sbitset_init PARAMS ((bitset, bitset_bindex));
|
||||
|
||||
#endif
|
||||
+343
@@ -0,0 +1,343 @@
|
||||
/* Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C 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.
|
||||
|
||||
The GNU C 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 the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef __set_errno
|
||||
# define __set_errno(Val) errno = (Val)
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#ifndef P_tmpdir
|
||||
# define P_tmpdir "/tmp"
|
||||
#endif
|
||||
#ifndef TMP_MAX
|
||||
# define TMP_MAX 238328
|
||||
#endif
|
||||
#ifndef __GT_FILE
|
||||
# define __GT_FILE 0
|
||||
# define __GT_BIGFILE 1
|
||||
# define __GT_DIR 2
|
||||
# define __GT_NOCREATE 3
|
||||
#endif
|
||||
|
||||
#if STDC_HEADERS || _LIBC
|
||||
# include <stddef.h>
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#if HAVE_FCNTL_H || _LIBC
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_TIME_H || _LIBC
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDINT_H || _LIBC
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H || _LIBC
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
#if STAT_MACROS_BROKEN
|
||||
# undef S_ISDIR
|
||||
#endif
|
||||
#if !defined S_ISDIR && defined S_IFDIR
|
||||
# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
#if !S_IRUSR && S_IREAD
|
||||
# define S_IRUSR S_IREAD
|
||||
#endif
|
||||
#if !S_IRUSR
|
||||
# define S_IRUSR 00400
|
||||
#endif
|
||||
#if !S_IWUSR && S_IWRITE
|
||||
# define S_IWUSR S_IWRITE
|
||||
#endif
|
||||
#if !S_IWUSR
|
||||
# define S_IWUSR 00200
|
||||
#endif
|
||||
#if !S_IXUSR && S_IEXEC
|
||||
# define S_IXUSR S_IEXEC
|
||||
#endif
|
||||
#if !S_IXUSR
|
||||
# define S_IXUSR 00100
|
||||
#endif
|
||||
|
||||
#if _LIBC
|
||||
# define struct_stat64 struct stat64
|
||||
#else
|
||||
# define struct_stat64 struct stat
|
||||
# define __getpid getpid
|
||||
# define __gettimeofday gettimeofday
|
||||
# define __mkdir mkdir
|
||||
# define __open open
|
||||
# define __open64 open
|
||||
# define __lxstat64(version, path, buf) lstat (path, buf)
|
||||
# define __xstat64(version, path, buf) stat (path, buf)
|
||||
#endif
|
||||
|
||||
#if ! (HAVE___SECURE_GETENV || _LIBC)
|
||||
# define __secure_getenv getenv
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <hp-timing.h>
|
||||
# if HP_TIMING_AVAIL
|
||||
# define RANDOM_BITS(Var) \
|
||||
if (__builtin_expect (value == UINT64_C (0), 0)) \
|
||||
{ \
|
||||
/* If this is the first time this function is used initialize \
|
||||
the variable we accumulate the value in to some somewhat \
|
||||
random value. If we'd not do this programs at startup time \
|
||||
might have a reduced set of possible names, at least on slow \
|
||||
machines. */ \
|
||||
struct timeval tv; \
|
||||
__gettimeofday (&tv, NULL); \
|
||||
value = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec; \
|
||||
} \
|
||||
HP_TIMING_NOW (Var)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Use the widest available unsigned type if uint64_t is not
|
||||
available. The algorithm below extracts a number less than 62**6
|
||||
(approximately 2**35.725) from uint64_t, so ancient hosts where
|
||||
uintmax_t is only 32 bits lose about 3.725 bits of randomness,
|
||||
which is better than not having mkstemp at all. */
|
||||
#if !defined UINT64_MAX && !defined uint64_t
|
||||
# define uint64_t uintmax_t
|
||||
#endif
|
||||
|
||||
/* Return nonzero if DIR is an existent directory. */
|
||||
static int
|
||||
direxists (const char *dir)
|
||||
{
|
||||
struct_stat64 buf;
|
||||
return __xstat64 (_STAT_VER, dir, &buf) == 0 && S_ISDIR (buf.st_mode);
|
||||
}
|
||||
|
||||
/* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is
|
||||
non-null and exists, uses it; otherwise uses the first of $TMPDIR,
|
||||
P_tmpdir, /tmp that exists. Copies into TMPL a template suitable
|
||||
for use with mk[s]temp. Will fail (-1) if DIR is non-null and
|
||||
doesn't exist, none of the searched dirs exists, or there's not
|
||||
enough space in TMPL. */
|
||||
int
|
||||
__path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
|
||||
int try_tmpdir)
|
||||
{
|
||||
const char *d;
|
||||
size_t dlen, plen;
|
||||
|
||||
if (!pfx || !pfx[0])
|
||||
{
|
||||
pfx = "file";
|
||||
plen = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
plen = strlen (pfx);
|
||||
if (plen > 5)
|
||||
plen = 5;
|
||||
}
|
||||
|
||||
if (try_tmpdir)
|
||||
{
|
||||
d = __secure_getenv ("TMPDIR");
|
||||
if (d != NULL && direxists (d))
|
||||
dir = d;
|
||||
else if (dir != NULL && direxists (dir))
|
||||
/* nothing */ ;
|
||||
else
|
||||
dir = NULL;
|
||||
}
|
||||
if (dir == NULL)
|
||||
{
|
||||
if (direxists (P_tmpdir))
|
||||
dir = P_tmpdir;
|
||||
else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp"))
|
||||
dir = "/tmp";
|
||||
else
|
||||
{
|
||||
__set_errno (ENOENT);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
dlen = strlen (dir);
|
||||
while (dlen > 1 && dir[dlen - 1] == '/')
|
||||
dlen--; /* remove trailing slashes */
|
||||
|
||||
/* check we have room for "${dir}/${pfx}XXXXXX\0" */
|
||||
if (tmpl_len < dlen + 1 + plen + 6 + 1)
|
||||
{
|
||||
__set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* These are the characters used in temporary filenames. */
|
||||
static const char letters[] =
|
||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
|
||||
/* Generate a temporary file name based on TMPL. TMPL must match the
|
||||
rules for mk[s]temp (i.e. end in "XXXXXX"). The name constructed
|
||||
does not exist at the time of the call to __gen_tempname. TMPL is
|
||||
overwritten with the result.
|
||||
|
||||
KIND may be one of:
|
||||
__GT_NOCREATE: simply verify that the name does not exist
|
||||
at the time of the call.
|
||||
__GT_FILE: create the file using open(O_CREAT|O_EXCL)
|
||||
and return a read-write fd. The file is mode 0600.
|
||||
__GT_BIGFILE: same as __GT_FILE but use open64().
|
||||
__GT_DIR: create a directory, which will be mode 0700.
|
||||
|
||||
We use a clever algorithm to get hard-to-predict names. */
|
||||
int
|
||||
__gen_tempname (char *tmpl, int kind)
|
||||
{
|
||||
int len;
|
||||
char *XXXXXX;
|
||||
static uint64_t value;
|
||||
uint64_t random_time_bits;
|
||||
unsigned int count;
|
||||
int fd = -1;
|
||||
int save_errno = errno;
|
||||
struct_stat64 st;
|
||||
|
||||
/* A lower bound on the number of temporary files to attempt to
|
||||
generate. The maximum total number of temporary file names that
|
||||
can exist for a given template is 62**6. It should never be
|
||||
necessary to try all these combinations. Instead if a reasonable
|
||||
number of names is tried (we define reasonable as 62**3) fail to
|
||||
give the system administrator the chance to remove the problems. */
|
||||
unsigned int attempts_min = 62 * 62 * 62;
|
||||
|
||||
/* The number of times to attempt to generate a temporary file. To
|
||||
conform to POSIX, this must be no smaller than TMP_MAX. */
|
||||
unsigned int attempts = attempts_min < TMP_MAX ? TMP_MAX : attempts_min;
|
||||
|
||||
len = strlen (tmpl);
|
||||
if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX"))
|
||||
{
|
||||
__set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* This is where the Xs start. */
|
||||
XXXXXX = &tmpl[len - 6];
|
||||
|
||||
/* Get some more or less random data. */
|
||||
#ifdef RANDOM_BITS
|
||||
RANDOM_BITS (random_time_bits);
|
||||
#else
|
||||
# if HAVE_GETTIMEOFDAY || _LIBC
|
||||
{
|
||||
struct timeval tv;
|
||||
__gettimeofday (&tv, NULL);
|
||||
random_time_bits = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec;
|
||||
}
|
||||
# else
|
||||
random_time_bits = time (NULL);
|
||||
# endif
|
||||
#endif
|
||||
value += random_time_bits ^ __getpid ();
|
||||
|
||||
for (count = 0; count < attempts; value += 7777, ++count)
|
||||
{
|
||||
uint64_t v = value;
|
||||
|
||||
/* Fill in the random bits. */
|
||||
XXXXXX[0] = letters[v % 62];
|
||||
v /= 62;
|
||||
XXXXXX[1] = letters[v % 62];
|
||||
v /= 62;
|
||||
XXXXXX[2] = letters[v % 62];
|
||||
v /= 62;
|
||||
XXXXXX[3] = letters[v % 62];
|
||||
v /= 62;
|
||||
XXXXXX[4] = letters[v % 62];
|
||||
v /= 62;
|
||||
XXXXXX[5] = letters[v % 62];
|
||||
|
||||
switch (kind)
|
||||
{
|
||||
case __GT_FILE:
|
||||
fd = __open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
|
||||
break;
|
||||
|
||||
case __GT_BIGFILE:
|
||||
fd = __open64 (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
|
||||
break;
|
||||
|
||||
case __GT_DIR:
|
||||
fd = __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
|
||||
break;
|
||||
|
||||
case __GT_NOCREATE:
|
||||
/* This case is backward from the other three. __gen_tempname
|
||||
succeeds if __xstat fails because the name does not exist.
|
||||
Note the continue to bypass the common logic at the bottom
|
||||
of the loop. */
|
||||
if (__lxstat64 (_STAT_VER, tmpl, &st) < 0)
|
||||
{
|
||||
if (errno == ENOENT)
|
||||
{
|
||||
__set_errno (save_errno);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
/* Give up now. */
|
||||
return -1;
|
||||
}
|
||||
continue;
|
||||
|
||||
default:
|
||||
assert (! "invalid KIND in __gen_tempname");
|
||||
}
|
||||
|
||||
if (fd >= 0)
|
||||
{
|
||||
__set_errno (save_errno);
|
||||
return fd;
|
||||
}
|
||||
else if (errno != EEXIST)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* We got out of the loop because we ran out of combinations to try. */
|
||||
__set_errno (EEXIST);
|
||||
return -1;
|
||||
}
|
||||
@@ -1,2 +1,14 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
|
||||
# From Gettext
|
||||
codeset.m4
|
||||
gettext.m4
|
||||
glibc21.m4
|
||||
iconv.m4
|
||||
isc-posix.m4
|
||||
lcmessage.m4
|
||||
lib-ld.m4
|
||||
lib-link.m4
|
||||
lib-prefix.m4
|
||||
progtest.m4
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||
EXTRA_DIST = \
|
||||
EXTRA_DIST = lib-ld.m4 lib-link.m4 lib-prefix.m4 \
|
||||
c-bs-a.m4 \
|
||||
codeset.m4 \
|
||||
dmalloc.m4 \
|
||||
@@ -9,9 +9,11 @@ glibc21.m4 \
|
||||
iconv.m4 \
|
||||
isc-posix.m4 \
|
||||
lcmessage.m4 \
|
||||
m4.m4 \
|
||||
malloc.m4 \
|
||||
mbrtowc.m4 \
|
||||
mbstate_t.m4 \
|
||||
mkstemp.m4 \
|
||||
prereq.m4 \
|
||||
progtest.m4 \
|
||||
realloc.m4 \
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#serial AM1
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
AC_DEFUN([AM_LANGINFO_CODESET],
|
||||
[
|
||||
AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
|
||||
[AC_TRY_LINK([#include <langinfo.h>],
|
||||
[char* cs = nl_langinfo(CODESET);],
|
||||
am_cv_langinfo_codeset=yes,
|
||||
am_cv_langinfo_codeset=no)
|
||||
])
|
||||
if test $am_cv_langinfo_codeset = yes; then
|
||||
AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
|
||||
[Define if you have <langinfo.h> and nl_langinfo(CODESET).])
|
||||
fi
|
||||
])
|
||||
-370
@@ -1,370 +0,0 @@
|
||||
# Macro to add for using GNU gettext.
|
||||
# Ulrich Drepper <[email protected]>, 1995.
|
||||
#
|
||||
# This file can be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU General Public
|
||||
# License or the GNU Library General Public License but which still want
|
||||
# to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code of the GNU gettext library is covered
|
||||
# by the GNU Library General Public License, and the rest of the GNU
|
||||
# gettext package package is covered by the GNU General Public License.
|
||||
# They are *not* in the public domain.
|
||||
|
||||
# serial 10
|
||||
|
||||
dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
|
||||
dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
|
||||
dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
|
||||
dnl depending on --{enable,disable}-{shared,static} and on the presence of
|
||||
dnl AM-DISABLE-SHARED). Otherwise, a static library
|
||||
dnl $(top_builddir)/intl/libintl.a will be created.
|
||||
dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
|
||||
dnl implementations (in libc or libintl) without the ngettext() function
|
||||
dnl will be ignored.
|
||||
dnl LIBDIR is used to find the intl libraries. If empty,
|
||||
dnl the value `$(top_builddir)/intl/' is used.
|
||||
dnl
|
||||
dnl The result of the configuration is one of three cases:
|
||||
dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
|
||||
dnl and used.
|
||||
dnl Catalog format: GNU --> install in $(datadir)
|
||||
dnl Catalog extension: .mo after installation, .gmo in source tree
|
||||
dnl 2) GNU gettext has been found in the system's C library.
|
||||
dnl Catalog format: GNU --> install in $(datadir)
|
||||
dnl Catalog extension: .mo after installation, .gmo in source tree
|
||||
dnl 3) No internationalization, always use English msgid.
|
||||
dnl Catalog format: none
|
||||
dnl Catalog extension: none
|
||||
dnl The use of .gmo is historical (it was needed to avoid overwriting the
|
||||
dnl GNU format catalogs when building on a platform with an X/Open gettext),
|
||||
dnl but we keep it in order not to force irrelevant filename changes on the
|
||||
dnl maintainers.
|
||||
dnl
|
||||
AC_DEFUN([AM_WITH_NLS],
|
||||
[AC_MSG_CHECKING([whether NLS is requested])
|
||||
dnl Default is enabled NLS
|
||||
AC_ARG_ENABLE(nls,
|
||||
[ --disable-nls do not use Native Language Support],
|
||||
USE_NLS=$enableval, USE_NLS=yes)
|
||||
AC_MSG_RESULT($USE_NLS)
|
||||
AC_SUBST(USE_NLS)
|
||||
|
||||
BUILD_INCLUDED_LIBINTL=no
|
||||
USE_INCLUDED_LIBINTL=no
|
||||
INTLLIBS=
|
||||
|
||||
dnl If we use NLS figure out what method
|
||||
if test "$USE_NLS" = "yes"; then
|
||||
AC_DEFINE(ENABLE_NLS, 1,
|
||||
[Define to 1 if translation of program messages to the user's native language
|
||||
is requested.])
|
||||
AC_MSG_CHECKING([whether included gettext is requested])
|
||||
AC_ARG_WITH(included-gettext,
|
||||
[ --with-included-gettext use the GNU gettext library included here],
|
||||
nls_cv_force_use_gnu_gettext=$withval,
|
||||
nls_cv_force_use_gnu_gettext=no)
|
||||
AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
|
||||
|
||||
nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
|
||||
if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
|
||||
dnl User does not insist on using GNU NLS library. Figure out what
|
||||
dnl to use. If GNU gettext is available we use this. Else we have
|
||||
dnl to fall back to GNU NLS library.
|
||||
CATOBJEXT=NONE
|
||||
|
||||
dnl Add a version number to the cache macros.
|
||||
define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
|
||||
define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
|
||||
|
||||
AC_CHECK_HEADER(libintl.h,
|
||||
[AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
|
||||
[AC_TRY_LINK([#include <libintl.h>
|
||||
extern int _nl_msg_cat_cntr;],
|
||||
[bindtextdomain ("", "");
|
||||
return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
|
||||
gt_cv_func_gnugettext_libc=yes,
|
||||
gt_cv_func_gnugettext_libc=no)])
|
||||
|
||||
if test "$gt_cv_func_gnugettext_libc" != "yes"; then
|
||||
AC_CACHE_CHECK([for GNU gettext in libintl],
|
||||
gt_cv_func_gnugettext_libintl,
|
||||
[gt_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS -lintl $LIBICONV"
|
||||
AC_TRY_LINK([#include <libintl.h>
|
||||
extern int _nl_msg_cat_cntr;],
|
||||
[bindtextdomain ("", "");
|
||||
return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
|
||||
gt_cv_func_gnugettext_libintl=yes,
|
||||
gt_cv_func_gnugettext_libintl=no)
|
||||
LIBS="$gt_save_LIBS"])
|
||||
fi
|
||||
|
||||
dnl If an already present or preinstalled GNU gettext() is found,
|
||||
dnl use it. But if this macro is used in GNU gettext, and GNU
|
||||
dnl gettext is already preinstalled in libintl, we update this
|
||||
dnl libintl. (Cf. the install rule in intl/Makefile.in.)
|
||||
if test "$gt_cv_func_gnugettext_libc" = "yes" \
|
||||
|| { test "$gt_cv_func_gnugettext_libintl" = "yes" \
|
||||
&& test "$PACKAGE" != gettext; }; then
|
||||
AC_DEFINE(HAVE_GETTEXT, 1,
|
||||
[Define if the GNU gettext() function is already present or preinstalled.])
|
||||
|
||||
if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
|
||||
dnl If iconv() is in a separate libiconv library, then anyone
|
||||
dnl linking with libintl{.a,.so} also needs to link with
|
||||
dnl libiconv.
|
||||
INTLLIBS="-lintl $LIBICONV"
|
||||
fi
|
||||
|
||||
gt_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS $INTLLIBS"
|
||||
AC_CHECK_FUNCS(dcgettext)
|
||||
LIBS="$gt_save_LIBS"
|
||||
|
||||
dnl Search for GNU msgfmt in the PATH.
|
||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
|
||||
dnl Search for GNU xgettext in the PATH.
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
|
||||
|
||||
CATOBJEXT=.gmo
|
||||
fi
|
||||
])
|
||||
|
||||
if test "$CATOBJEXT" = "NONE"; then
|
||||
dnl GNU gettext is not found in the C library.
|
||||
dnl Fall back on GNU gettext library.
|
||||
nls_cv_use_gnu_gettext=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$nls_cv_use_gnu_gettext" = "yes"; then
|
||||
dnl Mark actions used to generate GNU NLS library.
|
||||
INTLOBJS="\$(GETTOBJS)"
|
||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
|
||||
AC_SUBST(MSGFMT)
|
||||
BUILD_INCLUDED_LIBINTL=yes
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
CATOBJEXT=.gmo
|
||||
INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
|
||||
LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
|
||||
fi
|
||||
|
||||
dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
|
||||
dnl Test whether we really found GNU msgfmt.
|
||||
if test "$GMSGFMT" != ":"; then
|
||||
dnl If it is no GNU msgfmt we define it as : so that the
|
||||
dnl Makefiles still can work.
|
||||
if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
|
||||
: ;
|
||||
else
|
||||
AC_MSG_RESULT(
|
||||
[found msgfmt program is not GNU msgfmt; ignore it])
|
||||
GMSGFMT=":"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
|
||||
dnl Test whether we really found GNU xgettext.
|
||||
if test "$XGETTEXT" != ":"; then
|
||||
dnl If it is no GNU xgettext we define it as : so that the
|
||||
dnl Makefiles still can work.
|
||||
if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
|
||||
: ;
|
||||
else
|
||||
AC_MSG_RESULT(
|
||||
[found xgettext program is not GNU xgettext; ignore it])
|
||||
XGETTEXT=":"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl We need to process the po/ directory.
|
||||
POSUB=po
|
||||
fi
|
||||
AC_OUTPUT_COMMANDS(
|
||||
[for ac_file in $CONFIG_FILES; do
|
||||
# Support "outfile[:infile[:infile...]]"
|
||||
case "$ac_file" in
|
||||
*:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
|
||||
esac
|
||||
# PO directories have a Makefile.in generated from Makefile.in.in.
|
||||
case "$ac_file" in */Makefile.in)
|
||||
# Adjust a relative srcdir.
|
||||
ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
|
||||
ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
|
||||
ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
|
||||
# In autoconf-2.13 it is called $ac_given_srcdir.
|
||||
# In autoconf-2.50 it is called $srcdir.
|
||||
test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
|
||||
case "$ac_given_srcdir" in
|
||||
.) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
|
||||
/*) top_srcdir="$ac_given_srcdir" ;;
|
||||
*) top_srcdir="$ac_dots$ac_given_srcdir" ;;
|
||||
esac
|
||||
if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
|
||||
rm -f "$ac_dir/POTFILES"
|
||||
test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
|
||||
sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
|
||||
test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
|
||||
sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done])
|
||||
|
||||
|
||||
dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
|
||||
dnl to 'yes' because some of the testsuite requires it.
|
||||
if test "$PACKAGE" = gettext; then
|
||||
BUILD_INCLUDED_LIBINTL=yes
|
||||
fi
|
||||
|
||||
dnl intl/plural.c is generated from intl/plural.y. It requires bison,
|
||||
dnl because plural.y uses bison specific features. It requires at least
|
||||
dnl bison-1.26 because earlier versions generate a plural.c that doesn't
|
||||
dnl compile.
|
||||
dnl bison is only needed for the maintainer (who touches plural.y). But in
|
||||
dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
|
||||
dnl the rule in general Makefile. Now, some people carelessly touch the
|
||||
dnl files or have a broken "make" program, hence the plural.c rule will
|
||||
dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
|
||||
dnl present or too old.
|
||||
AC_CHECK_PROGS([INTLBISON], [bison])
|
||||
if test -z "$INTLBISON"; then
|
||||
ac_verc_fail=yes
|
||||
else
|
||||
dnl Found it, now check the version.
|
||||
AC_MSG_CHECKING([version of bison])
|
||||
changequote(<<,>>)dnl
|
||||
ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
|
||||
case $ac_prog_version in
|
||||
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
|
||||
1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
|
||||
changequote([,])dnl
|
||||
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
|
||||
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
|
||||
esac
|
||||
AC_MSG_RESULT([$ac_prog_version])
|
||||
fi
|
||||
if test $ac_verc_fail = yes; then
|
||||
INTLBISON=:
|
||||
fi
|
||||
|
||||
dnl These rules are solely for the distribution goal. While doing this
|
||||
dnl we only have to keep exactly one list of the available catalogs
|
||||
dnl in configure.in.
|
||||
for lang in $ALL_LINGUAS; do
|
||||
GMOFILES="$GMOFILES $lang.gmo"
|
||||
POFILES="$POFILES $lang.po"
|
||||
done
|
||||
|
||||
dnl Make all variables we use known to autoconf.
|
||||
AC_SUBST(BUILD_INCLUDED_LIBINTL)
|
||||
AC_SUBST(USE_INCLUDED_LIBINTL)
|
||||
AC_SUBST(CATALOGS)
|
||||
AC_SUBST(CATOBJEXT)
|
||||
AC_SUBST(GMOFILES)
|
||||
AC_SUBST(INTLLIBS)
|
||||
AC_SUBST(INTLOBJS)
|
||||
AC_SUBST(POFILES)
|
||||
AC_SUBST(POSUB)
|
||||
|
||||
dnl For backward compatibility. Some configure.ins may be using this.
|
||||
nls_cv_header_intl=
|
||||
nls_cv_header_libgt=
|
||||
|
||||
dnl For backward compatibility. Some Makefiles may be using this.
|
||||
DATADIRNAME=share
|
||||
AC_SUBST(DATADIRNAME)
|
||||
|
||||
dnl For backward compatibility. Some Makefiles may be using this.
|
||||
INSTOBJEXT=.mo
|
||||
AC_SUBST(INSTOBJEXT)
|
||||
|
||||
dnl For backward compatibility. Some Makefiles may be using this.
|
||||
GENCAT=gencat
|
||||
AC_SUBST(GENCAT)
|
||||
])
|
||||
|
||||
dnl Usage: Just like AM_WITH_NLS, which see.
|
||||
AC_DEFUN([AM_GNU_GETTEXT],
|
||||
[AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_ISC_POSIX])dnl
|
||||
AC_REQUIRE([AC_HEADER_STDC])dnl
|
||||
AC_REQUIRE([AC_C_CONST])dnl
|
||||
AC_REQUIRE([AC_C_INLINE])dnl
|
||||
AC_REQUIRE([AC_TYPE_OFF_T])dnl
|
||||
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
|
||||
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
|
||||
AC_REQUIRE([AC_FUNC_MMAP])dnl
|
||||
AC_REQUIRE([jm_GLIBC21])dnl
|
||||
|
||||
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
|
||||
stdlib.h string.h unistd.h sys/param.h])
|
||||
AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
|
||||
getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
|
||||
strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
|
||||
|
||||
AM_ICONV
|
||||
AM_LANGINFO_CODESET
|
||||
AM_LC_MESSAGES
|
||||
AM_WITH_NLS([$1],[$2],[$3])
|
||||
|
||||
if test "x$CATOBJEXT" != "x"; then
|
||||
if test "x$ALL_LINGUAS" = "x"; then
|
||||
LINGUAS=
|
||||
else
|
||||
AC_MSG_CHECKING(for catalogs to be installed)
|
||||
NEW_LINGUAS=
|
||||
for presentlang in $ALL_LINGUAS; do
|
||||
useit=no
|
||||
for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
|
||||
# Use the presentlang catalog if desiredlang is
|
||||
# a. equal to presentlang, or
|
||||
# b. a variant of presentlang (because in this case,
|
||||
# presentlang can be used as a fallback for messages
|
||||
# which are not translated in the desiredlang catalog).
|
||||
case "$desiredlang" in
|
||||
"$presentlang"*) useit=yes;;
|
||||
esac
|
||||
done
|
||||
if test $useit = yes; then
|
||||
NEW_LINGUAS="$NEW_LINGUAS $presentlang"
|
||||
fi
|
||||
done
|
||||
LINGUAS=$NEW_LINGUAS
|
||||
AC_MSG_RESULT($LINGUAS)
|
||||
fi
|
||||
|
||||
dnl Construct list of names of catalog files to be constructed.
|
||||
if test -n "$LINGUAS"; then
|
||||
for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
|
||||
dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
|
||||
dnl Try to locate is.
|
||||
MKINSTALLDIRS=
|
||||
if test -n "$ac_aux_dir"; then
|
||||
MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
|
||||
fi
|
||||
if test -z "$MKINSTALLDIRS"; then
|
||||
MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
|
||||
fi
|
||||
AC_SUBST(MKINSTALLDIRS)
|
||||
|
||||
dnl Enable libtool support if the surrounding package wishes it.
|
||||
INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
|
||||
AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
|
||||
])
|
||||
@@ -1,26 +0,0 @@
|
||||
#serial 2
|
||||
|
||||
# Test for the GNU C Library, version 2.1 or newer.
|
||||
# From Bruno Haible.
|
||||
|
||||
AC_DEFUN([jm_GLIBC21],
|
||||
[
|
||||
AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
|
||||
ac_cv_gnu_library_2_1,
|
||||
[AC_EGREP_CPP([Lucky GNU user],
|
||||
[
|
||||
#include <features.h>
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
|
||||
Lucky GNU user
|
||||
#endif
|
||||
#endif
|
||||
],
|
||||
ac_cv_gnu_library_2_1=yes,
|
||||
ac_cv_gnu_library_2_1=no)
|
||||
]
|
||||
)
|
||||
AC_SUBST(GLIBC21)
|
||||
GLIBC21="$ac_cv_gnu_library_2_1"
|
||||
]
|
||||
)
|
||||
-69
@@ -1,69 +0,0 @@
|
||||
#serial AM2
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
AC_DEFUN([AM_ICONV],
|
||||
[
|
||||
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
|
||||
dnl those with the standalone portable GNU libiconv installed).
|
||||
|
||||
AC_ARG_WITH([libiconv-prefix],
|
||||
[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
|
||||
for dir in `echo "$withval" | tr : ' '`; do
|
||||
if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
|
||||
if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
|
||||
done
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
|
||||
am_cv_func_iconv="no, consider installing GNU libiconv"
|
||||
am_cv_lib_iconv=no
|
||||
AC_TRY_LINK([#include <stdlib.h>
|
||||
#include <iconv.h>],
|
||||
[iconv_t cd = iconv_open("","");
|
||||
iconv(cd,NULL,NULL,NULL,NULL);
|
||||
iconv_close(cd);],
|
||||
am_cv_func_iconv=yes)
|
||||
if test "$am_cv_func_iconv" != yes; then
|
||||
am_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS -liconv"
|
||||
AC_TRY_LINK([#include <stdlib.h>
|
||||
#include <iconv.h>],
|
||||
[iconv_t cd = iconv_open("","");
|
||||
iconv(cd,NULL,NULL,NULL,NULL);
|
||||
iconv_close(cd);],
|
||||
am_cv_lib_iconv=yes
|
||||
am_cv_func_iconv=yes)
|
||||
LIBS="$am_save_LIBS"
|
||||
fi
|
||||
])
|
||||
if test "$am_cv_func_iconv" = yes; then
|
||||
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
|
||||
AC_MSG_CHECKING([for iconv declaration])
|
||||
AC_CACHE_VAL(am_cv_proto_iconv, [
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdlib.h>
|
||||
#include <iconv.h>
|
||||
extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
#endif
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
|
||||
#else
|
||||
size_t iconv();
|
||||
#endif
|
||||
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
|
||||
am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
|
||||
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
|
||||
AC_MSG_RESULT([$]{ac_t:-
|
||||
}[$]am_cv_proto_iconv)
|
||||
AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
|
||||
[Define as const if the declaration of iconv() needs const.])
|
||||
fi
|
||||
LIBICONV=
|
||||
if test "$am_cv_lib_iconv" = yes; then
|
||||
LIBICONV="-liconv"
|
||||
fi
|
||||
AC_SUBST(LIBICONV)
|
||||
])
|
||||
@@ -1,17 +0,0 @@
|
||||
#serial 1
|
||||
# This test replaces the one in autoconf.
|
||||
# Currently this macro should have the same name as the autoconf macro
|
||||
# because gettext's gettext.m4 (distributed in the automake package)
|
||||
# still uses it. Otherwise, the use in gettext.m4 makes autoheader
|
||||
# give these diagnostics:
|
||||
# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
|
||||
# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
|
||||
|
||||
undefine([AC_ISC_POSIX])
|
||||
|
||||
AC_DEFUN([AC_ISC_POSIX],
|
||||
[
|
||||
dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
|
||||
AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
|
||||
]
|
||||
)
|
||||
@@ -1,24 +0,0 @@
|
||||
# Check whether LC_MESSAGES is available in <locale.h>.
|
||||
# Ulrich Drepper <[email protected]>, 1995.
|
||||
#
|
||||
# This file can be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU General Public
|
||||
# License or the GNU Library General Public License but which still want
|
||||
# to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code of the GNU gettext library is covered
|
||||
# by the GNU Library General Public License, and the rest of the GNU
|
||||
# gettext package package is covered by the GNU General Public License.
|
||||
# They are *not* in the public domain.
|
||||
|
||||
# serial 2
|
||||
|
||||
AC_DEFUN([AM_LC_MESSAGES],
|
||||
[if test $ac_cv_header_locale_h = yes; then
|
||||
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
|
||||
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
|
||||
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
|
||||
if test $am_cv_val_LC_MESSAGES = yes; then
|
||||
AC_DEFINE(HAVE_LC_MESSAGES, 1,
|
||||
[Define if your <locale.h> file defines LC_MESSAGES.])
|
||||
fi
|
||||
fi])
|
||||
@@ -0,0 +1,29 @@
|
||||
# Copyright 2000 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.
|
||||
#
|
||||
# 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# BISON_PROG_GNU_M4
|
||||
# -----------------
|
||||
# Check for GNU m4, at least 1.3 (supports frozen files).
|
||||
AC_DEFUN([BISON_PROG_GNU_M4],
|
||||
[AC_PATH_PROGS(M4, gm4 gnum4 m4, m4)
|
||||
AC_CACHE_CHECK(whether m4 supports frozen files, ac_cv_prog_gnu_m4,
|
||||
[ac_cv_prog_gnu_m4=no
|
||||
if test x"$M4" != x; then
|
||||
case `$M4 --help < /dev/null 2>&1` in
|
||||
*reload-state*) ac_cv_prog_gnu_m4=yes ;;
|
||||
esac
|
||||
fi])])
|
||||
@@ -0,0 +1,46 @@
|
||||
#serial 1
|
||||
|
||||
# On some systems (e.g., HPUX-10.20, SunOS4.1.4, solaris2.5.1), mkstemp has the
|
||||
# silly limit that it can create no more than 26 files from a given template.
|
||||
# Other systems lack mkstemp altogether. On either type of system, arrange
|
||||
# to use the replacement function.
|
||||
AC_DEFUN([UTILS_FUNC_MKSTEMP],
|
||||
[dnl
|
||||
AC_REPLACE_FUNCS(mkstemp)
|
||||
if test $ac_cv_func_mkstemp = no; then
|
||||
utils_cv_func_mkstemp_limitations=yes
|
||||
else
|
||||
AC_CACHE_CHECK([for mkstemp limitations],
|
||||
utils_cv_func_mkstemp_limitations,
|
||||
[
|
||||
AC_TRY_RUN([
|
||||
# include <stdlib.h>
|
||||
int main ()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 30; i++)
|
||||
{
|
||||
char template[] = "conftestXXXXXX";
|
||||
int fd = mkstemp (template);
|
||||
if (fd == -1)
|
||||
exit (1);
|
||||
close (fd);
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
],
|
||||
utils_cv_func_mkstemp_limitations=no,
|
||||
utils_cv_func_mkstemp_limitations=yes,
|
||||
utils_cv_func_mkstemp_limitations=yes
|
||||
)
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
if test $utils_cv_func_mkstemp_limitations = yes; then
|
||||
AC_LIBOBJ(mkstemp)
|
||||
AC_LIBOBJ(tempname)
|
||||
AC_DEFINE(mkstemp, rpl_mkstemp,
|
||||
[Define to rpl_mkstemp if the replacement function should be used.])
|
||||
fi
|
||||
])
|
||||
@@ -1,51 +0,0 @@
|
||||
# Search path for a program which passes the given test.
|
||||
# Ulrich Drepper <[email protected]>, 1996.
|
||||
#
|
||||
# This file can be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU General Public
|
||||
# License or the GNU Library General Public License but which still want
|
||||
# to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code of the GNU gettext library is covered
|
||||
# by the GNU Library General Public License, and the rest of the GNU
|
||||
# gettext package package is covered by the GNU General Public License.
|
||||
# They are *not* in the public domain.
|
||||
|
||||
# serial 2
|
||||
|
||||
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
|
||||
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
|
||||
AC_DEFUN([AM_PATH_PROG_WITH_TEST],
|
||||
[# Extract the first word of "$2", so it can be a program name with args.
|
||||
set dummy $2; ac_word=[$]2
|
||||
AC_MSG_CHECKING([for $ac_word])
|
||||
AC_CACHE_VAL(ac_cv_path_$1,
|
||||
[case "[$]$1" in
|
||||
/*)
|
||||
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in ifelse([$5], , $PATH, [$5]); do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/$ac_word; then
|
||||
if [$3]; then
|
||||
ac_cv_path_$1="$ac_dir/$ac_word"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
dnl If no 4th arg is given, leave the cache variable unset,
|
||||
dnl so AC_PATH_PROGS will keep looking.
|
||||
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
|
||||
])dnl
|
||||
;;
|
||||
esac])dnl
|
||||
$1="$ac_cv_path_$1"
|
||||
if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
|
||||
AC_MSG_RESULT([$]$1)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
AC_SUBST($1)dnl
|
||||
])
|
||||
+197
-76
@@ -1,18 +1,16 @@
|
||||
# Makefile for program source directory in GNU NLS utilities package.
|
||||
# Copyright (C) 1995-1997, 2000, 2001 by Ulrich Drepper <[email protected]>
|
||||
# Makefile for PO directory in any package using GNU gettext.
|
||||
# Copyright (C) 1995-1997, 2000-2002 by Ulrich Drepper <[email protected]>
|
||||
#
|
||||
# This file file be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU General Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
# This file can be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU General Public
|
||||
# License but which still want to provide support for the GNU gettext
|
||||
# functionality.
|
||||
# Please note that the actual code of GNU gettext is covered by the GNU
|
||||
# General Public License and is *not* in the public domain.
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
|
||||
# These two variables depend on the location of this directory.
|
||||
subdir = po
|
||||
top_builddir = ..
|
||||
|
||||
SHELL = /bin/sh
|
||||
@SET_MAKE@
|
||||
|
||||
@@ -31,45 +29,47 @@ INSTALL_DATA = @INSTALL_DATA@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac`
|
||||
|
||||
CC = @CC@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
MSGFMT = @MSGFMT@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
MSGMERGE = msgmerge
|
||||
|
||||
DEFS = @DEFS@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
|
||||
INCLUDES = -I.. -I$(top_srcdir)/intl
|
||||
|
||||
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
|
||||
MSGMERGE_UPDATE = @MSGMERGE@ --update
|
||||
MSGINIT = msginit
|
||||
MSGCONV = msgconv
|
||||
MSGFILTER = msgfilter
|
||||
|
||||
POFILES = @POFILES@
|
||||
GMOFILES = @GMOFILES@
|
||||
DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
|
||||
$(POFILES) $(GMOFILES)
|
||||
UPDATEPOFILES = @UPDATEPOFILES@
|
||||
DUMMYPOFILES = @DUMMYPOFILES@
|
||||
DISTFILES.common = Makefile.in.in Makevars remove-potcdate.sin \
|
||||
$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
|
||||
DISTFILES = $(DISTFILES.common) POTFILES.in $(DOMAIN).pot \
|
||||
$(POFILES) $(GMOFILES) \
|
||||
$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
|
||||
|
||||
POTFILES = \
|
||||
|
||||
CATALOGS = @CATALOGS@
|
||||
|
||||
# Makevars gets inserted here. (Don't remove this line!)
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .po .pox .gmo .mo
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) $<
|
||||
|
||||
.po.pox:
|
||||
$(MAKE) $(PACKAGE).pot
|
||||
$(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
|
||||
.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-update
|
||||
|
||||
.po.mo:
|
||||
$(MSGFMT) -o $@ $<
|
||||
@echo "$(MSGFMT) -c -o $@ $<"; \
|
||||
$(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
|
||||
|
||||
.po.gmo:
|
||||
file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
|
||||
&& rm -f $$file && $(GMSGFMT) --statistics -o $$file $<
|
||||
@lang=`echo $* | sed -e 's,.*/,,'`; \
|
||||
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
|
||||
echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
|
||||
cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
|
||||
|
||||
.sin.sed:
|
||||
sed -e '/^#/d' $< > t-$@
|
||||
mv t-$@ $@
|
||||
|
||||
|
||||
all: all-@USE_NLS@
|
||||
@@ -77,17 +77,38 @@ all: all-@USE_NLS@
|
||||
all-yes: $(CATALOGS)
|
||||
all-no:
|
||||
|
||||
# Note: Target 'all' must not depend on target '$(srcdir)/$(PACKAGE).pot',
|
||||
# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
|
||||
# otherwise packages like GCC can not be built if only parts of the source
|
||||
# have been downloaded.
|
||||
|
||||
$(srcdir)/$(PACKAGE).pot: $(POTFILES) $(srcdir)/POTFILES.in
|
||||
$(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
|
||||
--add-comments --keyword=_ --keyword=N_ \
|
||||
$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
|
||||
$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
|
||||
--add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
|
||||
--files-from=$(srcdir)/POTFILES.in \
|
||||
&& test ! -f $(PACKAGE).po \
|
||||
|| ( rm -f $(srcdir)/$(PACKAGE).pot \
|
||||
&& mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )
|
||||
--copyright-holder='$(COPYRIGHT_HOLDER)'
|
||||
test ! -f $(DOMAIN).po || { \
|
||||
if test -f $(srcdir)/$(DOMAIN).pot; then \
|
||||
sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
|
||||
sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
|
||||
if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
|
||||
rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
|
||||
else \
|
||||
rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
|
||||
mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
|
||||
fi; \
|
||||
else \
|
||||
mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
|
||||
fi; \
|
||||
}
|
||||
|
||||
$(srcdir)/$(DOMAIN).pot:
|
||||
$(MAKE) $(DOMAIN).pot-update
|
||||
|
||||
$(POFILES): $(srcdir)/$(DOMAIN).pot
|
||||
@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
|
||||
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
|
||||
echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
|
||||
cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot
|
||||
|
||||
|
||||
install: install-exec install-data
|
||||
@@ -95,8 +116,10 @@ install-exec:
|
||||
install-data: install-data-@USE_NLS@
|
||||
if test "$(PACKAGE)" = "gettext"; then \
|
||||
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
|
||||
$(INSTALL_DATA) $(srcdir)/Makefile.in.in \
|
||||
$(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
|
||||
for file in $(DISTFILES.common); do \
|
||||
$(INSTALL_DATA) $(srcdir)/$$file \
|
||||
$(DESTDIR)$(gettextsrcdir)/$$file; \
|
||||
done; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
@@ -106,41 +129,117 @@ install-data-yes: all
|
||||
@catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
cat=`basename $$cat`; \
|
||||
lang=`echo $$cat | sed 's/\.gmo$$//'`; \
|
||||
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
|
||||
dir=$(localedir)/$$lang/LC_MESSAGES; \
|
||||
$(mkinstalldirs) $(DESTDIR)$$dir; \
|
||||
if test -r $$cat; then \
|
||||
$(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
|
||||
echo "installing $$cat as $(DESTDIR)$$dir/$(PACKAGE).mo"; \
|
||||
else \
|
||||
$(INSTALL_DATA) $(srcdir)/$$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
|
||||
echo "installing $(srcdir)/$$cat as" \
|
||||
"$(DESTDIR)$$dir/$(PACKAGE).mo"; \
|
||||
fi; \
|
||||
if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
|
||||
$(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
|
||||
echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
|
||||
for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
|
||||
if test -n "$$lc"; then \
|
||||
if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
|
||||
link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
|
||||
mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
|
||||
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
|
||||
(cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
|
||||
for file in *; do \
|
||||
if test -f $$file; then \
|
||||
ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
|
||||
fi; \
|
||||
done); \
|
||||
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
|
||||
else \
|
||||
if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
|
||||
:; \
|
||||
else \
|
||||
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
|
||||
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
|
||||
fi; \
|
||||
fi; \
|
||||
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
|
||||
ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
|
||||
ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
|
||||
cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
|
||||
echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
|
||||
fi; \
|
||||
done; \
|
||||
done
|
||||
|
||||
install-strip: install
|
||||
|
||||
installdirs: installdirs-exec installdirs-data
|
||||
installdirs-exec:
|
||||
installdirs-data: installdirs-data-@USE_NLS@
|
||||
if test "$(PACKAGE)" = "gettext"; then \
|
||||
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
installdirs-data-no:
|
||||
installdirs-data-yes:
|
||||
$(mkinstalldirs) $(DESTDIR)$(datadir)
|
||||
@catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
cat=`basename $$cat`; \
|
||||
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
|
||||
dir=$(localedir)/$$lang/LC_MESSAGES; \
|
||||
$(mkinstalldirs) $(DESTDIR)$$dir; \
|
||||
for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
|
||||
if test -n "$$lc"; then \
|
||||
if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
|
||||
link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
|
||||
mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
|
||||
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
|
||||
(cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
|
||||
for file in *; do \
|
||||
if test -f $$file; then \
|
||||
ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
|
||||
fi; \
|
||||
done); \
|
||||
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
|
||||
else \
|
||||
if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
|
||||
:; \
|
||||
else \
|
||||
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
|
||||
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
|
||||
fi; \
|
||||
fi; \
|
||||
fi; \
|
||||
done; \
|
||||
done
|
||||
|
||||
# Define this as empty until I found a useful application.
|
||||
installcheck:
|
||||
|
||||
uninstall:
|
||||
catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
cat=`basename $$cat`; \
|
||||
lang=`echo $$cat | sed 's/\.gmo$$//'`; \
|
||||
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
|
||||
done
|
||||
uninstall: uninstall-exec uninstall-data
|
||||
uninstall-exec:
|
||||
uninstall-data: uninstall-data-@USE_NLS@
|
||||
if test "$(PACKAGE)" = "gettext"; then \
|
||||
rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
|
||||
for file in $(DISTFILES.common); do \
|
||||
rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
|
||||
done; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
uninstall-data-no:
|
||||
uninstall-data-yes:
|
||||
catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
cat=`basename $$cat`; \
|
||||
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
|
||||
for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
|
||||
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
|
||||
done; \
|
||||
done
|
||||
|
||||
check: all
|
||||
|
||||
dvi info tags TAGS ID:
|
||||
|
||||
mostlyclean:
|
||||
rm -f core core.* *.pox $(PACKAGE).po *.new.po
|
||||
rm -f remove-potcdate.sed
|
||||
rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
|
||||
rm -fr *.o
|
||||
|
||||
clean: mostlyclean
|
||||
@@ -160,29 +259,49 @@ dist distdir:
|
||||
# This is a separate target because 'update-po' must be executed before.
|
||||
dist2: $(DISTFILES)
|
||||
dists="$(DISTFILES)"; \
|
||||
if test -f $(srcdir)/ChangeLog; then dists="$$dists ChangeLog"; fi; \
|
||||
if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
|
||||
for file in $$dists; do \
|
||||
if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
|
||||
cp -p $$dir/$$file $(distdir); \
|
||||
if test -f $$file; then \
|
||||
cp -p $$file $(distdir); \
|
||||
else \
|
||||
cp -p $(srcdir)/$$file $(distdir); \
|
||||
fi; \
|
||||
done
|
||||
|
||||
update-po: Makefile
|
||||
$(MAKE) $(PACKAGE).pot
|
||||
if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \
|
||||
cd $(srcdir); \
|
||||
catalogs='$(GMOFILES)'; \
|
||||
for cat in $$catalogs; do \
|
||||
cat=`basename $$cat`; \
|
||||
lang=`echo $$cat | sed 's/\.gmo$$//'`; \
|
||||
echo "$$lang:"; \
|
||||
if $(MSGMERGE) $$lang.po $(PACKAGE).pot -o $$lang.new.po; then \
|
||||
mv -f $$lang.new.po $$lang.po; \
|
||||
else \
|
||||
echo "msgmerge for $$cat failed!"; \
|
||||
rm -f $$lang.new.po; \
|
||||
fi; \
|
||||
done
|
||||
$(MAKE) $(DOMAIN).pot-update
|
||||
$(MAKE) $(UPDATEPOFILES)
|
||||
$(MAKE) update-gmo
|
||||
|
||||
# General rule for updating PO files.
|
||||
|
||||
.nop.po-update:
|
||||
@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
|
||||
if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \
|
||||
tmpdir=`pwd`; \
|
||||
echo "$$lang:"; \
|
||||
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
|
||||
echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
|
||||
cd $(srcdir); \
|
||||
if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
|
||||
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
|
||||
rm -f $$tmpdir/$$lang.new.po; \
|
||||
else \
|
||||
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
|
||||
:; \
|
||||
else \
|
||||
echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi; \
|
||||
else \
|
||||
echo "msgmerge for $$lang.po failed!" 1>&2; \
|
||||
rm -f $$tmpdir/$$lang.new.po; \
|
||||
fi
|
||||
|
||||
$(DUMMYPOFILES):
|
||||
|
||||
update-gmo: Makefile $(GMOFILES)
|
||||
@:
|
||||
|
||||
@@ -191,6 +310,8 @@ Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in
|
||||
&& CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
|
||||
$(SHELL) ./config.status
|
||||
|
||||
force:
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make not to export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
# Makefile variables for PO directory in any package using GNU gettext.
|
||||
|
||||
# Usually the message domain is the same as the package name.
|
||||
DOMAIN = $(PACKAGE)
|
||||
|
||||
# These two variables depend on the location of this directory.
|
||||
subdir = po
|
||||
top_builddir = ..
|
||||
|
||||
# These options get passed to xgettext.
|
||||
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
|
||||
|
||||
# This is the copyright holder that gets inserted into the header of the
|
||||
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
|
||||
# package. (Note that the msgstr strings, extracted from the package's
|
||||
# sources, belong to the copyright holder of the package.) Translators are
|
||||
# expected to transfer the copyright for their translations to this person
|
||||
# or entity, or to disclaim their copyright. The empty string stands for
|
||||
# the public domain; in this case the translators are expected to disclaim
|
||||
# their copyright.
|
||||
COPYRIGHT_HOLDER = Free Software Foundation, Inc.
|
||||
|
||||
# This is the list of locale categories, beyond LC_MESSAGES, for which the
|
||||
# message catalogs shall be used. It is usually empty.
|
||||
EXTRA_LOCALE_CATEGORIES =
|
||||
@@ -5,10 +5,7 @@ src/files.c
|
||||
src/getargs.c
|
||||
src/lalr.c
|
||||
src/lex.c
|
||||
src/main.c
|
||||
src/output.c
|
||||
src/print.c
|
||||
src/print_graph.c
|
||||
src/reader.c
|
||||
src/reduce.c
|
||||
|
||||
|
||||
@@ -4,21 +4,22 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: bison 1.28d\n"
|
||||
"POT-Creation-Date: 2002-01-29 17:17+0100\n"
|
||||
"PO-Revision-Date: 2001-08-29 17:06+02:00\n"
|
||||
"Project-Id-Version: bison 1.33b\n"
|
||||
"POT-Creation-Date: 2002-05-02 09:20+0200\n"
|
||||
"PO-Revision-Date: 2002-03-05 16:27+0200\n"
|
||||
"Last-Translator: Toomas Soome <[email protected]>\n"
|
||||
"Language-Team: Estonian <[email protected]>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=ISO-8859-15\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#: src/LR0.c:194
|
||||
#: src/LR0.c:198
|
||||
#, c-format
|
||||
msgid "too many states (max %d)"
|
||||
msgstr "liiga palju olekuid (maks %d)"
|
||||
|
||||
#: lib/error.c:128 lib/error.c:156 src/complain.c:99
|
||||
#: src/complain.c:99 lib/error.c:128 lib/error.c:156
|
||||
msgid "Unknown system error"
|
||||
msgstr "Tundmatu süsteemi viga"
|
||||
|
||||
@@ -30,93 +31,91 @@ msgstr "hoiatus: "
|
||||
msgid "fatal error: "
|
||||
msgstr "fataalne viga: "
|
||||
|
||||
#: src/conflicts.c:46
|
||||
#: src/conflicts.c:48
|
||||
#, c-format
|
||||
msgid "Conflict in state %d between rule %d and token %s resolved as %s.\n"
|
||||
msgstr "Konflikt olekus %d reegli %d ja märgi %s vahel lahendatud, kui %s.\n"
|
||||
|
||||
#: src/conflicts.c:111 src/conflicts.c:133
|
||||
#: src/conflicts.c:115 src/conflicts.c:137
|
||||
msgid "reduce"
|
||||
msgstr "redutseerimine"
|
||||
|
||||
#: src/conflicts.c:116 src/conflicts.c:128
|
||||
#: src/conflicts.c:120 src/conflicts.c:132
|
||||
msgid "shift"
|
||||
msgstr "nihutamine"
|
||||
|
||||
#: src/conflicts.c:138
|
||||
#: src/conflicts.c:142
|
||||
msgid "an error"
|
||||
msgstr "viga"
|
||||
|
||||
#: src/conflicts.c:291
|
||||
#, fuzzy, c-format
|
||||
#: src/conflicts.c:284
|
||||
#, c-format
|
||||
msgid "%d shift/reduce conflict"
|
||||
msgid_plural "%d shift/reduce conflicts"
|
||||
msgstr[0] " %d nihutamine/redutseerimine konflikti"
|
||||
msgstr[0] "%d nihutamine/redutseerimine konflikt"
|
||||
msgstr[1] "%d nihutamine/redutseerimine konflikti"
|
||||
|
||||
#: src/conflicts.c:298
|
||||
#, fuzzy
|
||||
#: src/conflicts.c:291
|
||||
msgid "and"
|
||||
msgstr " ja"
|
||||
msgstr "ja"
|
||||
|
||||
#: src/conflicts.c:304
|
||||
#, fuzzy, c-format
|
||||
#: src/conflicts.c:297
|
||||
#, c-format
|
||||
msgid "%d reduce/reduce conflict"
|
||||
msgid_plural "%d reduce/reduce conflicts"
|
||||
msgstr[0] " %d redutseerimine/redutseerimine konflikti"
|
||||
msgstr[0] "%d redutseerimine/redutseerimine konflikt"
|
||||
msgstr[1] "%d redutseerimine/redutseerimine konflikti"
|
||||
|
||||
#: src/conflicts.c:329
|
||||
#, fuzzy, c-format
|
||||
#: src/conflicts.c:322
|
||||
#, c-format
|
||||
msgid "State %d contains "
|
||||
msgstr "Olek %d sisaldab"
|
||||
msgstr "Olek %d sisaldab "
|
||||
|
||||
#. If invoked with `--yacc', use the output format specified by
|
||||
#. POSIX.
|
||||
#: src/conflicts.c:376
|
||||
#: src/conflicts.c:369
|
||||
msgid "conflicts: "
|
||||
msgstr "konfliktid: "
|
||||
|
||||
#: src/conflicts.c:378
|
||||
#: src/conflicts.c:371
|
||||
#, c-format
|
||||
msgid " %d shift/reduce"
|
||||
msgstr " %d nihutamine/redutseerimine"
|
||||
|
||||
#: src/conflicts.c:382
|
||||
#: src/conflicts.c:375
|
||||
#, c-format
|
||||
msgid " %d reduce/reduce"
|
||||
msgstr " %d redutseerimine/redutseerimine"
|
||||
|
||||
#: src/conflicts.c:387 src/reduce.c:499
|
||||
#: src/conflicts.c:380 src/reduce.c:391
|
||||
#, c-format
|
||||
msgid "%s contains "
|
||||
msgstr "%s sisaldab "
|
||||
|
||||
#: src/conflicts.c:394
|
||||
#, fuzzy, c-format
|
||||
#: src/conflicts.c:387
|
||||
#, c-format
|
||||
msgid "expected %d shift/reduce conflict\n"
|
||||
msgid_plural "expected %d shift/reduce conflicts\n"
|
||||
msgstr[0] " %d nihutamine/redutseerimine konflikti"
|
||||
msgstr[0] "eeldasime %d nihutamine/redutseerimine konflikti\n"
|
||||
msgstr[1] "eeldasime %d nihutamine/redutseerimine konflikti\n"
|
||||
|
||||
#: src/files.c:159
|
||||
#: src/files.c:160
|
||||
#, c-format
|
||||
msgid "cannot open file `%s'"
|
||||
msgstr "faili `%s' ei saa avada"
|
||||
|
||||
#: src/files.c:178
|
||||
#: src/files.c:179
|
||||
msgid "cannot close file"
|
||||
msgstr "faili ei õnnestu sulgeda"
|
||||
|
||||
#. Some efforts were made to ease the translators' task, please
|
||||
#. continue.
|
||||
#: src/getargs.c:55
|
||||
#: src/getargs.c:56
|
||||
msgid "GNU bison generates parsers for LALR(1) grammars.\n"
|
||||
msgstr "GNU bison genereerib parsereid LALR(1) grammatikatele.\n"
|
||||
|
||||
#: src/getargs.c:59
|
||||
#: src/getargs.c:60
|
||||
#, c-format
|
||||
msgid "Usage: %s [OPTION]... FILE\n"
|
||||
msgstr "Kasuta: %s [VÕTI]...FAIL\n"
|
||||
|
||||
#: src/getargs.c:63
|
||||
#: src/getargs.c:64
|
||||
msgid ""
|
||||
"If a long option shows an argument as mandatory, then it is mandatory\n"
|
||||
"for the equivalent short option also. Similarly for optional arguments.\n"
|
||||
@@ -124,7 +123,7 @@ msgstr ""
|
||||
"Kui pikk võti näitab, et argument on kohustuslik, siis on see kohustuslik \n"
|
||||
"ka lühikese võtme korral. Sama ka vabalt valitavate võtmete korral.\n"
|
||||
|
||||
#: src/getargs.c:69
|
||||
#: src/getargs.c:70
|
||||
msgid ""
|
||||
"Operation modes:\n"
|
||||
" -h, --help display this help and exit\n"
|
||||
@@ -136,7 +135,7 @@ msgstr ""
|
||||
" -V, --version esita versiooniinfo ja lõpeta töö\n"
|
||||
" -y, --yacc emuleeri POSIX yacc\n"
|
||||
|
||||
#: src/getargs.c:76
|
||||
#: src/getargs.c:77
|
||||
msgid ""
|
||||
"Parser:\n"
|
||||
" -S, --skeleton=FILE specify the skeleton to use\n"
|
||||
@@ -156,8 +155,7 @@ msgstr ""
|
||||
" -n, --no-parser genereeri ainult tabelid\n"
|
||||
" -k, --token-table lisa ka sümbolite nimede tabel\n"
|
||||
|
||||
#: src/getargs.c:88
|
||||
#, fuzzy
|
||||
#: src/getargs.c:89
|
||||
msgid ""
|
||||
"Output:\n"
|
||||
" -d, --defines also produce a header file\n"
|
||||
@@ -174,23 +172,25 @@ msgstr ""
|
||||
" -o, --output-file=FAIL jäta väljund FAILi\n"
|
||||
" -g, --graph loo automaadi kirjeldus VCG graafina\n"
|
||||
|
||||
#: src/getargs.c:98
|
||||
#: src/getargs.c:99
|
||||
msgid "Report bugs to <[email protected]>.\n"
|
||||
msgstr "Teatage palun vigadest aadressil <[email protected]>.\n"
|
||||
|
||||
#. Some efforts were made to ease the translators' task, please
|
||||
#. continue.
|
||||
#: src/getargs.c:112
|
||||
#: src/getargs.c:113
|
||||
#, c-format
|
||||
msgid "bison (GNU Bison) %s"
|
||||
msgstr "bison (GNU Bison) %s"
|
||||
|
||||
#: src/getargs.c:117
|
||||
msgid ""
|
||||
"Copyright 1984, 1986, 1989, 1992, 2000, 2001 Free Software Foundation, Inc.\n"
|
||||
#: src/getargs.c:115
|
||||
msgid "Written by Robert Corbett and Richard Stallman.\n"
|
||||
msgstr ""
|
||||
"Autoriõigus 1984, 1986, 1989, 1992, 2000, 2001 Free Software Foundation, "
|
||||
"Inc.\n"
|
||||
|
||||
#: src/getargs.c:119
|
||||
#, fuzzy, c-format
|
||||
msgid "Copyright (C) %d Free Software Foundation, Inc.\n"
|
||||
msgstr ""
|
||||
"Autoriõigus 1984, 1986, 1989, 1992, 2000, 2001, 2002\n"
|
||||
"Free Software Foundation, Inc.\n"
|
||||
|
||||
#: src/getargs.c:121
|
||||
msgid ""
|
||||
@@ -200,7 +200,7 @@ msgstr ""
|
||||
"See on vaba tarkvara; kopeerimistingimused leiate lähtetekstidest. Garantii\n"
|
||||
"PUUDUB; ka müügiks või mingil eesmärgil kasutamiseks.\n"
|
||||
|
||||
#: src/getargs.c:200 src/lex.c:599
|
||||
#: src/getargs.c:200 src/lex.c:603
|
||||
#, c-format
|
||||
msgid "`%s' is no longer supported"
|
||||
msgstr "`%s' ei ole enam toetatud"
|
||||
@@ -220,7 +220,7 @@ msgstr "%s: puudub grammatikafail\n"
|
||||
msgid "%s: extra arguments ignored after `%s'\n"
|
||||
msgstr "%s: ignoreerin lisaargumente peale `%s'\n"
|
||||
|
||||
#: src/lalr.c:175
|
||||
#: src/lalr.c:174
|
||||
#, c-format
|
||||
msgid "too many gotos (max %d)"
|
||||
msgstr "liiga palju gotosid (maks %d)"
|
||||
@@ -229,7 +229,7 @@ msgstr "liiga palju gotosid (maks %d)"
|
||||
msgid "unexpected `/' found and ignored"
|
||||
msgstr "leidsin ja ignoreerin ootamatu `/'"
|
||||
|
||||
#: src/lex.c:106 src/reader.c:302
|
||||
#: src/lex.c:106 src/reader.c:485
|
||||
msgid "unterminated comment"
|
||||
msgstr "lõpetamata kommentaar"
|
||||
|
||||
@@ -268,47 +268,42 @@ msgstr "l
|
||||
msgid "use \"...\" for multi-character literal tokens"
|
||||
msgstr "kasuta mitmesümboliliste literaalidega \"...\" konstruktsiooni"
|
||||
|
||||
#: src/lex.c:571
|
||||
#: src/lex.c:575
|
||||
#, c-format
|
||||
msgid "`%s' supports no argument: %s"
|
||||
msgstr ""
|
||||
msgstr "`%s' ei toeta argumente: %s"
|
||||
|
||||
#: src/lex.c:588
|
||||
#, fuzzy, c-format
|
||||
msgid "`%s' requires an argument"
|
||||
msgstr "%s: võti `%s' nõuab argumenti\n"
|
||||
|
||||
#: src/output.c:804
|
||||
#: src/lex.c:592
|
||||
#, c-format
|
||||
msgid "maximum table size (%d) exceeded"
|
||||
msgstr "ületati maksimaalset tabelisuurust (%d)"
|
||||
msgid "`%s' requires an argument"
|
||||
msgstr "võti `%s' nõuab argumenti"
|
||||
|
||||
#: src/print.c:44
|
||||
#: src/print.c:46
|
||||
#, c-format
|
||||
msgid " type %d is %s\n"
|
||||
msgstr " tüüp %d on %s\n"
|
||||
|
||||
#: src/print.c:106
|
||||
#: src/print.c:108
|
||||
#, c-format
|
||||
msgid " (rule %d)"
|
||||
msgstr " (reegel %d)"
|
||||
|
||||
#: src/print.c:127
|
||||
#: src/print.c:129
|
||||
#, c-format
|
||||
msgid " %-4s\tshift, and go to state %d\n"
|
||||
msgstr " %-4s\tnihuta ja liigu olekule %d\n"
|
||||
|
||||
#: src/print.c:144
|
||||
#: src/print.c:146
|
||||
#, c-format
|
||||
msgid " %-4s\terror (nonassociative)\n"
|
||||
msgstr " %-4s\tviga (mitteassotsiatiivne)\n"
|
||||
|
||||
#: src/print.c:168
|
||||
#: src/print.c:170
|
||||
#, c-format
|
||||
msgid " %-4s\tgo to state %d\n"
|
||||
msgstr " %-4s\tliigu olekule %d\n"
|
||||
|
||||
#: src/print.c:192 src/print.c:228
|
||||
#: src/print.c:194 src/print.c:228
|
||||
#, c-format
|
||||
msgid ""
|
||||
" $default\treduce using rule %d (%s)\n"
|
||||
@@ -317,334 +312,334 @@ msgstr ""
|
||||
" $default\tredutseerin kasutades reeglit %d (%s)\n"
|
||||
"\n"
|
||||
|
||||
#: src/print.c:224 src/print.c:301
|
||||
#: src/print.c:223 src/print.c:298
|
||||
#, c-format
|
||||
msgid " %-4s\t[reduce using rule %d (%s)]\n"
|
||||
msgstr " %-4s\t[redutseerin, kasutades reeglit %d (%s)]\n"
|
||||
|
||||
#: src/print.c:282 src/print.c:295
|
||||
#: src/print.c:279 src/print.c:292
|
||||
#, c-format
|
||||
msgid " %-4s\treduce using rule %d (%s)\n"
|
||||
msgstr " %-4s\tredutseerin kasutades reeglit %d (%s)\n"
|
||||
|
||||
#: src/print.c:311
|
||||
#: src/print.c:307
|
||||
#, c-format
|
||||
msgid " $default\treduce using rule %d (%s)\n"
|
||||
msgstr " $default\tredutseerin kasutades reeglit %d (%s)\n"
|
||||
|
||||
#: src/print.c:327
|
||||
#: src/print.c:323
|
||||
msgid " $default\taccept\n"
|
||||
msgstr " $default\taktsepteerin\n"
|
||||
|
||||
#: src/print.c:329
|
||||
#: src/print.c:325
|
||||
msgid " NO ACTIONS\n"
|
||||
msgstr " TEGEVUSI POLE\n"
|
||||
|
||||
#: src/print.c:342
|
||||
#: src/print.c:338
|
||||
#, c-format
|
||||
msgid "state %d"
|
||||
msgstr "olek %d"
|
||||
|
||||
#. rule # : LHS -> RHS
|
||||
#: src/print.c:373
|
||||
#: src/print.c:370
|
||||
msgid "Grammar"
|
||||
msgstr "Grammatika"
|
||||
|
||||
#: src/print.c:374
|
||||
#: src/print.c:371
|
||||
msgid "Number, Line, Rule"
|
||||
msgstr ""
|
||||
msgstr "Number, rida, reegel"
|
||||
|
||||
#: src/print.c:379
|
||||
#, fuzzy, c-format
|
||||
#: src/print.c:374
|
||||
#, c-format
|
||||
msgid " %3d %3d %s ->"
|
||||
msgstr "reegel %-4d %s ->"
|
||||
msgstr " %3d %3d %s ->"
|
||||
|
||||
#: src/print.c:386
|
||||
#: src/print.c:381
|
||||
msgid "empty"
|
||||
msgstr ""
|
||||
msgstr "tühi"
|
||||
|
||||
#. TERMINAL (type #) : rule #s terminal is on RHS
|
||||
#: src/print.c:393
|
||||
#: src/print.c:388
|
||||
msgid "Terminals, with rules where they appear"
|
||||
msgstr "Terminalid, koos reeglitega, kus nad ilmuvad"
|
||||
|
||||
#: src/print.c:416
|
||||
#: src/print.c:411
|
||||
msgid "Nonterminals, with rules where they appear"
|
||||
msgstr "Mitteterminalid, koos reeglitega, kus nad ilmuvad"
|
||||
|
||||
#: src/print.c:442
|
||||
#: src/print.c:437
|
||||
msgid " on left:"
|
||||
msgstr " vasakul:"
|
||||
|
||||
#: src/print.c:457
|
||||
#: src/print.c:452
|
||||
msgid " on right:"
|
||||
msgstr " paremal:"
|
||||
|
||||
#: src/reader.c:100
|
||||
msgid " Skipping to next \\n"
|
||||
msgstr " Liigun järgmisele \\n"
|
||||
|
||||
#: src/reader.c:102
|
||||
#, c-format
|
||||
msgid " Skipping to next %c"
|
||||
msgstr " Liigun järgmisele %c"
|
||||
|
||||
#: src/reader.c:153 src/reader.c:165
|
||||
msgid "invalid $ value"
|
||||
msgstr "vigane $ väärtus"
|
||||
|
||||
#: src/reader.c:192 src/reader.c:207
|
||||
msgid "unterminated string at end of file"
|
||||
msgstr "lõpetamata sõne faili lõpus"
|
||||
|
||||
#: src/reader.c:195
|
||||
msgid "unterminated string"
|
||||
msgstr "lõpetamata sõne"
|
||||
|
||||
#: src/reader.c:337 src/reader.c:401
|
||||
#, fuzzy, c-format
|
||||
msgid "invalid value: %s%d"
|
||||
msgstr "vigane $ väärtus"
|
||||
|
||||
#: src/reader.c:351 src/reader.c:423
|
||||
#, c-format
|
||||
msgid "%s is invalid"
|
||||
msgstr "%s on vigane"
|
||||
|
||||
#: src/reader.c:391
|
||||
#, c-format
|
||||
msgid "$$ of `%s' has no declared type"
|
||||
msgstr "`%s' $$ ei oma deklareeritud tüüpi"
|
||||
|
||||
#: src/reader.c:415
|
||||
#, c-format
|
||||
msgid "$%d of `%s' has no declared type"
|
||||
msgstr "$%d `%s' ei oma deklareeritud tüüpi"
|
||||
|
||||
#: src/reader.c:473
|
||||
msgid "unterminated `%{' definition"
|
||||
msgstr "lõpetamata `%{' definitsioon"
|
||||
|
||||
#: src/reader.c:518 src/reader.c:636 src/reader.c:686 src/reader.c:933
|
||||
#, c-format
|
||||
msgid "Premature EOF after %s"
|
||||
msgstr "Enneaegne EOF peale %s"
|
||||
|
||||
#: src/reader.c:535
|
||||
#, c-format
|
||||
msgid "symbol `%s' used more than once as a literal string"
|
||||
msgstr "sümbolit `%s' on kasutatud enam kui kord literaal sõnena"
|
||||
|
||||
#: src/reader.c:538
|
||||
#, c-format
|
||||
msgid "symbol `%s' given more than one literal string"
|
||||
msgstr "sümbolile `%s' on antud enam kui üks literaal sõne"
|
||||
|
||||
#: src/reader.c:559 src/reader.c:705
|
||||
#, c-format
|
||||
msgid "symbol %s redefined"
|
||||
msgstr "sümbol %s on uuesti defineeritud"
|
||||
|
||||
#: src/reader.c:569 src/reader.c:651 src/reader.c:712
|
||||
#, c-format
|
||||
msgid "type redeclaration for %s"
|
||||
msgstr "%s tüübi uuesti deklareerimine"
|
||||
|
||||
#: src/reader.c:581
|
||||
#, c-format
|
||||
msgid "`%s' is invalid in %s"
|
||||
msgstr "`%s' ei ole %s sees lubatud"
|
||||
|
||||
#: src/reader.c:599 src/reader.c:758
|
||||
#, c-format
|
||||
msgid "multiple %s declarations"
|
||||
msgstr "korduvad %s deklaratsioonid"
|
||||
|
||||
#: src/reader.c:601 src/reader.c:913 src/reader.c:928 src/reader.c:961
|
||||
#: src/reader.c:975 src/reader.c:1178
|
||||
#, c-format
|
||||
msgid "invalid %s declaration"
|
||||
msgstr "vigane %s deklaratsioon"
|
||||
|
||||
#: src/reader.c:621
|
||||
msgid "%type declaration has no <typename>"
|
||||
msgstr "%type deklaratsioonis puudub <tüübinimi>"
|
||||
|
||||
#: src/reader.c:656
|
||||
#, c-format
|
||||
msgid "invalid %%type declaration due to item: %s"
|
||||
msgstr "vigane %%type deklaratsioon, element: %s"
|
||||
|
||||
#: src/reader.c:701
|
||||
#, c-format
|
||||
msgid "redefining precedence of %s"
|
||||
msgstr "%s prioriteedi uus definitsioon"
|
||||
|
||||
#: src/reader.c:724
|
||||
#, c-format
|
||||
msgid "invalid text (%s) - number should be after identifier"
|
||||
msgstr "vigane tekst (%s) - number peab olema peale identifikaatorit"
|
||||
|
||||
#: src/reader.c:734
|
||||
#, c-format
|
||||
msgid "unexpected item: %s"
|
||||
msgstr "ootamatu element: %s"
|
||||
|
||||
#: src/reader.c:790 src/reader.c:1149
|
||||
#, c-format
|
||||
msgid "unmatched %s"
|
||||
msgstr "puudub %s"
|
||||
|
||||
#: src/reader.c:819
|
||||
#, c-format
|
||||
msgid "argument of %%expect is not an integer"
|
||||
msgstr "%%expect argument ei ole täisarv"
|
||||
|
||||
#: src/reader.c:865
|
||||
#, c-format
|
||||
msgid "unrecognized item %s, expected an identifier"
|
||||
msgstr "tundmatu element %s, eeldasin identifikaatorit"
|
||||
|
||||
#: src/reader.c:887
|
||||
#, c-format
|
||||
msgid "expected string constant instead of %s"
|
||||
msgstr "eeldasin %s asemel sõnekonstanti"
|
||||
|
||||
#: src/reader.c:1080
|
||||
#, c-format
|
||||
msgid "unrecognized: %s"
|
||||
msgstr "tundmatu: %s"
|
||||
|
||||
#: src/reader.c:1085
|
||||
msgid "no input grammar"
|
||||
msgstr "sisendgrammatikat pole"
|
||||
|
||||
#: src/reader.c:1090
|
||||
#, c-format
|
||||
msgid "unknown character: %s"
|
||||
msgstr "tundmatu sümbol: %s"
|
||||
|
||||
#: src/reader.c:1265
|
||||
msgid "ill-formed rule: initial symbol not followed by colon"
|
||||
msgstr "vigaselt formeeritud reegel: algsümbolile ei järgne koolonit"
|
||||
|
||||
#: src/reader.c:1272
|
||||
msgid "grammar starts with vertical bar"
|
||||
msgstr "grammatika algab püstkriipsuga"
|
||||
|
||||
#: src/reader.c:1300
|
||||
#, c-format
|
||||
msgid "rule given for %s, which is a token"
|
||||
msgstr "%s jaoks on antud reegel, aga see on märk"
|
||||
|
||||
#: src/reader.c:1405
|
||||
msgid "two @prec's in a row"
|
||||
msgstr "kaks @prec ühel real"
|
||||
|
||||
#: src/reader.c:1414
|
||||
#, c-format
|
||||
msgid "%%guard present but %%semantic_parser not specified"
|
||||
msgstr "%%guard on määratud, aga %%semantic_parser ei ole"
|
||||
|
||||
#: src/reader.c:1424
|
||||
msgid "two actions at end of one rule"
|
||||
msgstr "kaks tegevust ühe reegli lõpus"
|
||||
|
||||
#: src/reader.c:1438
|
||||
#, c-format
|
||||
msgid "type clash (`%s' `%s') on default action"
|
||||
msgstr "vaikimisi tegevuse tüübikonflikt (`%s' `%s')"
|
||||
|
||||
#: src/reader.c:1444
|
||||
msgid "empty rule for typed nonterminal, and no action"
|
||||
msgstr "tüübiga mitteterminalil on tühi reegel ja puudub tegevus"
|
||||
|
||||
#: src/reader.c:1450
|
||||
#, c-format
|
||||
msgid "invalid input: %s"
|
||||
msgstr "vigane sisend: %s"
|
||||
|
||||
#: src/reader.c:1457
|
||||
msgid "no rules in the input grammar"
|
||||
msgstr "sisendgrammatikas pole reegleid"
|
||||
|
||||
#: src/reader.c:1465
|
||||
#: src/reader.c:105
|
||||
#, c-format
|
||||
msgid "symbol %s is used, but is not defined as a token and has no rules"
|
||||
msgstr ""
|
||||
"kasutatakse sümbolit %s, mis ei ole defineeritud märgina ja millel puuduvad "
|
||||
"reeglid"
|
||||
|
||||
#: src/reader.c:1487
|
||||
#: src/reader.c:124
|
||||
#, c-format
|
||||
msgid "too many symbols (tokens plus nonterminals); maximum %d"
|
||||
msgstr "liiga palju sümboleid (märgid ja mitteterminalid); maksimaalne on %d"
|
||||
msgid "symbol `%s' used more than once as a literal string"
|
||||
msgstr "sümbolit `%s' on kasutatud enam kui kord literaal sõnena"
|
||||
|
||||
#: src/reader.c:1551
|
||||
#: src/reader.c:127
|
||||
#, c-format
|
||||
msgid "tokens %s and %s both assigned number %d"
|
||||
msgstr "märkidele %s ja %s on mõlemale omistatud number %d"
|
||||
msgid "symbol `%s' given more than one literal string"
|
||||
msgstr "sümbolile `%s' on antud enam kui üks literaal sõne"
|
||||
|
||||
#: src/reader.c:1601
|
||||
#: src/reader.c:162
|
||||
#, c-format
|
||||
msgid "conflicting precedences for %s and %s"
|
||||
msgstr "%s ja %s omavad konfliktseid prioriteete"
|
||||
|
||||
#: src/reader.c:1613
|
||||
#: src/reader.c:173
|
||||
#, c-format
|
||||
msgid "conflicting assoc values for %s and %s"
|
||||
msgstr "%s ja %s omavad konfliktseid assotsiatiivseid väärtuseid"
|
||||
|
||||
#: src/reader.c:1650
|
||||
#: src/reader.c:241
|
||||
#, c-format
|
||||
msgid "tokens %s and %s both assigned number %d"
|
||||
msgstr "märkidele %s ja %s on mõlemale omistatud number %d"
|
||||
|
||||
#: src/reader.c:261
|
||||
msgid " Skipping to next \\n"
|
||||
msgstr " Liigun järgmisele \\n"
|
||||
|
||||
#: src/reader.c:263
|
||||
#, c-format
|
||||
msgid " Skipping to next %c"
|
||||
msgstr " Liigun järgmisele %c"
|
||||
|
||||
#: src/reader.c:314 src/reader.c:326
|
||||
msgid "invalid $ value"
|
||||
msgstr "vigane $ väärtus"
|
||||
|
||||
#: src/reader.c:375 src/reader.c:390
|
||||
msgid "unterminated string at end of file"
|
||||
msgstr "lõpetamata sõne faili lõpus"
|
||||
|
||||
#: src/reader.c:378
|
||||
msgid "unterminated string"
|
||||
msgstr "lõpetamata sõne"
|
||||
|
||||
#: src/reader.c:520 src/reader.c:584
|
||||
#, fuzzy, c-format
|
||||
msgid "invalid value: %s%d"
|
||||
msgstr "vigane @ väärtus"
|
||||
|
||||
#: src/reader.c:534 src/reader.c:606
|
||||
#, c-format
|
||||
msgid "%s is invalid"
|
||||
msgstr "%s on vigane"
|
||||
|
||||
#: src/reader.c:574
|
||||
#, c-format
|
||||
msgid "$$ of `%s' has no declared type"
|
||||
msgstr "`%s' $$ ei oma deklareeritud tüüpi"
|
||||
|
||||
#: src/reader.c:598
|
||||
#, c-format
|
||||
msgid "$%d of `%s' has no declared type"
|
||||
msgstr "$%d `%s' ei oma deklareeritud tüüpi"
|
||||
|
||||
#: src/reader.c:656
|
||||
msgid "unterminated `%{' definition"
|
||||
msgstr "lõpetamata `%{' definitsioon"
|
||||
|
||||
#: src/reader.c:701 src/reader.c:811 src/reader.c:862 src/reader.c:1114
|
||||
#, c-format
|
||||
msgid "Premature EOF after %s"
|
||||
msgstr "Enneaegne EOF peale %s"
|
||||
|
||||
#: src/reader.c:726 src/reader.c:881
|
||||
#, c-format
|
||||
msgid "symbol %s redefined"
|
||||
msgstr "sümbol %s on uuesti defineeritud"
|
||||
|
||||
#: src/reader.c:738 src/reader.c:826 src/reader.c:892
|
||||
#, c-format
|
||||
msgid "type redeclaration for %s"
|
||||
msgstr "%s tüübi uuesti deklareerimine"
|
||||
|
||||
#: src/reader.c:756
|
||||
#, c-format
|
||||
msgid "`%s' is invalid in %s"
|
||||
msgstr "`%s' ei ole %s sees lubatud"
|
||||
|
||||
#: src/reader.c:774 src/reader.c:938
|
||||
#, c-format
|
||||
msgid "multiple %s declarations"
|
||||
msgstr "korduvad %s deklaratsioonid"
|
||||
|
||||
#: src/reader.c:776 src/reader.c:1094 src/reader.c:1109 src/reader.c:1142
|
||||
#: src/reader.c:1156 src/reader.c:1362
|
||||
#, c-format
|
||||
msgid "invalid %s declaration"
|
||||
msgstr "vigane %s deklaratsioon"
|
||||
|
||||
#: src/reader.c:796
|
||||
msgid "%type declaration has no <typename>"
|
||||
msgstr "%type deklaratsioonis puudub <tüübinimi>"
|
||||
|
||||
#: src/reader.c:831
|
||||
#, c-format
|
||||
msgid "invalid %%type declaration due to item: %s"
|
||||
msgstr "vigane %%type deklaratsioon, element: %s"
|
||||
|
||||
#: src/reader.c:877
|
||||
#, c-format
|
||||
msgid "redefining precedence of %s"
|
||||
msgstr "%s prioriteedi uus definitsioon"
|
||||
|
||||
#: src/reader.c:904
|
||||
#, c-format
|
||||
msgid "invalid text (%s) - number should be after identifier"
|
||||
msgstr "vigane tekst (%s) - number peab olema peale identifikaatorit"
|
||||
|
||||
#: src/reader.c:914
|
||||
#, c-format
|
||||
msgid "unexpected item: %s"
|
||||
msgstr "ootamatu element: %s"
|
||||
|
||||
#: src/reader.c:971 src/reader.c:1333
|
||||
#, c-format
|
||||
msgid "unmatched %s"
|
||||
msgstr "puudub %s"
|
||||
|
||||
#: src/reader.c:1000
|
||||
#, c-format
|
||||
msgid "argument of %%expect is not an integer"
|
||||
msgstr "%%expect argument ei ole täisarv"
|
||||
|
||||
#: src/reader.c:1046
|
||||
#, c-format
|
||||
msgid "unrecognized item %s, expected an identifier"
|
||||
msgstr "tundmatu element %s, eeldasin identifikaatorit"
|
||||
|
||||
#: src/reader.c:1068
|
||||
#, c-format
|
||||
msgid "expected string constant instead of %s"
|
||||
msgstr "eeldasin %s asemel sõnekonstanti"
|
||||
|
||||
#: src/reader.c:1264
|
||||
#, c-format
|
||||
msgid "unrecognized: %s"
|
||||
msgstr "tundmatu: %s"
|
||||
|
||||
#: src/reader.c:1269
|
||||
msgid "no input grammar"
|
||||
msgstr "sisendgrammatikat pole"
|
||||
|
||||
#: src/reader.c:1274
|
||||
#, c-format
|
||||
msgid "unknown character: %s"
|
||||
msgstr "tundmatu sümbol: %s"
|
||||
|
||||
#: src/reader.c:1448
|
||||
msgid "ill-formed rule: initial symbol not followed by colon"
|
||||
msgstr "vigaselt formeeritud reegel: algsümbolile ei järgne koolonit"
|
||||
|
||||
#: src/reader.c:1455
|
||||
msgid "grammar starts with vertical bar"
|
||||
msgstr "grammatika algab püstkriipsuga"
|
||||
|
||||
#: src/reader.c:1483
|
||||
#, c-format
|
||||
msgid "rule given for %s, which is a token"
|
||||
msgstr "%s jaoks on antud reegel, aga see on märk"
|
||||
|
||||
#: src/reader.c:1513 src/reader.c:1632
|
||||
msgid "previous rule lacks an ending `;'"
|
||||
msgstr "eelmisel reeglil puudub lõpetav `;'"
|
||||
|
||||
#: src/reader.c:1591
|
||||
msgid "two @prec's in a row"
|
||||
msgstr "kaks @prec ühel real"
|
||||
|
||||
#: src/reader.c:1600
|
||||
#, c-format
|
||||
msgid "%%guard present but %%semantic_parser not specified"
|
||||
msgstr "%%guard on määratud, aga %%semantic_parser ei ole"
|
||||
|
||||
#: src/reader.c:1610
|
||||
msgid "two actions at end of one rule"
|
||||
msgstr "kaks tegevust ühe reegli lõpus"
|
||||
|
||||
#: src/reader.c:1624
|
||||
#, c-format
|
||||
msgid "type clash (`%s' `%s') on default action"
|
||||
msgstr "vaikimisi tegevuse tüübikonflikt (`%s' `%s')"
|
||||
|
||||
#: src/reader.c:1630
|
||||
msgid "empty rule for typed nonterminal, and no action"
|
||||
msgstr "tüübiga mitteterminalil on tühi reegel ja puudub tegevus"
|
||||
|
||||
#: src/reader.c:1638
|
||||
#, c-format
|
||||
msgid "invalid input: %s"
|
||||
msgstr "vigane sisend: %s"
|
||||
|
||||
#: src/reader.c:1645
|
||||
msgid "no rules in the input grammar"
|
||||
msgstr "sisendgrammatikas pole reegleid"
|
||||
|
||||
#: src/reader.c:1666
|
||||
#, c-format
|
||||
msgid "too many symbols (tokens plus nonterminals); maximum %d"
|
||||
msgstr "liiga palju sümboleid (märgid ja mitteterminalid); maksimaalne on %d"
|
||||
|
||||
#: src/reader.c:1768
|
||||
#, c-format
|
||||
msgid "the start symbol %s is undefined"
|
||||
msgstr "stardisümbol %s ei ole defineeritud"
|
||||
|
||||
#: src/reader.c:1652
|
||||
#: src/reader.c:1770
|
||||
#, c-format
|
||||
msgid "the start symbol %s is a token"
|
||||
msgstr "stardisümbol %s on märk"
|
||||
|
||||
#: src/reader.c:1672
|
||||
#, fuzzy, c-format
|
||||
msgid "too many items (max %d)"
|
||||
msgstr "liiga palju olekuid (maks %d)"
|
||||
|
||||
#: src/reduce.c:398
|
||||
#: src/reduce.c:332
|
||||
msgid "Useless nonterminals:"
|
||||
msgstr "Kasutamata mitteterminalid:"
|
||||
|
||||
#: src/reduce.c:411
|
||||
#: src/reduce.c:346
|
||||
msgid "Terminals which are not used:"
|
||||
msgstr "Terminalid, mida ei kasutatud:"
|
||||
|
||||
#: src/reduce.c:422
|
||||
#: src/reduce.c:358
|
||||
msgid "Useless rules:"
|
||||
msgstr "Kasutamata reeglid:"
|
||||
|
||||
#: src/reduce.c:494
|
||||
#, fuzzy, c-format
|
||||
#: src/reduce.c:386
|
||||
#, c-format
|
||||
msgid "%d rule never reduced\n"
|
||||
msgid_plural "%d rules never reduced\n"
|
||||
msgstr[0] "%d reeglit ei redutseeritud\n"
|
||||
msgstr[0] "%d reegel ei redutseeru\n"
|
||||
msgstr[1] "%d reeglit ei redutseeru\n"
|
||||
|
||||
#: src/reduce.c:502
|
||||
#, fuzzy, c-format
|
||||
#: src/reduce.c:394
|
||||
#, c-format
|
||||
msgid "%d useless nonterminal"
|
||||
msgid_plural "%d useless nonterminals"
|
||||
msgstr[0] "%d kasutamata mitteterminali%s"
|
||||
msgstr[0] "%d kasutamata mitteterminal"
|
||||
msgstr[1] "%d kasutamata mitteterminali"
|
||||
|
||||
#: src/reduce.c:508
|
||||
#: src/reduce.c:400
|
||||
msgid " and "
|
||||
msgstr " ja "
|
||||
|
||||
#: src/reduce.c:511
|
||||
#, fuzzy, c-format
|
||||
#: src/reduce.c:403
|
||||
#, c-format
|
||||
msgid "%d useless rule"
|
||||
msgid_plural "%d useless rules"
|
||||
msgstr[0] "%d kasutamata reeglit%s"
|
||||
msgstr[0] "%d kasutamata reegel"
|
||||
msgstr[1] "%d kasutamata reeglit"
|
||||
|
||||
#: src/reduce.c:542
|
||||
#: src/reduce.c:433
|
||||
#, c-format
|
||||
msgid "Start symbol %s does not derive any sentence"
|
||||
msgstr "Stardisümbolist %s ei tuletata ühtegi lauset"
|
||||
@@ -669,19 +664,16 @@ msgstr "%s: v
|
||||
msgid "%s: option `%s' requires an argument\n"
|
||||
msgstr "%s: võti `%s' nõuab argumenti\n"
|
||||
|
||||
#. --option
|
||||
#: lib/getopt.c:771
|
||||
#, c-format
|
||||
msgid "%s: unrecognized option `--%s'\n"
|
||||
msgstr "%s: tundmatu võti `--%s'\n"
|
||||
|
||||
#. +option or -option
|
||||
#: lib/getopt.c:775
|
||||
#, c-format
|
||||
msgid "%s: unrecognized option `%c%s'\n"
|
||||
msgstr "%s: tundmatu võti `%c%s'\n"
|
||||
|
||||
#. 1003.2 specifies the format of this message.
|
||||
#: lib/getopt.c:801
|
||||
#, c-format
|
||||
msgid "%s: illegal option -- %c\n"
|
||||
@@ -692,7 +684,6 @@ msgstr "%s: lubamatu v
|
||||
msgid "%s: invalid option -- %c\n"
|
||||
msgstr "%s: vigane võti -- %c\n"
|
||||
|
||||
#. 1003.2 specifies the format of this message.
|
||||
#: lib/getopt.c:834 lib/getopt.c:964
|
||||
#, c-format
|
||||
msgid "%s: option requires an argument -- %c\n"
|
||||
@@ -708,26 +699,10 @@ msgstr "%s: v
|
||||
msgid "%s: option `-W %s' doesn't allow an argument\n"
|
||||
msgstr "%s: võti `-W %s' ei luba argumenti\n"
|
||||
|
||||
#. If XALLOC_FAIL_FUNC is NULL, or does return, display this message
|
||||
#. before exiting when memory is exhausted. Goes through gettext.
|
||||
#: lib/obstack.c:494 lib/obstack.c:497 lib/xmalloc.c:66
|
||||
msgid "memory exhausted"
|
||||
msgstr "mälu on otsas"
|
||||
|
||||
#. Get translations for open and closing quotation marks.
|
||||
#.
|
||||
#. The message catalog should translate "`" to a left
|
||||
#. quotation mark suitable for the locale, and similarly for
|
||||
#. "'". If the catalog has no translation,
|
||||
#. locale_quoting_style quotes `like this', and
|
||||
#. clocale_quoting_style quotes "like this".
|
||||
#.
|
||||
#. For example, an American English Unicode locale should
|
||||
#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and
|
||||
#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION
|
||||
#. MARK). A British English Unicode locale should instead
|
||||
#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and
|
||||
#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively.
|
||||
#: lib/quotearg.c:274
|
||||
msgid "`"
|
||||
msgstr "`"
|
||||
@@ -736,6 +711,12 @@ msgstr "`"
|
||||
msgid "'"
|
||||
msgstr "'"
|
||||
|
||||
#~ msgid "maximum table size (%d) exceeded"
|
||||
#~ msgstr "ületati maksimaalset tabelisuurust (%d)"
|
||||
|
||||
#~ msgid " $ \tgo to state %d\n"
|
||||
#~ msgstr " $ \tliigu olekule %d\n"
|
||||
|
||||
#~ msgid "%-4s\terror (nonassociative)"
|
||||
#~ msgstr "%-4s\tviga (mitteassotsiatiivne)"
|
||||
|
||||
@@ -744,72 +725,3 @@ msgstr "'"
|
||||
|
||||
#~ msgid "unterminated %guard clause"
|
||||
#~ msgstr "lõpetamata %guard klausel"
|
||||
|
||||
#~ msgid " $ \tgo to state %d\n"
|
||||
#~ msgstr " $ \tliigu olekule %d\n"
|
||||
|
||||
#~ msgid "%s: internal error: %s\n"
|
||||
#~ msgstr "%s: sisemine viga: %s\n"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Variables\n"
|
||||
#~ "---------\n"
|
||||
#~ "\n"
|
||||
#~ msgstr ""
|
||||
#~ "Muutujad\n"
|
||||
#~ "--------\n"
|
||||
#~ "\n"
|
||||
|
||||
#~ msgid "Value Sprec Sassoc Tag\n"
|
||||
#~ msgstr "Value Sprec Sassoc Tag\n"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Rules\n"
|
||||
#~ "-----\n"
|
||||
#~ "\n"
|
||||
#~ msgstr ""
|
||||
#~ "Reeglid\n"
|
||||
#~ "-------\n"
|
||||
#~ "\n"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Rules interpreted\n"
|
||||
#~ "-----------------\n"
|
||||
#~ "\n"
|
||||
#~ msgstr ""
|
||||
#~ "Interpreteeritud reeglid\n"
|
||||
#~ "------------------------\n"
|
||||
#~ "\n"
|
||||
|
||||
#~ msgid " 1 shift/reduce conflict"
|
||||
#~ msgstr " 1 nihutamine/redutseerimine konflikt"
|
||||
|
||||
#~ msgid " 1 reduce/reduce conflict"
|
||||
#~ msgstr " 1 redutseerimine/redutseerimine konflikt"
|
||||
|
||||
#~ msgid "%s contains"
|
||||
#~ msgstr "%s sisaldab"
|
||||
|
||||
#~ msgid "DERIVES"
|
||||
#~ msgstr "DERIVES"
|
||||
|
||||
#~ msgid "%s derives"
|
||||
#~ msgstr "%s derives"
|
||||
|
||||
#~ msgid "Entering set_nullable"
|
||||
#~ msgstr "Entering set_nullable"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "reduced %s defines %d terminal%s, %d nonterminal%s, and %d production%s.\n"
|
||||
#~ msgstr ""
|
||||
#~ "redutseeritud %s defineerib %d terminali%s, %d mitteterminali%s ja %d "
|
||||
#~ "reeglit%s.\n"
|
||||
|
||||
#~ msgid "\t\t/* empty */"
|
||||
#~ msgstr "\t\t/* tühi */"
|
||||
|
||||
#~ msgid "multiple %%header_extension declarations"
|
||||
#~ msgstr "korduvad %%header_extension eklaratsioonid"
|
||||
|
||||
#~ msgid "multiple %%source_extension declarations"
|
||||
#~ msgstr "korduvad %%source_extension deklaratsioonid"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: bison 1.31\n"
|
||||
"POT-Creation-Date: 2002-01-29 17:17+0100\n"
|
||||
"POT-Creation-Date: 2002-05-02 09:20+0200\n"
|
||||
"PO-Revision-Date: 2002-01-18 12:40 CET\n"
|
||||
"Last-Translator: Paolo Bonzini <[email protected]>\n"
|
||||
"Language-Team: Italian <[email protected]>\n"
|
||||
@@ -14,12 +14,12 @@ msgstr ""
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#: src/LR0.c:194
|
||||
#: src/LR0.c:198
|
||||
#, c-format
|
||||
msgid "too many states (max %d)"
|
||||
msgstr "troppi stati (massimo %d)"
|
||||
|
||||
#: lib/error.c:128 lib/error.c:156 src/complain.c:99
|
||||
#: src/complain.c:99 lib/error.c:128 lib/error.c:156
|
||||
msgid "Unknown system error"
|
||||
msgstr "Errore di sistema sconosciuto"
|
||||
|
||||
@@ -31,96 +31,92 @@ msgstr "attenzione: "
|
||||
msgid "fatal error: "
|
||||
msgstr "errore fatale: "
|
||||
|
||||
#: src/conflicts.c:46
|
||||
#: src/conflicts.c:48
|
||||
#, c-format
|
||||
msgid "Conflict in state %d between rule %d and token %s resolved as %s.\n"
|
||||
msgstr ""
|
||||
"Conflitto nello stato %d tra la regola %d e il token %s risolto come %s.\n"
|
||||
|
||||
#: src/conflicts.c:111 src/conflicts.c:133
|
||||
#: src/conflicts.c:115 src/conflicts.c:137
|
||||
msgid "reduce"
|
||||
msgstr "riduzione"
|
||||
|
||||
#: src/conflicts.c:116 src/conflicts.c:128
|
||||
#: src/conflicts.c:120 src/conflicts.c:132
|
||||
msgid "shift"
|
||||
msgstr "shift"
|
||||
|
||||
#: src/conflicts.c:138
|
||||
#: src/conflicts.c:142
|
||||
msgid "an error"
|
||||
msgstr "un errore"
|
||||
|
||||
#: src/conflicts.c:291
|
||||
#: src/conflicts.c:284
|
||||
#, c-format
|
||||
msgid "%d shift/reduce conflict"
|
||||
msgid_plural "%d shift/reduce conflicts"
|
||||
msgstr[0] "%d conflitto shift/riduzione"
|
||||
msgstr[1] "%d conflitti shift/riduzione"
|
||||
|
||||
#: src/conflicts.c:298
|
||||
#: src/conflicts.c:291
|
||||
msgid "and"
|
||||
msgstr "e"
|
||||
|
||||
#: src/conflicts.c:304
|
||||
#: src/conflicts.c:297
|
||||
#, c-format
|
||||
msgid "%d reduce/reduce conflict"
|
||||
msgid_plural "%d reduce/reduce conflicts"
|
||||
msgstr[0] "%d conflitto riduzione/riduzione"
|
||||
msgstr[1] "%d conflitti riduzione/riduzione"
|
||||
|
||||
#: src/conflicts.c:329
|
||||
#: src/conflicts.c:322
|
||||
#, c-format
|
||||
msgid "State %d contains "
|
||||
msgstr "Lo stato %d contiene"
|
||||
|
||||
#. If invoked with `--yacc', use the output format specified by
|
||||
#. POSIX.
|
||||
#: src/conflicts.c:376
|
||||
#: src/conflicts.c:369
|
||||
msgid "conflicts: "
|
||||
msgstr "conflitti: "
|
||||
|
||||
#: src/conflicts.c:378
|
||||
#: src/conflicts.c:371
|
||||
#, c-format
|
||||
msgid " %d shift/reduce"
|
||||
msgstr " %d shift/riduzione"
|
||||
|
||||
#: src/conflicts.c:382
|
||||
#: src/conflicts.c:375
|
||||
#, c-format
|
||||
msgid " %d reduce/reduce"
|
||||
msgstr " %d riduzione/riduzione"
|
||||
|
||||
#: src/conflicts.c:387 src/reduce.c:499
|
||||
#: src/conflicts.c:380 src/reduce.c:391
|
||||
#, c-format
|
||||
msgid "%s contains "
|
||||
msgstr "%s contiene "
|
||||
|
||||
#: src/conflicts.c:394
|
||||
#: src/conflicts.c:387
|
||||
#, c-format
|
||||
msgid "expected %d shift/reduce conflict\n"
|
||||
msgid_plural "expected %d shift/reduce conflicts\n"
|
||||
msgstr[0] "atteso %d conflitto shift/riduzione\n"
|
||||
msgstr[1] "attesi %d conflitti shift/riduzione\n"
|
||||
|
||||
#: src/files.c:159
|
||||
#: src/files.c:160
|
||||
#, c-format
|
||||
msgid "cannot open file `%s'"
|
||||
msgstr "impossibile aprire il file `%s'"
|
||||
|
||||
#: src/files.c:178
|
||||
#: src/files.c:179
|
||||
msgid "cannot close file"
|
||||
msgstr "impossibile chiudere il file `%s'"
|
||||
|
||||
#. Some efforts were made to ease the translators' task, please
|
||||
#. continue.
|
||||
#: src/getargs.c:55
|
||||
#: src/getargs.c:56
|
||||
msgid "GNU bison generates parsers for LALR(1) grammars.\n"
|
||||
msgstr "GNU bison genera parser per grammatiche LALR(1).\n"
|
||||
|
||||
#: src/getargs.c:59
|
||||
#: src/getargs.c:60
|
||||
#, c-format
|
||||
msgid "Usage: %s [OPTION]... FILE\n"
|
||||
msgstr "Utilizzo: %s [OPZIONE]... FILE\n"
|
||||
|
||||
#: src/getargs.c:63
|
||||
#: src/getargs.c:64
|
||||
msgid ""
|
||||
"If a long option shows an argument as mandatory, then it is mandatory\n"
|
||||
"for the equivalent short option also. Similarly for optional arguments.\n"
|
||||
@@ -129,7 +125,7 @@ msgstr ""
|
||||
"è obbligatorio anche per l'equivalente opzione corta. Analogamente per\n"
|
||||
"gli argomenti opzionali.\n"
|
||||
|
||||
#: src/getargs.c:69
|
||||
#: src/getargs.c:70
|
||||
msgid ""
|
||||
"Operation modes:\n"
|
||||
" -h, --help display this help and exit\n"
|
||||
@@ -141,7 +137,7 @@ msgstr ""
|
||||
" -V, --version mostra informazioni sulla versione ed esce\n"
|
||||
" -y, --yacc emula il comportamento di POSIX yacc\n"
|
||||
|
||||
#: src/getargs.c:76
|
||||
#: src/getargs.c:77
|
||||
msgid ""
|
||||
"Parser:\n"
|
||||
" -S, --skeleton=FILE specify the skeleton to use\n"
|
||||
@@ -160,7 +156,7 @@ msgstr ""
|
||||
" -n, --no-parser genera le sole tabelle\n"
|
||||
" -k, --token-table include una tabella di nomi dei token\n"
|
||||
|
||||
#: src/getargs.c:88
|
||||
#: src/getargs.c:89
|
||||
msgid ""
|
||||
"Output:\n"
|
||||
" -d, --defines also produce a header file\n"
|
||||
@@ -177,20 +173,22 @@ msgstr ""
|
||||
" -o, --output=FILE lascia l'output in FILE\n"
|
||||
" -g, --graph produce anche una descrizione VCG dell'automa\n"
|
||||
|
||||
#: src/getargs.c:98
|
||||
#: src/getargs.c:99
|
||||
msgid "Report bugs to <[email protected]>.\n"
|
||||
msgstr "Segnalare eventuali bug a <[email protected]>.\n"
|
||||
|
||||
#. Some efforts were made to ease the translators' task, please
|
||||
#. continue.
|
||||
#: src/getargs.c:112
|
||||
#: src/getargs.c:113
|
||||
#, c-format
|
||||
msgid "bison (GNU Bison) %s"
|
||||
msgstr "bison (GNU Bison) %s"
|
||||
|
||||
#: src/getargs.c:117
|
||||
msgid ""
|
||||
"Copyright 1984, 1986, 1989, 1992, 2000, 2001 Free Software Foundation, Inc.\n"
|
||||
#: src/getargs.c:115
|
||||
msgid "Written by Robert Corbett and Richard Stallman.\n"
|
||||
msgstr ""
|
||||
|
||||
#: src/getargs.c:119
|
||||
#, fuzzy, c-format
|
||||
msgid "Copyright (C) %d Free Software Foundation, Inc.\n"
|
||||
msgstr ""
|
||||
"Copyright 1984, 1986, 1989, 1992, 2000, 2001 Free Software Foundation, Inc.\n"
|
||||
|
||||
@@ -203,7 +201,7 @@ msgstr ""
|
||||
"sottoposta la copia. NON c'è ALCUNA garanzia, neanche di\n"
|
||||
"COMMERCIABILITA` o di ADEGUATEZZA AD UN PARTICOLARE SCOPO.\n"
|
||||
|
||||
#: src/getargs.c:200 src/lex.c:599
|
||||
#: src/getargs.c:200 src/lex.c:603
|
||||
#, c-format
|
||||
msgid "`%s' is no longer supported"
|
||||
msgstr "`%s' non è più supportato"
|
||||
@@ -223,7 +221,7 @@ msgstr "%s: nessun file grammatica specificato\n"
|
||||
msgid "%s: extra arguments ignored after `%s'\n"
|
||||
msgstr "%s: ignorati gli argomenti successivi a `%s'\n"
|
||||
|
||||
#: src/lalr.c:175
|
||||
#: src/lalr.c:174
|
||||
#, c-format
|
||||
msgid "too many gotos (max %d)"
|
||||
msgstr "troppi goto (max %d)"
|
||||
@@ -232,7 +230,7 @@ msgstr "troppi goto (max %d)"
|
||||
msgid "unexpected `/' found and ignored"
|
||||
msgstr "`/' inatteso, trovato e ignorato"
|
||||
|
||||
#: src/lex.c:106 src/reader.c:302
|
||||
#: src/lex.c:106 src/reader.c:485
|
||||
msgid "unterminated comment"
|
||||
msgstr "commento non terminato"
|
||||
|
||||
@@ -272,47 +270,42 @@ msgstr "nome di tipo non terminato"
|
||||
msgid "use \"...\" for multi-character literal tokens"
|
||||
msgstr "usa \"...\" per token letterali di più caratteri"
|
||||
|
||||
#: src/lex.c:571
|
||||
#: src/lex.c:575
|
||||
#, c-format
|
||||
msgid "`%s' supports no argument: %s"
|
||||
msgstr "`%s' non supporta argomenti: %s"
|
||||
|
||||
#: src/lex.c:588
|
||||
#: src/lex.c:592
|
||||
#, c-format
|
||||
msgid "`%s' requires an argument"
|
||||
msgstr "`%s' richiede un argomento"
|
||||
|
||||
#: src/output.c:804
|
||||
#, c-format
|
||||
msgid "maximum table size (%d) exceeded"
|
||||
msgstr "ecceduta la dimensione massima di una tabella (%d)"
|
||||
|
||||
#: src/print.c:44
|
||||
#: src/print.c:46
|
||||
#, c-format
|
||||
msgid " type %d is %s\n"
|
||||
msgstr " il tipo %d è %s\n"
|
||||
|
||||
#: src/print.c:106
|
||||
#: src/print.c:108
|
||||
#, c-format
|
||||
msgid " (rule %d)"
|
||||
msgstr " (regola %d)"
|
||||
|
||||
#: src/print.c:127
|
||||
#: src/print.c:129
|
||||
#, c-format
|
||||
msgid " %-4s\tshift, and go to state %d\n"
|
||||
msgstr " %-4s\tshift e prosecuzione allo stato %d\n"
|
||||
|
||||
#: src/print.c:144
|
||||
#: src/print.c:146
|
||||
#, c-format
|
||||
msgid " %-4s\terror (nonassociative)\n"
|
||||
msgstr " %-4s\terrore (non associativo)\n"
|
||||
|
||||
#: src/print.c:168
|
||||
#: src/print.c:170
|
||||
#, c-format
|
||||
msgid " %-4s\tgo to state %d\n"
|
||||
msgstr " %-4s\tprosecuzione allo stato %d\n"
|
||||
|
||||
#: src/print.c:192 src/print.c:228
|
||||
#: src/print.c:194 src/print.c:228
|
||||
#, c-format
|
||||
msgid ""
|
||||
" $default\treduce using rule %d (%s)\n"
|
||||
@@ -321,335 +314,332 @@ msgstr ""
|
||||
" $default\triduzione con la regola %d (%s)\n"
|
||||
"\n"
|
||||
|
||||
#: src/print.c:224 src/print.c:301
|
||||
#: src/print.c:223 src/print.c:298
|
||||
#, c-format
|
||||
msgid " %-4s\t[reduce using rule %d (%s)]\n"
|
||||
msgstr " %-4s\t[riduzione con la regole %d (%s)]\n"
|
||||
|
||||
#: src/print.c:282 src/print.c:295
|
||||
#: src/print.c:279 src/print.c:292
|
||||
#, c-format
|
||||
msgid " %-4s\treduce using rule %d (%s)\n"
|
||||
msgstr " %-4s\triduzione con la regola %d (%s)\n"
|
||||
|
||||
#: src/print.c:311
|
||||
#: src/print.c:307
|
||||
#, c-format
|
||||
msgid " $default\treduce using rule %d (%s)\n"
|
||||
msgstr " $default\triduzione con la regola %d (%s)\n"
|
||||
|
||||
#: src/print.c:327
|
||||
#: src/print.c:323
|
||||
msgid " $default\taccept\n"
|
||||
msgstr " $default\taccetta\n"
|
||||
|
||||
#: src/print.c:329
|
||||
#: src/print.c:325
|
||||
msgid " NO ACTIONS\n"
|
||||
msgstr " NESSUNA AZIONE\n"
|
||||
|
||||
#: src/print.c:342
|
||||
#: src/print.c:338
|
||||
#, c-format
|
||||
msgid "state %d"
|
||||
msgstr "stato %d"
|
||||
|
||||
#. rule # : LHS -> RHS
|
||||
#: src/print.c:373
|
||||
#: src/print.c:370
|
||||
msgid "Grammar"
|
||||
msgstr "Grammatica"
|
||||
|
||||
#: src/print.c:374
|
||||
#: src/print.c:371
|
||||
msgid "Number, Line, Rule"
|
||||
msgstr "Numero, Linea, Regola"
|
||||
|
||||
#: src/print.c:379
|
||||
#: src/print.c:374
|
||||
#, c-format
|
||||
msgid " %3d %3d %s ->"
|
||||
msgstr " %3d %3d %s ->"
|
||||
|
||||
#: src/print.c:386
|
||||
#: src/print.c:381
|
||||
msgid "empty"
|
||||
msgstr "vuoto"
|
||||
|
||||
#. TERMINAL (type #) : rule #s terminal is on RHS
|
||||
#: src/print.c:393
|
||||
#: src/print.c:388
|
||||
msgid "Terminals, with rules where they appear"
|
||||
msgstr "Simboli terminali e regole in cui appaiono"
|
||||
|
||||
#: src/print.c:416
|
||||
#: src/print.c:411
|
||||
msgid "Nonterminals, with rules where they appear"
|
||||
msgstr "Simboli nonterminali e regole in cui appaiono"
|
||||
|
||||
#: src/print.c:442
|
||||
#: src/print.c:437
|
||||
msgid " on left:"
|
||||
msgstr " nel primo membro:"
|
||||
|
||||
#: src/print.c:457
|
||||
#: src/print.c:452
|
||||
msgid " on right:"
|
||||
msgstr " nel secondo membro:"
|
||||
|
||||
#: src/reader.c:100
|
||||
msgid " Skipping to next \\n"
|
||||
msgstr " Passo al successivo \\n"
|
||||
|
||||
#: src/reader.c:102
|
||||
#, c-format
|
||||
msgid " Skipping to next %c"
|
||||
msgstr " Passo al successivo %c"
|
||||
|
||||
#: src/reader.c:153 src/reader.c:165
|
||||
msgid "invalid $ value"
|
||||
msgstr "valore $ non valido"
|
||||
|
||||
#: src/reader.c:192 src/reader.c:207
|
||||
msgid "unterminated string at end of file"
|
||||
msgstr "stringa non terminata alla fine del file"
|
||||
|
||||
#: src/reader.c:195
|
||||
msgid "unterminated string"
|
||||
msgstr "stringa non terminata"
|
||||
|
||||
#: src/reader.c:337 src/reader.c:401
|
||||
#, c-format
|
||||
msgid "invalid value: %s%d"
|
||||
msgstr "valore non valido: %s%d"
|
||||
|
||||
#: src/reader.c:351 src/reader.c:423
|
||||
#, c-format
|
||||
msgid "%s is invalid"
|
||||
msgstr "%s non è valido"
|
||||
|
||||
#: src/reader.c:391
|
||||
#, c-format
|
||||
msgid "$$ of `%s' has no declared type"
|
||||
msgstr "Manca una dichiarazione di tipo per $$ di `%s'"
|
||||
|
||||
#: src/reader.c:415
|
||||
#, c-format
|
||||
msgid "$%d of `%s' has no declared type"
|
||||
msgstr "Manca una dichiarazione di tipo per $%d di `%s'"
|
||||
|
||||
#: src/reader.c:473
|
||||
msgid "unterminated `%{' definition"
|
||||
msgstr "definizione `%{' non terminata"
|
||||
|
||||
#: src/reader.c:518 src/reader.c:636 src/reader.c:686 src/reader.c:933
|
||||
#, c-format
|
||||
msgid "Premature EOF after %s"
|
||||
msgstr "Fine di file prematura dopo %s"
|
||||
|
||||
#: src/reader.c:535
|
||||
#, c-format
|
||||
msgid "symbol `%s' used more than once as a literal string"
|
||||
msgstr "simbolo `%s' usato più di una volta in una stringa letterale"
|
||||
|
||||
#: src/reader.c:538
|
||||
#, c-format
|
||||
msgid "symbol `%s' given more than one literal string"
|
||||
msgstr "il simbolo `%s' dà pi` di una stringa letterale"
|
||||
|
||||
#: src/reader.c:559 src/reader.c:705
|
||||
#, c-format
|
||||
msgid "symbol %s redefined"
|
||||
msgstr "simbolo %s ridefinito"
|
||||
|
||||
#: src/reader.c:569 src/reader.c:651 src/reader.c:712
|
||||
#, c-format
|
||||
msgid "type redeclaration for %s"
|
||||
msgstr "tipo dichiarato due volte per %s"
|
||||
|
||||
#: src/reader.c:581
|
||||
#, c-format
|
||||
msgid "`%s' is invalid in %s"
|
||||
msgstr "`%s' non è valido in %s"
|
||||
|
||||
#: src/reader.c:599 src/reader.c:758
|
||||
#, c-format
|
||||
msgid "multiple %s declarations"
|
||||
msgstr "dichiarazioni multiple per %s"
|
||||
|
||||
#: src/reader.c:601 src/reader.c:913 src/reader.c:928 src/reader.c:961
|
||||
#: src/reader.c:975 src/reader.c:1178
|
||||
#, c-format
|
||||
msgid "invalid %s declaration"
|
||||
msgstr "dichiarazione %s non valida"
|
||||
|
||||
#: src/reader.c:621
|
||||
msgid "%type declaration has no <typename>"
|
||||
msgstr "dichiarazione %type senza <nome di tipo>"
|
||||
|
||||
#: src/reader.c:656
|
||||
#, c-format
|
||||
msgid "invalid %%type declaration due to item: %s"
|
||||
msgstr "dichiarazione %%type non valida per la presenza di `%s'"
|
||||
|
||||
#: src/reader.c:701
|
||||
#, c-format
|
||||
msgid "redefining precedence of %s"
|
||||
msgstr "precedenza di `%s' definita due volte"
|
||||
|
||||
#: src/reader.c:724
|
||||
#, c-format
|
||||
msgid "invalid text (%s) - number should be after identifier"
|
||||
msgstr "testo non valido (%s) - il numero dovrebbe seguire l'identificatore"
|
||||
|
||||
#: src/reader.c:734
|
||||
#, c-format
|
||||
msgid "unexpected item: %s"
|
||||
msgstr "elemento inatteso: %s"
|
||||
|
||||
#: src/reader.c:790 src/reader.c:1149
|
||||
#, c-format
|
||||
msgid "unmatched %s"
|
||||
msgstr "%s non bilanciato"
|
||||
|
||||
#: src/reader.c:819
|
||||
#, c-format
|
||||
msgid "argument of %%expect is not an integer"
|
||||
msgstr "L'argomento di %%expect non è un intero"
|
||||
|
||||
#: src/reader.c:865
|
||||
#, c-format
|
||||
msgid "unrecognized item %s, expected an identifier"
|
||||
msgstr "elemento %s non riconosciuto, atteso un identificatore"
|
||||
|
||||
#: src/reader.c:887
|
||||
#, c-format
|
||||
msgid "expected string constant instead of %s"
|
||||
msgstr "attesa una costante stringa invece di %s"
|
||||
|
||||
#: src/reader.c:1080
|
||||
#, c-format
|
||||
msgid "unrecognized: %s"
|
||||
msgstr "non riconosciuto: %s"
|
||||
|
||||
#: src/reader.c:1085
|
||||
msgid "no input grammar"
|
||||
msgstr "nessuna grammatica di input"
|
||||
|
||||
#: src/reader.c:1090
|
||||
#, c-format
|
||||
msgid "unknown character: %s"
|
||||
msgstr "carattere sconosciuto: %s"
|
||||
|
||||
#: src/reader.c:1265
|
||||
msgid "ill-formed rule: initial symbol not followed by colon"
|
||||
msgstr "regola malformata: simbolo iniziale non seguito da `:'"
|
||||
|
||||
#: src/reader.c:1272
|
||||
msgid "grammar starts with vertical bar"
|
||||
msgstr "la grammatica comincia con un `|'"
|
||||
|
||||
#: src/reader.c:1300
|
||||
#, c-format
|
||||
msgid "rule given for %s, which is a token"
|
||||
msgstr "fornita una regola per il token %s"
|
||||
|
||||
#: src/reader.c:1405
|
||||
msgid "two @prec's in a row"
|
||||
msgstr "due @prec di seguito"
|
||||
|
||||
#: src/reader.c:1414
|
||||
#, c-format
|
||||
msgid "%%guard present but %%semantic_parser not specified"
|
||||
msgstr "trovato %%guard senza che sia specificato %%semantic_parser"
|
||||
|
||||
#: src/reader.c:1424
|
||||
msgid "two actions at end of one rule"
|
||||
msgstr "due azioni alla fine di una regola"
|
||||
|
||||
#: src/reader.c:1438
|
||||
#, c-format
|
||||
msgid "type clash (`%s' `%s') on default action"
|
||||
msgstr "conflitto di tipo (`%s' e `%s') nell'azione di default"
|
||||
|
||||
#: src/reader.c:1444
|
||||
msgid "empty rule for typed nonterminal, and no action"
|
||||
msgstr "regola vuota e nessuna azione per un nonterminale con tipo"
|
||||
|
||||
#: src/reader.c:1450
|
||||
#, c-format
|
||||
msgid "invalid input: %s"
|
||||
msgstr "input non valido: %s"
|
||||
|
||||
#: src/reader.c:1457
|
||||
msgid "no rules in the input grammar"
|
||||
msgstr "nessuna regola nella grammatica di input"
|
||||
|
||||
#: src/reader.c:1465
|
||||
#: src/reader.c:105
|
||||
#, c-format
|
||||
msgid "symbol %s is used, but is not defined as a token and has no rules"
|
||||
msgstr "usato il simbolo %s, ma non è un token e non ha regole"
|
||||
|
||||
#: src/reader.c:1487
|
||||
#: src/reader.c:124
|
||||
#, c-format
|
||||
msgid "too many symbols (tokens plus nonterminals); maximum %d"
|
||||
msgstr "troppi simboli (token e nonterminali); il massimo è %d"
|
||||
msgid "symbol `%s' used more than once as a literal string"
|
||||
msgstr "simbolo `%s' usato più di una volta in una stringa letterale"
|
||||
|
||||
#: src/reader.c:1551
|
||||
#: src/reader.c:127
|
||||
#, c-format
|
||||
msgid "tokens %s and %s both assigned number %d"
|
||||
msgstr "i token %s e %s hanno lo stesso numero %d"
|
||||
msgid "symbol `%s' given more than one literal string"
|
||||
msgstr "il simbolo `%s' dà pi` di una stringa letterale"
|
||||
|
||||
#: src/reader.c:1601
|
||||
#: src/reader.c:162
|
||||
#, c-format
|
||||
msgid "conflicting precedences for %s and %s"
|
||||
msgstr "precedenze in conflitto per %s und %s"
|
||||
|
||||
#: src/reader.c:1613
|
||||
#: src/reader.c:173
|
||||
#, c-format
|
||||
msgid "conflicting assoc values for %s and %s"
|
||||
msgstr "associatività in conflitto per %s e %s"
|
||||
|
||||
#: src/reader.c:1650
|
||||
#: src/reader.c:241
|
||||
#, c-format
|
||||
msgid "tokens %s and %s both assigned number %d"
|
||||
msgstr "i token %s e %s hanno lo stesso numero %d"
|
||||
|
||||
#: src/reader.c:261
|
||||
msgid " Skipping to next \\n"
|
||||
msgstr " Passo al successivo \\n"
|
||||
|
||||
#: src/reader.c:263
|
||||
#, c-format
|
||||
msgid " Skipping to next %c"
|
||||
msgstr " Passo al successivo %c"
|
||||
|
||||
#: src/reader.c:314 src/reader.c:326
|
||||
msgid "invalid $ value"
|
||||
msgstr "valore $ non valido"
|
||||
|
||||
#: src/reader.c:375 src/reader.c:390
|
||||
msgid "unterminated string at end of file"
|
||||
msgstr "stringa non terminata alla fine del file"
|
||||
|
||||
#: src/reader.c:378
|
||||
msgid "unterminated string"
|
||||
msgstr "stringa non terminata"
|
||||
|
||||
#: src/reader.c:520 src/reader.c:584
|
||||
#, c-format
|
||||
msgid "invalid value: %s%d"
|
||||
msgstr "valore non valido: %s%d"
|
||||
|
||||
#: src/reader.c:534 src/reader.c:606
|
||||
#, c-format
|
||||
msgid "%s is invalid"
|
||||
msgstr "%s non è valido"
|
||||
|
||||
#: src/reader.c:574
|
||||
#, c-format
|
||||
msgid "$$ of `%s' has no declared type"
|
||||
msgstr "Manca una dichiarazione di tipo per $$ di `%s'"
|
||||
|
||||
#: src/reader.c:598
|
||||
#, c-format
|
||||
msgid "$%d of `%s' has no declared type"
|
||||
msgstr "Manca una dichiarazione di tipo per $%d di `%s'"
|
||||
|
||||
#: src/reader.c:656
|
||||
msgid "unterminated `%{' definition"
|
||||
msgstr "definizione `%{' non terminata"
|
||||
|
||||
#: src/reader.c:701 src/reader.c:811 src/reader.c:862 src/reader.c:1114
|
||||
#, c-format
|
||||
msgid "Premature EOF after %s"
|
||||
msgstr "Fine di file prematura dopo %s"
|
||||
|
||||
#: src/reader.c:726 src/reader.c:881
|
||||
#, c-format
|
||||
msgid "symbol %s redefined"
|
||||
msgstr "simbolo %s ridefinito"
|
||||
|
||||
#: src/reader.c:738 src/reader.c:826 src/reader.c:892
|
||||
#, c-format
|
||||
msgid "type redeclaration for %s"
|
||||
msgstr "tipo dichiarato due volte per %s"
|
||||
|
||||
#: src/reader.c:756
|
||||
#, c-format
|
||||
msgid "`%s' is invalid in %s"
|
||||
msgstr "`%s' non è valido in %s"
|
||||
|
||||
#: src/reader.c:774 src/reader.c:938
|
||||
#, c-format
|
||||
msgid "multiple %s declarations"
|
||||
msgstr "dichiarazioni multiple per %s"
|
||||
|
||||
#: src/reader.c:776 src/reader.c:1094 src/reader.c:1109 src/reader.c:1142
|
||||
#: src/reader.c:1156 src/reader.c:1362
|
||||
#, c-format
|
||||
msgid "invalid %s declaration"
|
||||
msgstr "dichiarazione %s non valida"
|
||||
|
||||
#: src/reader.c:796
|
||||
msgid "%type declaration has no <typename>"
|
||||
msgstr "dichiarazione %type senza <nome di tipo>"
|
||||
|
||||
#: src/reader.c:831
|
||||
#, c-format
|
||||
msgid "invalid %%type declaration due to item: %s"
|
||||
msgstr "dichiarazione %%type non valida per la presenza di `%s'"
|
||||
|
||||
#: src/reader.c:877
|
||||
#, c-format
|
||||
msgid "redefining precedence of %s"
|
||||
msgstr "precedenza di `%s' definita due volte"
|
||||
|
||||
#: src/reader.c:904
|
||||
#, c-format
|
||||
msgid "invalid text (%s) - number should be after identifier"
|
||||
msgstr "testo non valido (%s) - il numero dovrebbe seguire l'identificatore"
|
||||
|
||||
#: src/reader.c:914
|
||||
#, c-format
|
||||
msgid "unexpected item: %s"
|
||||
msgstr "elemento inatteso: %s"
|
||||
|
||||
#: src/reader.c:971 src/reader.c:1333
|
||||
#, c-format
|
||||
msgid "unmatched %s"
|
||||
msgstr "%s non bilanciato"
|
||||
|
||||
#: src/reader.c:1000
|
||||
#, c-format
|
||||
msgid "argument of %%expect is not an integer"
|
||||
msgstr "L'argomento di %%expect non è un intero"
|
||||
|
||||
#: src/reader.c:1046
|
||||
#, c-format
|
||||
msgid "unrecognized item %s, expected an identifier"
|
||||
msgstr "elemento %s non riconosciuto, atteso un identificatore"
|
||||
|
||||
#: src/reader.c:1068
|
||||
#, c-format
|
||||
msgid "expected string constant instead of %s"
|
||||
msgstr "attesa una costante stringa invece di %s"
|
||||
|
||||
#: src/reader.c:1264
|
||||
#, c-format
|
||||
msgid "unrecognized: %s"
|
||||
msgstr "non riconosciuto: %s"
|
||||
|
||||
#: src/reader.c:1269
|
||||
msgid "no input grammar"
|
||||
msgstr "nessuna grammatica di input"
|
||||
|
||||
#: src/reader.c:1274
|
||||
#, c-format
|
||||
msgid "unknown character: %s"
|
||||
msgstr "carattere sconosciuto: %s"
|
||||
|
||||
#: src/reader.c:1448
|
||||
msgid "ill-formed rule: initial symbol not followed by colon"
|
||||
msgstr "regola malformata: simbolo iniziale non seguito da `:'"
|
||||
|
||||
#: src/reader.c:1455
|
||||
msgid "grammar starts with vertical bar"
|
||||
msgstr "la grammatica comincia con un `|'"
|
||||
|
||||
#: src/reader.c:1483
|
||||
#, c-format
|
||||
msgid "rule given for %s, which is a token"
|
||||
msgstr "fornita una regola per il token %s"
|
||||
|
||||
#: src/reader.c:1513 src/reader.c:1632
|
||||
msgid "previous rule lacks an ending `;'"
|
||||
msgstr ""
|
||||
|
||||
#: src/reader.c:1591
|
||||
msgid "two @prec's in a row"
|
||||
msgstr "due @prec di seguito"
|
||||
|
||||
#: src/reader.c:1600
|
||||
#, c-format
|
||||
msgid "%%guard present but %%semantic_parser not specified"
|
||||
msgstr "trovato %%guard senza che sia specificato %%semantic_parser"
|
||||
|
||||
#: src/reader.c:1610
|
||||
msgid "two actions at end of one rule"
|
||||
msgstr "due azioni alla fine di una regola"
|
||||
|
||||
#: src/reader.c:1624
|
||||
#, c-format
|
||||
msgid "type clash (`%s' `%s') on default action"
|
||||
msgstr "conflitto di tipo (`%s' e `%s') nell'azione di default"
|
||||
|
||||
#: src/reader.c:1630
|
||||
msgid "empty rule for typed nonterminal, and no action"
|
||||
msgstr "regola vuota e nessuna azione per un nonterminale con tipo"
|
||||
|
||||
#: src/reader.c:1638
|
||||
#, c-format
|
||||
msgid "invalid input: %s"
|
||||
msgstr "input non valido: %s"
|
||||
|
||||
#: src/reader.c:1645
|
||||
msgid "no rules in the input grammar"
|
||||
msgstr "nessuna regola nella grammatica di input"
|
||||
|
||||
#: src/reader.c:1666
|
||||
#, c-format
|
||||
msgid "too many symbols (tokens plus nonterminals); maximum %d"
|
||||
msgstr "troppi simboli (token e nonterminali); il massimo è %d"
|
||||
|
||||
#: src/reader.c:1768
|
||||
#, c-format
|
||||
msgid "the start symbol %s is undefined"
|
||||
msgstr "simbolo iniziale %s non definito"
|
||||
|
||||
#: src/reader.c:1652
|
||||
#: src/reader.c:1770
|
||||
#, c-format
|
||||
msgid "the start symbol %s is a token"
|
||||
msgstr "specificato il token %s come simbolo iniziale"
|
||||
|
||||
#: src/reader.c:1672
|
||||
#, c-format
|
||||
msgid "too many items (max %d)"
|
||||
msgstr "troppi elementi (max %d)"
|
||||
|
||||
#: src/reduce.c:398
|
||||
#: src/reduce.c:332
|
||||
msgid "Useless nonterminals:"
|
||||
msgstr "Simboli nonterminali inutili:"
|
||||
|
||||
#: src/reduce.c:411
|
||||
#: src/reduce.c:346
|
||||
msgid "Terminals which are not used:"
|
||||
msgstr "Simboli terminali inutilizzati:"
|
||||
|
||||
#: src/reduce.c:422
|
||||
#: src/reduce.c:358
|
||||
msgid "Useless rules:"
|
||||
msgstr "Regole inutili:"
|
||||
|
||||
#: src/reduce.c:494
|
||||
#: src/reduce.c:386
|
||||
#, c-format
|
||||
msgid "%d rule never reduced\n"
|
||||
msgid_plural "%d rules never reduced\n"
|
||||
msgstr[0] "%d regola non applicata\n"
|
||||
msgstr[1] "%d regole non applicate\n"
|
||||
|
||||
#: src/reduce.c:502
|
||||
#: src/reduce.c:394
|
||||
#, c-format
|
||||
msgid "%d useless nonterminal"
|
||||
msgid_plural "%d useless nonterminals"
|
||||
msgstr[0] "%d simbolo nonterminale inutilizzato"
|
||||
msgstr[1] "%d simboli nonterminali inutilizzati"
|
||||
|
||||
#: src/reduce.c:508
|
||||
#: src/reduce.c:400
|
||||
msgid " and "
|
||||
msgstr " e "
|
||||
|
||||
#: src/reduce.c:511
|
||||
#: src/reduce.c:403
|
||||
#, c-format
|
||||
msgid "%d useless rule"
|
||||
msgid_plural "%d useless rules"
|
||||
msgstr[0] "%d regola inutile"
|
||||
msgstr[1] "%d regole inutili"
|
||||
|
||||
#: src/reduce.c:542
|
||||
#: src/reduce.c:433
|
||||
#, c-format
|
||||
msgid "Start symbol %s does not derive any sentence"
|
||||
msgstr "dal simbolo iniziale %s non deriva alcuna frase"
|
||||
@@ -674,19 +664,16 @@ msgstr "%s: l'opzione `%c%s' non ammette argomenti\n"
|
||||
msgid "%s: option `%s' requires an argument\n"
|
||||
msgstr "%s: l'opzione `%s' richiede un argomento\n"
|
||||
|
||||
#. --option
|
||||
#: lib/getopt.c:771
|
||||
#, c-format
|
||||
msgid "%s: unrecognized option `--%s'\n"
|
||||
msgstr "%s: opzione sconosciuta `--%s'\n"
|
||||
|
||||
#. +option or -option
|
||||
#: lib/getopt.c:775
|
||||
#, c-format
|
||||
msgid "%s: unrecognized option `%c%s'\n"
|
||||
msgstr "%s: opzione sconosciuta `%c%s'\n"
|
||||
|
||||
#. 1003.2 specifies the format of this message.
|
||||
#: lib/getopt.c:801
|
||||
#, c-format
|
||||
msgid "%s: illegal option -- %c\n"
|
||||
@@ -697,7 +684,6 @@ msgstr "%s: opzione non valida -- %c\n"
|
||||
msgid "%s: invalid option -- %c\n"
|
||||
msgstr "%s: opzione non valida -- %c\n"
|
||||
|
||||
#. 1003.2 specifies the format of this message.
|
||||
#: lib/getopt.c:834 lib/getopt.c:964
|
||||
#, c-format
|
||||
msgid "%s: option requires an argument -- %c\n"
|
||||
@@ -713,26 +699,10 @@ msgstr "%s: l'opzione `-W %s'
|
||||
msgid "%s: option `-W %s' doesn't allow an argument\n"
|
||||
msgstr "%s: l'opzione `-W %s' non ammette un argomento\n"
|
||||
|
||||
#. If XALLOC_FAIL_FUNC is NULL, or does return, display this message
|
||||
#. before exiting when memory is exhausted. Goes through gettext.
|
||||
#: lib/obstack.c:494 lib/obstack.c:497 lib/xmalloc.c:66
|
||||
msgid "memory exhausted"
|
||||
msgstr "memoria esaurita"
|
||||
|
||||
#. Get translations for open and closing quotation marks.
|
||||
#.
|
||||
#. The message catalog should translate "`" to a left
|
||||
#. quotation mark suitable for the locale, and similarly for
|
||||
#. "'". If the catalog has no translation,
|
||||
#. locale_quoting_style quotes `like this', and
|
||||
#. clocale_quoting_style quotes "like this".
|
||||
#.
|
||||
#. For example, an American English Unicode locale should
|
||||
#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and
|
||||
#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION
|
||||
#. MARK). A British English Unicode locale should instead
|
||||
#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and
|
||||
#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively.
|
||||
#: lib/quotearg.c:274
|
||||
msgid "`"
|
||||
msgstr "`"
|
||||
@@ -741,6 +711,12 @@ msgstr "`"
|
||||
msgid "'"
|
||||
msgstr "'"
|
||||
|
||||
#~ msgid "maximum table size (%d) exceeded"
|
||||
#~ msgstr "ecceduta la dimensione massima di una tabella (%d)"
|
||||
|
||||
#~ msgid "too many items (max %d)"
|
||||
#~ msgstr "troppi elementi (max %d)"
|
||||
|
||||
#~ msgid " $ \tgo to state %d\n"
|
||||
#~ msgstr " $ \tprosecuzione allo stato %d\n"
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# Swedish messages for bison.
|
||||
# Copyright © 2001 Free Software Foundation, Inc.
|
||||
# Göran Uddeborg <[email protected]>, 2001.
|
||||
# Copyright © 2001, 2002 Free Software Foundation, Inc.
|
||||
# Göran Uddeborg <[email protected]>, 2001, 2002.
|
||||
# $Revision$
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: bison 1.30c\n"
|
||||
"POT-Creation-Date: 2002-01-29 17:17+0100\n"
|
||||
"PO-Revision-Date: 2001-11-18 15:17+0100\n"
|
||||
"Project-Id-Version: bison 1.33b\n"
|
||||
"POT-Creation-Date: 2002-05-02 09:20+0200\n"
|
||||
"PO-Revision-Date: 2002-03-05 10:18+0100\n"
|
||||
"Last-Translator: Göran Uddeborg <[email protected]>\n"
|
||||
"Language-Team: Swedish <[email protected]>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -15,12 +15,12 @@ msgstr ""
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#: src/LR0.c:194
|
||||
#: src/LR0.c:198
|
||||
#, c-format
|
||||
msgid "too many states (max %d)"
|
||||
msgstr "för många tillstånd (max %d)"
|
||||
|
||||
#: lib/error.c:128 lib/error.c:156 src/complain.c:99
|
||||
#: src/complain.c:99 lib/error.c:128 lib/error.c:156
|
||||
msgid "Unknown system error"
|
||||
msgstr "Okänt systemfel"
|
||||
|
||||
@@ -32,96 +32,92 @@ msgstr "varning: "
|
||||
msgid "fatal error: "
|
||||
msgstr "ödesdigert fel: "
|
||||
|
||||
#: src/conflicts.c:46
|
||||
#: src/conflicts.c:48
|
||||
#, c-format
|
||||
msgid "Conflict in state %d between rule %d and token %s resolved as %s.\n"
|
||||
msgstr ""
|
||||
"Konflikt i tillstånd %d mellan regel %d och element %s, löstes med %s.\n"
|
||||
|
||||
#: src/conflicts.c:111 src/conflicts.c:133
|
||||
#: src/conflicts.c:115 src/conflicts.c:137
|
||||
msgid "reduce"
|
||||
msgstr "reducera"
|
||||
|
||||
#: src/conflicts.c:116 src/conflicts.c:128
|
||||
#: src/conflicts.c:120 src/conflicts.c:132
|
||||
msgid "shift"
|
||||
msgstr "skifta"
|
||||
|
||||
#: src/conflicts.c:138
|
||||
#: src/conflicts.c:142
|
||||
msgid "an error"
|
||||
msgstr "ett fel"
|
||||
|
||||
#: src/conflicts.c:291
|
||||
#: src/conflicts.c:284
|
||||
#, c-format
|
||||
msgid "%d shift/reduce conflict"
|
||||
msgid_plural "%d shift/reduce conflicts"
|
||||
msgstr[0] "%d skifta/reducerakonflikt"
|
||||
msgstr[1] "%d skifta/reducerakonflikter"
|
||||
|
||||
#: src/conflicts.c:298
|
||||
#: src/conflicts.c:291
|
||||
msgid "and"
|
||||
msgstr "och"
|
||||
|
||||
#: src/conflicts.c:304
|
||||
#: src/conflicts.c:297
|
||||
#, c-format
|
||||
msgid "%d reduce/reduce conflict"
|
||||
msgid_plural "%d reduce/reduce conflicts"
|
||||
msgstr[0] "%d reducera/reducerakonflikt"
|
||||
msgstr[1] "%d reducera/reducerakonflikter"
|
||||
|
||||
#: src/conflicts.c:329
|
||||
#: src/conflicts.c:322
|
||||
#, c-format
|
||||
msgid "State %d contains "
|
||||
msgstr "Tillstånd %d innehåller "
|
||||
|
||||
#. If invoked with `--yacc', use the output format specified by
|
||||
#. POSIX.
|
||||
#: src/conflicts.c:376
|
||||
#: src/conflicts.c:369
|
||||
msgid "conflicts: "
|
||||
msgstr "konflikter: "
|
||||
|
||||
#: src/conflicts.c:378
|
||||
#: src/conflicts.c:371
|
||||
#, c-format
|
||||
msgid " %d shift/reduce"
|
||||
msgstr " %d skifta/reducera"
|
||||
|
||||
#: src/conflicts.c:382
|
||||
#: src/conflicts.c:375
|
||||
#, c-format
|
||||
msgid " %d reduce/reduce"
|
||||
msgstr " %d reducera/reducera"
|
||||
|
||||
#: src/conflicts.c:387 src/reduce.c:499
|
||||
#: src/conflicts.c:380 src/reduce.c:391
|
||||
#, c-format
|
||||
msgid "%s contains "
|
||||
msgstr "%s innehåller "
|
||||
|
||||
#: src/conflicts.c:394
|
||||
#, fuzzy, c-format
|
||||
#: src/conflicts.c:387
|
||||
#, c-format
|
||||
msgid "expected %d shift/reduce conflict\n"
|
||||
msgid_plural "expected %d shift/reduce conflicts\n"
|
||||
msgstr[0] "förväntade %d skifta/reducerakonflikt"
|
||||
msgstr[1] "förväntade %d skifta/reducerakonflikter"
|
||||
msgstr[0] "förväntade %d skifta/reducerakonflikt\n"
|
||||
msgstr[1] "förväntade %d skifta/reducerakonflikter\n"
|
||||
|
||||
#: src/files.c:159
|
||||
#: src/files.c:160
|
||||
#, c-format
|
||||
msgid "cannot open file `%s'"
|
||||
msgstr "kan inte öppna filen \"%s\""
|
||||
|
||||
#: src/files.c:178
|
||||
#: src/files.c:179
|
||||
msgid "cannot close file"
|
||||
msgstr "kan inte stänga fil"
|
||||
|
||||
#. Some efforts were made to ease the translators' task, please
|
||||
#. continue.
|
||||
#: src/getargs.c:55
|
||||
#: src/getargs.c:56
|
||||
msgid "GNU bison generates parsers for LALR(1) grammars.\n"
|
||||
msgstr "GNU bison genererar parsrar för LALR(1)-grammatiker.\n"
|
||||
|
||||
#: src/getargs.c:59
|
||||
#: src/getargs.c:60
|
||||
#, c-format
|
||||
msgid "Usage: %s [OPTION]... FILE\n"
|
||||
msgstr "Användning: %s [FLAGGA]... FIL\n"
|
||||
|
||||
#: src/getargs.c:63
|
||||
#: src/getargs.c:64
|
||||
msgid ""
|
||||
"If a long option shows an argument as mandatory, then it is mandatory\n"
|
||||
"for the equivalent short option also. Similarly for optional arguments.\n"
|
||||
@@ -130,7 +126,7 @@ msgstr ""
|
||||
"obligatoriskt för den motsvarande korta flaggan också. Motsvarande\n"
|
||||
"för valfria argument.\n"
|
||||
|
||||
#: src/getargs.c:69
|
||||
#: src/getargs.c:70
|
||||
msgid ""
|
||||
"Operation modes:\n"
|
||||
" -h, --help display this help and exit\n"
|
||||
@@ -142,7 +138,7 @@ msgstr ""
|
||||
" -V, --version visa versionsinformation och avsluta\n"
|
||||
" -y, --yacc emulera POSIX-yacc\n"
|
||||
|
||||
#: src/getargs.c:76
|
||||
#: src/getargs.c:77
|
||||
msgid ""
|
||||
"Parser:\n"
|
||||
" -S, --skeleton=FILE specify the skeleton to use\n"
|
||||
@@ -162,7 +158,7 @@ msgstr ""
|
||||
" -n, --no-parser generera endast tabellerna\n"
|
||||
" -k, --token-table inkludera en tabell över elementnamn\n"
|
||||
|
||||
#: src/getargs.c:88
|
||||
#: src/getargs.c:89
|
||||
msgid ""
|
||||
"Output:\n"
|
||||
" -d, --defines also produce a header file\n"
|
||||
@@ -179,24 +175,27 @@ msgstr ""
|
||||
" -o, --output=FIL lägg utdata i FIL\n"
|
||||
" -g, --graph skapa också en VCG-beskrivning av automaten\n"
|
||||
|
||||
#: src/getargs.c:98
|
||||
#: src/getargs.c:99
|
||||
msgid "Report bugs to <[email protected]>.\n"
|
||||
msgstr ""
|
||||
"Rapportera fel till <[email protected]>.\n"
|
||||
"Rapportera anmärkningar på översättningen till <[email protected]>.\n"
|
||||
"Rapportera synpunkter på översättningen till <[email protected]>.\n"
|
||||
|
||||
#. Some efforts were made to ease the translators' task, please
|
||||
#. continue.
|
||||
#: src/getargs.c:112
|
||||
#: src/getargs.c:113
|
||||
#, c-format
|
||||
msgid "bison (GNU Bison) %s"
|
||||
msgstr "bison (GNU Bison) %s"
|
||||
|
||||
#: src/getargs.c:117
|
||||
msgid ""
|
||||
"Copyright 1984, 1986, 1989, 1992, 2000, 2001 Free Software Foundation, Inc.\n"
|
||||
#: src/getargs.c:115
|
||||
msgid "Written by Robert Corbett and Richard Stallman.\n"
|
||||
msgstr ""
|
||||
"Copyright 1984, 1986, 1989, 1992, 2000, 2001 Free Software Foundation, Inc.\n"
|
||||
|
||||
#: src/getargs.c:119
|
||||
#, fuzzy, c-format
|
||||
msgid "Copyright (C) %d Free Software Foundation, Inc.\n"
|
||||
msgstr ""
|
||||
"Copyright 1984, 1986, 1989, 1992, 2000, 2001, 2002\n"
|
||||
"Free Software Foundation, Inc.\n"
|
||||
|
||||
#: src/getargs.c:121
|
||||
msgid ""
|
||||
@@ -207,7 +206,7 @@ msgstr ""
|
||||
"finns INGEN garanti, inte ens för SÄLJBARHET eller LÄMPLIGHET FÖR ETT\n"
|
||||
"SPECIELLT ÄNDAMÅL.\n"
|
||||
|
||||
#: src/getargs.c:200 src/lex.c:599
|
||||
#: src/getargs.c:200 src/lex.c:603
|
||||
#, c-format
|
||||
msgid "`%s' is no longer supported"
|
||||
msgstr "\"%s\" stöds inte längre"
|
||||
@@ -227,7 +226,7 @@ msgstr "%s: ingen grammatikfil angiven\n"
|
||||
msgid "%s: extra arguments ignored after `%s'\n"
|
||||
msgstr "%s: extra argument ignorerade efter \"%s\"\n"
|
||||
|
||||
#: src/lalr.c:175
|
||||
#: src/lalr.c:174
|
||||
#, c-format
|
||||
msgid "too many gotos (max %d)"
|
||||
msgstr "för många goto (max %d)"
|
||||
@@ -236,7 +235,7 @@ msgstr "f
|
||||
msgid "unexpected `/' found and ignored"
|
||||
msgstr "oväntat \"/\" hittat och ignorerat"
|
||||
|
||||
#: src/lex.c:106 src/reader.c:302
|
||||
#: src/lex.c:106 src/reader.c:485
|
||||
msgid "unterminated comment"
|
||||
msgstr "oavslutad kommentar"
|
||||
|
||||
@@ -275,47 +274,42 @@ msgstr "oavslutat typnamn"
|
||||
msgid "use \"...\" for multi-character literal tokens"
|
||||
msgstr "använd \"...\" för bokstavliga element med mer än ett tecken"
|
||||
|
||||
#: src/lex.c:571
|
||||
#: src/lex.c:575
|
||||
#, c-format
|
||||
msgid "`%s' supports no argument: %s"
|
||||
msgstr "\"%s\" stödjer inga argument: %s"
|
||||
|
||||
#: src/lex.c:588
|
||||
#: src/lex.c:592
|
||||
#, c-format
|
||||
msgid "`%s' requires an argument"
|
||||
msgstr "\"%s\" behöver ett argument"
|
||||
|
||||
#: src/output.c:804
|
||||
#, c-format
|
||||
msgid "maximum table size (%d) exceeded"
|
||||
msgstr "maximal tabellstorlek (%d) överskriden"
|
||||
|
||||
#: src/print.c:44
|
||||
#: src/print.c:46
|
||||
#, c-format
|
||||
msgid " type %d is %s\n"
|
||||
msgstr " typ %d är %s\n"
|
||||
|
||||
#: src/print.c:106
|
||||
#: src/print.c:108
|
||||
#, c-format
|
||||
msgid " (rule %d)"
|
||||
msgstr " (regel %d)"
|
||||
|
||||
#: src/print.c:127
|
||||
#: src/print.c:129
|
||||
#, c-format
|
||||
msgid " %-4s\tshift, and go to state %d\n"
|
||||
msgstr " %-4s\tskifta, och gå till tillstånd %d\n"
|
||||
|
||||
#: src/print.c:144
|
||||
#: src/print.c:146
|
||||
#, c-format
|
||||
msgid " %-4s\terror (nonassociative)\n"
|
||||
msgstr " %-4s\tfel (ickeassociativ)\n"
|
||||
|
||||
#: src/print.c:168
|
||||
#: src/print.c:170
|
||||
#, c-format
|
||||
msgid " %-4s\tgo to state %d\n"
|
||||
msgstr " %-4s\tgå till tillstånd %d\n"
|
||||
|
||||
#: src/print.c:192 src/print.c:228
|
||||
#: src/print.c:194 src/print.c:228
|
||||
#, c-format
|
||||
msgid ""
|
||||
" $default\treduce using rule %d (%s)\n"
|
||||
@@ -324,337 +318,334 @@ msgstr ""
|
||||
" $standard\treducera med regel %d (%s)\n"
|
||||
"\n"
|
||||
|
||||
#: src/print.c:224 src/print.c:301
|
||||
#: src/print.c:223 src/print.c:298
|
||||
#, c-format
|
||||
msgid " %-4s\t[reduce using rule %d (%s)]\n"
|
||||
msgstr " %-4s\t[reducera med regel %d (%s)]\n"
|
||||
|
||||
#: src/print.c:282 src/print.c:295
|
||||
#: src/print.c:279 src/print.c:292
|
||||
#, c-format
|
||||
msgid " %-4s\treduce using rule %d (%s)\n"
|
||||
msgstr " %-4s\treducera med regel %d (%s)\n"
|
||||
|
||||
#: src/print.c:311
|
||||
#: src/print.c:307
|
||||
#, c-format
|
||||
msgid " $default\treduce using rule %d (%s)\n"
|
||||
msgstr " $standard\treducera med regel %d (%s)\n"
|
||||
|
||||
#: src/print.c:327
|
||||
#: src/print.c:323
|
||||
msgid " $default\taccept\n"
|
||||
msgstr " $standard\tacceptera\n"
|
||||
|
||||
#: src/print.c:329
|
||||
#: src/print.c:325
|
||||
msgid " NO ACTIONS\n"
|
||||
msgstr " INGA ÅTGÄRDER\n"
|
||||
|
||||
#: src/print.c:342
|
||||
#: src/print.c:338
|
||||
#, c-format
|
||||
msgid "state %d"
|
||||
msgstr "tillstånd %d"
|
||||
|
||||
#. rule # : LHS -> RHS
|
||||
#: src/print.c:373
|
||||
#: src/print.c:370
|
||||
msgid "Grammar"
|
||||
msgstr "Grammatik"
|
||||
|
||||
#: src/print.c:374
|
||||
#: src/print.c:371
|
||||
msgid "Number, Line, Rule"
|
||||
msgstr ""
|
||||
msgstr "Nummer, Rad, Regel"
|
||||
|
||||
#: src/print.c:379
|
||||
#, fuzzy, c-format
|
||||
#: src/print.c:374
|
||||
#, c-format
|
||||
msgid " %3d %3d %s ->"
|
||||
msgstr "regel %-4d %s ->"
|
||||
msgstr " %3d %3d %s ->"
|
||||
|
||||
#: src/print.c:386
|
||||
#: src/print.c:381
|
||||
msgid "empty"
|
||||
msgstr "tom"
|
||||
|
||||
#. TERMINAL (type #) : rule #s terminal is on RHS
|
||||
#: src/print.c:393
|
||||
#: src/print.c:388
|
||||
msgid "Terminals, with rules where they appear"
|
||||
msgstr "Terminaler, med regler där de förekommer"
|
||||
|
||||
#: src/print.c:416
|
||||
#: src/print.c:411
|
||||
msgid "Nonterminals, with rules where they appear"
|
||||
msgstr "Icketerminaler, med regler där de förekommer"
|
||||
|
||||
#: src/print.c:442
|
||||
#: src/print.c:437
|
||||
msgid " on left:"
|
||||
msgstr " till vänster:"
|
||||
|
||||
#: src/print.c:457
|
||||
#: src/print.c:452
|
||||
msgid " on right:"
|
||||
msgstr " till höger:"
|
||||
|
||||
#: src/reader.c:100
|
||||
msgid " Skipping to next \\n"
|
||||
msgstr " Hoppar över till nästa \\n"
|
||||
|
||||
#: src/reader.c:102
|
||||
#, c-format
|
||||
msgid " Skipping to next %c"
|
||||
msgstr " Hoppar över till nästa %c"
|
||||
|
||||
#: src/reader.c:153 src/reader.c:165
|
||||
msgid "invalid $ value"
|
||||
msgstr "felaktigt $-värde"
|
||||
|
||||
#: src/reader.c:192 src/reader.c:207
|
||||
msgid "unterminated string at end of file"
|
||||
msgstr "oavslutad sträng vid filslut"
|
||||
|
||||
#: src/reader.c:195
|
||||
msgid "unterminated string"
|
||||
msgstr "oavslutad sträng"
|
||||
|
||||
#: src/reader.c:337 src/reader.c:401
|
||||
#, fuzzy, c-format
|
||||
msgid "invalid value: %s%d"
|
||||
msgstr "felaktigt $-värde"
|
||||
|
||||
#: src/reader.c:351 src/reader.c:423
|
||||
#, c-format
|
||||
msgid "%s is invalid"
|
||||
msgstr "%s är felaktigt"
|
||||
|
||||
#: src/reader.c:391
|
||||
#, c-format
|
||||
msgid "$$ of `%s' has no declared type"
|
||||
msgstr "$$ för \"%s\" har ingen deklarerad typ"
|
||||
|
||||
#: src/reader.c:415
|
||||
#, c-format
|
||||
msgid "$%d of `%s' has no declared type"
|
||||
msgstr "$%d för \"%s\" har ingen deklarerad typ"
|
||||
|
||||
#: src/reader.c:473
|
||||
msgid "unterminated `%{' definition"
|
||||
msgstr "oavslutad \"%{\"-definition"
|
||||
|
||||
#: src/reader.c:518 src/reader.c:636 src/reader.c:686 src/reader.c:933
|
||||
#, c-format
|
||||
msgid "Premature EOF after %s"
|
||||
msgstr "Förtida filslut efter %s"
|
||||
|
||||
#: src/reader.c:535
|
||||
#, c-format
|
||||
msgid "symbol `%s' used more than once as a literal string"
|
||||
msgstr "symbolen \"%s\" används mer än en gång som en bokstavlig sträng"
|
||||
|
||||
#: src/reader.c:538
|
||||
#, c-format
|
||||
msgid "symbol `%s' given more than one literal string"
|
||||
msgstr "symbolen \"%s\" har fått mer än en bokstavlig sträng"
|
||||
|
||||
#: src/reader.c:559 src/reader.c:705
|
||||
#, c-format
|
||||
msgid "symbol %s redefined"
|
||||
msgstr "symbolen %s omdefinierad"
|
||||
|
||||
#: src/reader.c:569 src/reader.c:651 src/reader.c:712
|
||||
#, c-format
|
||||
msgid "type redeclaration for %s"
|
||||
msgstr "typen omdeklarerad för %s"
|
||||
|
||||
#: src/reader.c:581
|
||||
#, c-format
|
||||
msgid "`%s' is invalid in %s"
|
||||
msgstr "\"%s\" är felaktig i %s"
|
||||
|
||||
#: src/reader.c:599 src/reader.c:758
|
||||
#, c-format
|
||||
msgid "multiple %s declarations"
|
||||
msgstr "flera %s-deklarationer"
|
||||
|
||||
#: src/reader.c:601 src/reader.c:913 src/reader.c:928 src/reader.c:961
|
||||
#: src/reader.c:975 src/reader.c:1178
|
||||
#, c-format
|
||||
msgid "invalid %s declaration"
|
||||
msgstr "felaktig %s-deklaration"
|
||||
|
||||
#: src/reader.c:621
|
||||
msgid "%type declaration has no <typename>"
|
||||
msgstr "%type-deklaration har inget <typnamn>"
|
||||
|
||||
#: src/reader.c:656
|
||||
#, c-format
|
||||
msgid "invalid %%type declaration due to item: %s"
|
||||
msgstr "felaktig %%type-deklaration på grund av objekt: %s"
|
||||
|
||||
#: src/reader.c:701
|
||||
#, c-format
|
||||
msgid "redefining precedence of %s"
|
||||
msgstr "omdefinition av precedens för %s"
|
||||
|
||||
#: src/reader.c:724
|
||||
#, c-format
|
||||
msgid "invalid text (%s) - number should be after identifier"
|
||||
msgstr "felaktig text (%s) - tal skulle följa efter identifierare"
|
||||
|
||||
#: src/reader.c:734
|
||||
#, c-format
|
||||
msgid "unexpected item: %s"
|
||||
msgstr "oväntat objekt: %s"
|
||||
|
||||
#: src/reader.c:790 src/reader.c:1149
|
||||
#, c-format
|
||||
msgid "unmatched %s"
|
||||
msgstr "ensam %s"
|
||||
|
||||
#: src/reader.c:819
|
||||
#, c-format
|
||||
msgid "argument of %%expect is not an integer"
|
||||
msgstr "argument till %%expect är inte ett heltal"
|
||||
|
||||
#: src/reader.c:865
|
||||
#, c-format
|
||||
msgid "unrecognized item %s, expected an identifier"
|
||||
msgstr "oväntat objekt %s, förväntade en identifierare"
|
||||
|
||||
#: src/reader.c:887
|
||||
#, c-format
|
||||
msgid "expected string constant instead of %s"
|
||||
msgstr "förväntade strängkonstant istället för %s"
|
||||
|
||||
#: src/reader.c:1080
|
||||
#, c-format
|
||||
msgid "unrecognized: %s"
|
||||
msgstr "okänt: %s"
|
||||
|
||||
#: src/reader.c:1085
|
||||
msgid "no input grammar"
|
||||
msgstr "ingen ingrammatik"
|
||||
|
||||
#: src/reader.c:1090
|
||||
#, c-format
|
||||
msgid "unknown character: %s"
|
||||
msgstr "okänt tecken: %s"
|
||||
|
||||
#: src/reader.c:1265
|
||||
msgid "ill-formed rule: initial symbol not followed by colon"
|
||||
msgstr "felskriven regel: första symbolen följs inte av ett kolon"
|
||||
|
||||
#: src/reader.c:1272
|
||||
msgid "grammar starts with vertical bar"
|
||||
msgstr "grammatiken startar med ett vertikalt streck"
|
||||
|
||||
#: src/reader.c:1300
|
||||
#, c-format
|
||||
msgid "rule given for %s, which is a token"
|
||||
msgstr "regel given för %s, som är ett element"
|
||||
|
||||
#: src/reader.c:1405
|
||||
msgid "two @prec's in a row"
|
||||
msgstr "två @prec i rad"
|
||||
|
||||
#: src/reader.c:1414
|
||||
#, c-format
|
||||
msgid "%%guard present but %%semantic_parser not specified"
|
||||
msgstr "%%guard finns men %%semantic_parser är inte angiven"
|
||||
|
||||
#: src/reader.c:1424
|
||||
msgid "two actions at end of one rule"
|
||||
msgstr "två åtgärder vid slutet av en regel"
|
||||
|
||||
#: src/reader.c:1438
|
||||
#, c-format
|
||||
msgid "type clash (`%s' `%s') on default action"
|
||||
msgstr "typkonflikt (\"%s\" \"%s\") för standardåtgärd"
|
||||
|
||||
#: src/reader.c:1444
|
||||
msgid "empty rule for typed nonterminal, and no action"
|
||||
msgstr "tom regel för typad icketerminal, och ingen åtgärd"
|
||||
|
||||
#: src/reader.c:1450
|
||||
#, c-format
|
||||
msgid "invalid input: %s"
|
||||
msgstr "felaktig indata: %s"
|
||||
|
||||
#: src/reader.c:1457
|
||||
msgid "no rules in the input grammar"
|
||||
msgstr "inga regler i ingrammatiken"
|
||||
|
||||
#: src/reader.c:1465
|
||||
#: src/reader.c:105
|
||||
#, c-format
|
||||
msgid "symbol %s is used, but is not defined as a token and has no rules"
|
||||
msgstr ""
|
||||
"symbolen %s används, men är inte definierad som ett element och har inga "
|
||||
"regler"
|
||||
|
||||
#: src/reader.c:1487
|
||||
#: src/reader.c:124
|
||||
#, c-format
|
||||
msgid "too many symbols (tokens plus nonterminals); maximum %d"
|
||||
msgstr "för många symboler (element plus icketerminaler); max %d"
|
||||
msgid "symbol `%s' used more than once as a literal string"
|
||||
msgstr "symbolen \"%s\" används mer än en gång som en bokstavlig sträng"
|
||||
|
||||
#: src/reader.c:1551
|
||||
#: src/reader.c:127
|
||||
#, c-format
|
||||
msgid "tokens %s and %s both assigned number %d"
|
||||
msgstr "elementen %s och %s har båda fått nummer %d"
|
||||
msgid "symbol `%s' given more than one literal string"
|
||||
msgstr "symbolen \"%s\" har fått mer än en bokstavlig sträng"
|
||||
|
||||
#: src/reader.c:1601
|
||||
#: src/reader.c:162
|
||||
#, c-format
|
||||
msgid "conflicting precedences for %s and %s"
|
||||
msgstr "motstridiga precedenser mellan %s och %s"
|
||||
|
||||
#: src/reader.c:1613
|
||||
#: src/reader.c:173
|
||||
#, c-format
|
||||
msgid "conflicting assoc values for %s and %s"
|
||||
msgstr "motstridiga assoc-värden mellan %s och %s"
|
||||
|
||||
#: src/reader.c:1650
|
||||
#: src/reader.c:241
|
||||
#, c-format
|
||||
msgid "tokens %s and %s both assigned number %d"
|
||||
msgstr "elementen %s och %s har båda fått nummer %d"
|
||||
|
||||
#: src/reader.c:261
|
||||
msgid " Skipping to next \\n"
|
||||
msgstr " Hoppar över till nästa \\n"
|
||||
|
||||
#: src/reader.c:263
|
||||
#, c-format
|
||||
msgid " Skipping to next %c"
|
||||
msgstr " Hoppar över till nästa %c"
|
||||
|
||||
#: src/reader.c:314 src/reader.c:326
|
||||
msgid "invalid $ value"
|
||||
msgstr "felaktigt $-värde"
|
||||
|
||||
#: src/reader.c:375 src/reader.c:390
|
||||
msgid "unterminated string at end of file"
|
||||
msgstr "oavslutad sträng vid filslut"
|
||||
|
||||
#: src/reader.c:378
|
||||
msgid "unterminated string"
|
||||
msgstr "oavslutad sträng"
|
||||
|
||||
#: src/reader.c:520 src/reader.c:584
|
||||
#, fuzzy, c-format
|
||||
msgid "invalid value: %s%d"
|
||||
msgstr "felaktigt @-värde"
|
||||
|
||||
#: src/reader.c:534 src/reader.c:606
|
||||
#, c-format
|
||||
msgid "%s is invalid"
|
||||
msgstr "%s är felaktigt"
|
||||
|
||||
#: src/reader.c:574
|
||||
#, c-format
|
||||
msgid "$$ of `%s' has no declared type"
|
||||
msgstr "$$ för \"%s\" har ingen deklarerad typ"
|
||||
|
||||
#: src/reader.c:598
|
||||
#, c-format
|
||||
msgid "$%d of `%s' has no declared type"
|
||||
msgstr "$%d för \"%s\" har ingen deklarerad typ"
|
||||
|
||||
#: src/reader.c:656
|
||||
msgid "unterminated `%{' definition"
|
||||
msgstr "oavslutad \"%{\"-definition"
|
||||
|
||||
#: src/reader.c:701 src/reader.c:811 src/reader.c:862 src/reader.c:1114
|
||||
#, c-format
|
||||
msgid "Premature EOF after %s"
|
||||
msgstr "Förtida filslut efter %s"
|
||||
|
||||
#: src/reader.c:726 src/reader.c:881
|
||||
#, c-format
|
||||
msgid "symbol %s redefined"
|
||||
msgstr "symbolen %s omdefinierad"
|
||||
|
||||
#: src/reader.c:738 src/reader.c:826 src/reader.c:892
|
||||
#, c-format
|
||||
msgid "type redeclaration for %s"
|
||||
msgstr "typen omdeklarerad för %s"
|
||||
|
||||
#: src/reader.c:756
|
||||
#, c-format
|
||||
msgid "`%s' is invalid in %s"
|
||||
msgstr "\"%s\" är felaktig i %s"
|
||||
|
||||
#: src/reader.c:774 src/reader.c:938
|
||||
#, c-format
|
||||
msgid "multiple %s declarations"
|
||||
msgstr "flera %s-deklarationer"
|
||||
|
||||
#: src/reader.c:776 src/reader.c:1094 src/reader.c:1109 src/reader.c:1142
|
||||
#: src/reader.c:1156 src/reader.c:1362
|
||||
#, c-format
|
||||
msgid "invalid %s declaration"
|
||||
msgstr "felaktig %s-deklaration"
|
||||
|
||||
#: src/reader.c:796
|
||||
msgid "%type declaration has no <typename>"
|
||||
msgstr "%type-deklaration har inget <typnamn>"
|
||||
|
||||
#: src/reader.c:831
|
||||
#, c-format
|
||||
msgid "invalid %%type declaration due to item: %s"
|
||||
msgstr "felaktig %%type-deklaration på grund av objekt: %s"
|
||||
|
||||
#: src/reader.c:877
|
||||
#, c-format
|
||||
msgid "redefining precedence of %s"
|
||||
msgstr "omdefinition av precedens för %s"
|
||||
|
||||
#: src/reader.c:904
|
||||
#, c-format
|
||||
msgid "invalid text (%s) - number should be after identifier"
|
||||
msgstr "felaktig text (%s) - tal skulle följa efter identifierare"
|
||||
|
||||
#: src/reader.c:914
|
||||
#, c-format
|
||||
msgid "unexpected item: %s"
|
||||
msgstr "oväntat objekt: %s"
|
||||
|
||||
#: src/reader.c:971 src/reader.c:1333
|
||||
#, c-format
|
||||
msgid "unmatched %s"
|
||||
msgstr "ensam %s"
|
||||
|
||||
#: src/reader.c:1000
|
||||
#, c-format
|
||||
msgid "argument of %%expect is not an integer"
|
||||
msgstr "argument till %%expect är inte ett heltal"
|
||||
|
||||
#: src/reader.c:1046
|
||||
#, c-format
|
||||
msgid "unrecognized item %s, expected an identifier"
|
||||
msgstr "oväntat objekt %s, förväntade en identifierare"
|
||||
|
||||
#: src/reader.c:1068
|
||||
#, c-format
|
||||
msgid "expected string constant instead of %s"
|
||||
msgstr "förväntade strängkonstant istället för %s"
|
||||
|
||||
#: src/reader.c:1264
|
||||
#, c-format
|
||||
msgid "unrecognized: %s"
|
||||
msgstr "okänt: %s"
|
||||
|
||||
#: src/reader.c:1269
|
||||
msgid "no input grammar"
|
||||
msgstr "ingen ingrammatik"
|
||||
|
||||
#: src/reader.c:1274
|
||||
#, c-format
|
||||
msgid "unknown character: %s"
|
||||
msgstr "okänt tecken: %s"
|
||||
|
||||
#: src/reader.c:1448
|
||||
msgid "ill-formed rule: initial symbol not followed by colon"
|
||||
msgstr "felskriven regel: första symbolen följs inte av ett kolon"
|
||||
|
||||
#: src/reader.c:1455
|
||||
msgid "grammar starts with vertical bar"
|
||||
msgstr "grammatiken startar med ett vertikalt streck"
|
||||
|
||||
#: src/reader.c:1483
|
||||
#, c-format
|
||||
msgid "rule given for %s, which is a token"
|
||||
msgstr "regel given för %s, som är ett element"
|
||||
|
||||
#: src/reader.c:1513 src/reader.c:1632
|
||||
msgid "previous rule lacks an ending `;'"
|
||||
msgstr "föregående regel saknar ett avslutande \";\""
|
||||
|
||||
#: src/reader.c:1591
|
||||
msgid "two @prec's in a row"
|
||||
msgstr "två @prec i rad"
|
||||
|
||||
#: src/reader.c:1600
|
||||
#, c-format
|
||||
msgid "%%guard present but %%semantic_parser not specified"
|
||||
msgstr "%%guard finns men %%semantic_parser är inte angiven"
|
||||
|
||||
#: src/reader.c:1610
|
||||
msgid "two actions at end of one rule"
|
||||
msgstr "två åtgärder vid slutet av en regel"
|
||||
|
||||
#: src/reader.c:1624
|
||||
#, c-format
|
||||
msgid "type clash (`%s' `%s') on default action"
|
||||
msgstr "typkonflikt (\"%s\" \"%s\") för standardåtgärd"
|
||||
|
||||
#: src/reader.c:1630
|
||||
msgid "empty rule for typed nonterminal, and no action"
|
||||
msgstr "tom regel för typad icketerminal, och ingen åtgärd"
|
||||
|
||||
#: src/reader.c:1638
|
||||
#, c-format
|
||||
msgid "invalid input: %s"
|
||||
msgstr "felaktig indata: %s"
|
||||
|
||||
#: src/reader.c:1645
|
||||
msgid "no rules in the input grammar"
|
||||
msgstr "inga regler i ingrammatiken"
|
||||
|
||||
#: src/reader.c:1666
|
||||
#, c-format
|
||||
msgid "too many symbols (tokens plus nonterminals); maximum %d"
|
||||
msgstr "för många symboler (element plus icketerminaler); max %d"
|
||||
|
||||
#: src/reader.c:1768
|
||||
#, c-format
|
||||
msgid "the start symbol %s is undefined"
|
||||
msgstr "startsymbolen %s är odefinierad"
|
||||
|
||||
#: src/reader.c:1652
|
||||
#: src/reader.c:1770
|
||||
#, c-format
|
||||
msgid "the start symbol %s is a token"
|
||||
msgstr "startsymbolen %s är ett element"
|
||||
|
||||
#: src/reader.c:1672
|
||||
#, fuzzy, c-format
|
||||
msgid "too many items (max %d)"
|
||||
msgstr "för många tillstånd (max %d)"
|
||||
|
||||
#: src/reduce.c:398
|
||||
#: src/reduce.c:332
|
||||
msgid "Useless nonterminals:"
|
||||
msgstr "Oanvändbara icketerminaler:"
|
||||
|
||||
#: src/reduce.c:411
|
||||
#: src/reduce.c:346
|
||||
msgid "Terminals which are not used:"
|
||||
msgstr "Terminaler som inte används:"
|
||||
|
||||
#: src/reduce.c:422
|
||||
#: src/reduce.c:358
|
||||
msgid "Useless rules:"
|
||||
msgstr "Oanvändbara regler:"
|
||||
|
||||
#: src/reduce.c:494
|
||||
#, fuzzy, c-format
|
||||
#: src/reduce.c:386
|
||||
#, c-format
|
||||
msgid "%d rule never reduced\n"
|
||||
msgid_plural "%d rules never reduced\n"
|
||||
msgstr[0] "%d regler reduceras aldrig\n"
|
||||
msgstr[0] "%d regel reduceras aldrig\n"
|
||||
msgstr[1] "%d regler reduceras aldrig\n"
|
||||
|
||||
# Jag har anmält att det är fel att anta att "s" är en universell pluraländelse.
|
||||
# Jag föreslog också att de använder ngettext istället.
|
||||
# "Vad göras skall är redan gjort."
|
||||
#: src/reduce.c:502
|
||||
#, fuzzy, c-format
|
||||
#: src/reduce.c:394
|
||||
#, c-format
|
||||
msgid "%d useless nonterminal"
|
||||
msgid_plural "%d useless nonterminals"
|
||||
msgstr[0] "%d oanvändbara icketerminaler%.0s"
|
||||
msgstr[0] "%d oanvändbar icketerminal"
|
||||
msgstr[1] "%d oanvändbara icketerminaler"
|
||||
|
||||
#: src/reduce.c:508
|
||||
#: src/reduce.c:400
|
||||
msgid " and "
|
||||
msgstr " och "
|
||||
|
||||
#: src/reduce.c:511
|
||||
#, fuzzy, c-format
|
||||
#: src/reduce.c:403
|
||||
#, c-format
|
||||
msgid "%d useless rule"
|
||||
msgid_plural "%d useless rules"
|
||||
msgstr[0] "%d oanvändbara regler%.0s"
|
||||
msgstr[0] "%d oanvändbar regel"
|
||||
msgstr[1] "%d oanvändbara regler"
|
||||
|
||||
#: src/reduce.c:542
|
||||
#: src/reduce.c:433
|
||||
#, c-format
|
||||
msgid "Start symbol %s does not derive any sentence"
|
||||
msgstr "Startsymbolen %s genererar inga meningar"
|
||||
@@ -679,19 +670,16 @@ msgstr "%s: flaggan \"%c%s\" tar inget argument\n"
|
||||
msgid "%s: option `%s' requires an argument\n"
|
||||
msgstr "%s: flaggan \"%s\" behöver ett argument\n"
|
||||
|
||||
#. --option
|
||||
#: lib/getopt.c:771
|
||||
#, c-format
|
||||
msgid "%s: unrecognized option `--%s'\n"
|
||||
msgstr "%s: okänd flagga \"--%s\"\n"
|
||||
|
||||
#. +option or -option
|
||||
#: lib/getopt.c:775
|
||||
#, c-format
|
||||
msgid "%s: unrecognized option `%c%s'\n"
|
||||
msgstr "%s: okänd flagga \"%c%s\"\n"
|
||||
|
||||
#. 1003.2 specifies the format of this message.
|
||||
#: lib/getopt.c:801
|
||||
#, c-format
|
||||
msgid "%s: illegal option -- %c\n"
|
||||
@@ -702,7 +690,6 @@ msgstr "%s: otill
|
||||
msgid "%s: invalid option -- %c\n"
|
||||
msgstr "%s: ogiltig flagga --%c\n"
|
||||
|
||||
#. 1003.2 specifies the format of this message.
|
||||
#: lib/getopt.c:834 lib/getopt.c:964
|
||||
#, c-format
|
||||
msgid "%s: option requires an argument -- %c\n"
|
||||
@@ -718,8 +705,6 @@ msgstr "%s: flaggan \"-W %s\"
|
||||
msgid "%s: option `-W %s' doesn't allow an argument\n"
|
||||
msgstr "%s: flaggan \"-W %s\" tar inget argument\n"
|
||||
|
||||
#. If XALLOC_FAIL_FUNC is NULL, or does return, display this message
|
||||
#. before exiting when memory is exhausted. Goes through gettext.
|
||||
#: lib/obstack.c:494 lib/obstack.c:497 lib/xmalloc.c:66
|
||||
msgid "memory exhausted"
|
||||
msgstr "minnet slut"
|
||||
@@ -727,20 +712,6 @@ msgstr "minnet slut"
|
||||
# När vi går över till Unicode mer allmänt kanske vi bör översätta båda dessa
|
||||
# med U+201D (RIGHT DOUBLE QUOTATION MARK) på svenska. Eller?
|
||||
#
|
||||
#. Get translations for open and closing quotation marks.
|
||||
#.
|
||||
#. The message catalog should translate "`" to a left
|
||||
#. quotation mark suitable for the locale, and similarly for
|
||||
#. "'". If the catalog has no translation,
|
||||
#. locale_quoting_style quotes `like this', and
|
||||
#. clocale_quoting_style quotes "like this".
|
||||
#.
|
||||
#. For example, an American English Unicode locale should
|
||||
#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and
|
||||
#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION
|
||||
#. MARK). A British English Unicode locale should instead
|
||||
#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and
|
||||
#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively.
|
||||
#: lib/quotearg.c:274
|
||||
msgid "`"
|
||||
msgstr "\""
|
||||
@@ -749,6 +720,12 @@ msgstr "\""
|
||||
msgid "'"
|
||||
msgstr "\""
|
||||
|
||||
#~ msgid "maximum table size (%d) exceeded"
|
||||
#~ msgstr "maximal tabellstorlek (%d) överskriden"
|
||||
|
||||
#~ msgid " $ \tgo to state %d\n"
|
||||
#~ msgstr " $ \tgå till tillstånd %d\n"
|
||||
|
||||
#~ msgid "%-4s\terror (nonassociative)"
|
||||
#~ msgstr "%-4s\tfel (ickeassociativ)"
|
||||
|
||||
@@ -757,54 +734,3 @@ msgstr "\""
|
||||
|
||||
#~ msgid "unterminated %guard clause"
|
||||
#~ msgstr "oavlutad %guard-sats"
|
||||
|
||||
#~ msgid " $ \tgo to state %d\n"
|
||||
#~ msgstr " $ \tgå till tillstånd %d\n"
|
||||
|
||||
#~ msgid "%s: internal error: %s\n"
|
||||
#~ msgstr "%s: internt fel: %s\n"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Variables\n"
|
||||
#~ "---------\n"
|
||||
#~ "\n"
|
||||
#~ msgstr ""
|
||||
#~ "Variabler\n"
|
||||
#~ "---------\n"
|
||||
#~ "\n"
|
||||
|
||||
#~ msgid "Value Sprec Sassoc Tag\n"
|
||||
#~ msgstr "Värde Sprec Sassoc Tagg\n"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Rules\n"
|
||||
#~ "-----\n"
|
||||
#~ "\n"
|
||||
#~ msgstr ""
|
||||
#~ "Regler\n"
|
||||
#~ "------\n"
|
||||
#~ "\n"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Rules interpreted\n"
|
||||
#~ "-----------------\n"
|
||||
#~ "\n"
|
||||
#~ msgstr ""
|
||||
#~ "Tolkade regler\n"
|
||||
#~ "--------------\n"
|
||||
#~ "\n"
|
||||
|
||||
#~ msgid "DERIVES"
|
||||
#~ msgstr "HÄRLEDER"
|
||||
|
||||
#~ msgid "%s derives"
|
||||
#~ msgstr "%s härleder"
|
||||
|
||||
#~ msgid "Entering set_nullable"
|
||||
#~ msgstr "Påbörjar set_nullable"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "reduced %s defines %d terminal%s, %d nonterminal%s, and %d production%s.\n"
|
||||
#~ msgstr ""
|
||||
#~ "reducerad %s definierar %d terminaler%.0s, %d icketerminaler%.0s och %d "
|
||||
#~ "produktioner%.0s.\n"
|
||||
|
||||
@@ -5,5 +5,4 @@ bison
|
||||
*.log
|
||||
*.flc
|
||||
Makefile.in
|
||||
parse-skel.[ch] parse-skel.output
|
||||
scan-skel.c
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Generate the nondeterministic finite state machine for bison,
|
||||
Copyright 1984, 1986, 1989, 2000, 2001 Free Software Foundation, Inc.
|
||||
Copyright 1984, 1986, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -23,7 +23,10 @@
|
||||
The entry point is generate_states. */
|
||||
|
||||
#include "system.h"
|
||||
#include "bitset.h"
|
||||
#include "quotearg.h"
|
||||
#include "symtab.h"
|
||||
#include "gram.h"
|
||||
#include "getargs.h"
|
||||
#include "reader.h"
|
||||
#include "gram.h"
|
||||
@@ -34,7 +37,7 @@
|
||||
#include "lalr.h"
|
||||
#include "reduce.h"
|
||||
|
||||
int nstates;
|
||||
unsigned int nstates = 0;
|
||||
/* Initialize the final state to -1, otherwise, it might be set to 0
|
||||
by default, and since we don't compute the reductions of the final
|
||||
state, we end up not computing the reductions of the initial state,
|
||||
@@ -49,14 +52,14 @@ static state_t *this_state = NULL;
|
||||
static state_t *last_state = NULL;
|
||||
|
||||
static int nshifts;
|
||||
static short *shift_symbol = NULL;
|
||||
static token_number_t *shift_symbol = NULL;
|
||||
|
||||
static short *redset = NULL;
|
||||
static short *shiftset = NULL;
|
||||
|
||||
static short **kernel_base = NULL;
|
||||
static item_number_t **kernel_base = NULL;
|
||||
static int *kernel_size = NULL;
|
||||
static short *kernel_items = NULL;
|
||||
static item_number_t *kernel_items = NULL;
|
||||
|
||||
/* hash table for states, to recognize equivalent ones. */
|
||||
|
||||
@@ -67,7 +70,8 @@ static state_t **state_hash = NULL;
|
||||
static void
|
||||
allocate_itemsets (void)
|
||||
{
|
||||
int i;
|
||||
int i, r;
|
||||
item_number_t *rhsp;
|
||||
|
||||
/* Count the number of occurrences of all the symbols in RITEMS.
|
||||
Note that useless productions (hence useless nonterminals) are
|
||||
@@ -76,11 +80,11 @@ allocate_itemsets (void)
|
||||
int count = 0;
|
||||
short *symbol_count = XCALLOC (short, nsyms + nuseless_nonterminals);
|
||||
|
||||
for (i = 0; i < nritems; ++i)
|
||||
if (ritem[i] >= 0)
|
||||
for (r = 1; r < nrules + 1; ++r)
|
||||
for (rhsp = rules[r].rhs; *rhsp >= 0; ++rhsp)
|
||||
{
|
||||
count++;
|
||||
symbol_count[ritem[i]]++;
|
||||
symbol_count[*rhsp]++;
|
||||
}
|
||||
|
||||
/* See comments before new_itemsets. All the vectors of items
|
||||
@@ -89,9 +93,9 @@ allocate_itemsets (void)
|
||||
appears as an item, which is symbol_count[symbol].
|
||||
We allocate that much space for each symbol. */
|
||||
|
||||
kernel_base = XCALLOC (short *, nsyms);
|
||||
kernel_base = XCALLOC (item_number_t *, nsyms);
|
||||
if (count)
|
||||
kernel_items = XCALLOC (short, count);
|
||||
kernel_items = XCALLOC (item_number_t, count);
|
||||
|
||||
count = 0;
|
||||
for (i = 0; i < nsyms; i++)
|
||||
@@ -113,7 +117,7 @@ allocate_storage (void)
|
||||
shiftset = XCALLOC (short, nsyms);
|
||||
redset = XCALLOC (short, nrules + 1);
|
||||
state_hash = XCALLOC (state_t *, STATE_HASH_SIZE);
|
||||
shift_symbol = XCALLOC (short, nsyms);
|
||||
shift_symbol = XCALLOC (token_number_t, nsyms);
|
||||
}
|
||||
|
||||
|
||||
@@ -157,21 +161,20 @@ new_itemsets (void)
|
||||
|
||||
nshifts = 0;
|
||||
|
||||
for (i = 0; i < nitemset; ++i)
|
||||
{
|
||||
int symbol = ritem[itemset[i]];
|
||||
if (symbol >= 0)
|
||||
{
|
||||
if (!kernel_size[symbol])
|
||||
{
|
||||
shift_symbol[nshifts] = symbol;
|
||||
nshifts++;
|
||||
}
|
||||
for (i = 0; i < nritemset; ++i)
|
||||
if (ritem[itemset[i]] >= 0)
|
||||
{
|
||||
token_number_t symbol
|
||||
= item_number_as_token_number (ritem[itemset[i]]);
|
||||
if (!kernel_size[symbol])
|
||||
{
|
||||
shift_symbol[nshifts] = symbol;
|
||||
nshifts++;
|
||||
}
|
||||
|
||||
kernel_base[symbol][kernel_size[symbol]] = itemset[i] + 1;
|
||||
kernel_size[symbol]++;
|
||||
}
|
||||
}
|
||||
kernel_base[symbol][kernel_size[symbol]] = itemset[i] + 1;
|
||||
kernel_size[symbol]++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -182,32 +185,39 @@ new_itemsets (void)
|
||||
`-----------------------------------------------------------------*/
|
||||
|
||||
static state_t *
|
||||
new_state (int symbol)
|
||||
new_state (token_number_t symbol)
|
||||
{
|
||||
state_t *p;
|
||||
|
||||
if (trace_flag)
|
||||
fprintf (stderr, "Entering new_state, state = %d, symbol = %d (%s)\n",
|
||||
this_state->number, symbol, symbols[symbol]->tag);
|
||||
nstates, symbol, quotearg_style (escape_quoting_style,
|
||||
symbols[symbol]->tag));
|
||||
|
||||
if (nstates >= MAXSHORT)
|
||||
fatal (_("too many states (max %d)"), MAXSHORT);
|
||||
if (nstates >= SHRT_MAX)
|
||||
fatal (_("too many states (max %d)"), SHRT_MAX);
|
||||
|
||||
p = STATE_ALLOC (kernel_size[symbol]);
|
||||
p->accessing_symbol = symbol;
|
||||
p->number = nstates;
|
||||
p->nitems = kernel_size[symbol];
|
||||
|
||||
shortcpy (p->items, kernel_base[symbol], kernel_size[symbol]);
|
||||
memcpy (p->items, kernel_base[symbol],
|
||||
kernel_size[symbol] * sizeof (kernel_base[symbol][0]));
|
||||
|
||||
last_state->next = p;
|
||||
last_state = p;
|
||||
nstates++;
|
||||
|
||||
/* If this is the eoftoken, then this is the final state. */
|
||||
if (symbol == 0)
|
||||
/* If this is the eoftoken, and this is not the initial state, then
|
||||
this is the final state. */
|
||||
if (symbol == 0 && first_state)
|
||||
final_state = p->number;
|
||||
|
||||
if (!first_state)
|
||||
first_state = p;
|
||||
if (last_state)
|
||||
last_state->next = p;
|
||||
last_state = p;
|
||||
|
||||
nstates++;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -219,7 +229,7 @@ new_state (int symbol)
|
||||
`--------------------------------------------------------------*/
|
||||
|
||||
static int
|
||||
get_state (int symbol)
|
||||
get_state (token_number_t symbol)
|
||||
{
|
||||
int key;
|
||||
int i;
|
||||
@@ -227,7 +237,8 @@ get_state (int symbol)
|
||||
|
||||
if (trace_flag)
|
||||
fprintf (stderr, "Entering get_state, state = %d, symbol = %d (%s)\n",
|
||||
this_state->number, symbol, symbols[symbol]->tag);
|
||||
this_state->number, symbol, quotearg_style (escape_quoting_style,
|
||||
symbols[symbol]->tag));
|
||||
|
||||
/* Add up the target state's active item numbers to get a hash key.
|
||||
*/
|
||||
@@ -287,7 +298,7 @@ append_states (void)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
int symbol;
|
||||
token_number_t symbol;
|
||||
|
||||
if (trace_flag)
|
||||
fprintf (stderr, "Entering append_states, state = %d\n",
|
||||
@@ -315,8 +326,10 @@ append_states (void)
|
||||
static void
|
||||
new_states (void)
|
||||
{
|
||||
first_state = last_state = this_state = STATE_ALLOC (0);
|
||||
nstates = 1;
|
||||
/* The 0 at the lhs is the index of the item of this initial rule. */
|
||||
kernel_base[0][0] = 0;
|
||||
kernel_size[0] = 1;
|
||||
this_state = new_state (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -328,7 +341,7 @@ static void
|
||||
save_shifts (void)
|
||||
{
|
||||
shifts *p = shifts_new (nshifts);
|
||||
shortcpy (p->shifts, shiftset, nshifts);
|
||||
memcpy (p->shifts, shiftset, nshifts * sizeof (shiftset[0]));
|
||||
this_state->shifts = p;
|
||||
}
|
||||
|
||||
@@ -351,7 +364,7 @@ save_reductions (void)
|
||||
return;
|
||||
|
||||
/* Find and count the active items that represent ends of rules. */
|
||||
for (i = 0; i < nitemset; ++i)
|
||||
for (i = 0; i < nritemset; ++i)
|
||||
{
|
||||
int item = ritem[itemset[i]];
|
||||
if (item < 0)
|
||||
@@ -360,7 +373,7 @@ save_reductions (void)
|
||||
|
||||
/* Make a reductions structure and copy the data into it. */
|
||||
this_state->reductions = reductions_new (count);
|
||||
shortcpy (this_state->reductions->rules, redset, count);
|
||||
memcpy (this_state->reductions->rules, redset, count * sizeof (redset[0]));
|
||||
}
|
||||
|
||||
|
||||
@@ -407,7 +420,8 @@ generate_states (void)
|
||||
if (trace_flag)
|
||||
fprintf (stderr, "Processing state %d (reached by %s)\n",
|
||||
this_state->number,
|
||||
symbols[this_state->accessing_symbol]->tag);
|
||||
quotearg_style (escape_quoting_style,
|
||||
symbols[this_state->accessing_symbol]->tag));
|
||||
/* Set up ruleset and itemset for the transitions out of this
|
||||
state. ruleset gets a 1 bit for each rule that could reduce
|
||||
now. itemset gets a vector of all the items that could be
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Generate the nondeterministic finite state machine for bison,
|
||||
Copyright 1984, 1986, 1989, 2000, 2001 Free Software Foundation, Inc.
|
||||
Copyright 1984, 1986, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
void generate_states PARAMS ((void));
|
||||
|
||||
extern int nstates;
|
||||
extern unsigned int nstates;
|
||||
extern int final_state;
|
||||
|
||||
#endif /* !LR0_H_ */
|
||||
|
||||
+6
-7
@@ -1,4 +1,4 @@
|
||||
## Copyright 2001 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2001, 2002 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
|
||||
@@ -18,8 +18,7 @@
|
||||
AUTOMAKE_OPTIONS = ../lib/ansi2knr
|
||||
|
||||
DEFS = @DEFS@ \
|
||||
-DBISON_SIMPLE=\"$(pkgdatadir)/bison.simple\" \
|
||||
-DBISON_HAIRY=\"$(pkgdatadir)/bison.hairy\" \
|
||||
-DPKGDATADIR=\"$(pkgdatadir)\" \
|
||||
-DLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
CFLAGS = @CFLAGS@ $(WARNING_CFLAGS) $(WERROR_CFLAGS)
|
||||
@@ -44,17 +43,17 @@ bison_SOURCES = LR0.c closure.c complain.c conflicts.c \
|
||||
print_graph.h print_graph.c \
|
||||
muscle_tab.h muscle_tab.c \
|
||||
options.h options.c \
|
||||
print.c reader.c reduce.c symtab.c warshall.c vcg.c \
|
||||
skeleton.h parse-skel.h parse-skel.y scan-skel.l
|
||||
print.c reader.c reduce.c symtab.c vcg.c \
|
||||
scan-skel.l
|
||||
|
||||
BUILT_SOURCES = parse-skel.c scan-skel.c
|
||||
BUILT_SOURCES = scan-skel.c
|
||||
|
||||
EXTRA_bison_SOURCES = vmsgetargs.c
|
||||
|
||||
noinst_HEADERS = LR0.h closure.h complain.h conflicts.h \
|
||||
derives.h \
|
||||
files.h getargs.h gram.h lalr.h lex.h nullable.h \
|
||||
print.h reader.h reduce.h symtab.h warshall.h system.h \
|
||||
print.h reader.h reduce.h symtab.h system.h \
|
||||
types.h vcg.h vcg_defaults.h
|
||||
|
||||
EXTRA_DIST = build.com bison.cld vmshlp.mar
|
||||
|
||||
+120
-82
@@ -1,5 +1,5 @@
|
||||
/* Subroutines for bison
|
||||
Copyright 1984, 1989, 2000, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -19,33 +19,29 @@
|
||||
02111-1307, USA. */
|
||||
|
||||
#include "system.h"
|
||||
#include "quotearg.h"
|
||||
#include "bitset.h"
|
||||
#include "bitsetv.h"
|
||||
#include "getargs.h"
|
||||
#include "symtab.h"
|
||||
#include "gram.h"
|
||||
#include "reader.h"
|
||||
#include "closure.h"
|
||||
#include "derives.h"
|
||||
#include "warshall.h"
|
||||
|
||||
/* NITEMSET is the size of the array ITEMSET. */
|
||||
short *itemset;
|
||||
int nitemset;
|
||||
item_number_t *itemset;
|
||||
int nritemset;
|
||||
|
||||
static unsigned *ruleset;
|
||||
static bitset ruleset;
|
||||
|
||||
/* internal data. See comments before set_fderives and set_firsts. */
|
||||
static unsigned *fderives;
|
||||
static unsigned *firsts;
|
||||
static bitsetv fderives = NULL;
|
||||
static bitsetv firsts = NULL;
|
||||
|
||||
/* Retrieve the FDERIVES/FIRSTS sets of the nonterminals numbered Var. */
|
||||
#define FDERIVES(Var) (fderives + ((Var) - ntokens) * rulesetsize)
|
||||
#define FIRSTS(Var) (firsts + ((Var) - ntokens) * varsetsize)
|
||||
|
||||
/* number of words required to hold a bit for each rule */
|
||||
static int rulesetsize;
|
||||
|
||||
/* number of words required to hold a bit for each variable */
|
||||
static int varsetsize;
|
||||
#define FDERIVES(Var) fderives[(Var) - ntokens]
|
||||
#define FIRSTS(Var) firsts[(Var) - ntokens]
|
||||
|
||||
|
||||
/*-----------------.
|
||||
@@ -53,16 +49,17 @@ static int varsetsize;
|
||||
`-----------------*/
|
||||
|
||||
static void
|
||||
print_closure (const char *title, short *array, size_t size)
|
||||
print_closure (const char *title, item_number_t *array, size_t size)
|
||||
{
|
||||
size_t i;
|
||||
fprintf (stderr, "Closure: %s\n", title);
|
||||
for (i = 0; i < size; ++i)
|
||||
{
|
||||
short *rp;
|
||||
item_number_t *rp;
|
||||
fprintf (stderr, " %2d: .", array[i]);
|
||||
for (rp = &ritem[array[i]]; *rp >= 0; ++rp)
|
||||
fprintf (stderr, " %s", symbols[*rp]->tag);
|
||||
fprintf (stderr, " %s",
|
||||
quotearg_style (escape_quoting_style, symbols[*rp]->tag));
|
||||
fprintf (stderr, " (rule %d)\n", -*rp - 1);
|
||||
}
|
||||
fputs ("\n\n", stderr);
|
||||
@@ -77,11 +74,14 @@ print_firsts (void)
|
||||
fprintf (stderr, "FIRSTS\n");
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
{
|
||||
fprintf (stderr, "\t%s firsts\n", symbols[i]->tag);
|
||||
fprintf (stderr, "\t%s firsts\n",
|
||||
quotearg_style (escape_quoting_style, symbols[i]->tag));
|
||||
for (j = 0; j < nvars; j++)
|
||||
if (BITISSET (FIRSTS (i), j))
|
||||
if (bitset_test (FIRSTS (i), j))
|
||||
fprintf (stderr, "\t\t%d (%s)\n",
|
||||
j + ntokens, symbols[j + ntokens]->tag);
|
||||
j + ntokens,
|
||||
quotearg_style (escape_quoting_style,
|
||||
symbols[j + ntokens]->tag));
|
||||
}
|
||||
fprintf (stderr, "\n\n");
|
||||
}
|
||||
@@ -90,55 +90,107 @@ print_firsts (void)
|
||||
static void
|
||||
print_fderives (void)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
int i, j;
|
||||
|
||||
fprintf (stderr, "FDERIVES\n");
|
||||
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
{
|
||||
fprintf (stderr, "\t%s derives\n", symbols[i]->tag);
|
||||
for (j = 0; j <= nrules; j++)
|
||||
if (BITISSET (FDERIVES (i), j))
|
||||
fprintf (stderr, "\t%s derives\n",
|
||||
quotearg_style (escape_quoting_style, symbols[i]->tag));
|
||||
for (j = 0; j < nrules + 1; j++)
|
||||
if (bitset_test (FDERIVES (i), j))
|
||||
{
|
||||
short *rhsp;
|
||||
item_number_t *rhsp;
|
||||
fprintf (stderr, "\t\t%d:", j - 1);
|
||||
for (rhsp = &ritem[rules[j].rhs]; *rhsp >= 0; ++rhsp)
|
||||
fprintf (stderr, " %s", symbols[*rhsp]->tag);
|
||||
for (rhsp = rules[j].rhs; *rhsp >= 0; ++rhsp)
|
||||
fprintf (stderr, " %s",
|
||||
quotearg_style (escape_quoting_style,
|
||||
symbols[*rhsp]->tag));
|
||||
fputc ('\n', stderr);
|
||||
}
|
||||
}
|
||||
fprintf (stderr, "\n\n");
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------.
|
||||
| Display the MATRIX array of SIZE bitsets of size SIZE. |
|
||||
`--------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
bitmatrix_print (const char *title, bitsetv matrix)
|
||||
{
|
||||
size_t i, j;
|
||||
size_t size = bitset_size (matrix[0]);
|
||||
|
||||
/* Title. */
|
||||
fprintf (stderr, "%s BEGIN\n", title);
|
||||
|
||||
/* Column numbers. */
|
||||
fputs (" ", stderr);
|
||||
for (i = 0; i < size; ++i)
|
||||
putc (i / 10 ? '0' + i / 10 : ' ', stderr);
|
||||
putc ('\n', stderr);
|
||||
fputs (" ", stderr);
|
||||
for (i = 0; i < size; ++i)
|
||||
fprintf (stderr, "%d", i % 10);
|
||||
putc ('\n', stderr);
|
||||
|
||||
/* Bar. */
|
||||
fputs (" .", stderr);
|
||||
for (i = 0; i < size; ++i)
|
||||
putc ('-', stderr);
|
||||
fputs (".\n", stderr);
|
||||
|
||||
/* Contents. */
|
||||
for (i = 0; i < size; ++i)
|
||||
{
|
||||
fprintf (stderr, "%2d|", i);
|
||||
for (j = 0; j < size; ++j)
|
||||
fputs (bitset_test (matrix[i], j) ? "1" : " ", stderr);
|
||||
fputs ("|\n", stderr);
|
||||
}
|
||||
|
||||
/* Bar. */
|
||||
fputs (" `", stderr);
|
||||
for (i = 0; i < size; ++i)
|
||||
putc ('-', stderr);
|
||||
fputs ("'\n", stderr);
|
||||
|
||||
/* End title. */
|
||||
fprintf (stderr, "%s END\n\n", title);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------.
|
||||
| Set FIRSTS to be an NVARS by NVARS bit matrix indicating which |
|
||||
| items can represent the beginning of the input corresponding to |
|
||||
| which other items. |
|
||||
| |
|
||||
| For example, if some rule expands symbol 5 into the sequence of |
|
||||
| symbols 8 3 20, the symbol 8 can be the beginning of the data for |
|
||||
| symbol 5, so the bit [8 - ntokens, 5 - ntokens] in firsts is set. |
|
||||
`-------------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------------.
|
||||
| Set FIRSTS to be an NVARS array of NVARS bitsets indicating which |
|
||||
| items can represent the beginning of the input corresponding to |
|
||||
| which other items. |
|
||||
| |
|
||||
| For example, if some rule expands symbol 5 into the sequence of |
|
||||
| symbols 8 3 20, the symbol 8 can be the beginning of the data for |
|
||||
| symbol 5, so the bit [8 - ntokens] in first[5 - ntokens] (= FIRST |
|
||||
| (5)) is set. |
|
||||
`------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
set_firsts (void)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
varsetsize = WORDSIZE (nvars);
|
||||
|
||||
firsts = XCALLOC (unsigned, nvars * varsetsize);
|
||||
firsts = bitsetv_create (nvars, nvars, BITSET_FIXED);
|
||||
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
for (j = 0; derives[i][j] >= 0; ++j)
|
||||
{
|
||||
int symbol = ritem[rules[derives[i][j]].rhs];
|
||||
int symbol = rules[derives[i][j]].rhs[0];
|
||||
if (ISVAR (symbol))
|
||||
SETBIT (FIRSTS (i), symbol - ntokens);
|
||||
bitset_set (FIRSTS (i), symbol - ntokens);
|
||||
}
|
||||
|
||||
RTC (firsts, nvars);
|
||||
if (trace_flag)
|
||||
bitmatrix_print ("RTC: Input", firsts);
|
||||
bitsetv_reflexive_transitive_closure (firsts);
|
||||
if (trace_flag)
|
||||
bitmatrix_print ("RTC: Output", firsts);
|
||||
|
||||
if (trace_flag)
|
||||
print_firsts ();
|
||||
@@ -159,30 +211,29 @@ set_fderives (void)
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
fderives = XCALLOC (unsigned, nvars * rulesetsize);
|
||||
fderives = bitsetv_create (nvars, nrules + 1, BITSET_FIXED);
|
||||
|
||||
set_firsts ();
|
||||
|
||||
for (i = ntokens; i < nsyms; ++i)
|
||||
for (j = ntokens; j < nsyms; ++j)
|
||||
if (BITISSET (FIRSTS (i), j - ntokens))
|
||||
if (bitset_test (FIRSTS (i), j - ntokens))
|
||||
for (k = 0; derives[j][k] > 0; ++k)
|
||||
SETBIT (FDERIVES (i), derives[j][k]);
|
||||
bitset_set (FDERIVES (i), derives[j][k]);
|
||||
|
||||
if (trace_flag)
|
||||
print_fderives ();
|
||||
|
||||
XFREE (firsts);
|
||||
bitsetv_free (firsts);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
new_closure (int n)
|
||||
{
|
||||
itemset = XCALLOC (short, n);
|
||||
itemset = XCALLOC (item_number_t, n);
|
||||
|
||||
rulesetsize = WORDSIZE (nrules + 1);
|
||||
ruleset = XCALLOC (unsigned, rulesetsize);
|
||||
ruleset = bitset_create (nrules + 1, BITSET_FIXED);
|
||||
|
||||
set_fderives ();
|
||||
}
|
||||
@@ -190,61 +241,48 @@ new_closure (int n)
|
||||
|
||||
|
||||
void
|
||||
closure (short *core, int n)
|
||||
closure (item_number_t *core, int n)
|
||||
{
|
||||
/* Index over CORE. */
|
||||
int c;
|
||||
|
||||
/* An index over RULESET. */
|
||||
int r;
|
||||
|
||||
/* A bit index over RULESET. */
|
||||
int ruleno;
|
||||
|
||||
if (trace_flag)
|
||||
print_closure ("input", core, n);
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
for (r = 0; r < rulesetsize; ++r)
|
||||
ruleset[r] = FDERIVES (start_symbol)[r];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (r = 0; r < rulesetsize; ++r)
|
||||
ruleset[r] = 0;
|
||||
bitset_zero (ruleset);
|
||||
|
||||
for (c = 0; c < n; ++c)
|
||||
if (ISVAR (ritem[core[c]]))
|
||||
for (r = 0; r < rulesetsize; ++r)
|
||||
ruleset[r] |= FDERIVES (ritem[core[c]])[r];
|
||||
}
|
||||
for (c = 0; c < n; ++c)
|
||||
if (ISVAR (ritem[core[c]]))
|
||||
bitset_or (ruleset, ruleset, FDERIVES (ritem[core[c]]));
|
||||
|
||||
nitemset = 0;
|
||||
nritemset = 0;
|
||||
c = 0;
|
||||
for (ruleno = 0; ruleno < nrules + 1; ++ruleno)
|
||||
if (BITISSET (ruleset, ruleno))
|
||||
if (bitset_test (ruleset, ruleno))
|
||||
{
|
||||
int itemno = rules[ruleno].rhs;
|
||||
item_number_t itemno = rules[ruleno].rhs - ritem;
|
||||
while (c < n && core[c] < itemno)
|
||||
{
|
||||
itemset[nitemset] = core[c];
|
||||
nitemset++;
|
||||
itemset[nritemset] = core[c];
|
||||
nritemset++;
|
||||
c++;
|
||||
}
|
||||
itemset[nitemset] = itemno;
|
||||
nitemset++;
|
||||
itemset[nritemset] = itemno;
|
||||
nritemset++;
|
||||
}
|
||||
|
||||
while (c < n)
|
||||
{
|
||||
itemset[nitemset] = core[c];
|
||||
nitemset++;
|
||||
itemset[nritemset] = core[c];
|
||||
nritemset++;
|
||||
c++;
|
||||
}
|
||||
|
||||
if (trace_flag)
|
||||
print_closure ("output", itemset, nitemset);
|
||||
print_closure ("output", itemset, nritemset);
|
||||
}
|
||||
|
||||
|
||||
@@ -252,6 +290,6 @@ void
|
||||
free_closure (void)
|
||||
{
|
||||
XFREE (itemset);
|
||||
XFREE (ruleset);
|
||||
XFREE (fderives);
|
||||
bitset_free (ruleset);
|
||||
bitsetv_free (fderives);
|
||||
}
|
||||
|
||||
+9
-11
@@ -1,5 +1,5 @@
|
||||
/* Subroutines for bison
|
||||
Copyright 1984, 1989, 2000, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#ifndef CLOSURE_H_
|
||||
# define CLOSURE_H_
|
||||
|
||||
/* Subroutines of file LR0.c. */
|
||||
|
||||
/* Allocates the itemset and ruleset vectors, and precomputes useful
|
||||
data so that closure can be called. n is the number of elements to
|
||||
allocate for itemset. */
|
||||
@@ -31,27 +29,27 @@ void new_closure PARAMS ((int n));
|
||||
|
||||
|
||||
/* Given the kernel (aka core) of a state (a vector of item numbers
|
||||
ITEMS, of length N), set up ruleset and itemset to indicate what
|
||||
ITEMS, of length N), set up RULESET and ITEMSET to indicate what
|
||||
rules could be run and which items could be accepted when those
|
||||
items are the active ones.
|
||||
|
||||
ruleset contains a bit for each rule. closure sets the bits for
|
||||
RULESET contains a bit for each rule. CLOSURE sets the bits for
|
||||
all rules which could potentially describe the next input to be
|
||||
read.
|
||||
|
||||
ITEMSET is a vector of item numbers; NITEMSET is its size
|
||||
9actually, points to just beyond the end of the part of it that is
|
||||
significant). closure places there the indices of all items which
|
||||
(actually, points to just beyond the end of the part of it that is
|
||||
significant). CLOSURE places there the indices of all items which
|
||||
represent units of input that could arrive next. */
|
||||
|
||||
void closure PARAMS ((short *items, int n));
|
||||
void closure PARAMS ((item_number_t *items, int n));
|
||||
|
||||
|
||||
/* Frees itemset, ruleset and internal data. */
|
||||
/* Frees ITEMSET, RULESET and internal data. */
|
||||
|
||||
void free_closure PARAMS ((void));
|
||||
|
||||
extern short *itemset;
|
||||
extern int nitemset;
|
||||
extern item_number_t *itemset;
|
||||
extern int nritemset;
|
||||
|
||||
#endif /* !CLOSURE_H_ */
|
||||
|
||||
+42
-49
@@ -1,5 +1,6 @@
|
||||
/* Find and resolve or report look-ahead conflicts for bison,
|
||||
Copyright 1984, 1989, 1992, 2000, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1989, 1992, 2000, 2001, 2002
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -19,6 +20,7 @@
|
||||
02111-1307, USA. */
|
||||
|
||||
#include "system.h"
|
||||
#include "bitset.h"
|
||||
#include "complain.h"
|
||||
#include "getargs.h"
|
||||
#include "symtab.h"
|
||||
@@ -34,18 +36,20 @@
|
||||
int expected_conflicts = -1;
|
||||
static char *conflicts = NULL;
|
||||
|
||||
static unsigned *shiftset = NULL;
|
||||
static unsigned *lookaheadset = NULL;
|
||||
static bitset shiftset;
|
||||
static bitset lookaheadset;
|
||||
|
||||
|
||||
static inline void
|
||||
log_resolution (state_t *state, int LAno, int token, char *resolution)
|
||||
log_resolution (state_t *state, int LAno, int token, const char *resolution)
|
||||
{
|
||||
if (verbose_flag)
|
||||
obstack_fgrow4 (&output_obstack,
|
||||
_("\
|
||||
Conflict in state %d between rule %d and token %s resolved as %s.\n"),
|
||||
state->number, LAruleno[LAno], symbols[token]->tag,
|
||||
state->number,
|
||||
LArule[LAno]->number,
|
||||
symbols[token]->tag,
|
||||
resolution);
|
||||
}
|
||||
|
||||
@@ -62,7 +66,7 @@ flush_shift (state_t *state, int token)
|
||||
shifts *shiftp = state->shifts;
|
||||
int i;
|
||||
|
||||
RESETBIT (lookaheadset, token);
|
||||
bitset_reset (lookaheadset, token);
|
||||
for (i = 0; i < shiftp->nshifts; i++)
|
||||
if (!SHIFT_IS_DISABLED (shiftp, i) && SHIFT_SYMBOL (shiftp, i) == token)
|
||||
SHIFT_DISABLE (shiftp, i);
|
||||
@@ -78,7 +82,7 @@ flush_shift (state_t *state, int token)
|
||||
static void
|
||||
flush_reduce (int lookahead, int token)
|
||||
{
|
||||
RESETBIT (LA (lookahead), token);
|
||||
bitset_reset (LA[lookahead], token);
|
||||
}
|
||||
|
||||
|
||||
@@ -94,13 +98,13 @@ resolve_sr_conflict (state_t *state, int lookahead)
|
||||
{
|
||||
int i;
|
||||
/* find the rule to reduce by to get precedence of reduction */
|
||||
int redprec = rules[LAruleno[lookahead]].prec;
|
||||
int redprec = LArule[lookahead]->prec->prec;
|
||||
errs *errp = errs_new (ntokens + 1);
|
||||
errp->nerrs = 0;
|
||||
|
||||
for (i = 0; i < ntokens; i++)
|
||||
if (BITISSET (LA (lookahead), i)
|
||||
&& BITISSET (lookaheadset, i)
|
||||
if (bitset_test (LA[lookahead], i)
|
||||
&& bitset_test (lookaheadset, i)
|
||||
&& symbols[i]->prec)
|
||||
{
|
||||
/* Shift-reduce conflict occurs for token number i
|
||||
@@ -154,54 +158,50 @@ resolve_sr_conflict (state_t *state, int lookahead)
|
||||
static void
|
||||
set_conflicts (state_t *state)
|
||||
{
|
||||
int i, j;
|
||||
int i;
|
||||
shifts *shiftp;
|
||||
|
||||
if (state->consistent)
|
||||
return;
|
||||
|
||||
for (i = 0; i < tokensetsize; i++)
|
||||
lookaheadset[i] = 0;
|
||||
bitset_zero (lookaheadset);
|
||||
|
||||
shiftp = state->shifts;
|
||||
for (i = 0; i < shiftp->nshifts && SHIFT_IS_SHIFT (shiftp, i); i++)
|
||||
if (!SHIFT_IS_DISABLED (shiftp, i))
|
||||
SETBIT (lookaheadset, SHIFT_SYMBOL (shiftp, i));
|
||||
bitset_set (lookaheadset, SHIFT_SYMBOL (shiftp, i));
|
||||
|
||||
/* Loop over all rules which require lookahead in this state. First
|
||||
check for shift-reduce conflict, and try to resolve using
|
||||
precedence */
|
||||
for (i = 0; i < state->nlookaheads; ++i)
|
||||
if (rules[LAruleno[state->lookaheadsp + i]].prec)
|
||||
for (j = 0; j < tokensetsize; ++j)
|
||||
if (LA (state->lookaheadsp + i)[j] & lookaheadset[j])
|
||||
{
|
||||
resolve_sr_conflict (state, state->lookaheadsp + i);
|
||||
break;
|
||||
}
|
||||
|
||||
if (LArule[state->lookaheadsp + i]->prec
|
||||
&& LArule[state->lookaheadsp + i]->prec->prec
|
||||
&& !bitset_disjoint_p (LA[state->lookaheadsp + i], lookaheadset))
|
||||
{
|
||||
resolve_sr_conflict (state, state->lookaheadsp + i);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Loop over all rules which require lookahead in this state. Check
|
||||
for conflicts not resolved above. */
|
||||
for (i = 0; i < state->nlookaheads; ++i)
|
||||
{
|
||||
for (j = 0; j < tokensetsize; ++j)
|
||||
if (LA (state->lookaheadsp + i)[j] & lookaheadset[j])
|
||||
conflicts[state->number] = 1;
|
||||
if (!bitset_disjoint_p (LA[state->lookaheadsp + i], lookaheadset))
|
||||
conflicts[state->number] = 1;
|
||||
|
||||
for (j = 0; j < tokensetsize; ++j)
|
||||
lookaheadset[j] |= LA (state->lookaheadsp + i)[j];
|
||||
bitset_or (lookaheadset, lookaheadset, LA[state->lookaheadsp + i]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
solve_conflicts (void)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
conflicts = XCALLOC (char, nstates);
|
||||
shiftset = XCALLOC (unsigned, tokensetsize);
|
||||
lookaheadset = XCALLOC (unsigned, tokensetsize);
|
||||
shiftset = bitset_create (ntokens, BITSET_FIXED);
|
||||
lookaheadset = bitset_create (ntokens, BITSET_FIXED);
|
||||
|
||||
for (i = 0; i < nstates; i++)
|
||||
set_conflicts (states[i]);
|
||||
@@ -215,33 +215,26 @@ solve_conflicts (void)
|
||||
static int
|
||||
count_sr_conflicts (state_t *state)
|
||||
{
|
||||
int i, k;
|
||||
int i;
|
||||
int src_count = 0;
|
||||
shifts *shiftp = state->shifts;
|
||||
|
||||
if (!shiftp)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < tokensetsize; i++)
|
||||
{
|
||||
shiftset[i] = 0;
|
||||
lookaheadset[i] = 0;
|
||||
}
|
||||
bitset_zero (lookaheadset);
|
||||
bitset_zero (shiftset);
|
||||
|
||||
for (i = 0; i < shiftp->nshifts && SHIFT_IS_SHIFT (shiftp, i); i++)
|
||||
if (!SHIFT_IS_DISABLED (shiftp, i))
|
||||
SETBIT (shiftset, SHIFT_SYMBOL (shiftp, i));
|
||||
bitset_set (shiftset, SHIFT_SYMBOL (shiftp, i));
|
||||
|
||||
for (i = 0; i < state->nlookaheads; ++i)
|
||||
for (k = 0; k < tokensetsize; ++k)
|
||||
lookaheadset[k] |= LA (state->lookaheadsp + i)[k];
|
||||
bitset_or (lookaheadset, lookaheadset, LA[state->lookaheadsp + i]);
|
||||
|
||||
for (k = 0; k < tokensetsize; ++k)
|
||||
lookaheadset[k] &= shiftset[k];
|
||||
bitset_and (lookaheadset, lookaheadset, shiftset);
|
||||
|
||||
for (i = 0; i < ntokens; i++)
|
||||
if (BITISSET (lookaheadset, i))
|
||||
src_count++;
|
||||
src_count = bitset_count (lookaheadset);
|
||||
|
||||
return src_count;
|
||||
}
|
||||
@@ -265,7 +258,7 @@ count_rr_conflicts (state_t *state)
|
||||
int count = 0;
|
||||
int j;
|
||||
for (j = 0; j < state->nlookaheads; ++j)
|
||||
if (BITISSET (LA (state->lookaheadsp + j), i))
|
||||
if (bitset_test (LA[state->lookaheadsp + j], i))
|
||||
count++;
|
||||
|
||||
if (count >= 2)
|
||||
@@ -322,7 +315,7 @@ void
|
||||
conflicts_output (FILE *out)
|
||||
{
|
||||
bool printed_sth = FALSE;
|
||||
int i;
|
||||
size_t i;
|
||||
for (i = 0; i < nstates; i++)
|
||||
if (conflicts[i])
|
||||
{
|
||||
@@ -343,7 +336,7 @@ conflicts_output (FILE *out)
|
||||
void
|
||||
conflicts_print (void)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
/* Is the number of SR conflicts OK? Either EXPECTED_CONFLICTS is
|
||||
not set, and then we want 0 SR, or else it is specified, in which
|
||||
@@ -403,6 +396,6 @@ void
|
||||
free_conflicts (void)
|
||||
{
|
||||
XFREE (conflicts);
|
||||
XFREE (shiftset);
|
||||
XFREE (lookaheadset);
|
||||
bitset_free (shiftset);
|
||||
bitset_free (lookaheadset);
|
||||
}
|
||||
|
||||
+9
-10
@@ -42,9 +42,9 @@ print_derives (void)
|
||||
fprintf (stderr, "\t%s derives\n", symbols[i]->tag);
|
||||
for (sp = derives[i]; *sp > 0; sp++)
|
||||
{
|
||||
short *rhsp;
|
||||
item_number_t *rhsp;
|
||||
fprintf (stderr, "\t\t%d:", *sp);
|
||||
for (rhsp = &ritem[rules[*sp].rhs]; *rhsp >= 0; ++rhsp)
|
||||
for (rhsp = rules[*sp].rhs; *rhsp >= 0; ++rhsp)
|
||||
fprintf (stderr, " %s", symbols[*rhsp]->tag);
|
||||
fprintf (stderr, " (rule %d)\n", -*rhsp - 1);
|
||||
}
|
||||
@@ -68,14 +68,13 @@ set_derives (void)
|
||||
|
||||
p = delts;
|
||||
for (i = nrules; i > 0; i--)
|
||||
if (rules[i].useful)
|
||||
{
|
||||
int lhs = rules[i].lhs;
|
||||
p->next = dset[lhs];
|
||||
p->value = i;
|
||||
dset[lhs] = p;
|
||||
p++;
|
||||
}
|
||||
{
|
||||
token_number_t lhs = rules[i].lhs->number;
|
||||
p->next = dset[lhs];
|
||||
p->value = i;
|
||||
dset[lhs] = p;
|
||||
p++;
|
||||
}
|
||||
|
||||
derives = XCALLOC (short *, nvars) - ntokens;
|
||||
q = XCALLOC (short, nvars + nrules);
|
||||
|
||||
+2
-1
@@ -33,8 +33,9 @@ const char *base_name PARAMS ((char const *name));
|
||||
FILE *finput = NULL;
|
||||
|
||||
struct obstack action_obstack;
|
||||
struct obstack attrs_obstack;
|
||||
struct obstack output_obstack;
|
||||
struct obstack pre_prologue_obstack;
|
||||
struct obstack post_prologue_obstack;
|
||||
|
||||
/* Initializing some values below (such SPEC_NAME_PREFIX to `yy') is
|
||||
tempting, but don't do that: for the time being our handling of the
|
||||
|
||||
+2
-1
@@ -50,7 +50,8 @@ extern FILE *finput;
|
||||
extern struct obstack action_obstack;
|
||||
|
||||
/* If semantic parser, output a .h file that defines YYSTYPE... */
|
||||
extern struct obstack attrs_obstack;
|
||||
extern struct obstack pre_prologue_obstack;
|
||||
extern struct obstack post_prologue_obstack;
|
||||
|
||||
/* The verbose output. */
|
||||
extern struct obstack output_obstack;
|
||||
|
||||
+6
-6
@@ -1,5 +1,6 @@
|
||||
/* Parse command line arguments for bison.
|
||||
Copyright 1984, 1986, 1989, 1992, 2000, 2001 Free Software Foundation, Inc.
|
||||
Copyright 1984, 1986, 1989, 1992, 2000, 2001, 2002
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -109,14 +110,13 @@ version (FILE *stream)
|
||||
{
|
||||
/* Some efforts were made to ease the translators' task, please
|
||||
continue. */
|
||||
fprintf (stream, _("\
|
||||
bison (GNU Bison) %s"), VERSION);
|
||||
fprintf (stream, _("bison (GNU Bison) %s"), VERSION);
|
||||
putc ('\n', stream);
|
||||
fputs (_("Written by Robert Corbett and Richard Stallman.\n"), stream);
|
||||
putc ('\n', stream);
|
||||
|
||||
fputs (_("\
|
||||
Copyright 1984, 1986, 1989, 1992, 2000, 2001 Free Software Foundation, Inc.\n"),
|
||||
stream);
|
||||
fprintf (stream,
|
||||
_("Copyright (C) %d Free Software Foundation, Inc.\n"), 2002);
|
||||
|
||||
fputs (_("\
|
||||
This is free software; see the source for copying conditions. There is NO\n\
|
||||
|
||||
+98
-33
@@ -1,5 +1,5 @@
|
||||
/* Allocate input grammar variables for bison,
|
||||
Copyright 1984, 1986, 1989, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1986, 1989, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -20,35 +20,49 @@
|
||||
|
||||
|
||||
#include "system.h"
|
||||
#include "gram.h"
|
||||
#include "quotearg.h"
|
||||
#include "symtab.h"
|
||||
#include "gram.h"
|
||||
#include "reduce.h"
|
||||
#include "reader.h"
|
||||
|
||||
/* comments for these variables are in gram.h */
|
||||
|
||||
int nitems;
|
||||
int nrules;
|
||||
int nsyms;
|
||||
int ntokens;
|
||||
int nvars;
|
||||
|
||||
short *ritem = NULL;
|
||||
int nritems;
|
||||
item_number_t *ritem = NULL;
|
||||
int nritems = 0;
|
||||
|
||||
rule_t *rules = NULL;
|
||||
int nrules = 0;
|
||||
|
||||
struct bucket **symbols = NULL;
|
||||
short *token_translations = NULL;
|
||||
symbol_t **symbols = NULL;
|
||||
int nsyms = 0;
|
||||
int ntokens = 1;
|
||||
int nvars = 0;
|
||||
|
||||
int start_symbol;
|
||||
token_number_t *token_translations = NULL;
|
||||
|
||||
int max_user_token_number;
|
||||
token_number_t start_symbol = 0;
|
||||
|
||||
int semantic_parser;
|
||||
int max_user_token_number = 256;
|
||||
|
||||
int pure_parser;
|
||||
int semantic_parser = 0;
|
||||
|
||||
int error_token_number;
|
||||
int pure_parser = 0;
|
||||
|
||||
|
||||
/*--------------------------------------.
|
||||
| Return the number of symbols in RHS. |
|
||||
`--------------------------------------*/
|
||||
|
||||
int
|
||||
rule_rhs_length (rule_t *rule)
|
||||
{
|
||||
int res = 0;
|
||||
item_number_t *rhsp;
|
||||
for (rhsp = rule->rhs; *rhsp >= 0; ++rhsp)
|
||||
++res;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------.
|
||||
@@ -62,7 +76,8 @@ ritem_print (FILE *out)
|
||||
fputs ("RITEM\n", out);
|
||||
for (i = 0; i < nritems; ++i)
|
||||
if (ritem[i] >= 0)
|
||||
fprintf (out, " %s", symbols[ritem[i]]->tag);
|
||||
fprintf (out, " %s", quotearg_style (escape_quoting_style,
|
||||
symbols[ritem[i]]->tag));
|
||||
else
|
||||
fprintf (out, " (rule %d)\n", -ritem[i] - 1);
|
||||
fputs ("\n\n", out);
|
||||
@@ -76,23 +91,73 @@ ritem_print (FILE *out)
|
||||
size_t
|
||||
ritem_longest_rhs (void)
|
||||
{
|
||||
int length;
|
||||
int max;
|
||||
int max = 0;
|
||||
int i;
|
||||
|
||||
length = 0;
|
||||
max = 0;
|
||||
for (i = 0; i < nritems; ++i)
|
||||
if (ritem[i] >= 0)
|
||||
{
|
||||
length++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (length > max)
|
||||
max = length;
|
||||
length = 0;
|
||||
}
|
||||
for (i = 1; i < nrules + 1; ++i)
|
||||
{
|
||||
int length = rule_rhs_length (&rules[i]);
|
||||
if (length > max)
|
||||
max = length;
|
||||
}
|
||||
|
||||
return max;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------.
|
||||
| Dump the grammar. |
|
||||
`-------------------*/
|
||||
|
||||
void
|
||||
grammar_dump (FILE *out, const char *title)
|
||||
{
|
||||
int i;
|
||||
item_number_t *r;
|
||||
|
||||
fprintf (out, "%s\n\n", title);
|
||||
fprintf (out,
|
||||
"ntokens = %d, nvars = %d, nsyms = %d, nrules = %d, nritems = %d\n\n",
|
||||
ntokens, nvars, nsyms, nrules, nritems);
|
||||
fprintf (out, "Variables\n---------\n\n");
|
||||
fprintf (out, "Value Sprec Sassoc Tag\n");
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
fprintf (out, "%5d %5d %5d %s\n",
|
||||
i,
|
||||
symbols[i]->prec, symbols[i]->assoc,
|
||||
quotearg_style (escape_quoting_style, symbols[i]->tag));
|
||||
fprintf (out, "\n\n");
|
||||
fprintf (out, "Rules\n-----\n\n");
|
||||
fprintf (out, "Num (Prec, Assoc, Useful, Ritem Range) Lhs -> Rhs (Ritem range) [Num]\n");
|
||||
for (i = 1; i < nrules + nuseless_productions + 1; i++)
|
||||
{
|
||||
int rhs_count = 0;
|
||||
/* Find the last RHS index in ritems. */
|
||||
for (r = rules[i].rhs; *r >= 0; ++r)
|
||||
++rhs_count;
|
||||
fprintf (out, "%3d (%2d, %2d, %2d, %2d-%2d) %2d ->",
|
||||
i - 1,
|
||||
rules[i].prec ? rules[i].prec->prec : 0,
|
||||
rules[i].prec ? rules[i].prec->assoc : 0,
|
||||
rules[i].useful,
|
||||
rules[i].rhs - ritem,
|
||||
rules[i].rhs - ritem + rhs_count - 1,
|
||||
rules[i].lhs->number);
|
||||
/* Dumped the RHS. */
|
||||
for (r = rules[i].rhs; *r >= 0; r++)
|
||||
fprintf (out, " %3d", *r);
|
||||
fprintf (out, " [%d]\n", -(*r) - 1);
|
||||
}
|
||||
fprintf (out, "\n\n");
|
||||
fprintf (out, "Rules interpreted\n-----------------\n\n");
|
||||
for (i = 1; i < nrules + nuseless_productions + 1; i++)
|
||||
{
|
||||
fprintf (out, "%-5d %s :",
|
||||
i, quotearg_style (escape_quoting_style, rules[i].lhs->tag));
|
||||
for (r = rules[i].rhs; *r >= 0; r++)
|
||||
fprintf (out, " %s",
|
||||
quotearg_style (escape_quoting_style, symbols[*r]->tag));
|
||||
fputc ('\n', out);
|
||||
}
|
||||
fprintf (out, "\n\n");
|
||||
}
|
||||
|
||||
+54
-37
@@ -1,5 +1,6 @@
|
||||
/* Data definitions for internal representation of bison's input,
|
||||
Copyright 1984, 1986, 1989, 1992, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1986, 1989, 1992, 2001, 2002
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -53,23 +54,24 @@
|
||||
|
||||
RULES is an array of struct rule_s, which members are:
|
||||
|
||||
RULES[R].lhs -- the symbol number of the left hand side of rule R.
|
||||
If -1, the rule has been thrown out by reduce.c and should be
|
||||
ignored.
|
||||
RULES[R].lhs -- the symbol of the left hand side of rule R.
|
||||
|
||||
RULES[R].rhs -- the index in RITEM of the beginning of the portion
|
||||
for rule R.
|
||||
|
||||
RULES[R].prec -- the precedence level of R.
|
||||
RULES[R].prec -- the symbol providing the precedence level of R.
|
||||
|
||||
RULES[R].precsym -- the symbol-number of the symbol in %prec for R
|
||||
(if any).
|
||||
RULES[R].precsym -- the symbol attached (via %prec) to give its
|
||||
precedence to R. Of course, if set, it is equal to `prec', but we
|
||||
need to distinguish one from the other when reducing: a symbol used
|
||||
in a %prec is not useless.
|
||||
|
||||
RULES[R].assoc -- the associativity of R.
|
||||
|
||||
RULES[R].line -- the line where R was defined.
|
||||
|
||||
RULES[R].useful -- TRUE iff the rule is used.
|
||||
RULES[R].useful -- TRUE iff the rule is used (i.e., FALSE if thrown
|
||||
away by reduce).
|
||||
|
||||
The right hand side is stored as symbol numbers in a portion of
|
||||
RITEM.
|
||||
@@ -80,7 +82,7 @@
|
||||
says which rule it is for.
|
||||
|
||||
The portions of RITEM come in order of increasing rule number and
|
||||
are followed by an element which is zero to mark the end. nitems
|
||||
are followed by an element which is zero to mark the end. nritems
|
||||
is the total length of ritem, not counting the final zero. Each
|
||||
element of RITEM is called an "item" and its index in RITEM is an
|
||||
item number.
|
||||
@@ -97,57 +99,71 @@
|
||||
|
||||
Associativities are recorded similarly in SYMBOLS[I]->assoc. */
|
||||
|
||||
#include "symtab.h"
|
||||
|
||||
#define ISTOKEN(s) ((s) < ntokens)
|
||||
#define ISVAR(s) ((s) >= ntokens)
|
||||
|
||||
extern int nitems;
|
||||
extern int nrules;
|
||||
extern int nsyms;
|
||||
extern int ntokens;
|
||||
extern int nvars;
|
||||
|
||||
extern short *ritem;
|
||||
#define ITEM_NUMBER_MAX INT_MAX
|
||||
typedef int item_number_t;
|
||||
extern item_number_t *ritem;
|
||||
extern int nritems;
|
||||
|
||||
extern int start_symbol;
|
||||
/* There is weird relationship between item_number_t and
|
||||
token_number_t: we store token_number_t in item_number_t, but in
|
||||
the latter we also store, as negative numbers, the rule numbers.
|
||||
|
||||
/* Associativity values for tokens and rules. */
|
||||
typedef enum
|
||||
{
|
||||
right_assoc,
|
||||
left_assoc,
|
||||
non_assoc
|
||||
} associativity;
|
||||
Therefore, an token_number_t must be a valid item_number_t, and we
|
||||
sometimes have to perform the converse transformation. */
|
||||
#define token_number_as_item_number(Tok) ((item_number_t) (Tok))
|
||||
#define item_number_as_token_number(Ite) ((token_number_t) (Ite))
|
||||
|
||||
extern token_number_t start_symbol;
|
||||
|
||||
|
||||
typedef struct rule_s
|
||||
{
|
||||
short lhs;
|
||||
short rhs;
|
||||
short prec;
|
||||
short precsym;
|
||||
associativity assoc;
|
||||
short line;
|
||||
/* The number of the rule in the source. It is usually the index in
|
||||
RULES too, except if there are useless rules. */
|
||||
short user_number;
|
||||
|
||||
/* The index in RULES. Usually the rule number in the source,
|
||||
except if some rules are useless. */
|
||||
short number;
|
||||
|
||||
symbol_t *lhs;
|
||||
item_number_t *rhs;
|
||||
|
||||
/* This symbol provides both the associativity, and the precedence. */
|
||||
symbol_t *prec;
|
||||
|
||||
/* This symbol was attached to the rule via %prec. */
|
||||
symbol_t *precsym;
|
||||
|
||||
int line;
|
||||
bool useful;
|
||||
|
||||
const char *action;
|
||||
short action_line;
|
||||
int action_line;
|
||||
|
||||
const char *guard;
|
||||
short guard_line;
|
||||
int guard_line;
|
||||
} rule_t;
|
||||
|
||||
extern struct rule_s *rules;
|
||||
|
||||
/* Table of the symbols, indexed by the symbol number. */
|
||||
extern struct bucket **symbols;
|
||||
extern symbol_t **symbols;
|
||||
|
||||
/* token translation table: indexed by a token number as returned by
|
||||
the user's yylex routine, it yields the internal token number used
|
||||
by the parser and throughout bison. */
|
||||
|
||||
extern short *token_translations;
|
||||
/* TOKEN_TRANSLATION -- a table indexed by a token number as returned
|
||||
by the user's yylex routine, it yields the internal token number
|
||||
used by the parser and throughout bison. */
|
||||
extern token_number_t *token_translations;
|
||||
extern int max_user_token_number;
|
||||
|
||||
/* SEMANTIC_PARSER is nonzero if the input file says to use the hairy
|
||||
@@ -161,10 +177,8 @@ extern int semantic_parser;
|
||||
|
||||
extern int pure_parser;
|
||||
|
||||
/* ERROR_TOKEN_NUMBER is the token number of the error token. */
|
||||
|
||||
extern int error_token_number;
|
||||
|
||||
/* Report the length of the RHS. */
|
||||
int rule_rhs_length PARAMS ((rule_t *rule));
|
||||
|
||||
/* Dump RITEM for traces. */
|
||||
void ritem_print PARAMS ((FILE *out));
|
||||
@@ -172,4 +186,7 @@ void ritem_print PARAMS ((FILE *out));
|
||||
/* Return the size of the longest rule RHS. */
|
||||
size_t ritem_longest_rhs PARAMS ((void));
|
||||
|
||||
/* Dump the grammar. */
|
||||
void grammar_dump PARAMS ((FILE *out, const char *title));
|
||||
|
||||
#endif /* !GRAM_H_ */
|
||||
|
||||
+48
-52
@@ -1,5 +1,6 @@
|
||||
/* Compute look-ahead criteria for bison,
|
||||
Copyright 1984, 1986, 1989, 2000, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -24,11 +25,14 @@
|
||||
tokens they accept. */
|
||||
|
||||
#include "system.h"
|
||||
#include "bitset.h"
|
||||
#include "bitsetv.h"
|
||||
#include "quotearg.h"
|
||||
#include "symtab.h"
|
||||
#include "gram.h"
|
||||
#include "reader.h"
|
||||
#include "types.h"
|
||||
#include "LR0.h"
|
||||
#include "symtab.h"
|
||||
#include "gram.h"
|
||||
#include "complain.h"
|
||||
#include "lalr.h"
|
||||
#include "nullable.h"
|
||||
@@ -38,20 +42,18 @@
|
||||
/* All the decorated states, indexed by the state number. */
|
||||
state_t **states = NULL;
|
||||
|
||||
int tokensetsize;
|
||||
short *LAruleno;
|
||||
unsigned *LA;
|
||||
rule_t **LArule = NULL;
|
||||
bitsetv LA = NULL;
|
||||
size_t nLA;
|
||||
|
||||
static int ngotos;
|
||||
short *goto_map;
|
||||
short *from_state;
|
||||
short *to_state;
|
||||
short *goto_map = NULL;
|
||||
short *from_state = NULL;
|
||||
short *to_state = NULL;
|
||||
|
||||
/* And for the famous F variable, which name is so descriptive that a
|
||||
comment is hardly needed. <grin>. */
|
||||
static unsigned *F = NULL;
|
||||
#define F(Rule) (F + (Rule) * tokensetsize)
|
||||
static bitsetv F = NULL;
|
||||
|
||||
static short **includes;
|
||||
static shorts **lookback;
|
||||
@@ -74,9 +76,7 @@ static void
|
||||
traverse (int i)
|
||||
{
|
||||
int j;
|
||||
size_t k;
|
||||
int height;
|
||||
size_t size = F (i + 1) - F(i);
|
||||
|
||||
VERTICES[++top] = i;
|
||||
INDEX[i] = height = top;
|
||||
@@ -90,8 +90,7 @@ traverse (int i)
|
||||
if (INDEX[i] > INDEX[R[i][j]])
|
||||
INDEX[i] = INDEX[R[i][j]];
|
||||
|
||||
for (k = 0; k < size; ++k)
|
||||
F (i)[k] |= F (R[i][j])[k];
|
||||
bitset_or (F[i], F[i], F[R[i][j]]);
|
||||
}
|
||||
|
||||
if (INDEX[i] == height)
|
||||
@@ -103,8 +102,7 @@ traverse (int i)
|
||||
if (i == j)
|
||||
break;
|
||||
|
||||
for (k = 0; k < size; ++k)
|
||||
F (j)[k] = F (i)[k];
|
||||
bitset_copy (F[j], F[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,30 +134,31 @@ digraph (short **relation)
|
||||
static void
|
||||
initialize_LA (void)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
int j;
|
||||
short *np;
|
||||
rule_t **np;
|
||||
|
||||
/* Avoid having to special case 0. */
|
||||
if (!nLA)
|
||||
nLA = 1;
|
||||
|
||||
LA = XCALLOC (unsigned, nLA * tokensetsize);
|
||||
LAruleno = XCALLOC (short, nLA);
|
||||
LA = bitsetv_create (nLA, ntokens, BITSET_FIXED);
|
||||
LArule = XCALLOC (rule_t *, nLA);
|
||||
lookback = XCALLOC (shorts *, nLA);
|
||||
|
||||
np = LAruleno;
|
||||
np = LArule;
|
||||
for (i = 0; i < nstates; i++)
|
||||
if (!states[i]->consistent)
|
||||
for (j = 0; j < states[i]->reductions->nreds; j++)
|
||||
*np++ = states[i]->reductions->rules[j];
|
||||
*np++ = &rules[states[i]->reductions->rules[j]];
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_goto_map (void)
|
||||
{
|
||||
int state, i;
|
||||
size_t state;
|
||||
int i;
|
||||
short *temp_map;
|
||||
|
||||
goto_map = XCALLOC (short, nvars + 1) - ntokens;
|
||||
@@ -171,8 +170,8 @@ set_goto_map (void)
|
||||
shifts *sp = states[state]->shifts;
|
||||
for (i = sp->nshifts - 1; i >= 0 && SHIFT_IS_GOTO (sp, i); --i)
|
||||
{
|
||||
if (ngotos == MAXSHORT)
|
||||
fatal (_("too many gotos (max %d)"), MAXSHORT);
|
||||
if (ngotos == SHRT_MAX)
|
||||
fatal (_("too many gotos (max %d)"), SHRT_MAX);
|
||||
|
||||
ngotos++;
|
||||
goto_map[SHIFT_SYMBOL (sp, i)]++;
|
||||
@@ -218,7 +217,7 @@ set_goto_map (void)
|
||||
`----------------------------------------------------------*/
|
||||
|
||||
static int
|
||||
map_goto (int state, int symbol)
|
||||
map_goto (int state, token_number_t symbol)
|
||||
{
|
||||
int high;
|
||||
int low;
|
||||
@@ -255,7 +254,7 @@ initialize_F (void)
|
||||
|
||||
int i;
|
||||
|
||||
F = XCALLOC (unsigned, ngotos * tokensetsize);
|
||||
F = bitsetv_create (ngotos, ntokens, BITSET_FIXED);
|
||||
|
||||
for (i = 0; i < ngotos; i++)
|
||||
{
|
||||
@@ -264,11 +263,11 @@ initialize_F (void)
|
||||
|
||||
int j;
|
||||
for (j = 0; j < sp->nshifts && SHIFT_IS_SHIFT (sp, j); j++)
|
||||
SETBIT (F (i), SHIFT_SYMBOL (sp, j));
|
||||
bitset_set (F[i], SHIFT_SYMBOL (sp, j));
|
||||
|
||||
for (; j < sp->nshifts; j++)
|
||||
{
|
||||
int symbol = SHIFT_SYMBOL (sp, j);
|
||||
token_number_t symbol = SHIFT_SYMBOL (sp, j);
|
||||
if (nullable[symbol])
|
||||
edge[nedges++] = map_goto (stateno, symbol);
|
||||
}
|
||||
@@ -276,7 +275,7 @@ initialize_F (void)
|
||||
if (nedges)
|
||||
{
|
||||
reads[i] = XCALLOC (short, nedges + 1);
|
||||
shortcpy (reads[i], edge, nedges);
|
||||
memcpy (reads[i], edge, nedges * sizeof (edge[0]));
|
||||
reads[i][nedges] = -1;
|
||||
nedges = 0;
|
||||
}
|
||||
@@ -299,10 +298,10 @@ add_lookback_edge (state_t *state, int ruleno, int gotono)
|
||||
shorts *sp;
|
||||
|
||||
for (i = 0; i < state->nlookaheads; ++i)
|
||||
if (LAruleno[state->lookaheadsp + i] == ruleno)
|
||||
if (LArule[state->lookaheadsp + i]->number == ruleno)
|
||||
break;
|
||||
|
||||
assert (LAruleno[state->lookaheadsp + i] == ruleno);
|
||||
assert (LArule[state->lookaheadsp + i]->number == ruleno);
|
||||
|
||||
sp = XCALLOC (shorts, 1);
|
||||
sp->next = lookback[state->lookaheadsp + i];
|
||||
@@ -409,25 +408,26 @@ build_relations (void)
|
||||
for (i = 0; i < ngotos; i++)
|
||||
{
|
||||
int nedges = 0;
|
||||
int symbol1 = states[to_state[i]]->accessing_symbol;
|
||||
token_number_t symbol1 = states[to_state[i]]->accessing_symbol;
|
||||
short *rulep;
|
||||
|
||||
for (rulep = derives[symbol1]; *rulep > 0; rulep++)
|
||||
{
|
||||
int done;
|
||||
int length = 1;
|
||||
short *rp;
|
||||
item_number_t *rp;
|
||||
state_t *state = states[from_state[i]];
|
||||
states1[0] = state->number;
|
||||
|
||||
for (rp = &ritem[rules[*rulep].rhs]; *rp >= 0; rp++)
|
||||
for (rp = rules[*rulep].rhs; *rp >= 0; rp++)
|
||||
{
|
||||
shifts *sp = state->shifts;
|
||||
int j;
|
||||
for (j = 0; j < sp->nshifts; j++)
|
||||
{
|
||||
state = states[sp->shifts[j]];
|
||||
if (state->accessing_symbol == *rp)
|
||||
if (state->accessing_symbol
|
||||
== item_number_as_token_number (*rp))
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -446,7 +446,9 @@ build_relations (void)
|
||||
/* JF added rp>=ritem && I hope to god its right! */
|
||||
if (rp >= ritem && ISVAR (*rp))
|
||||
{
|
||||
edge[nedges++] = map_goto (states1[--length], *rp);
|
||||
/* Downcasting from item_number_t to token_number_t. */
|
||||
edge[nedges++] = map_goto (states1[--length],
|
||||
item_number_as_token_number (*rp));
|
||||
if (nullable[*rp])
|
||||
done = 0;
|
||||
}
|
||||
@@ -493,19 +495,14 @@ compute_lookaheads (void)
|
||||
|
||||
for (i = 0; i < nLA; i++)
|
||||
for (sp = lookback[i]; sp; sp = sp->next)
|
||||
{
|
||||
int size = LA (i + 1) - LA (i);
|
||||
int j;
|
||||
for (j = 0; j < size; ++j)
|
||||
LA (i)[j] |= F (sp->value)[j];
|
||||
}
|
||||
bitset_or (LA[i], LA[i], F[sp->value]);
|
||||
|
||||
/* Free LOOKBACK. */
|
||||
for (i = 0; i < nLA; i++)
|
||||
LIST_FREE (shorts, lookback[i]);
|
||||
|
||||
XFREE (lookback);
|
||||
XFREE (F);
|
||||
bitsetv_free (F);
|
||||
}
|
||||
|
||||
|
||||
@@ -516,7 +513,7 @@ compute_lookaheads (void)
|
||||
static void
|
||||
initialize_lookaheads (void)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
nLA = 0;
|
||||
for (i = 0; i < nstates; i++)
|
||||
{
|
||||
@@ -556,7 +553,8 @@ initialize_lookaheads (void)
|
||||
static void
|
||||
lookaheads_print (FILE *out)
|
||||
{
|
||||
int i, j, k;
|
||||
size_t i;
|
||||
int j, k;
|
||||
fprintf (out, "Lookaheads: BEGIN\n");
|
||||
for (i = 0; i < nstates; ++i)
|
||||
{
|
||||
@@ -565,10 +563,10 @@ lookaheads_print (FILE *out)
|
||||
|
||||
for (j = 0; j < states[i]->nlookaheads; ++j)
|
||||
for (k = 0; k < ntokens; ++k)
|
||||
if (BITISSET (LA (states[i]->lookaheadsp + j), j))
|
||||
if (bitset_test (LA[states[i]->lookaheadsp + j], k))
|
||||
fprintf (out, " on %d (%s) -> rule %d\n",
|
||||
k, symbols[k]->tag,
|
||||
-LAruleno[states[i]->lookaheadsp + j] - 1);
|
||||
k, quotearg_style (escape_quoting_style, symbols[k]->tag),
|
||||
LArule[states[i]->lookaheadsp + j]->number - 1);
|
||||
}
|
||||
fprintf (out, "Lookaheads: END\n");
|
||||
}
|
||||
@@ -576,8 +574,6 @@ lookaheads_print (FILE *out)
|
||||
void
|
||||
lalr (void)
|
||||
{
|
||||
tokensetsize = WORDSIZE (ntokens);
|
||||
|
||||
initialize_lookaheads ();
|
||||
initialize_LA ();
|
||||
set_goto_map ();
|
||||
|
||||
+11
-11
@@ -1,5 +1,5 @@
|
||||
/* Compute look-ahead criteria for bison,
|
||||
Copyright 1984, 1986, 1989, 2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1986, 1989, 2000, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -21,10 +21,14 @@
|
||||
#ifndef LALR_H_
|
||||
# define LALR_H_
|
||||
|
||||
#include "bitset.h"
|
||||
#include "bitsetv.h"
|
||||
|
||||
/* Import the definition of CORE, SHIFTS and REDUCTIONS. */
|
||||
# include "state.h"
|
||||
|
||||
/* Import the definition of RULE_T. */
|
||||
# include "gram.h"
|
||||
|
||||
/* Compute how to make the finite state machine deterministic; find
|
||||
which rules need lookahead in each state, and which lookahead
|
||||
@@ -49,29 +53,25 @@ extern short *goto_map;
|
||||
extern short *from_state;
|
||||
extern short *to_state;
|
||||
|
||||
/* LARULENO is a vector which records the rules that need lookahead in
|
||||
various states. The elements of LARULENO that apply to state S are
|
||||
those from LOOKAHEADS[S] through LOOKAHEADS[S+1]-1. Each element
|
||||
of LARULENO is a rule number.
|
||||
/* LARULE is a vector which records the rules that need lookahead in
|
||||
various states. The elements of LARULE that apply to state S are
|
||||
those from LOOKAHEADS[S] through LOOKAHEADS[S+1]-1.
|
||||
|
||||
If LR is the length of LAruleno, then a number from 0 to LR-1 can
|
||||
If LR is the length of LArule, then a number from 0 to LR-1 can
|
||||
specify both a rule and a state where the rule might be applied.
|
||||
*/
|
||||
|
||||
extern short *LAruleno;
|
||||
extern rule_t **LArule;
|
||||
|
||||
/* LA is a lr by ntokens matrix of bits. LA[l, i] is 1 if the rule
|
||||
LAruleno[l] is applicable in the appropriate state when the next
|
||||
token is symbol i. If LA[l, i] and LA[l, j] are both 1 for i != j,
|
||||
it is a conflict. */
|
||||
|
||||
extern unsigned *LA;
|
||||
#define LA(Rule) (LA + (Rule) * tokensetsize)
|
||||
extern bitsetv LA;
|
||||
|
||||
|
||||
/* All the states, indexed by the state number. */
|
||||
extern state_t **states;
|
||||
|
||||
extern int tokensetsize;
|
||||
|
||||
#endif /* !LALR_H_ */
|
||||
|
||||
@@ -32,12 +32,12 @@
|
||||
static struct obstack token_obstack;
|
||||
const char *token_buffer = NULL;
|
||||
|
||||
bucket *symval = NULL;
|
||||
symbol_t *symval = NULL;
|
||||
int numval;
|
||||
|
||||
/* A token to be reread, see unlex and lex. */
|
||||
static token_t unlexed = tok_undef;
|
||||
static bucket *unlexed_symval = NULL;
|
||||
static symbol_t *unlexed_symval = NULL;
|
||||
static const char *unlexed_token_buffer = NULL;
|
||||
|
||||
void
|
||||
@@ -364,9 +364,13 @@ lex (void)
|
||||
obstack_1grow (&token_obstack, '\0');
|
||||
token_buffer = obstack_finish (&token_obstack);
|
||||
symval = getsym (token_buffer);
|
||||
symval->class = token_sym;
|
||||
if (symval->user_token_number == SUNDEF)
|
||||
symval->user_token_number = code;
|
||||
if (symval->number == NUMBER_UNDEFINED)
|
||||
{
|
||||
symval->number = ntokens++;
|
||||
symval->class = token_sym;
|
||||
if (symval->user_token_number == SUNDEF)
|
||||
symval->user_token_number = code;
|
||||
}
|
||||
return tok_identifier;
|
||||
}
|
||||
|
||||
@@ -388,7 +392,11 @@ lex (void)
|
||||
token_buffer = obstack_finish (&token_obstack);
|
||||
|
||||
symval = getsym (token_buffer);
|
||||
symval->class = token_sym;
|
||||
if (symval->number == NUMBER_UNDEFINED)
|
||||
{
|
||||
symval->number = ntokens++;
|
||||
symval->class = token_sym;
|
||||
}
|
||||
|
||||
return tok_identifier;
|
||||
}
|
||||
@@ -485,44 +493,40 @@ parse_percent_token (void)
|
||||
obstack_1grow (&token_obstack, '%');
|
||||
obstack_1grow (&token_obstack, c);
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '%':
|
||||
token_buffer = obstack_finish (&token_obstack);
|
||||
return tok_two_percents;
|
||||
|
||||
case '{':
|
||||
token_buffer = obstack_finish (&token_obstack);
|
||||
return tok_percent_left_curly;
|
||||
|
||||
/* The following guys are here for backward compatibility with
|
||||
very ancient Yacc versions. The paper of Johnson mentions
|
||||
them (as ancient :). */
|
||||
case '<':
|
||||
token_buffer = obstack_finish (&token_obstack);
|
||||
return tok_left;
|
||||
|
||||
case '>':
|
||||
token_buffer = obstack_finish (&token_obstack);
|
||||
return tok_right;
|
||||
|
||||
case '2':
|
||||
token_buffer = obstack_finish (&token_obstack);
|
||||
return tok_nonassoc;
|
||||
|
||||
case '0':
|
||||
token_buffer = obstack_finish (&token_obstack);
|
||||
return tok_token;
|
||||
|
||||
case '=':
|
||||
token_buffer = obstack_finish (&token_obstack);
|
||||
return tok_prec;
|
||||
}
|
||||
|
||||
if (!isalpha (c))
|
||||
{
|
||||
obstack_1grow (&token_obstack, '\0');
|
||||
token_buffer = obstack_finish (&token_obstack);
|
||||
return tok_illegal;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '%':
|
||||
return tok_two_percents;
|
||||
|
||||
case '{':
|
||||
return tok_percent_left_curly;
|
||||
|
||||
/* The following guys are here for backward compatibility with
|
||||
very ancient Yacc versions. The paper of Johnson mentions
|
||||
them (as ancient :). */
|
||||
case '<':
|
||||
return tok_left;
|
||||
|
||||
case '>':
|
||||
return tok_right;
|
||||
|
||||
case '2':
|
||||
return tok_nonassoc;
|
||||
|
||||
case '0':
|
||||
return tok_token;
|
||||
|
||||
case '=':
|
||||
return tok_prec;
|
||||
|
||||
default:
|
||||
return tok_illegal;
|
||||
}
|
||||
}
|
||||
|
||||
while (c = getc (finput), isalpha (c) || c == '_' || c == '-')
|
||||
|
||||
@@ -58,7 +58,7 @@ typedef enum token_e
|
||||
} token_t;
|
||||
|
||||
extern const char *token_buffer;
|
||||
extern bucket *symval;
|
||||
extern symbol_t *symval;
|
||||
extern int numval;
|
||||
|
||||
void lex_init PARAMS ((void));
|
||||
|
||||
+7
-5
@@ -1,5 +1,5 @@
|
||||
/* Top level entry point of bison,
|
||||
Copyright 1984, 1986, 1989, 1992, 1995, 2000, 2001
|
||||
Copyright 1984, 1986, 1989, 1992, 1995, 2000, 2001, 2002
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
@@ -21,7 +21,10 @@
|
||||
|
||||
|
||||
#include "system.h"
|
||||
#include "bitset.h"
|
||||
#include "getargs.h"
|
||||
#include "symtab.h"
|
||||
#include "gram.h"
|
||||
#include "files.h"
|
||||
#include "complain.h"
|
||||
#include "derives.h"
|
||||
@@ -35,7 +38,6 @@
|
||||
#include "conflicts.h"
|
||||
#include "print_graph.h"
|
||||
#include "muscle_tab.h"
|
||||
#include "symtab.h"
|
||||
#include "lex.h"
|
||||
|
||||
/* The name this program was run with, for messages. */
|
||||
@@ -49,6 +51,8 @@ main (int argc, char *argv[])
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
bitset_stats_init ();
|
||||
|
||||
lineno = 0;
|
||||
getargs (argc, argv);
|
||||
|
||||
@@ -102,13 +106,11 @@ main (int argc, char *argv[])
|
||||
/* Output the tables and the parser to ftable. In file output. */
|
||||
output ();
|
||||
|
||||
/* Free the symbol table data structure. */
|
||||
free_symtab ();
|
||||
|
||||
reduce_free ();
|
||||
free_conflicts ();
|
||||
free_nullable ();
|
||||
free_derives ();
|
||||
grammar_free ();
|
||||
|
||||
/* If using alloca.c, flush the alloca'ed memory for the benefit of
|
||||
people running Bison as a library in IDEs. */
|
||||
|
||||
@@ -92,3 +92,26 @@ muscle_find (const char *key)
|
||||
muscle_entry_t *result = hash_lookup (muscle_table, &pair);
|
||||
return result ? result->value : NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Output the definition of all the current muscles into a list of
|
||||
m4_defines. */
|
||||
|
||||
static void
|
||||
muscle_m4_output (muscle_entry_t *entry, FILE *out)
|
||||
{
|
||||
fprintf (out, "m4_define([b4_%s],\n", entry->key);
|
||||
fprintf (out, " [[%s]])\n\n\n", entry->value);
|
||||
}
|
||||
|
||||
|
||||
/* Output the definition of all the current muscles into a list of
|
||||
m4_defines. */
|
||||
|
||||
void
|
||||
muscles_m4_output (FILE *out)
|
||||
{
|
||||
hash_do_for_each (muscle_table,
|
||||
(Hash_processor) muscle_m4_output,
|
||||
out);
|
||||
}
|
||||
|
||||
+11
-1
@@ -1,5 +1,5 @@
|
||||
/* Definitions for macrotab.c and callers, part of bison,
|
||||
Copyright 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -40,6 +40,13 @@ const char *muscle_find PARAMS ((const char *key));
|
||||
muscle_insert (Key, obstack_finish (&muscle_obstack)); \
|
||||
}
|
||||
|
||||
#define MUSCLE_INSERT_LONG_INT(Key, Value) \
|
||||
{ \
|
||||
obstack_fgrow1 (&muscle_obstack, "%ld", Value); \
|
||||
obstack_1grow (&muscle_obstack, 0); \
|
||||
muscle_insert (Key, obstack_finish (&muscle_obstack)); \
|
||||
}
|
||||
|
||||
#define MUSCLE_INSERT_STRING(Key, Value) \
|
||||
{ \
|
||||
obstack_sgrow (&muscle_obstack, Value); \
|
||||
@@ -55,4 +62,7 @@ const char *muscle_find PARAMS ((const char *key));
|
||||
muscle_insert (Key, obstack_finish (&muscle_obstack)); \
|
||||
}
|
||||
|
||||
|
||||
void muscles_m4_output PARAMS ((FILE *out));
|
||||
|
||||
#endif /* not MUSCLE_TAB_H_ */
|
||||
|
||||
+14
-14
@@ -47,11 +47,11 @@ void
|
||||
set_nullable (void)
|
||||
{
|
||||
int ruleno;
|
||||
short *s1;
|
||||
short *s2;
|
||||
token_number_t *s1;
|
||||
token_number_t *s2;
|
||||
shorts *p;
|
||||
|
||||
short *squeue = XCALLOC (short, nvars);
|
||||
token_number_t *squeue = XCALLOC (token_number_t, nvars);
|
||||
short *rcount = XCALLOC (short, nrules + 1);
|
||||
/* RITEM contains all the rules, including useless productions.
|
||||
Hence we must allocate room for useless nonterminals too. */
|
||||
@@ -71,19 +71,19 @@ set_nullable (void)
|
||||
for (ruleno = 1; ruleno < nrules + 1; ++ruleno)
|
||||
if (rules[ruleno].useful)
|
||||
{
|
||||
if (ritem[rules[ruleno].rhs] >= 0)
|
||||
if (rules[ruleno].rhs[0] >= 0)
|
||||
{
|
||||
/* This rule has a non empty RHS. */
|
||||
short *r;
|
||||
item_number_t *r;
|
||||
int any_tokens = 0;
|
||||
for (r = &ritem[rules[ruleno].rhs]; *r >= 0; ++r)
|
||||
for (r = rules[ruleno].rhs; *r >= 0; ++r)
|
||||
if (ISTOKEN (*r))
|
||||
any_tokens = 1;
|
||||
|
||||
/* This rule has only nonterminals: schedule it for the second
|
||||
pass. */
|
||||
if (!any_tokens)
|
||||
for (r = &ritem[rules[ruleno].rhs]; *r >= 0; ++r)
|
||||
for (r = rules[ruleno].rhs; *r >= 0; ++r)
|
||||
{
|
||||
rcount[ruleno]++;
|
||||
p->next = rsets[*r];
|
||||
@@ -95,11 +95,11 @@ set_nullable (void)
|
||||
else
|
||||
{
|
||||
/* This rule has an empty RHS. */
|
||||
assert (ritem[rules[ruleno].rhs] == -ruleno);
|
||||
if (rules[ruleno].useful && !nullable[rules[ruleno].lhs])
|
||||
assert (rules[ruleno].rhs[0] == -ruleno);
|
||||
if (rules[ruleno].useful && !nullable[rules[ruleno].lhs->number])
|
||||
{
|
||||
nullable[rules[ruleno].lhs] = 1;
|
||||
*s2++ = rules[ruleno].lhs;
|
||||
nullable[rules[ruleno].lhs->number] = 1;
|
||||
*s2++ = rules[ruleno].lhs->number;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,10 +109,10 @@ set_nullable (void)
|
||||
{
|
||||
ruleno = p->value;
|
||||
if (--rcount[ruleno] == 0)
|
||||
if (rules[ruleno].useful && !nullable[rules[ruleno].lhs])
|
||||
if (rules[ruleno].useful && !nullable[rules[ruleno].lhs->number])
|
||||
{
|
||||
nullable[rules[ruleno].lhs] = 1;
|
||||
*s2++ = rules[ruleno].lhs;
|
||||
nullable[rules[ruleno].lhs->number] = 1;
|
||||
*s2++ = rules[ruleno].lhs->number;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
/* Concentrate all options use in bison,
|
||||
Copyright 2001 Free Software Foundation, Inc.
|
||||
Copyright 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "files.h"
|
||||
#include "getargs.h"
|
||||
#include "symtab.h"
|
||||
#include "gram.h"
|
||||
#include "lex.h"
|
||||
#include "output.h"
|
||||
#include "options.h"
|
||||
|
||||
+347
-317
@@ -89,7 +89,9 @@
|
||||
negative short int. Used to flag ?? */
|
||||
|
||||
#include "system.h"
|
||||
#include "bitsetv.h"
|
||||
#include "quotearg.h"
|
||||
#include "error.h"
|
||||
#include "getargs.h"
|
||||
#include "files.h"
|
||||
#include "gram.h"
|
||||
@@ -101,7 +103,13 @@
|
||||
#include "symtab.h"
|
||||
#include "conflicts.h"
|
||||
#include "muscle_tab.h"
|
||||
#include "skeleton.h"
|
||||
|
||||
/* From lib/readpipe.h. */
|
||||
FILE *readpipe PARAMS ((const char *, ...));
|
||||
|
||||
/* From src/scan-skel.l. */
|
||||
int skel_lex PARAMS ((void));
|
||||
extern FILE *skel_in;
|
||||
|
||||
static int nvectors;
|
||||
static int nentries;
|
||||
@@ -114,6 +122,11 @@ static short *state_count = NULL;
|
||||
static short *order = NULL;
|
||||
static short *base = NULL;
|
||||
static short *pos = NULL;
|
||||
|
||||
/* TABLE_SIZE is the allocated size of both TABLE and CHECK.
|
||||
We start with the original hard-coded value: SHRT_MAX
|
||||
(yes, not USHRT_MAX). */
|
||||
static size_t table_size = SHRT_MAX;
|
||||
static short *table = NULL;
|
||||
static short *check = NULL;
|
||||
static int lowzero;
|
||||
@@ -124,198 +137,226 @@ static struct obstack format_obstack;
|
||||
|
||||
int error_verbose = 0;
|
||||
|
||||
/* Returns the number of lines of S. */
|
||||
size_t
|
||||
get_lines_number (const char *s)
|
||||
{
|
||||
size_t lines = 0;
|
||||
|
||||
size_t i;
|
||||
for (i = 0; s[i]; ++i)
|
||||
if (s[i] == '\n')
|
||||
++lines;
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
|
||||
/* FIXME. */
|
||||
|
||||
static inline void
|
||||
output_table_data (struct obstack *oout,
|
||||
short *table_data,
|
||||
short first,
|
||||
int begin,
|
||||
int end)
|
||||
{
|
||||
int i;
|
||||
int j = 1;
|
||||
|
||||
obstack_fgrow1 (oout, "%6d", first);
|
||||
for (i = begin; i < end; ++i)
|
||||
{
|
||||
obstack_1grow (oout, ',');
|
||||
if (j >= 10)
|
||||
{
|
||||
obstack_sgrow (oout, "\n ");
|
||||
j = 1;
|
||||
}
|
||||
else
|
||||
++j;
|
||||
obstack_fgrow1 (oout, "%6d", table_data[i]);
|
||||
}
|
||||
obstack_1grow (oout, 0);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------.
|
||||
| If TABLE (and CHECK) appear to be small to be addressed at |
|
||||
| DESIRED, grow them. Note that TABLE[DESIRED] is to be used, so |
|
||||
| the desired size is at least DESIRED + 1. |
|
||||
`----------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
output_token_translations (void)
|
||||
table_grow (size_t desired)
|
||||
{
|
||||
output_table_data (&format_obstack, token_translations,
|
||||
0, 1, max_user_token_number + 1);
|
||||
size_t old_size = table_size;
|
||||
|
||||
while (table_size <= desired)
|
||||
table_size *= 2;
|
||||
|
||||
if (trace_flag)
|
||||
fprintf (stderr, "growing table and check from: %d to %d\n",
|
||||
old_size, table_size);
|
||||
|
||||
table = XREALLOC (table, short, table_size);
|
||||
check = XREALLOC (check, short, table_size);
|
||||
|
||||
for (/* Nothing. */; old_size < table_size; ++old_size)
|
||||
{
|
||||
table[old_size] = 0;
|
||||
check[old_size] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------.
|
||||
| Create a function NAME which Format the FIRST and then |
|
||||
| TABLE_DATA[BEGIN..END[ (of TYPE) into OOUT, and return the number |
|
||||
| of bits needed for its longuest value. |
|
||||
`------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#define GENERATE_OUTPUT_TABLE(Name, Type) \
|
||||
\
|
||||
static inline long int \
|
||||
Name (struct obstack *oout, \
|
||||
Type *table_data, \
|
||||
Type first, \
|
||||
int begin, \
|
||||
int end) \
|
||||
{ \
|
||||
long int max = first; \
|
||||
int i; \
|
||||
int j = 1; \
|
||||
\
|
||||
obstack_fgrow1 (oout, "%6d", first); \
|
||||
for (i = begin; i < end; ++i) \
|
||||
{ \
|
||||
obstack_1grow (oout, ','); \
|
||||
if (j >= 10) \
|
||||
{ \
|
||||
obstack_sgrow (oout, "\n "); \
|
||||
j = 1; \
|
||||
} \
|
||||
else \
|
||||
++j; \
|
||||
obstack_fgrow1 (oout, "%6d", table_data[i]); \
|
||||
if (table_data[i] > max) \
|
||||
max = table_data[i]; \
|
||||
} \
|
||||
obstack_1grow (oout, 0); \
|
||||
\
|
||||
return max; \
|
||||
}
|
||||
|
||||
GENERATE_OUTPUT_TABLE(output_int_table, int)
|
||||
GENERATE_OUTPUT_TABLE(output_short_table, short)
|
||||
GENERATE_OUTPUT_TABLE(output_token_number_table, token_number_t)
|
||||
GENERATE_OUTPUT_TABLE(output_item_number_table, item_number_t)
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------.
|
||||
| Prepare the muscles related to the tokens: translate, tname, and |
|
||||
| toknum. |
|
||||
`-----------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
prepare_tokens (void)
|
||||
{
|
||||
long int max = output_token_number_table (&format_obstack,
|
||||
token_translations,
|
||||
0, 1, max_user_token_number + 1);
|
||||
muscle_insert ("translate", obstack_finish (&format_obstack));
|
||||
MUSCLE_INSERT_LONG_INT ("token_number_max", max);
|
||||
XFREE (token_translations);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
output_gram (void)
|
||||
{
|
||||
{
|
||||
int i;
|
||||
short *values = XCALLOC (short, nrules + 1);
|
||||
for (i = 0; i < nrules + 1; ++i)
|
||||
values[i] = rules[i].rhs;
|
||||
output_table_data (&format_obstack, values,
|
||||
0, 1, nrules + 1);
|
||||
XFREE (values);
|
||||
int j = 0;
|
||||
for (i = 0; i < nsyms; i++)
|
||||
{
|
||||
/* Be sure not to use twice the same quotearg slot. */
|
||||
const char *cp =
|
||||
quotearg_n_style (1, c_quoting_style,
|
||||
quotearg_style (escape_quoting_style,
|
||||
symbols[i]->tag));
|
||||
/* Width of the next token, including the two quotes, the coma
|
||||
and the space. */
|
||||
int strsize = strlen (cp) + 2;
|
||||
|
||||
if (j + strsize > 75)
|
||||
{
|
||||
obstack_sgrow (&format_obstack, "\n ");
|
||||
j = 2;
|
||||
}
|
||||
|
||||
obstack_sgrow (&format_obstack, cp);
|
||||
obstack_sgrow (&format_obstack, ", ");
|
||||
j += strsize;
|
||||
}
|
||||
/* Add a NULL entry to list of tokens (well, 0, as NULL might not be
|
||||
defined). */
|
||||
obstack_sgrow (&format_obstack, "0");
|
||||
|
||||
/* Finish table and store. */
|
||||
obstack_1grow (&format_obstack, 0);
|
||||
muscle_insert ("tname", obstack_finish (&format_obstack));
|
||||
}
|
||||
|
||||
muscle_insert ("prhs", obstack_finish (&format_obstack));
|
||||
|
||||
/* Output YYTOKNUM. */
|
||||
{
|
||||
short *yyrhs;
|
||||
int i;
|
||||
|
||||
yyrhs = XMALLOC (short, nritems);
|
||||
|
||||
for (i = 1; i < nritems; ++i)
|
||||
yyrhs[i] = ritem[i] >= 0 ? ritem[i] : -1;
|
||||
|
||||
output_table_data (&format_obstack, yyrhs,
|
||||
ritem[0], 1, nritems);
|
||||
muscle_insert ("rhs", obstack_finish (&format_obstack));
|
||||
|
||||
XFREE (yyrhs);
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (!semantic_parser)
|
||||
obstack_sgrow (&table_obstack, "\n#endif\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
output_stos (void)
|
||||
{
|
||||
int i;
|
||||
short *values = (short *) alloca (sizeof (short) * nstates);
|
||||
for (i = 0; i < nstates; ++i)
|
||||
values[i] = states[i]->accessing_symbol;
|
||||
output_table_data (&format_obstack, values,
|
||||
0, 1, nstates);
|
||||
muscle_insert ("stos", obstack_finish (&format_obstack));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
output_rule_data (void)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
short *short_tab = NULL;
|
||||
|
||||
{
|
||||
short *values = XCALLOC (short, nrules + 1);
|
||||
for (i = 0; i < nrules + 1; ++i)
|
||||
values[i] = rules[i].line;
|
||||
output_table_data (&format_obstack, values,
|
||||
0, 1, nrules + 1);
|
||||
muscle_insert ("rline", obstack_finish (&format_obstack));
|
||||
XFREE (values);
|
||||
}
|
||||
|
||||
|
||||
j = 0;
|
||||
for (i = 0; i < nsyms; i++)
|
||||
{
|
||||
/* Be sure not to use twice the same quotearg slot. */
|
||||
const char *cp =
|
||||
quotearg_n_style (1, c_quoting_style,
|
||||
quotearg_style (escape_quoting_style, symbols[i]->tag));
|
||||
/* Width of the next token, including the two quotes, the coma
|
||||
and the space. */
|
||||
int strsize = strlen (cp) + 2;
|
||||
|
||||
if (j + strsize > 75)
|
||||
{
|
||||
obstack_sgrow (&format_obstack, "\n ");
|
||||
j = 2;
|
||||
}
|
||||
|
||||
obstack_sgrow (&format_obstack, cp);
|
||||
obstack_sgrow (&format_obstack, ", ");
|
||||
j += strsize;
|
||||
}
|
||||
/* add a NULL entry to list of tokens */
|
||||
obstack_sgrow (&format_obstack, "NULL");
|
||||
|
||||
/* Finish table and store. */
|
||||
obstack_1grow (&format_obstack, 0);
|
||||
muscle_insert ("tname", obstack_finish (&format_obstack));
|
||||
|
||||
/* Output YYTOKNUM. */
|
||||
{
|
||||
short *values = XCALLOC (short, ntokens + 1);
|
||||
for (i = 0; i < ntokens + 1; ++i)
|
||||
values[i] = symbols[i]->user_token_number;
|
||||
output_table_data (&format_obstack, values,
|
||||
output_short_table (&format_obstack, values,
|
||||
0, 1, ntokens + 1);
|
||||
muscle_insert ("toknum", obstack_finish (&format_obstack));
|
||||
XFREE (values);
|
||||
free (values);
|
||||
}
|
||||
|
||||
|
||||
/* Output YYR1. */
|
||||
{
|
||||
short *values = XCALLOC (short, nrules + 1);
|
||||
for (i = 0; i < nrules + 1; ++i)
|
||||
values[i] = rules[i].lhs;
|
||||
output_table_data (&format_obstack, values,
|
||||
0, 1, nrules + 1);
|
||||
muscle_insert ("r1", obstack_finish (&format_obstack));
|
||||
XFREE (values);
|
||||
}
|
||||
|
||||
/* Output YYR2. */
|
||||
short_tab = XMALLOC (short, nrules + 1);
|
||||
for (i = 1; i < nrules; i++)
|
||||
short_tab[i] = rules[i + 1].rhs - rules[i].rhs - 1;
|
||||
short_tab[nrules] = nritems - rules[nrules].rhs - 1;
|
||||
output_table_data (&format_obstack, short_tab,
|
||||
0, 1, nrules + 1);
|
||||
muscle_insert ("r2", obstack_finish (&format_obstack));
|
||||
XFREE (short_tab);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------.
|
||||
| Prepare the muscles related to the rules: rhs, prhs, r1, r2, |
|
||||
| rline. |
|
||||
`-------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
prepare_rules (void)
|
||||
{
|
||||
long int max;
|
||||
item_number_t *rhsp;
|
||||
int r;
|
||||
int i = 0;
|
||||
item_number_t *rhs = XMALLOC (item_number_t, nritems);
|
||||
short *prhs = XMALLOC (short, nrules + 1);
|
||||
token_number_t *r1 = XMALLOC (token_number_t, nrules + 1);
|
||||
short *r2 = XMALLOC (short, nrules + 1);
|
||||
short *rline = XMALLOC (short, nrules + 1);
|
||||
|
||||
for (r = 1; r < nrules + 1; ++r)
|
||||
{
|
||||
/* Index of rule R in RHS. */
|
||||
prhs[r] = i;
|
||||
/* RHS of the rule R. */
|
||||
for (rhsp = rules[r].rhs; *rhsp >= 0; ++rhsp)
|
||||
rhs[i++] = *rhsp;
|
||||
/* LHS of the rule R. */
|
||||
r1[r] = rules[r].lhs->number;
|
||||
/* Length of rule R's RHS. */
|
||||
r2[r] = i - prhs[r];
|
||||
/* Separator in RHS. */
|
||||
rhs[i++] = -1;
|
||||
/* Line where rule was defined. */
|
||||
rline[r] = rules[r].line;
|
||||
}
|
||||
assert (i == nritems);
|
||||
|
||||
max = output_int_table (&format_obstack, rhs, ritem[0], 1, nritems);
|
||||
muscle_insert ("rhs", obstack_finish (&format_obstack));
|
||||
MUSCLE_INSERT_LONG_INT ("rhs_number_max", max);
|
||||
|
||||
output_short_table (&format_obstack, prhs, 0, 1, nrules + 1);
|
||||
muscle_insert ("prhs", obstack_finish (&format_obstack));
|
||||
|
||||
output_short_table (&format_obstack, rline, 0, 1, nrules + 1);
|
||||
muscle_insert ("rline", obstack_finish (&format_obstack));
|
||||
|
||||
output_token_number_table (&format_obstack, r1, 0, 1, nrules + 1);
|
||||
muscle_insert ("r1", obstack_finish (&format_obstack));
|
||||
|
||||
output_short_table (&format_obstack, r2, 0, 1, nrules + 1);
|
||||
muscle_insert ("r2", obstack_finish (&format_obstack));
|
||||
|
||||
free (rhs);
|
||||
free (prhs);
|
||||
free (r2);
|
||||
}
|
||||
|
||||
/*--------------------------------------------.
|
||||
| Prepare the muscles related to the states. |
|
||||
`--------------------------------------------*/
|
||||
|
||||
static void
|
||||
prepare_states (void)
|
||||
{
|
||||
size_t i;
|
||||
token_number_t *values =
|
||||
(token_number_t *) alloca (sizeof (token_number_t) * nstates);
|
||||
for (i = 0; i < nstates; ++i)
|
||||
values[i] = states[i]->accessing_symbol;
|
||||
output_token_number_table (&format_obstack, values,
|
||||
0, 1, nstates);
|
||||
muscle_insert ("stos", obstack_finish (&format_obstack));
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------.
|
||||
| Decide what to do for each type of token if seen as the lookahead |
|
||||
| token in specified state. The value returned is used as the |
|
||||
| default action (yydefact) for the state. In addition, actrow is |
|
||||
| filled with what to do for each kind of token, index by symbol |
|
||||
| number, with zero meaning do the default action. The value |
|
||||
| MINSHORT, a very negative number, means this situation is an |
|
||||
| SHRT_MIN, a very negative number, means this situation is an |
|
||||
| error. The parser recognizes this value specially. |
|
||||
| |
|
||||
| This is where conflicts are resolved. The loop over lookahead |
|
||||
@@ -348,8 +389,8 @@ action_row (state_t *state)
|
||||
for (j = 0; j < ntokens; j++)
|
||||
/* and record this rule as the rule to use if that
|
||||
token follows. */
|
||||
if (BITISSET (LA (state->lookaheadsp + i), j))
|
||||
actrow[j] = -LAruleno[state->lookaheadsp + i];
|
||||
if (bitset_test (LA[state->lookaheadsp + i], j))
|
||||
actrow[j] = -LArule[state->lookaheadsp + i]->number;
|
||||
}
|
||||
|
||||
/* Now see which tokens are allowed for shifts in this state. For
|
||||
@@ -357,7 +398,7 @@ action_row (state_t *state)
|
||||
to reduce. */
|
||||
for (i = 0; i < shiftp->nshifts; i++)
|
||||
{
|
||||
int symbol;
|
||||
token_number_t symbol;
|
||||
int shift_state = shiftp->shifts[i];
|
||||
if (!shift_state)
|
||||
continue;
|
||||
@@ -371,16 +412,16 @@ action_row (state_t *state)
|
||||
|
||||
/* Do not use any default reduction if there is a shift for
|
||||
error */
|
||||
if (symbol == error_token_number)
|
||||
if (symbol == errtoken->number)
|
||||
nodefault = 1;
|
||||
}
|
||||
|
||||
/* See which tokens are an explicit error in this state (due to
|
||||
%nonassoc). For them, record MINSHORT as the action. */
|
||||
%nonassoc). For them, record SHRT_MIN as the action. */
|
||||
for (i = 0; i < errp->nerrs; i++)
|
||||
{
|
||||
int symbol = errp->errs[i];
|
||||
actrow[symbol] = MINSHORT;
|
||||
actrow[symbol] = SHRT_MIN;
|
||||
}
|
||||
|
||||
/* Now find the most common reduction and make it the default action
|
||||
@@ -396,7 +437,7 @@ action_row (state_t *state)
|
||||
for (i = 0; i < state->nlookaheads; i++)
|
||||
{
|
||||
int count = 0;
|
||||
int rule = -LAruleno[state->lookaheadsp + i];
|
||||
int rule = -LArule[state->lookaheadsp + i]->number;
|
||||
int j;
|
||||
|
||||
for (j = 0; j < ntokens; j++)
|
||||
@@ -430,7 +471,7 @@ action_row (state_t *state)
|
||||
|
||||
if (default_rule == 0)
|
||||
for (i = 0; i < ntokens; i++)
|
||||
if (actrow[i] == MINSHORT)
|
||||
if (actrow[i] == SHRT_MIN)
|
||||
actrow[i] = 0;
|
||||
|
||||
return default_rule;
|
||||
@@ -480,7 +521,7 @@ save_row (int state)
|
||||
static void
|
||||
token_actions (void)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
short *yydefact = XCALLOC (short, nstates);
|
||||
|
||||
actrow = XCALLOC (short, ntokens);
|
||||
@@ -490,7 +531,7 @@ token_actions (void)
|
||||
save_row (i);
|
||||
}
|
||||
|
||||
output_table_data (&format_obstack, yydefact,
|
||||
output_short_table (&format_obstack, yydefact,
|
||||
yydefact[0], 1, nstates);
|
||||
muscle_insert ("defact", obstack_finish (&format_obstack));
|
||||
|
||||
@@ -504,7 +545,7 @@ token_actions (void)
|
||||
`-----------------------------*/
|
||||
|
||||
void
|
||||
actions_output (FILE *out, size_t *line)
|
||||
actions_output (FILE *out)
|
||||
{
|
||||
int rule;
|
||||
for (rule = 1; rule < nrules + 1; ++rule)
|
||||
@@ -523,14 +564,6 @@ actions_output (FILE *out, size_t *line)
|
||||
fprintf (out, "{ %s%s }\n break;\n\n",
|
||||
rules[rule].action,
|
||||
yacc_flag ? ";" : "");
|
||||
|
||||
/* We always output 4 '\n' per action. */
|
||||
*line += 4;
|
||||
/* Plus one if !no_lines_flag. */
|
||||
if (!no_lines_flag)
|
||||
++*line;
|
||||
/* Get the number of lines written by the user. */
|
||||
*line += get_lines_number (rules[rule].action);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -540,11 +573,11 @@ actions_output (FILE *out, size_t *line)
|
||||
`----------------------------*/
|
||||
|
||||
void
|
||||
guards_output (FILE *out, size_t *line)
|
||||
guards_output (FILE *out)
|
||||
{
|
||||
int rule;
|
||||
for (rule = 1; rule < nrules + 1; ++rule)
|
||||
if (rules[rule].action)
|
||||
if (rules[rule].guard)
|
||||
{
|
||||
fprintf (out, " case %d:\n", rule);
|
||||
|
||||
@@ -555,14 +588,6 @@ guards_output (FILE *out, size_t *line)
|
||||
muscle_find ("filename")));
|
||||
fprintf (out, "{ %s; }\n break;\n\n",
|
||||
rules[rule].guard);
|
||||
|
||||
/* We always output 4 '\n' per action. */
|
||||
*line += 4;
|
||||
/* Plus one if !no_lines_flag. */
|
||||
if (!no_lines_flag)
|
||||
++*line;
|
||||
/* Get the number of lines written by the user. */
|
||||
*line += get_lines_number (rules[rule].guard);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -572,18 +597,19 @@ guards_output (FILE *out, size_t *line)
|
||||
`---------------------------------------*/
|
||||
|
||||
void
|
||||
token_definitions_output (FILE *out, size_t *line)
|
||||
token_definitions_output (FILE *out)
|
||||
{
|
||||
int i;
|
||||
int first = 1;
|
||||
for (i = 0; i < ntokens; ++i)
|
||||
{
|
||||
bucket *symbol = symbols[i];
|
||||
symbol_t *symbol = symbols[i];
|
||||
int number = symbol->user_token_number;
|
||||
|
||||
if (number == SALIAS)
|
||||
continue;
|
||||
/* Skip error token. */
|
||||
if (symbol->value == error_token_number)
|
||||
if (symbol == errtoken)
|
||||
continue;
|
||||
if (symbol->tag[0] == '\'')
|
||||
continue; /* skip literal character */
|
||||
@@ -601,16 +627,13 @@ token_definitions_output (FILE *out, size_t *line)
|
||||
if (strchr (symbol->tag, '.') || strchr (symbol->tag, '$'))
|
||||
continue;
|
||||
|
||||
fprintf (out, "# define %s\t%d\n",
|
||||
symbol->tag, number);
|
||||
++*line;
|
||||
fprintf (out, "%s [[[%s]], [%d]]",
|
||||
first ? "" : ",\n", symbol->tag, number);
|
||||
if (semantic_parser)
|
||||
{
|
||||
/* FIXME: This is probably wrong, and should be just as
|
||||
above. --akim. */
|
||||
fprintf (out, "# define T%s\t%d\n", symbol->tag, symbol->value);
|
||||
++*line;
|
||||
}
|
||||
/* FIXME: This is probably wrong, and should be just as
|
||||
above. --akim. */
|
||||
fprintf (out, "# define T%s\t%d\n", symbol->tag, symbol->number);
|
||||
first = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -653,9 +676,9 @@ save_column (int symbol, int default_state)
|
||||
static int
|
||||
default_goto (int symbol)
|
||||
{
|
||||
int i;
|
||||
int m = goto_map[symbol];
|
||||
int n = goto_map[symbol + 1];
|
||||
size_t i;
|
||||
size_t m = goto_map[symbol];
|
||||
size_t n = goto_map[symbol + 1];
|
||||
int default_state = -1;
|
||||
int max = 0;
|
||||
|
||||
@@ -702,7 +725,7 @@ goto_actions (void)
|
||||
yydefgoto[i - ntokens] = default_state;
|
||||
}
|
||||
|
||||
output_table_data (&format_obstack, yydefgoto,
|
||||
output_short_table (&format_obstack, yydefgoto,
|
||||
yydefgoto[0], 1, nsyms - ntokens);
|
||||
muscle_insert ("defgoto", obstack_finish (&format_obstack));
|
||||
|
||||
@@ -753,7 +776,7 @@ matching_state (int vector)
|
||||
int w;
|
||||
int prev;
|
||||
|
||||
if (i >= nstates)
|
||||
if (i >= (int) nstates)
|
||||
return -1;
|
||||
|
||||
t = tally[i];
|
||||
@@ -792,7 +815,7 @@ pack_vector (int vector)
|
||||
|
||||
assert (t);
|
||||
|
||||
for (j = lowzero - from[0]; j < MAXTABLE; j++)
|
||||
for (j = lowzero - from[0]; j < (int) table_size; j++)
|
||||
{
|
||||
int k;
|
||||
int ok = 1;
|
||||
@@ -800,8 +823,8 @@ pack_vector (int vector)
|
||||
for (k = 0; ok && k < t; k++)
|
||||
{
|
||||
loc = j + from[k];
|
||||
if (loc > MAXTABLE)
|
||||
fatal (_("maximum table size (%d) exceeded"), MAXTABLE);
|
||||
if (loc > (int) table_size)
|
||||
table_grow (loc);
|
||||
|
||||
if (table[loc] != 0)
|
||||
ok = 0;
|
||||
@@ -844,16 +867,16 @@ pack_table (void)
|
||||
|
||||
base = XCALLOC (short, nvectors);
|
||||
pos = XCALLOC (short, nentries);
|
||||
table = XCALLOC (short, MAXTABLE);
|
||||
check = XCALLOC (short, MAXTABLE);
|
||||
table = XCALLOC (short, table_size);
|
||||
check = XCALLOC (short, table_size);
|
||||
|
||||
lowzero = 0;
|
||||
high = 0;
|
||||
|
||||
for (i = 0; i < nvectors; i++)
|
||||
base[i] = MINSHORT;
|
||||
base[i] = SHRT_MIN;
|
||||
|
||||
for (i = 0; i < MAXTABLE; i++)
|
||||
for (i = 0; i < (int) table_size; i++)
|
||||
check[i] = -1;
|
||||
|
||||
for (i = 0; i < nentries; i++)
|
||||
@@ -887,12 +910,12 @@ static void
|
||||
output_base (void)
|
||||
{
|
||||
/* Output pact. */
|
||||
output_table_data (&format_obstack, base,
|
||||
output_short_table (&format_obstack, base,
|
||||
base[0], 1, nstates);
|
||||
muscle_insert ("pact", obstack_finish (&format_obstack));
|
||||
|
||||
/* Output pgoto. */
|
||||
output_table_data (&format_obstack, base,
|
||||
output_short_table (&format_obstack, base,
|
||||
base[nstates], nstates + 1, nvectors);
|
||||
muscle_insert ("pgoto", obstack_finish (&format_obstack));
|
||||
|
||||
@@ -903,7 +926,7 @@ output_base (void)
|
||||
static void
|
||||
output_table (void)
|
||||
{
|
||||
output_table_data (&format_obstack, table,
|
||||
output_short_table (&format_obstack, table,
|
||||
table[0], 1, high + 1);
|
||||
muscle_insert ("table", obstack_finish (&format_obstack));
|
||||
XFREE (table);
|
||||
@@ -913,19 +936,21 @@ output_table (void)
|
||||
static void
|
||||
output_check (void)
|
||||
{
|
||||
output_table_data (&format_obstack, check,
|
||||
output_short_table (&format_obstack, check,
|
||||
check[0], 1, high + 1);
|
||||
muscle_insert ("check", obstack_finish (&format_obstack));
|
||||
XFREE (check);
|
||||
}
|
||||
|
||||
/* compute and output yydefact, yydefgoto, yypact, yypgoto, yytable
|
||||
and yycheck. */
|
||||
/*-----------------------------------------------------------------.
|
||||
| Compute and output yydefact, yydefgoto, yypact, yypgoto, yytable |
|
||||
| and yycheck. |
|
||||
`-----------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
output_actions (void)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
nvectors = nstates + nvars;
|
||||
|
||||
froms = XCALLOC (short *, nvectors);
|
||||
@@ -934,8 +959,8 @@ output_actions (void)
|
||||
width = XCALLOC (short, nvectors);
|
||||
|
||||
token_actions ();
|
||||
XFREE (LA);
|
||||
XFREE (LAruleno);
|
||||
bitsetv_free (LA);
|
||||
free (LArule);
|
||||
|
||||
goto_actions ();
|
||||
XFREE (goto_map + ntokens);
|
||||
@@ -968,105 +993,121 @@ output_actions (void)
|
||||
static void
|
||||
output_skeleton (void)
|
||||
{
|
||||
/* Find the right skeleton file. */
|
||||
if (!skeleton)
|
||||
{
|
||||
if (semantic_parser)
|
||||
skeleton = skeleton_find ("BISON_HAIRY", BISON_HAIRY);
|
||||
else
|
||||
skeleton = skeleton_find ("BISON_SIMPLE", BISON_SIMPLE);
|
||||
}
|
||||
/* Store the definition of all the muscles. */
|
||||
const char *tempdir = getenv ("TMPDIR");
|
||||
char *tempfile = NULL;
|
||||
FILE *out = NULL;
|
||||
int fd;
|
||||
|
||||
/* Parse the skeleton file and output the needed parsers. */
|
||||
muscle_insert ("skeleton", skeleton);
|
||||
process_skeleton (skeleton);
|
||||
if (tempdir == NULL)
|
||||
tempdir = DEFAULT_TMPDIR;
|
||||
tempfile = xmalloc (strlen (tempdir) + 11);
|
||||
sprintf (tempfile, "%s/bsnXXXXXX", tempdir);
|
||||
fd = mkstemp (tempfile);
|
||||
if (fd == -1)
|
||||
error (EXIT_FAILURE, errno, "%s", tempfile);
|
||||
|
||||
out = fdopen (fd, "w");
|
||||
if (out == NULL)
|
||||
error (EXIT_FAILURE, errno, "%s", tempfile);
|
||||
|
||||
/* There are no comments, especially not `#': we do want M4 expansion
|
||||
after `#': think of CPP macros! */
|
||||
fputs ("m4_changecom()\n", out);
|
||||
fputs ("m4_init()\n", out);
|
||||
|
||||
fputs ("m4_define([b4_actions], \n[[", out);
|
||||
actions_output (out);
|
||||
fputs ("]])\n\n", out);
|
||||
|
||||
fputs ("m4_define([b4_guards], \n[[", out);
|
||||
guards_output (out);
|
||||
fputs ("]])\n\n", out);
|
||||
|
||||
fputs ("m4_define([b4_tokens], \n[", out);
|
||||
token_definitions_output (out);
|
||||
fputs ("])\n\n", out);
|
||||
|
||||
muscles_m4_output (out);
|
||||
|
||||
fputs ("m4_wrap([m4_divert_pop(0)])\n", out);
|
||||
fputs ("m4_divert_push(0)dnl\n", out);
|
||||
xfclose (out);
|
||||
|
||||
/* Invoke m4 on the definition of the muscles, and the skeleton. */
|
||||
{
|
||||
const char *bison_pkgdatadir = getenv ("BISON_PKGDATADIR");
|
||||
const char *m4 = getenv ("M4");
|
||||
if (!m4)
|
||||
m4 = M4;
|
||||
if (!bison_pkgdatadir)
|
||||
bison_pkgdatadir = PKGDATADIR;
|
||||
if (trace_flag)
|
||||
fprintf (stderr,
|
||||
"running: %s -I %s m4sugar/m4sugar.m4 %s %s\n",
|
||||
m4, bison_pkgdatadir, tempfile, skeleton);
|
||||
skel_in = readpipe (m4,
|
||||
"-I", bison_pkgdatadir,
|
||||
"m4sugar/m4sugar.m4",
|
||||
tempfile,
|
||||
skeleton,
|
||||
NULL);
|
||||
if (!skel_in)
|
||||
error (EXIT_FAILURE, errno, "cannot run m4");
|
||||
skel_lex ();
|
||||
|
||||
/* If `debugging', keep this file alive. */
|
||||
if (!trace_flag)
|
||||
unlink (tempfile);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
prepare (void)
|
||||
{
|
||||
MUSCLE_INSERT_INT ("last", high);
|
||||
MUSCLE_INSERT_INT ("flag", MINSHORT);
|
||||
MUSCLE_INSERT_INT ("flag", SHRT_MIN);
|
||||
MUSCLE_INSERT_INT ("pure", pure_parser);
|
||||
MUSCLE_INSERT_INT ("nsym", nsyms);
|
||||
MUSCLE_INSERT_INT ("debug", debug_flag);
|
||||
MUSCLE_INSERT_INT ("final", final_state);
|
||||
MUSCLE_INSERT_INT ("maxtok", max_user_token_number);
|
||||
MUSCLE_INSERT_INT ("error-verbose", error_verbose);
|
||||
MUSCLE_INSERT_INT ("undef_token_number", undeftoken->number);
|
||||
MUSCLE_INSERT_INT ("user_token_number_max", max_user_token_number);
|
||||
MUSCLE_INSERT_INT ("error_verbose", error_verbose);
|
||||
MUSCLE_INSERT_STRING ("prefix", spec_name_prefix ? spec_name_prefix : "yy");
|
||||
|
||||
/* FIXME: This is wrong: the muscles should decide whether they hold
|
||||
a copy or not, but the situation is too obscure currently. */
|
||||
MUSCLE_INSERT_STRING ("output-infix", output_infix ? output_infix : "");
|
||||
MUSCLE_INSERT_STRING ("output-prefix", short_base_name);
|
||||
MUSCLE_INSERT_STRING ("output_infix", output_infix ? output_infix : "");
|
||||
MUSCLE_INSERT_STRING ("output_prefix", short_base_name);
|
||||
MUSCLE_INSERT_STRING ("output_parser_name", parser_file_name);
|
||||
MUSCLE_INSERT_STRING ("output_header_name", spec_defines_file);
|
||||
|
||||
MUSCLE_INSERT_INT ("nnts", nvars);
|
||||
MUSCLE_INSERT_INT ("nrules", nrules);
|
||||
MUSCLE_INSERT_INT ("nstates", nstates);
|
||||
MUSCLE_INSERT_INT ("ntokens", ntokens);
|
||||
|
||||
MUSCLE_INSERT_INT ("locations-flag", locations_flag);
|
||||
}
|
||||
MUSCLE_INSERT_INT ("locations_flag", locations_flag);
|
||||
MUSCLE_INSERT_INT ("defines_flag", defines_flag);
|
||||
|
||||
/*-------------------------.
|
||||
| Output the header file. |
|
||||
`-------------------------*/
|
||||
/* Copy definitions in directive. */
|
||||
obstack_1grow (&pre_prologue_obstack, 0);
|
||||
obstack_1grow (&post_prologue_obstack, 0);
|
||||
muscle_insert ("pre_prologue", obstack_finish (&pre_prologue_obstack));
|
||||
muscle_insert ("post_prologue", obstack_finish (&post_prologue_obstack));
|
||||
|
||||
static void
|
||||
header_output (void)
|
||||
{
|
||||
size_t dummy_line;
|
||||
FILE *out = xfopen (spec_defines_file, "w");
|
||||
char *macro_name = compute_header_macro ();
|
||||
|
||||
fprintf (out, "#ifndef %s\n", macro_name);
|
||||
fprintf (out, "# define %s\n\n", macro_name);
|
||||
|
||||
token_definitions_output (out, &dummy_line);
|
||||
fprintf (out, "\
|
||||
#ifndef YYSTYPE\n\
|
||||
typedef %s
|
||||
yystype;\n\
|
||||
# define YYSTYPE yystype\n\
|
||||
#endif\n",
|
||||
muscle_find ("stype"));
|
||||
|
||||
if (!pure_parser)
|
||||
fprintf (out, "\nextern YYSTYPE %slval;\n",
|
||||
spec_name_prefix ? spec_name_prefix : "yy");
|
||||
|
||||
if (locations_flag)
|
||||
/* Find the right skeleton file. */
|
||||
if (!skeleton)
|
||||
{
|
||||
fputs ("\n\n", out);
|
||||
fprintf (out, "\
|
||||
#ifndef YYLTYPE\n\
|
||||
typedef struct yyltype\n\
|
||||
{\n\
|
||||
int first_line;\n\
|
||||
int first_column;\n\
|
||||
int last_line;\n\
|
||||
int last_column;\n\
|
||||
} yyltype;\n\
|
||||
# define YYLTYPE yyltype\n\
|
||||
#endif\n");
|
||||
if (!pure_parser)
|
||||
fprintf (out, "\nextern YYLTYPE %slloc;\n",
|
||||
spec_name_prefix ? spec_name_prefix : "yy");
|
||||
if (semantic_parser)
|
||||
skeleton = "bison.hairy";
|
||||
else
|
||||
skeleton = "bison.simple";
|
||||
}
|
||||
|
||||
if (semantic_parser)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
/* don't make these for dummy nonterminals made by gensym. */
|
||||
if (*symbols[i]->tag != '@')
|
||||
fprintf (out, "# define NT%s\t%d\n", symbols[i]->tag, i);
|
||||
}
|
||||
|
||||
fprintf (out, "\n#endif /* not %s */\n", macro_name);
|
||||
free (macro_name);
|
||||
xfclose (out);
|
||||
/* Parse the skeleton file and output the needed parsers. */
|
||||
muscle_insert ("skeleton", skeleton);
|
||||
}
|
||||
|
||||
|
||||
@@ -1079,30 +1120,19 @@ output (void)
|
||||
{
|
||||
obstack_init (&format_obstack);
|
||||
|
||||
output_token_translations ();
|
||||
output_gram ();
|
||||
|
||||
XFREE (ritem);
|
||||
if (semantic_parser)
|
||||
output_stos ();
|
||||
output_rule_data ();
|
||||
prepare_tokens ();
|
||||
prepare_rules ();
|
||||
prepare_states ();
|
||||
output_actions ();
|
||||
|
||||
prepare ();
|
||||
/* Copy definitions in directive. */
|
||||
obstack_1grow (&attrs_obstack, 0);
|
||||
muscle_insert ("prologue", obstack_finish (&attrs_obstack));
|
||||
|
||||
/* Process the selected skeleton file. */
|
||||
output_skeleton ();
|
||||
|
||||
/* Output the header if needed. */
|
||||
if (defines_flag)
|
||||
header_output ();
|
||||
|
||||
free (rules + 1);
|
||||
obstack_free (&muscle_obstack, NULL);
|
||||
obstack_free (&format_obstack, NULL);
|
||||
obstack_free (&action_obstack, NULL);
|
||||
obstack_free (&attrs_obstack, NULL);
|
||||
obstack_free (&pre_prologue_obstack, NULL);
|
||||
obstack_free (&post_prologue_obstack, NULL);
|
||||
}
|
||||
|
||||
+4
-6
@@ -1,5 +1,5 @@
|
||||
/* Output the generated parsing program for bison,
|
||||
Copyright 2000, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -26,11 +26,9 @@ extern int error_verbose;
|
||||
/* Output the parsing tables and the parser code to FTABLE. */
|
||||
void output PARAMS ((void));
|
||||
|
||||
size_t get_lines_number PARAMS ((const char *s));
|
||||
|
||||
void actions_output PARAMS ((FILE *out, size_t *line));
|
||||
void guards_output PARAMS ((FILE *out, size_t *line));
|
||||
void token_definitions_output PARAMS ((FILE *out, size_t *line));
|
||||
void actions_output PARAMS ((FILE *out));
|
||||
void guards_output PARAMS ((FILE *out));
|
||||
void token_definitions_output PARAMS ((FILE *out));
|
||||
|
||||
extern struct obstack muscle_obstack;
|
||||
|
||||
|
||||
@@ -1,231 +0,0 @@
|
||||
/* -*- C -*- */
|
||||
/* Parse Bison Skeletons.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
Bison 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.
|
||||
|
||||
Bison 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 Bison; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
%debug
|
||||
%defines
|
||||
%verbose
|
||||
%locations
|
||||
%name-prefix="skel_"
|
||||
%pure-parser
|
||||
|
||||
%{
|
||||
#include "system.h"
|
||||
#include "obstack.h"
|
||||
#include "quotearg.h"
|
||||
#include "files.h"
|
||||
#include "getargs.h"
|
||||
#include "output.h"
|
||||
#include "skeleton.h"
|
||||
#include "muscle_tab.h"
|
||||
|
||||
#define YYERROR_VERBOSE 1
|
||||
|
||||
/* Pass the control structure to YYPARSE but not YYLEX (yet?). */
|
||||
#define YYPARSE_PARAM skel_control
|
||||
/* YYPARSE receives SKEL_CONTROL as a void *. Provide a correctly
|
||||
typed access to it. */
|
||||
#define yycontrol ((skel_control_t *) skel_control)
|
||||
|
||||
FILE* parser = NULL;
|
||||
|
||||
size_t output_line;
|
||||
size_t skeleton_line;
|
||||
|
||||
static void merror PARAMS ((const char* error));
|
||||
|
||||
/* Request detailed parse error messages, and pass them to
|
||||
YLEVAL_ERROR. */
|
||||
#undef yyerror
|
||||
#define yyerror(Msg) \
|
||||
skel_error (yycontrol, &yylloc, Msg)
|
||||
|
||||
/* When debugging our pure parser, we want to see values and locations
|
||||
of the tokens. */
|
||||
#define YYPRINT(File, Type, Value) \
|
||||
yyprint (File, &yylloc, Type, &Value)
|
||||
static void yyprint (FILE *file, const yyltype *loc,
|
||||
int type, const yystype *value);
|
||||
%}
|
||||
|
||||
%union
|
||||
{
|
||||
char *string;
|
||||
char character;
|
||||
int boolean;
|
||||
}
|
||||
|
||||
/* Name of a muscle. */
|
||||
%token <string> MUSCLE
|
||||
/* A string dedicated to Bison (%%"foo"). */
|
||||
%token <string> STRING
|
||||
/* Raw data, to output directly. */
|
||||
%token <string> RAW
|
||||
/* Spaces. */
|
||||
%token <string> BLANKS
|
||||
/* Raw data, but char by char. */
|
||||
%token <character> CHARACTER
|
||||
|
||||
%token LINE
|
||||
%token SLINE
|
||||
|
||||
%token SECTION
|
||||
|
||||
%token GUARDS
|
||||
%token TOKENS
|
||||
%token ACTIONS
|
||||
|
||||
%type <string> string.1 string
|
||||
|
||||
%start input
|
||||
|
||||
%%
|
||||
input:
|
||||
{ LOCATION_RESET (yylloc) } skeleton
|
||||
;
|
||||
|
||||
skeleton : /* Empty. */ { }
|
||||
| section skeleton { }
|
||||
;
|
||||
|
||||
section : section.header section.body { }
|
||||
;
|
||||
|
||||
section.header : SECTION BLANKS string '\n'
|
||||
{
|
||||
char *name = $3;
|
||||
|
||||
/* Close the previous parser. */
|
||||
if (parser)
|
||||
parser = (xfclose (parser), NULL);
|
||||
|
||||
/* Prepare the next parser to be output. */
|
||||
parser = xfopen (name, "w");
|
||||
MUSCLE_INSERT_STRING ("parser-file-name", name);
|
||||
XFREE (name);
|
||||
|
||||
++skeleton_line;
|
||||
}
|
||||
;
|
||||
|
||||
/* Either a literal string, or a muscle value. */
|
||||
string.1:
|
||||
STRING { $$ = $1; }
|
||||
| MUSCLE { $$ = xstrdup (muscle_find ($1)); }
|
||||
;
|
||||
|
||||
/* Either a literal string, or a muscle value, or the concatenation of
|
||||
them. */
|
||||
string:
|
||||
string.1
|
||||
{ $$ = $1; }
|
||||
| string BLANKS string.1
|
||||
{ $$ = stringappend ($1, $3); free ($1); free ($3); }
|
||||
;
|
||||
|
||||
section.body
|
||||
: /* Empty. */ { }
|
||||
| section.body '\n' { fputc ('\n', parser); ++output_line; ++skeleton_line; }
|
||||
| section.body LINE { fprintf (parser, "%d", output_line); }
|
||||
| section.body SLINE { fprintf (parser, "%d", skeleton_line); }
|
||||
| section.body GUARDS { guards_output (parser, &output_line); }
|
||||
| section.body TOKENS { token_definitions_output (parser, &output_line); }
|
||||
| section.body ACTIONS { actions_output (parser, &output_line); }
|
||||
| section.body CHARACTER { fputc ($2, parser); }
|
||||
| section.body RAW { fputs ($2, parser); }
|
||||
| section.body BLANKS { fputs ($2, parser); }
|
||||
| section.body MUSCLE {
|
||||
const char* value = muscle_find ($2);
|
||||
if (value)
|
||||
{
|
||||
fputs (value, parser);
|
||||
output_line += get_lines_number (value);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (parser, "%%{%s}", $2);
|
||||
merror ($2);
|
||||
}
|
||||
}
|
||||
;
|
||||
%%
|
||||
/*------------------------------------------------------------------.
|
||||
| When debugging the parser, display tokens' locations and values. |
|
||||
`------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
yyprint (FILE *file,
|
||||
const yyltype *loc, int type, const yystype *value)
|
||||
{
|
||||
fputs (" (", file);
|
||||
LOCATION_PRINT (file, *loc);
|
||||
fputs (")", file);
|
||||
switch (type)
|
||||
{
|
||||
case MUSCLE:
|
||||
case STRING:
|
||||
case RAW:
|
||||
case BLANKS:
|
||||
fprintf (file, " = %s", quotearg_style (c_quoting_style,
|
||||
value->string));
|
||||
break;
|
||||
|
||||
case CHARACTER:
|
||||
fprintf (file, " = '%c'", value->character);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
merror (const char* error)
|
||||
{
|
||||
printf ("line %d: %%{%s} undeclared.\n", skeleton_line, error);
|
||||
}
|
||||
|
||||
void
|
||||
skel_error (skel_control_t *control,
|
||||
const yyltype *loc, const char *msg)
|
||||
{
|
||||
/* Neutralize GCC warnings for unused parameters. */
|
||||
skel_control_t *c = control;
|
||||
c++;
|
||||
LOCATION_PRINT (stderr, *loc);
|
||||
fprintf (stderr, "%s\n", msg);
|
||||
}
|
||||
|
||||
void
|
||||
process_skeleton (const char* skel)
|
||||
{
|
||||
/* Prepare a few things. */
|
||||
output_line = 1;
|
||||
skeleton_line = 1;
|
||||
|
||||
/* Output. */
|
||||
skel_in = fopen (skel, "r");
|
||||
/* FIXME: This is not acceptable for a release. */
|
||||
skel__flex_debug = getenv ("BISON_TRACE_SCAN") ? 1 : 0;
|
||||
skel_debug = getenv ("BISON_TRACE_PARSE") ? 1 : 0;
|
||||
skel_parse (NULL);
|
||||
|
||||
/* Close the last parser. */
|
||||
if (parser)
|
||||
parser = (xfclose (parser), NULL);
|
||||
}
|
||||
+104
-109
@@ -1,5 +1,6 @@
|
||||
/* Print information on generated parser, for bison,
|
||||
Copyright 1984, 1986, 1989, 2000, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -33,9 +34,10 @@
|
||||
#include "print.h"
|
||||
#include "reduce.h"
|
||||
#include "closure.h"
|
||||
#include "bitset.h"
|
||||
|
||||
static unsigned *shiftset = NULL;
|
||||
static unsigned *lookaheadset = NULL;
|
||||
static bitset shiftset;
|
||||
static bitset lookaheadset;
|
||||
|
||||
#if 0
|
||||
static void
|
||||
@@ -67,24 +69,24 @@ static void
|
||||
print_core (FILE *out, state_t *state)
|
||||
{
|
||||
int i;
|
||||
short *sitems = state->items;
|
||||
int snitems = state->nitems;
|
||||
item_number_t *sitems = state->items;
|
||||
int snritems = state->nitems;
|
||||
|
||||
/* New experimental feature: if TRACE_FLAGS output all the items of
|
||||
a state, not only its kernel. */
|
||||
if (trace_flag)
|
||||
{
|
||||
closure (sitems, snitems);
|
||||
closure (sitems, snritems);
|
||||
sitems = itemset;
|
||||
snitems = nitemset;
|
||||
snritems = nritemset;
|
||||
}
|
||||
|
||||
if (snitems)
|
||||
if (snritems)
|
||||
{
|
||||
for (i = 0; i < snitems; i++)
|
||||
for (i = 0; i < snritems; i++)
|
||||
{
|
||||
short *sp;
|
||||
short *sp1;
|
||||
item_number_t *sp;
|
||||
item_number_t *sp1;
|
||||
int rule;
|
||||
|
||||
sp1 = sp = ritem + sitems[i];
|
||||
@@ -93,9 +95,9 @@ print_core (FILE *out, state_t *state)
|
||||
sp++;
|
||||
|
||||
rule = -(*sp);
|
||||
fprintf (out, " %s -> ", escape (symbols[rules[rule].lhs]->tag));
|
||||
fprintf (out, " %s -> ", escape (rules[rule].lhs->tag));
|
||||
|
||||
for (sp = ritem + rules[rule].rhs; sp < sp1; sp++)
|
||||
for (sp = rules[rule].rhs; sp < sp1; sp++)
|
||||
fprintf (out, "%s ", escape (symbols[*sp]->tag));
|
||||
|
||||
fputc ('.', out);
|
||||
@@ -122,7 +124,7 @@ print_shifts (FILE *out, state_t *state)
|
||||
if (!SHIFT_IS_DISABLED (shiftp, i))
|
||||
{
|
||||
int state1 = shiftp->shifts[i];
|
||||
int symbol = states[state1]->accessing_symbol;
|
||||
token_number_t symbol = states[state1]->accessing_symbol;
|
||||
fprintf (out,
|
||||
_(" %-4s\tshift, and go to state %d\n"),
|
||||
escape (symbols[symbol]->tag), state1);
|
||||
@@ -164,7 +166,7 @@ print_gotos (FILE *out, state_t *state)
|
||||
if (!SHIFT_IS_DISABLED (shiftp, i))
|
||||
{
|
||||
int state1 = shiftp->shifts[i];
|
||||
int symbol = states[state1]->accessing_symbol;
|
||||
token_number_t symbol = states[state1]->accessing_symbol;
|
||||
fprintf (out, _(" %-4s\tgo to state %d\n"),
|
||||
escape (symbols[symbol]->tag), state1);
|
||||
}
|
||||
@@ -188,14 +190,13 @@ print_reductions (FILE *out, state_t *state)
|
||||
if (state->consistent)
|
||||
{
|
||||
int rule = redp->rules[0];
|
||||
int symbol = rules[rule].lhs;
|
||||
token_number_t symbol = rules[rule].lhs->number;
|
||||
fprintf (out, _(" $default\treduce using rule %d (%s)\n\n"),
|
||||
rule - 1, escape (symbols[symbol]->tag));
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < tokensetsize; i++)
|
||||
shiftset[i] = 0;
|
||||
bitset_zero (shiftset);
|
||||
|
||||
for (i = 0; i < shiftp->nshifts && SHIFT_IS_SHIFT (shiftp, i); i++)
|
||||
if (!SHIFT_IS_DISABLED (shiftp, i))
|
||||
@@ -204,113 +205,108 @@ print_reductions (FILE *out, state_t *state)
|
||||
default rule. */
|
||||
if (SHIFT_IS_ERROR (shiftp, i))
|
||||
nodefault = 1;
|
||||
SETBIT (shiftset, SHIFT_SYMBOL (shiftp, i));
|
||||
bitset_set (shiftset, SHIFT_SYMBOL (shiftp, i));
|
||||
}
|
||||
|
||||
for (i = 0; i < errp->nerrs; i++)
|
||||
if (errp->errs[i])
|
||||
SETBIT (shiftset, errp->errs[i]);
|
||||
bitset_set (shiftset, errp->errs[i]);
|
||||
|
||||
if (state->nlookaheads == 1 && !nodefault)
|
||||
{
|
||||
int k;
|
||||
int default_rule = LAruleno[state->lookaheadsp];
|
||||
rule_t *default_rule = LArule[state->lookaheadsp];
|
||||
|
||||
for (k = 0; k < tokensetsize; ++k)
|
||||
lookaheadset[k] = LA (state->lookaheadsp)[k] & shiftset[k];
|
||||
bitset_and (lookaheadset, LA[state->lookaheadsp], shiftset);
|
||||
|
||||
for (i = 0; i < ntokens; i++)
|
||||
if (BITISSET (lookaheadset, i))
|
||||
if (bitset_test (lookaheadset, i))
|
||||
fprintf (out, _(" %-4s\t[reduce using rule %d (%s)]\n"),
|
||||
escape (symbols[i]->tag), default_rule - 1,
|
||||
escape2 (symbols[rules[default_rule].lhs]->tag));
|
||||
escape (symbols[i]->tag),
|
||||
default_rule->number - 1,
|
||||
escape2 (default_rule->lhs->tag));
|
||||
|
||||
fprintf (out, _(" $default\treduce using rule %d (%s)\n\n"),
|
||||
default_rule - 1, escape (symbols[rules[default_rule].lhs]->tag));
|
||||
default_rule->number - 1,
|
||||
escape (default_rule->lhs->tag));
|
||||
}
|
||||
else if (state->nlookaheads >= 1)
|
||||
{
|
||||
int cmax = 0;
|
||||
int default_LA = -1;
|
||||
int default_rule = 0;
|
||||
rule_t *default_rule = NULL;
|
||||
|
||||
if (!nodefault)
|
||||
for (i = 0; i < state->nlookaheads; ++i)
|
||||
{
|
||||
int count = 0;
|
||||
int j, k;
|
||||
int j;
|
||||
|
||||
for (k = 0; k < tokensetsize; ++k)
|
||||
lookaheadset[k] = LA (state->lookaheadsp + i)[k] & ~shiftset[k];
|
||||
bitset_andn (lookaheadset, LA[state->lookaheadsp + i], shiftset);
|
||||
|
||||
for (j = 0; j < ntokens; j++)
|
||||
if (BITISSET (lookaheadset, j))
|
||||
if (bitset_test (lookaheadset, j))
|
||||
count++;
|
||||
|
||||
if (count > cmax)
|
||||
{
|
||||
cmax = count;
|
||||
default_LA = state->lookaheadsp + i;
|
||||
default_rule = LAruleno[state->lookaheadsp + i];
|
||||
default_rule = LArule[state->lookaheadsp + i];
|
||||
}
|
||||
|
||||
for (k = 0; k < tokensetsize; ++k)
|
||||
shiftset[k] |= lookaheadset[k];
|
||||
bitset_or (shiftset, shiftset, lookaheadset);
|
||||
}
|
||||
|
||||
for (i = 0; i < tokensetsize; i++)
|
||||
shiftset[i] = 0;
|
||||
bitset_zero (shiftset);
|
||||
|
||||
for (i = 0; i < shiftp->nshifts && SHIFT_IS_SHIFT (shiftp, i); i++)
|
||||
if (!SHIFT_IS_DISABLED (shiftp, i))
|
||||
SETBIT (shiftset, SHIFT_SYMBOL (shiftp, i));
|
||||
bitset_set (shiftset, SHIFT_SYMBOL (shiftp, i));
|
||||
|
||||
for (i = 0; i < ntokens; i++)
|
||||
{
|
||||
int j;
|
||||
int defaulted = 0;
|
||||
int count = BITISSET (shiftset, i);
|
||||
int count = bitset_test (shiftset, i);
|
||||
|
||||
for (j = 0; j < state->nlookaheads; ++j)
|
||||
{
|
||||
if (BITISSET (LA (state->lookaheadsp + j), i))
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
if (state->lookaheadsp + j != default_LA)
|
||||
fprintf (out,
|
||||
_(" %-4s\treduce using rule %d (%s)\n"),
|
||||
escape (symbols[i]->tag),
|
||||
LAruleno[state->lookaheadsp + j] - 1,
|
||||
escape2 (symbols[rules[LAruleno[state->lookaheadsp + j]].lhs]->tag));
|
||||
else
|
||||
defaulted = 1;
|
||||
|
||||
count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (defaulted)
|
||||
fprintf (out,
|
||||
_(" %-4s\treduce using rule %d (%s)\n"),
|
||||
escape (symbols[i]->tag),
|
||||
LAruleno[default_LA] - 1,
|
||||
escape2 (symbols[rules[LAruleno[default_LA]].lhs]->tag));
|
||||
defaulted = 0;
|
||||
if (bitset_test (LA[state->lookaheadsp + j], i))
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
if (state->lookaheadsp + j != default_LA)
|
||||
fprintf (out,
|
||||
_(" %-4s\t[reduce using rule %d (%s)]\n"),
|
||||
_(" %-4s\treduce using rule %d (%s)\n"),
|
||||
escape (symbols[i]->tag),
|
||||
LAruleno[state->lookaheadsp + j] - 1,
|
||||
escape2 (symbols[rules[LAruleno[state->lookaheadsp + j]].lhs]->tag));
|
||||
}
|
||||
}
|
||||
}
|
||||
LArule[state->lookaheadsp + j]->number - 1,
|
||||
escape2 (LArule[state->lookaheadsp + j]->lhs->tag));
|
||||
else
|
||||
defaulted = 1;
|
||||
|
||||
count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (defaulted)
|
||||
fprintf (out,
|
||||
_(" %-4s\treduce using rule %d (%s)\n"),
|
||||
escape (symbols[i]->tag),
|
||||
LArule[default_LA]->number - 1,
|
||||
escape2 (LArule[default_LA]->lhs->tag));
|
||||
defaulted = 0;
|
||||
fprintf (out,
|
||||
_(" %-4s\t[reduce using rule %d (%s)]\n"),
|
||||
escape (symbols[i]->tag),
|
||||
LArule[state->lookaheadsp + j]->number - 1,
|
||||
escape2 (LArule[state->lookaheadsp + j]->lhs->tag));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (default_LA >= 0)
|
||||
fprintf (out, _(" $default\treduce using rule %d (%s)\n"),
|
||||
default_rule - 1,
|
||||
escape (symbols[rules[default_rule].lhs]->tag));
|
||||
default_rule->number - 1,
|
||||
escape (default_rule->lhs->tag));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,35 +360,34 @@ do { \
|
||||
static void
|
||||
print_grammar (FILE *out)
|
||||
{
|
||||
int i, j;
|
||||
short *rule;
|
||||
token_number_t i;
|
||||
int j;
|
||||
item_number_t *rule;
|
||||
char buffer[90];
|
||||
int column = 0;
|
||||
|
||||
/* rule # : LHS -> RHS */
|
||||
fprintf (out, "%s\n\n", _("Grammar"));
|
||||
fprintf (out, " %s\n", _("Number, Line, Rule"));
|
||||
for (i = 1; i <= nrules; i++)
|
||||
/* Don't print rules disabled in reduce_grammar_tables. */
|
||||
if (rules[i].useful)
|
||||
{
|
||||
fprintf (out, _(" %3d %3d %s ->"),
|
||||
i - 1, rules[i].line, escape (symbols[rules[i].lhs]->tag));
|
||||
rule = &ritem[rules[i].rhs];
|
||||
if (*rule >= 0)
|
||||
while (*rule >= 0)
|
||||
fprintf (out, " %s", escape (symbols[*rule++]->tag));
|
||||
else
|
||||
fprintf (out, " /* %s */", _("empty"));
|
||||
fputc ('\n', out);
|
||||
}
|
||||
for (j = 1; j < nrules + 1; j++)
|
||||
{
|
||||
fprintf (out, _(" %3d %3d %s ->"),
|
||||
j - 1, rules[j].line, escape (rules[j].lhs->tag));
|
||||
rule = rules[j].rhs;
|
||||
if (*rule >= 0)
|
||||
while (*rule >= 0)
|
||||
fprintf (out, " %s", escape (symbols[*rule++]->tag));
|
||||
else
|
||||
fprintf (out, " /* %s */", _("empty"));
|
||||
fputc ('\n', out);
|
||||
}
|
||||
fputs ("\n\n", out);
|
||||
|
||||
|
||||
/* TERMINAL (type #) : rule #s terminal is on RHS */
|
||||
fprintf (out, "%s\n\n", _("Terminals, with rules where they appear"));
|
||||
for (i = 0; i <= max_user_token_number; i++)
|
||||
if (token_translations[i] != 2)
|
||||
for (i = 0; i < max_user_token_number + 1; i++)
|
||||
if (token_translations[i] != undeftoken->number)
|
||||
{
|
||||
buffer[0] = 0;
|
||||
column = strlen (escape (symbols[token_translations[i]]->tag));
|
||||
@@ -400,9 +395,9 @@ print_grammar (FILE *out)
|
||||
END_TEST (50);
|
||||
sprintf (buffer, " (%d)", i);
|
||||
|
||||
for (j = 1; j <= nrules; j++)
|
||||
for (rule = &ritem[rules[j].rhs]; *rule >= 0; rule++)
|
||||
if (*rule == token_translations[i])
|
||||
for (j = 1; j < nrules + 1; j++)
|
||||
for (rule = rules[j].rhs; *rule >= 0; rule++)
|
||||
if (item_number_as_token_number (*rule) == token_translations[i])
|
||||
{
|
||||
END_TEST (65);
|
||||
sprintf (buffer + strlen (buffer), " %d", j - 1);
|
||||
@@ -414,16 +409,16 @@ print_grammar (FILE *out)
|
||||
|
||||
|
||||
fprintf (out, "%s\n\n", _("Nonterminals, with rules where they appear"));
|
||||
for (i = ntokens; i <= nsyms - 1; i++)
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
{
|
||||
int left_count = 0, right_count = 0;
|
||||
|
||||
for (j = 1; j <= nrules; j++)
|
||||
for (j = 1; j < nrules + 1; j++)
|
||||
{
|
||||
if (rules[j].lhs == i)
|
||||
if (rules[j].lhs->number == i)
|
||||
left_count++;
|
||||
for (rule = &ritem[rules[j].rhs]; *rule >= 0; rule++)
|
||||
if (*rule == i)
|
||||
for (rule = rules[j].rhs; *rule >= 0; rule++)
|
||||
if (item_number_as_token_number (*rule) == i)
|
||||
{
|
||||
right_count++;
|
||||
break;
|
||||
@@ -441,10 +436,10 @@ print_grammar (FILE *out)
|
||||
END_TEST (50);
|
||||
sprintf (buffer + strlen (buffer), _(" on left:"));
|
||||
|
||||
for (j = 1; j <= nrules; j++)
|
||||
for (j = 1; j < nrules + 1; j++)
|
||||
{
|
||||
END_TEST (65);
|
||||
if (rules[j].lhs == i)
|
||||
if (rules[j].lhs->number == i)
|
||||
sprintf (buffer + strlen (buffer), " %d", j - 1);
|
||||
}
|
||||
}
|
||||
@@ -455,10 +450,10 @@ print_grammar (FILE *out)
|
||||
sprintf (buffer + strlen (buffer), ",");
|
||||
END_TEST (50);
|
||||
sprintf (buffer + strlen (buffer), _(" on right:"));
|
||||
for (j = 1; j <= nrules; j++)
|
||||
for (j = 1; j < nrules + 1; j++)
|
||||
{
|
||||
for (rule = &ritem[rules[j].rhs]; *rule >= 0; rule++)
|
||||
if (*rule == i)
|
||||
for (rule = rules[j].rhs; *rule >= 0; rule++)
|
||||
if (item_number_as_token_number (*rule) == i)
|
||||
{
|
||||
END_TEST (65);
|
||||
sprintf (buffer + strlen (buffer), " %d", j - 1);
|
||||
@@ -474,7 +469,7 @@ print_grammar (FILE *out)
|
||||
void
|
||||
print_results (void)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
/* We used to use just .out if SPEC_NAME_PREFIX (-p) was used, but
|
||||
that conflicts with Posix. */
|
||||
@@ -498,12 +493,12 @@ print_results (void)
|
||||
if (trace_flag)
|
||||
new_closure (nritems);
|
||||
/* Storage for print_reductions. */
|
||||
shiftset = XCALLOC (unsigned, tokensetsize);
|
||||
lookaheadset = XCALLOC (unsigned, tokensetsize);
|
||||
shiftset = bitset_create (ntokens, BITSET_FIXED);
|
||||
lookaheadset = bitset_create (ntokens, BITSET_FIXED);
|
||||
for (i = 0; i < nstates; i++)
|
||||
print_state (out, states[i]);
|
||||
free (shiftset);
|
||||
free (lookaheadset);
|
||||
bitset_free (shiftset);
|
||||
bitset_free (lookaheadset);
|
||||
if (trace_flag)
|
||||
free_closure ();
|
||||
|
||||
|
||||
+11
-11
@@ -50,22 +50,22 @@ static void
|
||||
print_core (state_t *state, struct obstack *node_obstack)
|
||||
{
|
||||
int i;
|
||||
short *sitems = state->items;
|
||||
int snitems = state->nitems;
|
||||
item_number_t *sitems = state->items;
|
||||
int snritems = state->nitems;
|
||||
|
||||
/* Output all the items of a state, not only its kernel. */
|
||||
if (trace_flag)
|
||||
{
|
||||
closure (sitems, snitems);
|
||||
closure (sitems, snritems);
|
||||
sitems = itemset;
|
||||
snitems = nitemset;
|
||||
snritems = nritemset;
|
||||
}
|
||||
|
||||
obstack_fgrow1 (node_obstack, "state %2d\n", state->number);
|
||||
for (i = 0; i < snitems; i++)
|
||||
for (i = 0; i < snritems; i++)
|
||||
{
|
||||
short *sp;
|
||||
short *sp1;
|
||||
item_number_t *sp;
|
||||
item_number_t *sp1;
|
||||
int rule;
|
||||
|
||||
sp1 = sp = ritem + sitems[i];
|
||||
@@ -78,9 +78,9 @@ print_core (state_t *state, struct obstack *node_obstack)
|
||||
if (i)
|
||||
obstack_1grow (node_obstack, '\n');
|
||||
obstack_fgrow1 (node_obstack, " %s -> ",
|
||||
escape (symbols[rules[rule].lhs]->tag));
|
||||
escape (rules[rule].lhs->tag));
|
||||
|
||||
for (sp = ritem + rules[rule].rhs; sp < sp1; sp++)
|
||||
for (sp = rules[rule].rhs; sp < sp1; sp++)
|
||||
obstack_fgrow1 (node_obstack, "%s ", escape (symbols[*sp]->tag));
|
||||
|
||||
obstack_1grow (node_obstack, '.');
|
||||
@@ -114,7 +114,7 @@ print_actions (state_t *state, const char *node_name)
|
||||
if (!SHIFT_IS_DISABLED (shiftp, i))
|
||||
{
|
||||
int state1 = shiftp->shifts[i];
|
||||
int symbol = states[state1]->accessing_symbol;
|
||||
token_number_t symbol = states[state1]->accessing_symbol;
|
||||
|
||||
new_edge (&edge);
|
||||
|
||||
@@ -172,7 +172,7 @@ print_state (state_t *state)
|
||||
void
|
||||
print_graph (void)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
/* Output file. */
|
||||
fgraph = xfopen (spec_graph_file, "w");
|
||||
|
||||
+347
-240
File diff suppressed because it is too large
Load Diff
+11
-2
@@ -1,5 +1,5 @@
|
||||
/* Input parser for bison
|
||||
Copyright 2000, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -21,15 +21,24 @@
|
||||
#ifndef READER_H_
|
||||
# define READER_H_
|
||||
|
||||
#include "symtab.h"
|
||||
|
||||
/* Read in the grammar specification and record it in the format
|
||||
described in gram.h. All guards are copied into the FGUARD file
|
||||
and all actions into FACTION, in each case forming the body of a C
|
||||
function (YYGUARD or YYACTION) which contains a switch statement to
|
||||
decide which guard or action to execute. */
|
||||
|
||||
extern void reader PARAMS ((void));
|
||||
void reader PARAMS ((void));
|
||||
|
||||
/* Free the packed grammar. */
|
||||
void grammar_free PARAMS ((void));
|
||||
|
||||
extern int lineno;
|
||||
|
||||
extern symbol_t *errtoken;
|
||||
extern symbol_t *undeftoken;
|
||||
extern symbol_t *eoftoken;
|
||||
extern symbol_t *axiom;
|
||||
|
||||
#endif /* !READER_H_ */
|
||||
|
||||
+133
-238
@@ -1,5 +1,5 @@
|
||||
/* Grammar reduction for Bison.
|
||||
Copyright 1988, 1989, 2000, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
user's parser. */
|
||||
|
||||
#include "system.h"
|
||||
#include "quotearg.h"
|
||||
#include "getargs.h"
|
||||
#include "files.h"
|
||||
#include "symtab.h"
|
||||
@@ -34,65 +35,26 @@
|
||||
#include "reduce.h"
|
||||
#include "reader.h"
|
||||
#include "getargs.h"
|
||||
|
||||
typedef unsigned *BSet;
|
||||
typedef short *rule;
|
||||
|
||||
#include "bitset.h"
|
||||
|
||||
/* Set of all nonterminals which are not useless. */
|
||||
static BSet N;
|
||||
static bitset N;
|
||||
|
||||
/* Set of all rules which have no useless nonterminals in their RHS. */
|
||||
static BSet P;
|
||||
static bitset P;
|
||||
|
||||
/* Set of all accessible symbols. */
|
||||
static BSet V;
|
||||
static bitset V;
|
||||
|
||||
/* Set of symbols used to define rule precedence (so they are
|
||||
`useless', but no warning should be issued). */
|
||||
static BSet V1;
|
||||
static bitset V1;
|
||||
|
||||
static int nuseful_productions;
|
||||
static int nuseless_productions;
|
||||
int nuseless_productions;
|
||||
static int nuseful_nonterminals;
|
||||
int nuseless_nonterminals;
|
||||
|
||||
static bool
|
||||
bits_equal (BSet L, BSet R, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = n - 1; i >= 0; i--)
|
||||
if (L[i] != R[i])
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
nbits (unsigned i)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
while (i != 0)
|
||||
{
|
||||
i ^= (i & ((unsigned) (-(int) i)));
|
||||
++count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
bits_size (BSet S, int n)
|
||||
{
|
||||
int i, count = 0;
|
||||
|
||||
for (i = n - 1; i >= 0; i--)
|
||||
count += nbits (S[i]);
|
||||
return count;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------.
|
||||
| Another way to do this would be with a set for each production and |
|
||||
| then do subset tests against N0, but even for the C grammar the |
|
||||
@@ -100,18 +62,17 @@ bits_size (BSet S, int n)
|
||||
`-------------------------------------------------------------------*/
|
||||
|
||||
static bool
|
||||
useful_production (int i, BSet N0)
|
||||
useful_production (int i, bitset N0)
|
||||
{
|
||||
rule r;
|
||||
item_number_t *r;
|
||||
short n;
|
||||
|
||||
/* A production is useful if all of the nonterminals in its appear
|
||||
in the set of useful nonterminals. */
|
||||
|
||||
for (r = &ritem[rules[i].rhs]; *r >= 0; r++)
|
||||
if (ISVAR (n = *r))
|
||||
if (!BITISSET (N0, n - ntokens))
|
||||
return FALSE;
|
||||
for (r = rules[i].rhs; *r >= 0; r++)
|
||||
if (ISVAR (n = *r) && !bitset_test (N0, n - ntokens))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -123,13 +84,14 @@ useful_production (int i, BSet N0)
|
||||
static void
|
||||
useless_nonterminals (void)
|
||||
{
|
||||
BSet Np, Ns;
|
||||
bitset Np, Ns;
|
||||
int i;
|
||||
|
||||
/* N is set as built. Np is set being built this iteration. P is
|
||||
set of all productions which have a RHS all in N. */
|
||||
|
||||
Np = XCALLOC (unsigned, WORDSIZE (nvars));
|
||||
Np = bitset_create (nvars, BITSET_FIXED);
|
||||
|
||||
|
||||
/* The set being computed is a set of nonterminals which can derive
|
||||
the empty string or strings consisting of all terminals. At each
|
||||
@@ -149,26 +111,21 @@ useless_nonterminals (void)
|
||||
|
||||
while (1)
|
||||
{
|
||||
for (i = WORDSIZE (nvars) - 1; i >= 0; i--)
|
||||
Np[i] = N[i];
|
||||
for (i = 1; i <= nrules; i++)
|
||||
{
|
||||
if (!BITISSET (P, i))
|
||||
{
|
||||
if (useful_production (i, N))
|
||||
{
|
||||
SETBIT (Np, rules[i].lhs - ntokens);
|
||||
SETBIT (P, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bits_equal (N, Np, WORDSIZE (nvars)))
|
||||
bitset_copy (Np, N);
|
||||
for (i = 1; i < nrules + 1; i++)
|
||||
if (!bitset_test (P, i)
|
||||
&& useful_production (i, N))
|
||||
{
|
||||
bitset_set (Np, rules[i].lhs->number - ntokens);
|
||||
bitset_set (P, i);
|
||||
}
|
||||
if (bitset_equal_p (N, Np))
|
||||
break;
|
||||
Ns = Np;
|
||||
Np = N;
|
||||
N = Ns;
|
||||
}
|
||||
XFREE (N);
|
||||
bitset_free (N);
|
||||
N = Np;
|
||||
}
|
||||
|
||||
@@ -176,10 +133,10 @@ useless_nonterminals (void)
|
||||
static void
|
||||
inaccessable_symbols (void)
|
||||
{
|
||||
BSet Vp, Vs, Pp;
|
||||
bitset Vp, Vs, Pp;
|
||||
int i;
|
||||
short t;
|
||||
rule r;
|
||||
item_number_t *r;
|
||||
|
||||
/* Find out which productions are reachable and which symbols are
|
||||
used. Starting with an empty set of productions and a set of
|
||||
@@ -204,31 +161,30 @@ inaccessable_symbols (void)
|
||||
terminals are printed (if running in verbose mode) so that the
|
||||
user can know. */
|
||||
|
||||
Vp = XCALLOC (unsigned, WORDSIZE (nsyms));
|
||||
Pp = XCALLOC (unsigned, WORDSIZE (nrules + 1));
|
||||
Vp = bitset_create (nsyms, BITSET_FIXED);
|
||||
Pp = bitset_create (nrules + 1, BITSET_FIXED);
|
||||
|
||||
/* If the start symbol isn't useful, then nothing will be useful. */
|
||||
if (BITISSET (N, start_symbol - ntokens))
|
||||
if (bitset_test (N, start_symbol - ntokens))
|
||||
{
|
||||
SETBIT (V, start_symbol);
|
||||
bitset_set (V, start_symbol);
|
||||
|
||||
while (1)
|
||||
{
|
||||
for (i = WORDSIZE (nsyms) - 1; i >= 0; i--)
|
||||
Vp[i] = V[i];
|
||||
for (i = 1; i <= nrules; i++)
|
||||
bitset_copy (Vp, V);
|
||||
for (i = 1; i < nrules + 1; i++)
|
||||
{
|
||||
if (!BITISSET (Pp, i)
|
||||
&& BITISSET (P, i)
|
||||
&& BITISSET (V, rules[i].lhs))
|
||||
if (!bitset_test (Pp, i)
|
||||
&& bitset_test (P, i)
|
||||
&& bitset_test (V, rules[i].lhs->number))
|
||||
{
|
||||
for (r = &ritem[rules[i].rhs]; *r >= 0; r++)
|
||||
if (ISTOKEN (t = *r) || BITISSET (N, t - ntokens))
|
||||
SETBIT (Vp, t);
|
||||
SETBIT (Pp, i);
|
||||
for (r = rules[i].rhs; *r >= 0; r++)
|
||||
if (ISTOKEN (t = *r) || bitset_test (N, t - ntokens))
|
||||
bitset_set (Vp, t);
|
||||
bitset_set (Pp, i);
|
||||
}
|
||||
}
|
||||
if (bits_equal (V, Vp, WORDSIZE (nsyms)))
|
||||
if (bitset_equal_p (V, Vp))
|
||||
break;
|
||||
Vs = Vp;
|
||||
Vp = V;
|
||||
@@ -236,96 +192,82 @@ inaccessable_symbols (void)
|
||||
}
|
||||
}
|
||||
|
||||
XFREE (V);
|
||||
bitset_free (V);
|
||||
V = Vp;
|
||||
|
||||
/* Tokens 0, 1, and 2 are internal to Bison. Consider them useful. */
|
||||
SETBIT (V, 0); /* end-of-input token */
|
||||
SETBIT (V, 1); /* error token */
|
||||
SETBIT (V, 2); /* some undefined token */
|
||||
bitset_set (V, eoftoken->number); /* end-of-input token */
|
||||
bitset_set (V, errtoken->number); /* error token */
|
||||
bitset_set (V, undeftoken->number); /* some undefined token */
|
||||
|
||||
XFREE (P);
|
||||
bitset_free (P);
|
||||
P = Pp;
|
||||
|
||||
nuseful_productions = bits_size (P, WORDSIZE (nrules + 1));
|
||||
nuseful_productions = bitset_count (P);
|
||||
nuseless_productions = nrules - nuseful_productions;
|
||||
|
||||
nuseful_nonterminals = 0;
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
if (BITISSET (V, i))
|
||||
if (bitset_test (V, i))
|
||||
nuseful_nonterminals++;
|
||||
nuseless_nonterminals = nvars - nuseful_nonterminals;
|
||||
|
||||
/* A token that was used in %prec should not be warned about. */
|
||||
for (i = 1; i < nrules; i++)
|
||||
for (i = 1; i < nrules + 1; i++)
|
||||
if (rules[i].precsym != 0)
|
||||
SETBIT (V1, rules[i].precsym);
|
||||
bitset_set (V1, rules[i].precsym->number);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------.
|
||||
| Put the useless productions at the end of RULES, and adjust NRULES |
|
||||
| accordingly. |
|
||||
`-------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
reduce_grammar_tables (void)
|
||||
{
|
||||
/* This is turned off because we would need to change the numbers in
|
||||
the case statements in the actions file.
|
||||
/* Flag useless productions. */
|
||||
{
|
||||
int pn;
|
||||
for (pn = 1; pn < nrules + 1; pn++)
|
||||
rules[pn].useful = bitset_test (P, pn);
|
||||
}
|
||||
|
||||
We don't disable it via CPP so that it is still checked with the
|
||||
rest of the code, to avoid its becoming completely obsolete.
|
||||
/* Map the nonterminals to their new index: useful first, useless
|
||||
afterwards. Kept for later report. */
|
||||
{
|
||||
int useful = 1;
|
||||
int useless = nrules + 1 - nuseless_productions;
|
||||
rule_t *rules_sorted = XMALLOC (rule_t, nrules + 1) - 1;
|
||||
int i;
|
||||
for (i = 1; i < nrules + 1; ++i)
|
||||
rules_sorted[rules[i].useful ? useful++ : useless++] = rules[i];
|
||||
free (rules + 1);
|
||||
rules = rules_sorted;
|
||||
|
||||
FIXME: I think the comment above demonstrates this code must be
|
||||
turned off for *semantic* parser, not in the general case. Try
|
||||
to understand this better --akim. */
|
||||
|
||||
if (0)
|
||||
/* remove useless productions */
|
||||
if (nuseless_productions > 0)
|
||||
/* Renumber the rules markers in RITEMS. */
|
||||
for (i = 1; i < nrules + 1; ++i)
|
||||
{
|
||||
short np, pn, ni, pi;
|
||||
|
||||
np = 0;
|
||||
ni = 0;
|
||||
for (pn = 1; pn <= nrules; pn++)
|
||||
if (BITISSET (P, pn))
|
||||
{
|
||||
np++;
|
||||
if (pn != np)
|
||||
{
|
||||
rules[np].lhs = rules[pn].lhs;
|
||||
rules[np].line = rules[pn].line;
|
||||
rules[np].prec = rules[pn].prec;
|
||||
rules[np].assoc = rules[pn].assoc;
|
||||
rules[np].rhs = rules[pn].rhs;
|
||||
if (rules[np].rhs != ni)
|
||||
{
|
||||
pi = rules[np].rhs;
|
||||
rules[np].rhs = ni;
|
||||
while (ritem[pi] >= 0)
|
||||
ritem[ni++] = ritem[pi++];
|
||||
ritem[ni++] = -np;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (ritem[ni++] >= 0)
|
||||
/* Nothing. */;
|
||||
}
|
||||
}
|
||||
|
||||
ritem[ni] = 0;
|
||||
nrules -= nuseless_productions;
|
||||
nitems = ni;
|
||||
nritems = ni;
|
||||
|
||||
/* Is it worth it to reduce the amount of memory for the
|
||||
grammar? Probably not. */
|
||||
item_number_t *rhsp = rules[i].rhs;
|
||||
for (/* Nothing. */; *rhsp >= 0; ++rhsp)
|
||||
/* Nothing. */;
|
||||
*rhsp = -i;
|
||||
rules[i].number = i;
|
||||
}
|
||||
nrules -= nuseless_productions;
|
||||
}
|
||||
|
||||
/* Disable useless productions. */
|
||||
if (nuseless_productions > 0)
|
||||
{
|
||||
int pn;
|
||||
for (pn = 1; pn <= nrules; pn++)
|
||||
rules[pn].useful = BITISSET (P, pn);
|
||||
}
|
||||
/* Adjust NRITEMS and NITEMS. */
|
||||
{
|
||||
int r;
|
||||
int length;
|
||||
for (r = nrules + 1; r < nrules + 1 + nuseless_productions; ++r)
|
||||
{
|
||||
length = rule_rhs_length (&rules[r]);
|
||||
nritems -= length + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -336,25 +278,27 @@ reduce_grammar_tables (void)
|
||||
static void
|
||||
nonterminals_reduce (void)
|
||||
{
|
||||
int i, n;
|
||||
token_number_t i, n;
|
||||
|
||||
/* Map the nonterminals to their new index: useful first, useless
|
||||
afterwards. Kept for later report. */
|
||||
|
||||
short *nontermmap = XCALLOC (short, nvars) - ntokens;
|
||||
token_number_t *nontermmap = XCALLOC (token_number_t, nvars) - ntokens;
|
||||
n = ntokens;
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
if (BITISSET (V, i))
|
||||
if (bitset_test (V, i))
|
||||
nontermmap[i] = n++;
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
if (!BITISSET (V, i))
|
||||
if (!bitset_test (V, i))
|
||||
nontermmap[i] = n++;
|
||||
|
||||
|
||||
/* Shuffle elements of tables indexed by symbol number. */
|
||||
{
|
||||
bucket **symbols_sorted = XMALLOC (bucket *, nvars) - ntokens;
|
||||
symbol_t **symbols_sorted = XMALLOC (symbol_t *, nvars) - ntokens;
|
||||
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
symbols[i]->number = nontermmap[i];
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
symbols_sorted[nontermmap[i]] = symbols[i];
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
@@ -362,19 +306,9 @@ nonterminals_reduce (void)
|
||||
free (symbols_sorted + ntokens);
|
||||
}
|
||||
|
||||
/* Replace all symbol numbers in valid data structures. */
|
||||
|
||||
for (i = 1; i <= nrules; i++)
|
||||
{
|
||||
rules[i].lhs = nontermmap[rules[i].lhs];
|
||||
if (ISVAR (rules[i].precsym))
|
||||
/* Can this happen? */
|
||||
rules[i].precsym = nontermmap[rules[i].precsym];
|
||||
}
|
||||
|
||||
for (i = 0; i < nritems; ++i)
|
||||
if (ISVAR (ritem[i]))
|
||||
ritem[i] = nontermmap[ritem[i]];
|
||||
ritem[i] = token_number_as_item_number (nontermmap[ritem[i]]);
|
||||
|
||||
start_symbol = nontermmap[start_symbol];
|
||||
|
||||
@@ -397,7 +331,8 @@ reduce_output (FILE *out)
|
||||
int i;
|
||||
fprintf (out, "%s\n\n", _("Useless nonterminals:"));
|
||||
for (i = 0; i < nuseless_nonterminals; ++i)
|
||||
fprintf (out, " %s\n", symbols[nsyms + i]->tag);
|
||||
fprintf (out, " %s\n", quotearg_style (escape_quoting_style,
|
||||
symbols[nsyms + i]->tag));
|
||||
fputs ("\n\n", out);
|
||||
}
|
||||
|
||||
@@ -405,12 +340,13 @@ reduce_output (FILE *out)
|
||||
bool b = FALSE;
|
||||
int i;
|
||||
for (i = 0; i < ntokens; i++)
|
||||
if (!BITISSET (V, i) && !BITISSET (V1, i))
|
||||
if (!bitset_test (V, i) && !bitset_test (V1, i))
|
||||
{
|
||||
if (!b)
|
||||
fprintf (out, "%s\n\n", _("Terminals which are not used:"));
|
||||
b = TRUE;
|
||||
fprintf (out, " %s\n", symbols[i]->tag);
|
||||
fprintf (out, " %s\n", quotearg_style (escape_quoting_style,
|
||||
symbols[i]->tag));
|
||||
}
|
||||
if (b)
|
||||
fputs ("\n\n", out);
|
||||
@@ -420,66 +356,22 @@ reduce_output (FILE *out)
|
||||
{
|
||||
int i;
|
||||
fprintf (out, "%s\n\n", _("Useless rules:"));
|
||||
for (i = 1; i <= nrules; i++)
|
||||
if (!rules[i].useful)
|
||||
{
|
||||
rule r;
|
||||
fprintf (out, "#%-4d ", i - 1);
|
||||
fprintf (out, "%s:", symbols[rules[i].lhs]->tag);
|
||||
for (r = &ritem[rules[i].rhs]; *r >= 0; r++)
|
||||
fprintf (out, " %s", symbols[*r]->tag);
|
||||
fputs (";\n", out);
|
||||
}
|
||||
for (i = nrules + 1; i < nuseless_productions + nrules + 1; i++)
|
||||
{
|
||||
item_number_t *r;
|
||||
fprintf (out, "#%-4d ", rules[i].user_number - 1);
|
||||
fprintf (out, "%s:", quotearg_style (escape_quoting_style,
|
||||
rules[i].lhs->tag));
|
||||
for (r = rules[i].rhs; *r >= 0; r++)
|
||||
fprintf (out, " %s", quotearg_style (escape_quoting_style,
|
||||
symbols[*r]->tag));
|
||||
fputs (";\n", out);
|
||||
}
|
||||
fputs ("\n\n", out);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dump_grammar (FILE *out)
|
||||
{
|
||||
int i;
|
||||
rule r;
|
||||
|
||||
fprintf (out, "REDUCED GRAMMAR\n\n");
|
||||
fprintf (out,
|
||||
"ntokens = %d, nvars = %d, nsyms = %d, nrules = %d, nitems = %d\n\n",
|
||||
ntokens, nvars, nsyms, nrules, nitems);
|
||||
fprintf (out, "Variables\n---------\n\n");
|
||||
fprintf (out, "Value Sprec Sassoc Tag\n");
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
fprintf (out, "%5d %5d %5d %s\n",
|
||||
i,
|
||||
symbols[i]->prec, symbols[i]->assoc, symbols[i]->tag);
|
||||
fprintf (out, "\n\n");
|
||||
fprintf (out, "Rules\n-----\n\n");
|
||||
fprintf (out, "Num (Prec, Assoc, Useful, Ritem Range) Lhs -> Rhs (Ritem range) [Num]\n");
|
||||
for (i = 1; i <= nrules; i++)
|
||||
{
|
||||
int rhs_count = 0;
|
||||
/* Find the last RHS index in ritems. */
|
||||
for (r = &ritem[rules[i].rhs]; *r >= 0; ++r)
|
||||
++rhs_count;
|
||||
fprintf (out, "%3d (%2d, %2d, %2d, %2d-%2d) %2d ->",
|
||||
i - 1,
|
||||
rules[i].prec, rules[i].assoc, rules[i].useful,
|
||||
rules[i].rhs, rules[i].rhs + rhs_count - 1,
|
||||
rules[i].lhs);
|
||||
/* Dumped the RHS. */
|
||||
for (r = &ritem[rules[i].rhs]; *r >= 0; r++)
|
||||
fprintf (out, "%3d", *r);
|
||||
fprintf (out, " [%d]\n", -(*r) - 1);
|
||||
}
|
||||
fprintf (out, "\n\n");
|
||||
fprintf (out, "Rules interpreted\n-----------------\n\n");
|
||||
for (i = 1; i <= nrules; i++)
|
||||
{
|
||||
fprintf (out, "%-5d %s :", i, symbols[rules[i].lhs]->tag);
|
||||
for (r = &ritem[rules[i].rhs]; *r >= 0; r++)
|
||||
fprintf (out, " %s", symbols[*r]->tag);
|
||||
fputc ('\n', out);
|
||||
}
|
||||
fprintf (out, "\n\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -523,32 +415,35 @@ reduce_grammar (void)
|
||||
|
||||
/* Allocate the global sets used to compute the reduced grammar */
|
||||
|
||||
N = XCALLOC (unsigned, WORDSIZE (nvars));
|
||||
P = XCALLOC (unsigned, WORDSIZE (nrules + 1));
|
||||
V = XCALLOC (unsigned, WORDSIZE (nsyms));
|
||||
V1 = XCALLOC (unsigned, WORDSIZE (nsyms));
|
||||
N = bitset_create (nvars, BITSET_FIXED);
|
||||
P = bitset_create (nrules + 1, BITSET_FIXED);
|
||||
V = bitset_create (nsyms, BITSET_FIXED);
|
||||
V1 = bitset_create (nsyms, BITSET_FIXED);
|
||||
|
||||
useless_nonterminals ();
|
||||
inaccessable_symbols ();
|
||||
|
||||
reduced = (bool) (nuseless_nonterminals + nuseless_productions > 0);
|
||||
|
||||
if (!reduced)
|
||||
return;
|
||||
|
||||
reduce_print ();
|
||||
|
||||
if (!BITISSET (N, start_symbol - ntokens))
|
||||
if (!bitset_test (N, start_symbol - ntokens))
|
||||
fatal (_("Start symbol %s does not derive any sentence"),
|
||||
symbols[start_symbol]->tag);
|
||||
quotearg_style (escape_quoting_style, symbols[start_symbol]->tag));
|
||||
|
||||
reduce_grammar_tables ();
|
||||
/* First reduce the nonterminals, as they renumber themselves in the
|
||||
whole grammar. If you change the order, nonterms would be
|
||||
renumbered only in the reduced grammar. */
|
||||
if (nuseless_nonterminals > 0)
|
||||
nonterminals_reduce ();
|
||||
if (nuseless_productions > 0)
|
||||
reduce_grammar_tables ();
|
||||
|
||||
if (trace_flag)
|
||||
{
|
||||
dump_grammar (stderr);
|
||||
grammar_dump (stderr, "Reduced Grammar");
|
||||
|
||||
fprintf (stderr, "reduced %s defines %d terminals, %d nonterminals\
|
||||
, and %d productions.\n",
|
||||
@@ -564,8 +459,8 @@ reduce_grammar (void)
|
||||
void
|
||||
reduce_free (void)
|
||||
{
|
||||
XFREE (N);
|
||||
XFREE (V);
|
||||
XFREE (V1);
|
||||
XFREE (P);
|
||||
bitset_free (N);
|
||||
bitset_free (V);
|
||||
bitset_free (V1);
|
||||
bitset_free (P);
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
/* Grammar reduction for Bison.
|
||||
Copyright 2000, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -26,4 +26,5 @@ void reduce_output PARAMS ((FILE *out));
|
||||
void reduce_free PARAMS ((void));
|
||||
|
||||
extern int nuseless_nonterminals;
|
||||
extern int nuseless_productions;
|
||||
#endif /* !REDUCE_H_ */
|
||||
|
||||
+22
-67
@@ -1,6 +1,5 @@
|
||||
/* -*- C -*- */
|
||||
/* Scan Bison Skeletons.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
/* Scan Bison Skeletons. -*- C -*-
|
||||
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -19,77 +18,33 @@
|
||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
%option debug nodefault noyywrap nounput
|
||||
%option nodefault noyywrap nounput
|
||||
%option prefix="skel_" outfile="lex.yy.c"
|
||||
|
||||
/* If we enable
|
||||
|
||||
%option yylineno
|
||||
|
||||
Then we have warning: `yy_flex_realloc' defined but not used.
|
||||
Seems like a Flex bug to me: Why the heck yylineno would trigger
|
||||
the REJECT exception??? */
|
||||
|
||||
%{
|
||||
#include "system.h"
|
||||
#include "skeleton.h"
|
||||
#include "parse-skel.h"
|
||||
%}
|
||||
|
||||
%{
|
||||
/* Each time we match a string, move the end cursor to its end. */
|
||||
#define YY_USER_ACTION yylloc->last_column += yyleng;
|
||||
#include "files.h"
|
||||
int skel_lex PARAMS ((void));
|
||||
static int yylineno = 1;
|
||||
static char *yyoutname = NULL;
|
||||
%}
|
||||
%%
|
||||
%{
|
||||
/* At each yylex invocation, mark the current position as the
|
||||
start of the next token. */
|
||||
LOCATION_STEP (*yylloc);
|
||||
%}
|
||||
/* This is an approximation, but we don't need more. */
|
||||
^"#output \""[^\"]+\"\n {
|
||||
yytext[yyleng - 2] = '\0';
|
||||
XFREE (yyoutname);
|
||||
yyoutname = xstrdup (yytext + strlen ("#output \""));
|
||||
yyout = xfopen (yyoutname, "w");
|
||||
yylineno = 1;
|
||||
}
|
||||
|
||||
"%%{line}" { return LINE; }
|
||||
"%%{skeleton-line}" { return SLINE; }
|
||||
"@<:@" fputc ('[', yyout);
|
||||
"@:>@" fputc (']', yyout);
|
||||
|
||||
"%%{section}" { return SECTION; }
|
||||
|
||||
"%%{guards}" { return GUARDS; }
|
||||
"%%{actions}" { return ACTIONS; }
|
||||
"%%{tokendef}" { return TOKENS; }
|
||||
|
||||
/* Muscle. */
|
||||
"%%{"[a-zA-Z][0-9a-zA-Z_-]+"}" {
|
||||
yylval->string = xstrndup (yytext + 3, yyleng - 4);
|
||||
return MUSCLE;
|
||||
}
|
||||
|
||||
/* String. */
|
||||
"%%\"".*"\"" {
|
||||
yylval->string = xstrndup (yytext + 3, yyleng - 4);
|
||||
return STRING;
|
||||
}
|
||||
|
||||
/* End of line. */
|
||||
"\n" {
|
||||
LOCATION_LINES (*yylloc, yyleng);
|
||||
return '\n';
|
||||
}
|
||||
|
||||
/* White spaces. */
|
||||
[\t ]+ {
|
||||
yylval->string = yytext;
|
||||
return BLANKS;
|
||||
}
|
||||
|
||||
/* Plain Characters. */
|
||||
[^%\n]+ {
|
||||
yylval->string = yytext;
|
||||
return RAW;
|
||||
}
|
||||
|
||||
/* Plain Character. */
|
||||
. {
|
||||
yylval->character = *yytext;
|
||||
return CHARACTER;
|
||||
}
|
||||
"__oline__" fprintf (yyout, "%d", yylineno);
|
||||
"__ofile__" fprintf (yyout, "%s", yyoutname);
|
||||
[^@_\n]+ ECHO;
|
||||
\n+ yylineno += yyleng; ECHO;
|
||||
. ECHO;
|
||||
|
||||
%%
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
/* Parse Bison Skeletons.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
Bison 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.
|
||||
|
||||
Bison 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 Bison; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifndef SKELETON_H_
|
||||
# define SKELETON_H_
|
||||
|
||||
# include "parse-skel.h"
|
||||
|
||||
/* Initialize LOC. */
|
||||
# define LOCATION_RESET(Loc) \
|
||||
(Loc).first_column = (Loc).first_line = 1; \
|
||||
(Loc).last_column = (Loc).last_line = 1;
|
||||
|
||||
/* Advance of NUM lines. */
|
||||
# define LOCATION_LINES(Loc, Num) \
|
||||
(Loc).last_column = 1; \
|
||||
(Loc).last_line += Num;
|
||||
|
||||
/* Restart: move the first cursor to the last position. */
|
||||
# define LOCATION_STEP(Loc) \
|
||||
(Loc).first_column = (Loc).last_column; \
|
||||
(Loc).first_line = (Loc).last_line;
|
||||
|
||||
/* Output LOC on the stream OUT. */
|
||||
# define LOCATION_PRINT(Out, Loc) \
|
||||
if ((Loc).first_line != (Loc).last_line) \
|
||||
fprintf (Out, "%d.%d-%d.%d", \
|
||||
(Loc).first_line, (Loc).first_column, \
|
||||
(Loc).last_line, (Loc).last_column - 1); \
|
||||
else if ((Loc).first_column < (Loc).last_column - 1) \
|
||||
fprintf (Out, "%d.%d-%d", (Loc).first_line, \
|
||||
(Loc).first_column, (Loc).last_column - 1); \
|
||||
else \
|
||||
fprintf (Out, "%d.%d", (Loc).first_line, (Loc).first_column)
|
||||
|
||||
|
||||
/* Pure parsers need to pass arguments to yyparse. */
|
||||
typedef struct skel_control_s
|
||||
{
|
||||
/* For the time being, nothing. */
|
||||
} skel_control_t;
|
||||
|
||||
/* From parse-skel.y. */
|
||||
extern int skel_debug;
|
||||
void skel_error PARAMS ((skel_control_t *control,
|
||||
const yyltype *loc, const char *msg));
|
||||
void process_skeleton PARAMS ((const char* skel));
|
||||
|
||||
/* From scan-skel.l. */
|
||||
extern int skel__flex_debug;
|
||||
|
||||
/* Renamed yyin. */
|
||||
extern FILE* skel_in;
|
||||
|
||||
# define YY_DECL \
|
||||
int skel_lex PARAMS ((yystype *yylval, yyltype *yylloc))
|
||||
YY_DECL;
|
||||
|
||||
#endif SKELETON_H_
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
/* Type definitions for nondeterministic finite state machine for bison,
|
||||
Copyright 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
|
||||
#include "system.h"
|
||||
#include "gram.h"
|
||||
#include "state.h"
|
||||
|
||||
/*---------------------------------.
|
||||
|
||||
+6
-6
@@ -41,10 +41,10 @@
|
||||
the last thing accepted to reach that state. It is the
|
||||
accessing_symbol of the core.
|
||||
|
||||
Each core contains a vector of nitems items which are the indices
|
||||
Each core contains a vector of NITEMS items which are the indices
|
||||
in the ritems vector of the items that are selected in this state.
|
||||
|
||||
The link field is used for chaining buckets that hash states by
|
||||
The link field is used for chaining symbols that hash states by
|
||||
their itemsets. This is for recognizing equivalent states and
|
||||
combining them when the states are generated.
|
||||
|
||||
@@ -122,7 +122,7 @@ shifts *shifts_new PARAMS ((int n));
|
||||
/* Is the SHIFTS->shifts[Shift] then handling of the error token?. */
|
||||
|
||||
#define SHIFT_IS_ERROR(Shifts, Shift) \
|
||||
(SHIFT_SYMBOL (Shifts, Shift) == error_token_number)
|
||||
(SHIFT_SYMBOL (Shifts, Shift) == errtoken->number)
|
||||
|
||||
/* When resolving a SR conflicts, if the reduction wins, the shift is
|
||||
disabled. */
|
||||
@@ -171,7 +171,7 @@ typedef struct state_s
|
||||
struct state_s *link;
|
||||
|
||||
short number;
|
||||
short accessing_symbol;
|
||||
token_number_t accessing_symbol;
|
||||
shifts *shifts;
|
||||
reductions *reductions;
|
||||
errs *errs;
|
||||
@@ -186,11 +186,11 @@ typedef struct state_s
|
||||
|
||||
/* Its items. */
|
||||
short nitems;
|
||||
short items[1];
|
||||
item_number_t items[1];
|
||||
} state_t;
|
||||
|
||||
#define STATE_ALLOC(Nitems) \
|
||||
(state_t *) xcalloc ((unsigned) (sizeof (state_t) \
|
||||
+ (Nitems - 1) * sizeof (short)), 1)
|
||||
+ (Nitems - 1) * sizeof (item_number_t)), 1)
|
||||
|
||||
#endif /* !STATE_H_ */
|
||||
|
||||
+90
-89
@@ -1,5 +1,5 @@
|
||||
/* Symbol table manager for Bison,
|
||||
Copyright 1984, 1989, 2000, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -20,42 +20,22 @@
|
||||
|
||||
|
||||
#include "system.h"
|
||||
#include "hash.h"
|
||||
#include "symtab.h"
|
||||
#include "gram.h"
|
||||
|
||||
/*---------------------------------.
|
||||
| Create a new symbol, named TAG. |
|
||||
`---------------------------------*/
|
||||
|
||||
bucket *firstsymbol;
|
||||
static bucket *lastsymbol;
|
||||
static bucket **symtab;
|
||||
|
||||
static int
|
||||
hash (const char *key)
|
||||
static symbol_t *
|
||||
symbol_new (const char *tag)
|
||||
{
|
||||
const char *cp;
|
||||
int k;
|
||||
symbol_t *res = XMALLOC (symbol_t, 1);
|
||||
|
||||
cp = key;
|
||||
k = 0;
|
||||
while (*cp)
|
||||
k = ((k << 1) ^ (*cp++)) & 0x3fff;
|
||||
|
||||
return k % TABSIZE;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------.
|
||||
| Create a new symbol, named TAG, which hash value is HASHVAL. |
|
||||
`--------------------------------------------------------------*/
|
||||
|
||||
static bucket *
|
||||
bucket_new (const char *tag, int hashval)
|
||||
{
|
||||
bucket *res = XMALLOC (bucket, 1);
|
||||
|
||||
res->link = symtab[hashval];
|
||||
res->next = NULL;
|
||||
res->tag = xstrdup (tag);
|
||||
res->type_name = NULL;
|
||||
res->value = -1;
|
||||
res->number = NUMBER_UNDEFINED;
|
||||
res->prec = 0;
|
||||
res->assoc = right_assoc;
|
||||
res->user_token_number = SUNDEF;
|
||||
@@ -68,13 +48,58 @@ bucket_new (const char *tag, int hashval)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
tabinit (void)
|
||||
{
|
||||
symtab = XCALLOC (bucket *, TABSIZE);
|
||||
/*------------.
|
||||
| Free THIS. |
|
||||
`------------*/
|
||||
|
||||
firstsymbol = NULL;
|
||||
lastsymbol = NULL;
|
||||
static void
|
||||
symbol_free (symbol_t *this)
|
||||
{
|
||||
#if 0
|
||||
/* This causes crashes because one string can appear more
|
||||
than once. */
|
||||
XFREE (this->type_name);
|
||||
#endif
|
||||
XFREE (this->tag);
|
||||
XFREE (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*----------------------.
|
||||
| A symbol_t hash table. |
|
||||
`----------------------*/
|
||||
|
||||
/* Initial capacity of symbols hash table. */
|
||||
#define HT_INITIAL_CAPACITY 257
|
||||
|
||||
static struct hash_table *symbol_table = NULL;
|
||||
|
||||
static bool
|
||||
hash_compare_symbol_t (const symbol_t *m1, const symbol_t *m2)
|
||||
{
|
||||
return strcmp (m1->tag, m2->tag) ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
hash_symbol_t (const symbol_t *m, unsigned int tablesize)
|
||||
{
|
||||
return hash_string (m->tag, tablesize);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------.
|
||||
| Create the symbol_t hash table. |
|
||||
`-------------------------------*/
|
||||
|
||||
void
|
||||
symbols_new (void)
|
||||
{
|
||||
symbol_table = hash_initialize (HT_INITIAL_CAPACITY,
|
||||
NULL,
|
||||
(Hash_hasher) hash_symbol_t,
|
||||
(Hash_comparator) hash_compare_symbol_t,
|
||||
(Hash_data_freer) symbol_free);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,69 +108,45 @@ tabinit (void)
|
||||
| yet, create it. |
|
||||
`----------------------------------------------------------------*/
|
||||
|
||||
bucket *
|
||||
symbol_t *
|
||||
getsym (const char *key)
|
||||
{
|
||||
int hashval;
|
||||
bucket *bp;
|
||||
int found;
|
||||
symbol_t probe;
|
||||
symbol_t *entry;
|
||||
|
||||
hashval = hash (key);
|
||||
bp = symtab[hashval];
|
||||
(const char *) probe.tag = key;
|
||||
entry = hash_lookup (symbol_table, &probe);
|
||||
|
||||
found = 0;
|
||||
while (bp != NULL && found == 0)
|
||||
if (!entry)
|
||||
{
|
||||
if (strcmp (key, bp->tag) == 0)
|
||||
found = 1;
|
||||
else
|
||||
bp = bp->link;
|
||||
/* First insertion in the hash. */
|
||||
entry = symbol_new (key);
|
||||
hash_insert (symbol_table, entry);
|
||||
}
|
||||
|
||||
if (found == 0)
|
||||
{
|
||||
bp = bucket_new (key, hashval);
|
||||
|
||||
if (firstsymbol == NULL)
|
||||
{
|
||||
firstsymbol = bp;
|
||||
lastsymbol = bp;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastsymbol->next = bp;
|
||||
lastsymbol = bp;
|
||||
}
|
||||
|
||||
symtab[hashval] = bp;
|
||||
}
|
||||
|
||||
return bp;
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------.
|
||||
| Free the symbols. |
|
||||
`-------------------*/
|
||||
|
||||
void
|
||||
free_symtab (void)
|
||||
symbols_free (void)
|
||||
{
|
||||
int i;
|
||||
bucket *bp, *bptmp; /* JF don't use ptr after free */
|
||||
|
||||
for (i = 0; i < TABSIZE; i++)
|
||||
{
|
||||
bp = symtab[i];
|
||||
while (bp)
|
||||
{
|
||||
bptmp = bp->link;
|
||||
#if 0
|
||||
/* This causes crashes because one string can appear more
|
||||
than once. */
|
||||
if (bp->type_name)
|
||||
XFREE (bp->type_name);
|
||||
#endif
|
||||
XFREE (bp->tag);
|
||||
XFREE (bp);
|
||||
bp = bptmp;
|
||||
}
|
||||
}
|
||||
XFREE (symtab);
|
||||
hash_free (symbol_table);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------.
|
||||
| Look for undefined symbols, report an error, and consider them |
|
||||
| terminals. |
|
||||
`---------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
symbols_do (symbol_processor processor, void *processor_data)
|
||||
{
|
||||
hash_do_for_each (symbol_table,
|
||||
(Hash_processor) processor,
|
||||
processor_data);
|
||||
}
|
||||
|
||||
+29
-16
@@ -1,5 +1,6 @@
|
||||
/* Definitions for symtab.c and callers, part of bison,
|
||||
Copyright 1984, 1989, 1992, 2000, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1989, 1992, 2000, 2001, 2002
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -20,12 +21,19 @@
|
||||
|
||||
#ifndef SYMTAB_H_
|
||||
# define SYMTAB_H_
|
||||
# include "gram.h"
|
||||
|
||||
#define TABSIZE 1009
|
||||
|
||||
/* symbol classes */
|
||||
/* Associativity values for tokens and rules. */
|
||||
typedef enum
|
||||
{
|
||||
right_assoc,
|
||||
left_assoc,
|
||||
non_assoc
|
||||
} associativity;
|
||||
|
||||
|
||||
/* Symbol classes. */
|
||||
typedef enum
|
||||
{
|
||||
unknown_sym,
|
||||
@@ -33,37 +41,42 @@ typedef enum
|
||||
nterm_sym /* non-terminal */
|
||||
} symbol_class;
|
||||
|
||||
/* Internal token numbers. */
|
||||
typedef short token_number_t;
|
||||
|
||||
#define SUNDEF -1 /* For undefined user number. */
|
||||
#define SALIAS -9991 /* for symbol generated with an alias */
|
||||
|
||||
typedef struct bucket
|
||||
{
|
||||
/* Needed for the hash table. */
|
||||
struct bucket *link;
|
||||
struct bucket *next;
|
||||
#define NUMBER_UNDEFINED ((token_number_t) -1)
|
||||
|
||||
struct symbol_s
|
||||
{
|
||||
/* The key, name of the symbol. */
|
||||
char *tag;
|
||||
/* Its type. */
|
||||
char *type_name;
|
||||
short value;
|
||||
|
||||
token_number_t number;
|
||||
short prec;
|
||||
associativity assoc;
|
||||
short user_token_number;
|
||||
int user_token_number;
|
||||
|
||||
/* Points to the other in the identifier-symbol pair for an
|
||||
alias. Special value SALIAS in the identifier half of the
|
||||
identifier-symbol pair for an alias. */
|
||||
struct bucket *alias;
|
||||
struct symbol_s *alias;
|
||||
symbol_class class;
|
||||
} bucket;
|
||||
};
|
||||
|
||||
typedef struct symbol_s symbol_t;
|
||||
|
||||
extern bucket *firstsymbol;
|
||||
/* A function to apply to each symbol. */
|
||||
typedef bool (*symbol_processor) PARAMS ((symbol_t *));
|
||||
|
||||
bucket *getsym PARAMS ((const char *));
|
||||
symbol_t *getsym PARAMS ((const char *));
|
||||
|
||||
void tabinit PARAMS ((void));
|
||||
void free_symtab PARAMS ((void));
|
||||
void symbols_new PARAMS ((void));
|
||||
void symbols_do PARAMS ((symbol_processor processor, void *processor_data));
|
||||
void symbols_free PARAMS ((void));
|
||||
|
||||
#endif /* !SYMTAB_H_ */
|
||||
|
||||
+25
-55
@@ -1,5 +1,5 @@
|
||||
/* system-dependent definitions for Bison.
|
||||
Copyright 2000, 2001 Free Software Foundation, Inc.
|
||||
Copyright 2000, 2001, 2002 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
|
||||
@@ -89,6 +89,16 @@ char *alloca ();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
# include <limits.h>
|
||||
#endif
|
||||
#ifndef SHRT_MIN
|
||||
# define SHRT_MIN (-32768)
|
||||
#endif
|
||||
#ifndef SHRT_MAX
|
||||
# define SHRT_MAX 32767
|
||||
#endif
|
||||
|
||||
# include "xalloc.h"
|
||||
|
||||
/* From xstrndup.c. */
|
||||
@@ -106,10 +116,6 @@ char *stpcpy PARAMS ((char *dest, const char *src));
|
||||
char *strchr(const char *s, int c);
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_STRNDUP
|
||||
char *strndup PARAMS ((const char *s, size_t size));
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_STRSPN
|
||||
size_t strspn(const char *s, const char *accept);
|
||||
#endif
|
||||
@@ -158,7 +164,7 @@ void *memrchr PARAMS ((const void *s, int c, size_t n));
|
||||
# define setlocale(Category, Locale)
|
||||
#endif
|
||||
|
||||
#include "libgettext.h"
|
||||
#include "gettext.h"
|
||||
#define _(Msgid) gettext (Msgid)
|
||||
#define N_(Msgid) (Msgid)
|
||||
|
||||
@@ -223,33 +229,10 @@ do { \
|
||||
} while (0)
|
||||
|
||||
|
||||
/*---------------------------------.
|
||||
| Machine-dependencies for Bison. |
|
||||
`---------------------------------*/
|
||||
|
||||
#ifdef eta10
|
||||
# define MAXSHORT 2147483647
|
||||
# define MINSHORT -2147483648
|
||||
#else
|
||||
# define MAXSHORT 32767
|
||||
# define MINSHORT -32768
|
||||
#endif
|
||||
|
||||
#if defined (MSDOS) && !defined (__GO32__)
|
||||
# define BITS_PER_WORD 16
|
||||
# define MAXTABLE 16383
|
||||
#else
|
||||
# define BITS_PER_WORD 32
|
||||
# define MAXTABLE 32767
|
||||
#endif
|
||||
|
||||
#define WORDSIZE(n) (((n) + BITS_PER_WORD - 1) / BITS_PER_WORD)
|
||||
#define SETBIT(x, i) ((x)[(i)/BITS_PER_WORD] |= (1<<((i) % BITS_PER_WORD)))
|
||||
#define RESETBIT(x, i) ((x)[(i)/BITS_PER_WORD] &= ~(1<<((i) % BITS_PER_WORD)))
|
||||
#define BITISSET(x, i) (((x)[(i)/BITS_PER_WORD] & (1<<((i) % BITS_PER_WORD))) != 0)
|
||||
|
||||
|
||||
/* Extensions to use for the output files. */
|
||||
/*-----------------------------------------.
|
||||
| Extensions to use for the output files. |
|
||||
`-----------------------------------------*/
|
||||
|
||||
#ifdef VMS
|
||||
/* VMS. */
|
||||
@@ -273,30 +256,16 @@ do { \
|
||||
# endif /* ! MSDOS */
|
||||
#endif /* ! VMS */
|
||||
|
||||
#if defined (VMS) & !defined (__VMS_POSIX)
|
||||
# ifndef BISON_SIMPLE
|
||||
# define BISON_SIMPLE "GNU_BISON:[000000]BISON.SIMPLE"
|
||||
# endif
|
||||
# ifndef BISON_HAIRY
|
||||
# define BISON_HARIRY "GNU_BISON:[000000]BISON.HAIRY"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (_MSC_VER)
|
||||
# ifndef BISON_SIMPLE
|
||||
# define BISON_SIMPLE "c:/usr/local/lib/bison.simple"
|
||||
# endif
|
||||
# ifndef BISON_HAIRY
|
||||
# define BISON_HAIRY "c:/usr/local/lib/bison.hairy"
|
||||
# endif
|
||||
#ifndef DEFAULT_TMPDIR
|
||||
# define DEFAULT_TMPDIR "/tmp"
|
||||
#endif
|
||||
|
||||
|
||||
/* As memcpy, but for shorts. */
|
||||
#define shortcpy(Dest, Src, Num) \
|
||||
memcpy (Dest, Src, Num * sizeof (short))
|
||||
|
||||
/* Free a linked list. */
|
||||
/*---------------------.
|
||||
| Free a linked list. |
|
||||
`---------------------*/
|
||||
|
||||
#define LIST_FREE(Type, List) \
|
||||
do { \
|
||||
Type *_node, *_next; \
|
||||
@@ -307,9 +276,10 @@ do { \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/*---------------------------------.
|
||||
| Debugging the memory allocator. |
|
||||
`---------------------------------*/
|
||||
|
||||
/*---------------------------------------------.
|
||||
| Debugging memory allocation (must be last). |
|
||||
`---------------------------------------------*/
|
||||
|
||||
# if WITH_DMALLOC
|
||||
# define DMALLOC_FUNC_CHECK
|
||||
|
||||
-116
@@ -1,116 +0,0 @@
|
||||
/* Generate transitive closure of a matrix,
|
||||
Copyright 1984, 1989, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
Bison 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.
|
||||
|
||||
Bison 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 Bison; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
#include "system.h"
|
||||
#include "getargs.h"
|
||||
#include "warshall.h"
|
||||
|
||||
/*-------------------------------------------------------------.
|
||||
| Given n by n matrix of bits R, modify its contents to be the |
|
||||
| transive closure of what was given. |
|
||||
`-------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
bitmatrix_print (const char *title, unsigned *matrix, size_t size)
|
||||
{
|
||||
size_t i, j;
|
||||
size_t rowsize = WORDSIZE (size) * sizeof (unsigned);
|
||||
#define ROW(Num) ((unsigned *) ((char *) matrix + ((Num) * rowsize)))
|
||||
|
||||
/* Title. */
|
||||
fprintf (stderr, "%s BEGIN\n", title);
|
||||
|
||||
/* Column numbers. */
|
||||
fputs (" ", stderr);
|
||||
for (i = 0; i < size; ++i)
|
||||
putc (i / 10 ? '0' + i / 10 : ' ', stderr);
|
||||
putc ('\n', stderr);
|
||||
fputs (" ", stderr);
|
||||
for (i = 0; i < size; ++i)
|
||||
fprintf (stderr, "%d", i % 10);
|
||||
putc ('\n', stderr);
|
||||
|
||||
/* Bar. */
|
||||
fputs (" .", stderr);
|
||||
for (i = 0; i < size; ++i)
|
||||
putc ('-', stderr);
|
||||
fputs (".\n", stderr);
|
||||
|
||||
/* Contents. */
|
||||
for (i = 0; i < size; ++i)
|
||||
{
|
||||
fprintf (stderr, "%2d|", i);
|
||||
for (j = 0; j < size; ++j)
|
||||
fputs (BITISSET (ROW (i), j) ? "1" : " ", stderr);
|
||||
fputs ("|\n", stderr);
|
||||
}
|
||||
|
||||
/* Bar. */
|
||||
fputs (" `", stderr);
|
||||
for (i = 0; i < size; ++i)
|
||||
putc ('-', stderr);
|
||||
fputs ("'\n", stderr);
|
||||
|
||||
/* End title. */
|
||||
fprintf (stderr, "%s END\n\n", title);
|
||||
}
|
||||
|
||||
#define R(Num) (unsigned *) ((char *) R + ((Num) * rowsize))
|
||||
|
||||
static void
|
||||
TC (unsigned *R, int n)
|
||||
{
|
||||
int rowsize = WORDSIZE (n) * sizeof (unsigned);
|
||||
int i, j, k;
|
||||
|
||||
if (trace_flag)
|
||||
bitmatrix_print ("TC: Input", R, n);
|
||||
|
||||
/* R (J, I) && R (I, K) => R (J, K).
|
||||
I *must* be the outter loop. */
|
||||
|
||||
for (i = 0; i < n; ++i)
|
||||
for (j = 0; j < n; ++j)
|
||||
if (BITISSET (R (j), i))
|
||||
for (k = 0; k < n; ++k)
|
||||
if (BITISSET (R (i), k))
|
||||
SETBIT (R (j), k);
|
||||
|
||||
if (trace_flag)
|
||||
bitmatrix_print ("TC: Output", R, n);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------.
|
||||
| Reflexive Transitive Closure. Same as TC and then set all the |
|
||||
| bits on the diagonal of R. |
|
||||
`---------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
RTC (unsigned *R, int n)
|
||||
{
|
||||
int rowsize = WORDSIZE (n) * sizeof (unsigned);
|
||||
int i;
|
||||
|
||||
TC (R, n);
|
||||
for (i = 0; i < n; ++i)
|
||||
SETBIT (R (i), i);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/* Generate transitive closure of a matrix,
|
||||
Copyright 1984, 1989, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
Bison 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.
|
||||
|
||||
Bison 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 Bison; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef WARSHALL_H_
|
||||
# define WARSHALL_H_
|
||||
|
||||
void RTC PARAMS ((unsigned *, int));
|
||||
#endif /* !WARSHALL_H_ */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user