diff options
-rw-r--r-- | doc/Makefile.am | 2 | ||||
-rw-r--r-- | po/PriorityLists.pot | 213 | ||||
-rw-r--r-- | po/cat-id-tbl.c | 184 | ||||
-rw-r--r-- | po/de.po | 213 | ||||
-rw-r--r-- | po/fr.po | 215 | ||||
-rw-r--r-- | src/test.cc | 252 |
6 files changed, 887 insertions, 192 deletions
diff --git a/doc/Makefile.am b/doc/Makefile.am index 2ddd071..ee5aba4 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1 +1 @@ -EXTRA_DIST = BHeap.doc.fr
\ No newline at end of file +EXTRA_DIST = README.fr README.en diff --git a/po/PriorityLists.pot b/po/PriorityLists.pot index 820727b..4738ad9 100644 --- a/po/PriorityLists.pot +++ b/po/PriorityLists.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2001-03-07 01:54+0100\n" +"POT-Creation-Date: 2001-03-13 00:35+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -14,141 +14,288 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: ENCODING\n" -#: src/main.cc:35 src/main.cc:175 src/test.cc:37 src/test.cc:166 +#: src/test.cc:23 +msgid "0 - Binary Heap" +msgstr "" + +#: src/test.cc:24 +msgid "1 - Binomial Heap" +msgstr "" + +#: src/test.cc:25 +msgid "2 - Fibonacci Heap" +msgstr "" + +#: src/test.cc:26 +msgid "3 - Sorted chained list" +msgstr "" + +#: src/test.cc:30 +msgid "a - Add a key into the priority list" +msgstr "" + +#: src/test.cc:31 +msgid "c - Change priority list type" +msgstr "" + +#: src/test.cc:32 +msgid "d - Delete a Key from the priority list" +msgstr "" + +#: src/test.cc:33 +msgid "e - Extract Min onto the priority list" +msgstr "" + +#: src/test.cc:34 +msgid "l - Lower Key onto a key of the priority list" +msgstr "" + +#: src/test.cc:35 +msgid "p - Print the current priority list on the screen" +msgstr "" + +#: src/test.cc:36 +msgid "r - Remove the whole priority list" +msgstr "" + +#: src/test.cc:37 +msgid "t - Test the priority list algorithms" +msgstr "" + +#: src/test.cc:38 +msgid "q - Quit" +msgstr "" + +#: src/main.cc:35 src/main.cc:175 src/test.cc:64 src/test.cc:278 msgid "Unknow priority list type: " msgstr "" -#: src/test.cc:49 +#: src/test.cc:77 msgid "Creation of a priority list and adding " msgstr "" -#: src/test.cc:49 +#: src/test.cc:77 msgid " random entrie(s)..." msgstr "" -#: src/test.cc:56 +#: src/test.cc:82 msgid "" "Ok.\n" "Deleting the list..." msgstr "" -#: src/test.cc:60 src/test.cc:64 +#: src/test.cc:86 src/test.cc:90 msgid "List has " msgstr "" -#: src/test.cc:60 +#: src/test.cc:86 msgid " keys. Expecting " msgstr "" -#: src/test.cc:61 src/test.cc:65 +#: src/test.cc:87 src/test.cc:91 msgid "List corrupted." msgstr "" -#: src/test.cc:64 +#: src/test.cc:90 msgid " keys (real count). Expecting " msgstr "" -#: src/test.cc:69 src/test.cc:146 +#: src/test.cc:95 src/test.cc:162 msgid "Incorrect order." msgstr "" -#: src/test.cc:84 +#: src/test.cc:110 msgid "Size of a PriorityList cell: " msgstr "" -#: src/test.cc:85 +#: src/test.cc:111 msgid "Size of a BHeap cell : " msgstr "" -#: src/test.cc:86 +#: src/test.cc:112 msgid "Size of a FHeap cell : " msgstr "" -#: src/test.cc:87 +#: src/test.cc:113 msgid "Size of a PLList header : " msgstr "" -#: src/test.cc:88 +#: src/test.cc:114 msgid "Size of a CList cell : " msgstr "" -#: src/test.cc:89 +#: src/test.cc:115 msgid "Size of a SList cell : " msgstr "" -#: src/test.cc:90 +#: src/test.cc:116 msgid "Size of a BinHeap header : " msgstr "" -#: src/test.cc:91 +#: src/test.cc:117 msgid "Size of a BinHeap cell : " msgstr "" -#: src/test.cc:105 +#: src/test.cc:124 msgid "Creating a priority list and adding keys:\n" msgstr "" -#: src/test.cc:122 src/test.cc:129 src/test.cc:133 src/test.cc:137 +#: src/test.cc:138 src/test.cc:145 src/test.cc:149 src/test.cc:153 msgid "" "Ok.\n" "List browsing...\n" msgstr "" -#: src/test.cc:124 +#: src/test.cc:140 msgid "" "Ok.\n" "Extract_Min + List browsing...\n" msgstr "" -#: src/test.cc:127 +#: src/test.cc:143 msgid "" "Ok.\n" "Lower_Key(0) over 59...\n" msgstr "" -#: src/test.cc:131 +#: src/test.cc:147 msgid "" "Ok.\n" "Delete over 54...\n" msgstr "" -#: src/test.cc:135 +#: src/test.cc:151 msgid "" "Ok.\n" "Lower_Key(-12) over 30...\n" msgstr "" -#: src/test.cc:139 +#: src/test.cc:155 msgid "" "Ok.\n" "Extract_Min...\n" msgstr "" -#: src/test.cc:141 +#: src/test.cc:157 msgid "" "Ok.\n" "Extracting datas...\n" msgstr "" -#: src/test.cc:143 +#: src/test.cc:159 msgid "Minimum #" msgstr "" -#: src/test.cc:149 +#: src/test.cc:165 msgid "" "Ok.\n" "\n" "All the tests were successfull\n" msgstr "" -#: src/test.cc:155 +#: src/test.cc:171 msgid "Usage: testTas [type]\n" msgstr "" -#: src/main.cc:179 src/test.cc:170 +#: src/test.cc:182 +msgid "Choice: " +msgstr "" + +#: src/test.cc:199 +msgid "Incorrect choice, select again\n" +msgstr "" + +#: src/test.cc:215 +#, c-format +msgid "%i - Key: %i" +msgstr "" + +#: src/test.cc:217 +#, c-format +msgid "%i - Empty slot" +msgstr "" + +#: src/test.cc:224 +msgid "n - Don't store" +msgstr "" + +#: src/test.cc:225 +msgid "c - Cancel" +msgstr "" + +#: src/test.cc:252 +msgid "could not set attributes\n" +msgstr "" + +#: src/main.cc:179 src/test.cc:282 msgid "Extra command: " msgstr "" +#: src/test.cc:296 +msgid "You are not a terminal, Ok.\n" +msgstr "" + +#: src/test.cc:301 +msgid "Unable to open /dev/tty\n" +msgstr "" + +#: src/test.cc:319 +msgid "Priority list type: " +msgstr "" + +#: src/test.cc:320 +msgid "Please select an action" +msgstr "" + +#: src/test.cc:321 +msgid "You have chosen: " +msgstr "" + +#: src/test.cc:325 +msgid "Please select a slot to save the cell" +msgstr "" + +#: src/test.cc:335 +msgid "Please type in a key to add" +msgstr "" + +#: src/test.cc:349 +msgid "Please select a priority list type" +msgstr "" + +#: src/test.cc:356 +msgid "Please select a key to delete" +msgstr "" + +#: src/test.cc:362 +msgid "Delete result: " +msgstr "" + +#. Extract Min. +#: src/test.cc:366 +msgid "Extract Min result: " +msgstr "" + +#: src/test.cc:370 +msgid "Please select a key to lower" +msgstr "" + +#: src/test.cc:376 +msgid "Please type in the new key" +msgstr "" + +#: src/test.cc:380 +msgid "Lower key result: " +msgstr "" + +#: src/test.cc:380 +msgid "True" +msgstr "" + +#: src/test.cc:380 +msgid "False" +msgstr "" + #: src/main.cc:46 src/main.cc:73 msgid "Error opening file (" msgstr "" @@ -245,15 +392,15 @@ msgstr "" msgid "-i and -f options are exclusive" msgstr "" -#: src/main.cc:195 +#: src/main.cc:196 msgid "-i needs a filename" msgstr "" -#: src/main.cc:200 +#: src/main.cc:201 msgid "-f needs a filename" msgstr "" -#: src/main.cc:204 +#: src/main.cc:205 msgid "Internal error." msgstr "" diff --git a/po/cat-id-tbl.c b/po/cat-id-tbl.c index c911baa..df9abe5 100644 --- a/po/cat-id-tbl.c +++ b/po/cat-id-tbl.c @@ -8,102 +8,138 @@ const struct _msg_ent _msg_tbl[] = { {"", 1}, - {"Unknow priority list type: ", 2}, - {"Creation of a priority list and adding ", 3}, - {" random entrie(s)...", 4}, + {"0 - Binary Heap", 2}, + {"1 - Binomial Heap", 3}, + {"2 - Fibonacci Heap", 4}, + {"3 - Sorted chained list", 5}, + {"a - Add a key into the priority list", 6}, + {"c - Change priority list type", 7}, + {"d - Delete a Key from the priority list", 8}, + {"e - Extract Min onto the priority list", 9}, + {"l - Lower Key onto a key of the priority list", 10}, + {"p - Print the current priority list on the screen", 11}, + {"r - Remove the whole priority list", 12}, + {"t - Test the priority list algorithms", 13}, + {"q - Quit", 14}, + {"Unknow priority list type: ", 15}, + {"Creation of a priority list and adding ", 16}, + {" random entrie(s)...", 17}, {"\ Ok.\n\ -Deleting the list...", 5}, - {"List has ", 6}, - {" keys. Expecting ", 7}, - {"List corrupted.", 8}, - {" keys (real count). Expecting ", 9}, - {"Incorrect order.", 10}, - {"Size of a PriorityList cell: ", 11}, - {"Size of a BHeap cell : ", 12}, - {"Size of a FHeap cell : ", 13}, - {"Size of a PLList header : ", 14}, - {"Size of a CList cell : ", 15}, - {"Size of a SList cell : ", 16}, - {"Size of a BinHeap header : ", 17}, - {"Size of a BinHeap cell : ", 18}, - {"Creating a priority list and adding keys:\n", 19}, +Deleting the list...", 18}, + {"List has ", 19}, + {" keys. Expecting ", 20}, + {"List corrupted.", 21}, + {" keys (real count). Expecting ", 22}, + {"Incorrect order.", 23}, + {"Size of a PriorityList cell: ", 24}, + {"Size of a BHeap cell : ", 25}, + {"Size of a FHeap cell : ", 26}, + {"Size of a PLList header : ", 27}, + {"Size of a CList cell : ", 28}, + {"Size of a SList cell : ", 29}, + {"Size of a BinHeap header : ", 30}, + {"Size of a BinHeap cell : ", 31}, + {"Creating a priority list and adding keys:\n", 32}, {"\ Ok.\n\ -List browsing...\n", 20}, +List browsing...\n", 33}, {"\ Ok.\n\ -Extract_Min + List browsing...\n", 21}, +Extract_Min + List browsing...\n", 34}, {"\ Ok.\n\ -Lower_Key(0) over 59...\n", 22}, +Lower_Key(0) over 59...\n", 35}, {"\ Ok.\n\ -Delete over 54...\n", 23}, +Delete over 54...\n", 36}, {"\ Ok.\n\ -Lower_Key(-12) over 30...\n", 24}, +Lower_Key(-12) over 30...\n", 37}, {"\ Ok.\n\ -Extract_Min...\n", 25}, +Extract_Min...\n", 38}, {"\ Ok.\n\ -Extracting datas...\n", 26}, - {"Minimum #", 27}, +Extracting datas...\n", 39}, + {"Minimum #", 40}, {"\ Ok.\n\ \n\ -All the tests were successfull\n", 28}, - {"Usage: testTas [type]\n", 29}, - {"Extra command: ", 30}, - {"Error opening file (", 31}, - {"Bad dictionnary structure. See doc/README.en (missing : separator)", 32}, - {"Bad dictionnary structure. See doc/README.en (missing word)", 33}, - {"Bad dictionnary structure. See doc/README.en (missing frequency)", 34}, - {"Error: \"", 35}, - {"\" is not a valid number.", 36}, - {"Huffman [{-f|-i} file] {type}", 37}, - {"Huffman -h", 38}, - {"By Nicolas Noble (nicolas@nobis-crew.org).", 39}, - {"This will encode the input file with the Huffman code", 40}, - {"using the priority list defined by type.", 41}, - {"Type is a number taken from this list:", 42}, - {" 0 : Binary Heap (default)", 43}, - {" 1 : Binomial Heap", 44}, - {" 2 : Fibonacci Heap", 45}, - {" 3 : Sorted chained list", 46}, - {"-f file means that you specify a dictionnary file which is", 47}, - {" structured as described into the README file.", 48}, - {"-i file means that you specify a file to encode. It will", 49}, - {" built a quiet dumb dictionnary.", 50}, - {"By default, a dictionnary will be built from stdin.", 51}, - {"-h prints this help and exit.", 52}, - {"Unknow option: ", 53}, - {"-i and -f options are exclusive", 54}, - {"-i needs a filename", 55}, - {"-f needs a filename", 56}, - {"Internal error.", 57}, - {" * Head cell. (", 58}, - {"Insert: not over Head.", 59}, - {"Insert: No more memory.", 60}, - {"Extract_Min: Priority List is empty.", 61}, +All the tests were successfull\n", 41}, + {"Usage: testTas [type]\n", 42}, + {"Choice: ", 43}, + {"Incorrect choice, select again\n", 44}, + {"%i - Key: %i", 45}, + {"%i - Empty slot", 46}, + {"n - Don't store", 47}, + {"c - Cancel", 48}, + {"could not set attributes\n", 49}, + {"Extra command: ", 50}, + {"You are not a terminal, Ok.\n", 51}, + {"Unable to open /dev/tty\n", 52}, + {"Priority list type: ", 53}, + {"Please select an action", 54}, + {"You have chosen: ", 55}, + {"Please select a slot to save the cell", 56}, + {"Please type in a key to add", 57}, + {"Please select a priority list type", 58}, + {"Please select a key to delete", 59}, + {"Delete result: ", 60}, + {"Extract Min result: ", 61}, + {"Please select a key to lower", 62}, + {"Please type in the new key", 63}, + {"Lower key result: ", 64}, + {"True", 65}, + {"False", 66}, + {"Error opening file (", 67}, + {"Bad dictionnary structure. See doc/README.en (missing : separator)", 68}, + {"Bad dictionnary structure. See doc/README.en (missing word)", 69}, + {"Bad dictionnary structure. See doc/README.en (missing frequency)", 70}, + {"Error: \"", 71}, + {"\" is not a valid number.", 72}, + {"Huffman [{-f|-i} file] {type}", 73}, + {"Huffman -h", 74}, + {"By Nicolas Noble (nicolas@nobis-crew.org).", 75}, + {"This will encode the input file with the Huffman code", 76}, + {"using the priority list defined by type.", 77}, + {"Type is a number taken from this list:", 78}, + {" 0 : Binary Heap (default)", 79}, + {" 1 : Binomial Heap", 80}, + {" 2 : Fibonacci Heap", 81}, + {" 3 : Sorted chained list", 82}, + {"-f file means that you specify a dictionnary file which is", 83}, + {" structured as described into the README file.", 84}, + {"-i file means that you specify a file to encode. It will", 85}, + {" built a quiet dumb dictionnary.", 86}, + {"By default, a dictionnary will be built from stdin.", 87}, + {"-h prints this help and exit.", 88}, + {"Unknow option: ", 89}, + {"-i and -f options are exclusive", 90}, + {"-i needs a filename", 91}, + {"-f needs a filename", 92}, + {"Internal error.", 93}, + {" * Head cell. (", 94}, + {"Insert: not over Head.", 95}, + {"Insert: No more memory.", 96}, + {"Extract_Min: Priority List is empty.", 97}, {"\ * Head cell.\n\ - |\n", 62}, - {"Not enough memory", 63}, - {"negative overflow", 64}, + |\n", 98}, + {"Not enough memory", 99}, + {"negative overflow", 100}, {"\ * Head cell\n\ - |\n", 65}, - {"Bitstream length : ", 66}, - {" bits (= ", 67}, - {" bytes)\n", 68}, - {"Real size input : ", 69}, - {"Size squeezed by : ", 70}, - {" percents\n", 71}, - {"Dictionnary size : ", 72}, - {"Total bitstream length : ", 73}, - {"Real gain (4 bytes header) : ", 74}, + |\n", 101}, + {"Bitstream length : ", 102}, + {" bits (= ", 103}, + {" bytes)\n", 104}, + {"Real size input : ", 105}, + {"Size squeezed by : ", 106}, + {" percents\n", 107}, + {"Dictionnary size : ", 108}, + {"Total bitstream length : ", 109}, + {"Real gain (4 bytes header) : ", 110}, }; -int _msg_tbl_length = 74; +int _msg_tbl_length = 110; @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2001-03-07 01:54+0100\n" +"POT-Creation-Date: 2001-03-13 00:35+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -14,141 +14,288 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: ENCODING\n" -#: src/main.cc:35 src/main.cc:175 src/test.cc:37 src/test.cc:166 +#: src/test.cc:23 +msgid "0 - Binary Heap" +msgstr "" + +#: src/test.cc:24 +msgid "1 - Binomial Heap" +msgstr "" + +#: src/test.cc:25 +msgid "2 - Fibonacci Heap" +msgstr "" + +#: src/test.cc:26 +msgid "3 - Sorted chained list" +msgstr "" + +#: src/test.cc:30 +msgid "a - Add a key into the priority list" +msgstr "" + +#: src/test.cc:31 +msgid "c - Change priority list type" +msgstr "" + +#: src/test.cc:32 +msgid "d - Delete a Key from the priority list" +msgstr "" + +#: src/test.cc:33 +msgid "e - Extract Min onto the priority list" +msgstr "" + +#: src/test.cc:34 +msgid "l - Lower Key onto a key of the priority list" +msgstr "" + +#: src/test.cc:35 +msgid "p - Print the current priority list on the screen" +msgstr "" + +#: src/test.cc:36 +msgid "r - Remove the whole priority list" +msgstr "" + +#: src/test.cc:37 +msgid "t - Test the priority list algorithms" +msgstr "" + +#: src/test.cc:38 +msgid "q - Quit" +msgstr "" + +#: src/main.cc:35 src/main.cc:175 src/test.cc:64 src/test.cc:278 msgid "Unknow priority list type: " msgstr "" -#: src/test.cc:49 +#: src/test.cc:77 msgid "Creation of a priority list and adding " msgstr "" -#: src/test.cc:49 +#: src/test.cc:77 msgid " random entrie(s)..." msgstr "" -#: src/test.cc:56 +#: src/test.cc:82 msgid "" "Ok.\n" "Deleting the list..." msgstr "" -#: src/test.cc:60 src/test.cc:64 +#: src/test.cc:86 src/test.cc:90 msgid "List has " msgstr "" -#: src/test.cc:60 +#: src/test.cc:86 msgid " keys. Expecting " msgstr "" -#: src/test.cc:61 src/test.cc:65 +#: src/test.cc:87 src/test.cc:91 msgid "List corrupted." msgstr "" -#: src/test.cc:64 +#: src/test.cc:90 msgid " keys (real count). Expecting " msgstr "" -#: src/test.cc:69 src/test.cc:146 +#: src/test.cc:95 src/test.cc:162 msgid "Incorrect order." msgstr "" -#: src/test.cc:84 +#: src/test.cc:110 msgid "Size of a PriorityList cell: " msgstr "" -#: src/test.cc:85 +#: src/test.cc:111 msgid "Size of a BHeap cell : " msgstr "" -#: src/test.cc:86 +#: src/test.cc:112 msgid "Size of a FHeap cell : " msgstr "" -#: src/test.cc:87 +#: src/test.cc:113 msgid "Size of a PLList header : " msgstr "" -#: src/test.cc:88 +#: src/test.cc:114 msgid "Size of a CList cell : " msgstr "" -#: src/test.cc:89 +#: src/test.cc:115 msgid "Size of a SList cell : " msgstr "" -#: src/test.cc:90 +#: src/test.cc:116 msgid "Size of a BinHeap header : " msgstr "" -#: src/test.cc:91 +#: src/test.cc:117 msgid "Size of a BinHeap cell : " msgstr "" -#: src/test.cc:105 +#: src/test.cc:124 msgid "Creating a priority list and adding keys:\n" msgstr "" -#: src/test.cc:122 src/test.cc:129 src/test.cc:133 src/test.cc:137 +#: src/test.cc:138 src/test.cc:145 src/test.cc:149 src/test.cc:153 msgid "" "Ok.\n" "List browsing...\n" msgstr "" -#: src/test.cc:124 +#: src/test.cc:140 msgid "" "Ok.\n" "Extract_Min + List browsing...\n" msgstr "" -#: src/test.cc:127 +#: src/test.cc:143 msgid "" "Ok.\n" "Lower_Key(0) over 59...\n" msgstr "" -#: src/test.cc:131 +#: src/test.cc:147 msgid "" "Ok.\n" "Delete over 54...\n" msgstr "" -#: src/test.cc:135 +#: src/test.cc:151 msgid "" "Ok.\n" "Lower_Key(-12) over 30...\n" msgstr "" -#: src/test.cc:139 +#: src/test.cc:155 msgid "" "Ok.\n" "Extract_Min...\n" msgstr "" -#: src/test.cc:141 +#: src/test.cc:157 msgid "" "Ok.\n" "Extracting datas...\n" msgstr "" -#: src/test.cc:143 +#: src/test.cc:159 msgid "Minimum #" msgstr "" -#: src/test.cc:149 +#: src/test.cc:165 msgid "" "Ok.\n" "\n" "All the tests were successfull\n" msgstr "" -#: src/test.cc:155 +#: src/test.cc:171 msgid "Usage: testTas [type]\n" msgstr "" -#: src/main.cc:179 src/test.cc:170 +#: src/test.cc:182 +msgid "Choice: " +msgstr "" + +#: src/test.cc:199 +msgid "Incorrect choice, select again\n" +msgstr "" + +#: src/test.cc:215 +#, c-format +msgid "%i - Key: %i" +msgstr "" + +#: src/test.cc:217 +#, c-format +msgid "%i - Empty slot" +msgstr "" + +#: src/test.cc:224 +msgid "n - Don't store" +msgstr "" + +#: src/test.cc:225 +msgid "c - Cancel" +msgstr "" + +#: src/test.cc:252 +msgid "could not set attributes\n" +msgstr "" + +#: src/main.cc:179 src/test.cc:282 msgid "Extra command: " msgstr "" +#: src/test.cc:296 +msgid "You are not a terminal, Ok.\n" +msgstr "" + +#: src/test.cc:301 +msgid "Unable to open /dev/tty\n" +msgstr "" + +#: src/test.cc:319 +msgid "Priority list type: " +msgstr "" + +#: src/test.cc:320 +msgid "Please select an action" +msgstr "" + +#: src/test.cc:321 +msgid "You have chosen: " +msgstr "" + +#: src/test.cc:325 +msgid "Please select a slot to save the cell" +msgstr "" + +#: src/test.cc:335 +msgid "Please type in a key to add" +msgstr "" + +#: src/test.cc:349 +msgid "Please select a priority list type" +msgstr "" + +#: src/test.cc:356 +msgid "Please select a key to delete" +msgstr "" + +#: src/test.cc:362 +msgid "Delete result: " +msgstr "" + +#. Extract Min. +#: src/test.cc:366 +msgid "Extract Min result: " +msgstr "" + +#: src/test.cc:370 +msgid "Please select a key to lower" +msgstr "" + +#: src/test.cc:376 +msgid "Please type in the new key" +msgstr "" + +#: src/test.cc:380 +msgid "Lower key result: " +msgstr "" + +#: src/test.cc:380 +msgid "True" +msgstr "" + +#: src/test.cc:380 +msgid "False" +msgstr "" + #: src/main.cc:46 src/main.cc:73 msgid "Error opening file (" msgstr "" @@ -245,15 +392,15 @@ msgstr "" msgid "-i and -f options are exclusive" msgstr "" -#: src/main.cc:195 +#: src/main.cc:196 msgid "-i needs a filename" msgstr "" -#: src/main.cc:200 +#: src/main.cc:201 msgid "-f needs a filename" msgstr "" -#: src/main.cc:204 +#: src/main.cc:205 msgid "Internal error." msgstr "" @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PriorityList-1.0.0\n" -"POT-Creation-Date: 2001-03-07 01:54+0100\n" +"POT-Creation-Date: 2001-03-13 00:35+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Nicolas Noble <pixel@nobis-crew.org>\n" "Language-Team: French <fr@li.org>\n" @@ -14,19 +14,71 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: ENCODING\n" -#: src/main.cc:35 src/main.cc:175 src/test.cc:37 src/test.cc:166 +#: src/test.cc:23 +msgid "0 - Binary Heap" +msgstr "0 - Tas binaire" + +#: src/test.cc:24 +msgid "1 - Binomial Heap" +msgstr "1 - Tas binomial" + +#: src/test.cc:25 +msgid "2 - Fibonacci Heap" +msgstr "2 - Tas de Fibonacci" + +#: src/test.cc:26 +msgid "3 - Sorted chained list" +msgstr "3 - Liste chaînée triée" + +#: src/test.cc:30 +msgid "a - Add a key into the priority list" +msgstr "a - Ajoute une clef dans la file de priorité" + +#: src/test.cc:31 +msgid "c - Change priority list type" +msgstr "c - Change le type de la file de priorité." + +#: src/test.cc:32 +msgid "d - Delete a Key from the priority list" +msgstr "d - Supprime une clef de la file de priorité" + +#: src/test.cc:33 +msgid "e - Extract Min onto the priority list" +msgstr "e - Extraire Min sur la file de priorité" + +#: src/test.cc:34 +msgid "l - Lower Key onto a key of the priority list" +msgstr "l - Diminuer Clef sur une clef de la file de priorité" + +#: src/test.cc:35 +msgid "p - Print the current priority list on the screen" +msgstr "p - Afficher la file de priorité à l'écran" + +#: src/test.cc:36 +msgid "r - Remove the whole priority list" +msgstr "r - Efface la file de priorité" + +#: src/test.cc:37 +msgid "t - Test the priority list algorithms" +msgstr "t - Teste les algorithmes de la file de priorité" + +#: src/test.cc:38 +msgid "q - Quit" +msgstr "q - Quitter" + +#: src/main.cc:35 src/main.cc:175 src/test.cc:64 src/test.cc:278 msgid "Unknow priority list type: " msgstr "File de priorité inconnue: " -#: src/test.cc:49 +#: src/test.cc:77 msgid "Creation of a priority list and adding " msgstr "Création d'une liste de priorité et ajout de " -#: src/test.cc:49 +#: src/test.cc:77 msgid " random entrie(s)..." msgstr " entrée(s) aléatoires..." -#: src/test.cc:56 +#: src/test.cc:82 msgid "" "Ok.\n" "Deleting the list..." @@ -34,63 +86,63 @@ msgstr "" "Ok.\n" "Effacement de la liste..." -#: src/test.cc:60 src/test.cc:64 +#: src/test.cc:86 src/test.cc:90 msgid "List has " msgstr "La liste possède " -#: src/test.cc:60 +#: src/test.cc:86 msgid " keys. Expecting " msgstr " clefs alors que nous attendions " -#: src/test.cc:61 src/test.cc:65 +#: src/test.cc:87 src/test.cc:91 msgid "List corrupted." msgstr "Liste corrompue." -#: src/test.cc:64 +#: src/test.cc:90 msgid " keys (real count). Expecting " msgstr " clefs (compte réel) alors que nous attendions " -#: src/test.cc:69 src/test.cc:146 +#: src/test.cc:95 src/test.cc:162 msgid "Incorrect order." msgstr "Ordre incorrect." -#: src/test.cc:84 +#: src/test.cc:110 msgid "Size of a PriorityList cell: " msgstr "Taille d'une cellule du type PriorityList: " -#: src/test.cc:85 +#: src/test.cc:111 msgid "Size of a BHeap cell : " msgstr "Taille d'une cellule du type BHeap : " -#: src/test.cc:86 +#: src/test.cc:112 msgid "Size of a FHeap cell : " msgstr "Taille d'une cellule du type FHeap : " -#: src/test.cc:87 +#: src/test.cc:113 msgid "Size of a PLList header : " msgstr "Taille d'un entète du type PLList : " -#: src/test.cc:88 +#: src/test.cc:114 msgid "Size of a CList cell : " msgstr "Taille d'une cellule du type CList : " -#: src/test.cc:89 +#: src/test.cc:115 msgid "Size of a SList cell : " msgstr "Taille d'une cellule du type SList : " -#: src/test.cc:90 +#: src/test.cc:116 msgid "Size of a BinHeap header : " msgstr "Taille d'un entête du type BinHeap : " -#: src/test.cc:91 +#: src/test.cc:117 msgid "Size of a BinHeap cell : " msgstr "Taille d'une cellule du type BinHeap : " -#: src/test.cc:105 +#: src/test.cc:124 msgid "Creating a priority list and adding keys:\n" msgstr "Création d'une liste de priorité et ajout de clefs:\n" -#: src/test.cc:122 src/test.cc:129 src/test.cc:133 src/test.cc:137 +#: src/test.cc:138 src/test.cc:145 src/test.cc:149 src/test.cc:153 msgid "" "Ok.\n" "List browsing...\n" @@ -98,7 +150,7 @@ msgstr "" "Ok.\n" "Exploration de la liste...\n" -#: src/test.cc:124 +#: src/test.cc:140 msgid "" "Ok.\n" "Extract_Min + List browsing...\n" @@ -106,7 +158,7 @@ msgstr "" "Ok.\n" "Extract_Min + Exploration de la liste...\n" -#: src/test.cc:127 +#: src/test.cc:143 msgid "" "Ok.\n" "Lower_Key(0) over 59...\n" @@ -114,7 +166,7 @@ msgstr "" "Ok.\n" "Lower_Key(0) sur 59...\n" -#: src/test.cc:131 +#: src/test.cc:147 msgid "" "Ok.\n" "Delete over 54...\n" @@ -122,7 +174,7 @@ msgstr "" "Ok.\n" "Delete sur 54...\n" -#: src/test.cc:135 +#: src/test.cc:151 msgid "" "Ok.\n" "Lower_Key(-12) over 30...\n" @@ -130,7 +182,7 @@ msgstr "" "Ok.\n" "Lower_Key(-12) sur 30...\n" -#: src/test.cc:139 +#: src/test.cc:155 msgid "" "Ok.\n" "Extract_Min...\n" @@ -138,7 +190,7 @@ msgstr "" "Ok.\n" "Extract_Min...\n" -#: src/test.cc:141 +#: src/test.cc:157 msgid "" "Ok.\n" "Extracting datas...\n" @@ -146,11 +198,11 @@ msgstr "" "Ok.\n" "Extraction des données...\n" -#: src/test.cc:143 +#: src/test.cc:159 msgid "Minimum #" msgstr "Minimum #" -#: src/test.cc:149 +#: src/test.cc:165 msgid "" "Ok.\n" "\n" @@ -160,14 +212,109 @@ msgstr "" "\n" "Tous les tests se sont déroulés correctement\n" -#: src/test.cc:155 +#: src/test.cc:171 msgid "Usage: testTas [type]\n" msgstr "Usage: testTas [type]\n" -#: src/main.cc:179 src/test.cc:170 +#: src/test.cc:182 +msgid "Choice: " +msgstr "Choix: " + +#: src/test.cc:199 +msgid "Incorrect choice, select again\n" +msgstr "Choix incorrect, veuillez recommencer\n" + +#: src/test.cc:215 +#, c-format +msgid "%i - Key: %i" +msgstr "%i - Clef: %i" + +#: src/test.cc:217 +#, c-format +msgid "%i - Empty slot" +msgstr "%i - Emplacement vide" + +#: src/test.cc:224 +msgid "n - Don't store" +msgstr "n - Ne pas stocker" + +#: src/test.cc:225 +msgid "c - Cancel" +msgstr "c - Annuler" + +#: src/test.cc:252 +msgid "could not set attributes\n" +msgstr "Ne peut définir les attributs\n" + +#: src/main.cc:179 src/test.cc:282 msgid "Extra command: " msgstr "Commande supplémentaire: " +#: src/test.cc:296 +msgid "You are not a terminal, Ok.\n" +msgstr "Vous n'êtes pas un terminal, tant pis.\n" + +#: src/test.cc:301 +msgid "Unable to open /dev/tty\n" +msgstr "Impossible d'ouvrir /dev/tty\n" + +#: src/test.cc:319 +msgid "Priority list type: " +msgstr "Type de file de priorité: " + +#: src/test.cc:320 +msgid "Please select an action" +msgstr "Veuillez sélectionner une action" + +#: src/test.cc:321 +msgid "You have chosen: " +msgstr "Vous avez choisi: " + +#: src/test.cc:325 +msgid "Please select a slot to save the cell" +msgstr "Veuillez sélectionner un emplacement pour sauvegarder la cellule" + +#: src/test.cc:335 +msgid "Please type in a key to add" +msgstr "Veuillez taper une clef a ajouter" + +#: src/test.cc:349 +msgid "Please select a priority list type" +msgstr "Veuillez sélectionner le type de la file de priorité" + +#: src/test.cc:356 +msgid "Please select a key to delete" +msgstr "Veuillez sélectionner une clef à supprimer" + +#: src/test.cc:362 +msgid "Delete result: " +msgstr "Résultat de l'effacement: " + +#. Extract Min. +#: src/test.cc:366 +msgid "Extract Min result: " +msgstr "Résultat de l'Extraire Min: " + +#: src/test.cc:370 +msgid "Please select a key to lower" +msgstr "Veuillez sélctionner une clef à diminuer" + +#: src/test.cc:376 +msgid "Please type in the new key" +msgstr "Veuillez entrer la nouvelle clef" + +#: src/test.cc:380 +msgid "Lower key result: " +msgstr "Résultat du Diminuer Clef: " + +#: src/test.cc:380 +msgid "True" +msgstr "Vrai" + +#: src/test.cc:380 +msgid "False" +msgstr "Faux" + #: src/main.cc:46 src/main.cc:73 msgid "Error opening file (" msgstr "Erreur à l'ouverture du fichier (" @@ -229,7 +376,7 @@ msgstr " 1 : Tas binomial" #: src/main.cc:125 msgid " 2 : Fibonacci Heap" -msgstr " 2: Tas de Fibonacci" +msgstr " 2 : Tas de Fibonacci" #: src/main.cc:126 msgid " 3 : Sorted chained list" @@ -267,15 +414,15 @@ msgstr "Option inconnue: " msgid "-i and -f options are exclusive" msgstr "les options -i et -f sont exclusives" -#: src/main.cc:195 +#: src/main.cc:196 msgid "-i needs a filename" msgstr "-i nécessite un fichier" -#: src/main.cc:200 +#: src/main.cc:201 msgid "-f needs a filename" msgstr "-f nécessite un fichier" -#: src/main.cc:204 +#: src/main.cc:205 msgid "Internal error." msgstr "Erreur interne." diff --git a/src/test.cc b/src/test.cc index cc84d6a..05f5414 100644 --- a/src/test.cc +++ b/src/test.cc @@ -1,5 +1,8 @@ #include <stdio.h> #include <stdlib.h> +#include <unistd.h> +#include <termios.h> +#include <string.h> #include "config.h" #include "BHeap.h" #include "FHeap.h" @@ -12,9 +15,33 @@ char N[] = { 30, 21, 26, 4, 7, 28, 12, 27, 19, 22, }; +int method = -1; +FILE *input; +struct termios initial_settings, new_settings; + +char *method_names[] = { + N_("0 - Binary Heap"), + N_("1 - Binomial Heap"), + N_("2 - Fibonacci Heap"), + N_("3 - Sorted chained list") +}; + +char *menu[] = { + N_("a - Add a key into the priority list"), + N_("c - Change priority list type"), + N_("d - Delete a Key from the priority list"), + N_("e - Extract Min onto the priority list"), + N_("l - Lower Key onto a key of the priority list"), + N_("p - Print the current priority list on the screen"), + N_("r - Remove the whole priority list"), + N_("t - Test the priority list algorithms"), + N_("q - Quit") +}; + void exception(int e, char *msg) { fprintf(stderr, "%s\n", msg); + tcsetattr(fileno(input), TCSANOW, &initial_settings); exit(-1); } @@ -35,7 +62,8 @@ PriorityList *newlist(int method) break; default: cerr << _("Unknow priority list type: ") << method << endl; - exit(-1); + exception(1, "Exitting"); + return NULL; } } @@ -49,9 +77,7 @@ void DoCombTest(int method, int number) cerr << _("Creation of a priority list and adding ") << number << _(" random entrie(s)..."); T = newlist(method); for (i = 1; i <= number; i++) { -// T->Insert(rand() % P_INFINITY, NULL); -// T->Insert(rand() % 100, NULL); - T->Insert(1, NULL); + T->Insert(rand() % 100, NULL); } cerr << _("Ok.\nDeleting the list..."); oK = P_INFINITY; @@ -94,13 +120,6 @@ void FullTest(int method) DoCombTest(method, 30); DoCombTest(method, 70); DoCombTest(method, 1000); -// DoCombTest(method, 10000); -#ifdef BT - DoCombTest(method, 100000); -#ifdef VBT - DoCombTest(method, 1000000); -#endif -#endif cerr << _("Creating a priority list and adding keys:\n"); T = newlist(method); @@ -111,9 +130,6 @@ void FullTest(int method) C3 = C1; } - if (!C3) - exit(-1); - fprintf(stderr, "59 54 -10\n"); C1 = T->Insert(59, NULL); C2 = T->Insert(54, NULL); @@ -156,9 +172,105 @@ void Usage(void) exit(-1); } +int getchoice(char *greet, char *choices[], FILE * in) +{ + int chosen = 0; + int selected; + char **option; + + do { + cerr << _("Choice: ") << greet << endl; + option = choices; + while (*option) { + cerr << *(option++) << endl; + } + do { + selected = fgetc(in); + } while (selected == '\n' || selected == '\r'); + option = choices; + while (*option) { + if (selected == *option[0]) { + chosen = 1; + break; + } + option++; + } + if (!chosen) { + cerr << _("Incorrect choice, select again\n"); + } + } while (!chosen); + return selected; +} + +char **buildslots(PriorityList * T, Cell * Cells, char option) +{ + char **slots, **r, temp[BUFSIZ]; + int i; + + r = slots = (char **) malloc(12 * sizeof(char *)); + + for (i = 0; i < 10; i++) { + if (Cells[i] || option) { + if (Cells[i]) { + sprintf(temp, _("%i - Key: %i"), i, T->ReadKey(Cells[i])); + } else { + sprintf(temp, _("%i - Empty slot"), i); + } + *(slots++) = strdup(temp); + } + } + + if (option) + *(slots++) = strdup(_("n - Don't store")); + *(slots++) = strdup(_("c - Cancel")); + + *slots = NULL; + + return r; + +} + +void freeslots(char **slots) +{ + char **t; + + for (t = slots; *t; t++) + free(*t); + free(slots); +} + +void initterm(FILE * in) { + tcgetattr(fileno(input), &initial_settings); + new_settings = initial_settings; + new_settings.c_lflag &= ~ICANON; + new_settings.c_lflag &= ~ECHO; + new_settings.c_cc[VMIN] = 1; + new_settings.c_cc[VTIME] = 0; + new_settings.c_lflag &= ~ISIG; + + if (tcsetattr(fileno(input), TCSANOW, &new_settings) != 0) { + cerr << _("could not set attributes\n"); + exit(-1); + } + +} + +void clearterm(FILE * in) { + tcsetattr(fileno(input), TCSANOW, &initial_settings); +} + int main(int argc, char **argv) { - int method = -1; + char choice = 0, **slots; + PriorityList *T, * Temp; + Datas_t Datas; + Cell Cells[10]; + int i; + Key_t Key; + + /* + Lecture des arguments de la ligne de commande. + */ while (--argc) { argv++; @@ -175,6 +287,112 @@ int main(int argc, char **argv) if (method == -1) method = 0; - FullTest(method); - return 0; + + /* + Initialisation du terminal. + */ + + if (!isatty(fileno(stdout))) { + cerr << _("You are not a terminal, Ok.\n"); + } + + input = fopen("/dev/tty", "r"); + if (!input) { + cerr << _("Unable to open /dev/tty\n"); + exit(1); + } + + initterm(input); + + /* + Debut du programme de test. + */ + + for (i = 0; i < 10; i++) { + Cells[i] = NULL; + } + + T = newlist(method); + + do { + cerr << "\n\n\n\n"; + cerr << _("Priority list type: ") << method_names[method] << endl; + choice = getchoice(_("Please select an action"), menu, input); + cerr << _("You have chosen: ") << choice << "\n\n"; + switch (choice) { + case 'a': // Ajout d'une clef. + slots = buildslots(T, Cells, 1); + choice = getchoice(_("Please select a slot to save the cell"), slots, input); + if (choice == 'c') { + freeslots(slots); + break; + } + if (choice == 'n') { + choice = -1; + } else { + choice -= '0'; + } + cerr << _("Please type in a key to add") << endl; + clearterm(input); + cin >> Key; + initterm(input); + if (choice == -1) { + T->Insert(Key, NULL); + } else { + Cells[choice] = T->Insert(Key, NULL); + } + freeslots(slots); + break; + case 'c': // Changement du type. + Temp = T; + cerr << "\n\n\n\n"; + method = getchoice(_("Please select a priority list type"), method_names, input) - '0'; + T = newlist(method); + T->Union(Temp); + delete Temp; + break; + case 'd': // Effacement d'une clef. + slots = buildslots(T, Cells, 0); + choice = getchoice(_("Please select a key to delete"), slots, input); + if (choice == 'c') { + freeslots(slots); + break; + } + choice -= '0'; + cerr << _("Delete result: ") << T->Delete(Datas, Cells[choice]); + freeslots(slots); + break; + case 'e': // Extract Min. + cerr << _("Extract Min result: ") << T->Extract_Min(Datas); + break; + case 'l': // Lower Key. + slots = buildslots(T, Cells, 0); + choice = getchoice(_("Please select a key to lower"), slots, input); + if (choice == 'c') { + freeslots(slots); + break; + } + choice -= '0'; + cerr << _("Please type in the new key") << endl; + clearterm(input); + cin >> Key; + initterm(input); + cerr << _("Lower key result: ") << T->Lower_Key(Cells[choice], Key) ? _("True") : _("False"); + freeslots(slots); + break; + case 'p': // Print + T->Dump(cerr); + break; + case 'r': // Delete + delete T; + T = newlist(method); + break; + case 't': // Test + FullTest(method); + break; + } + } while (choice != 'q'); + + clearterm(input); + exit(0); } |