From a4a884600888e5e2e6b5231c2840c01b44eae644 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 21 Feb 2016 18:53:49 -0500 Subject: text compression. 7017 bytes free. --- messages.pl | 191 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 messages.pl (limited to 'messages.pl') diff --git a/messages.pl b/messages.pl new file mode 100644 index 0000000..0fd871f --- /dev/null +++ b/messages.pl @@ -0,0 +1,191 @@ +#!/usr/bin/perl -w + +# compresses messages for taipan.c. +# messages are listed at the end of this file after __END__ marker. +# output of this script should be redirected to messages.c. + +print "// do not edit, contents are generated by messages.pl\n\n"; + +while() { + chomp; + $msgcount++; + /^(\w+)\s/; + my $label = $1; + s/^\w+\s+//; + + my $orig = $_; + s/"//g; + s/\\r//g; + s/\\n/\n/g; + # warn "msg: $_\n"; + + $total_in += (1 + length); + open my $out, ">msg.out" or die $!; + print $out $_; + close $out; + system("./textcomp < msg.out > msg.tmp 2>/dev/null"); + open my $result, ") { + my @got = split " ", $_; + $readbytes = @got; + print join(", ", @got); + $total_out += @got; + } + die "failed to compress $orig\n" unless $readbytes; + print "\n};\n\n"; +} + +print "// messages: $msgcount\n"; +print "// total input size: $total_in\n"; +print "// total output size: $total_out\n"; +print "// compression: " . ($total_in - $total_out) . "\n"; +print "// ratio: " . sprintf("%.1f", $total_out * 100 / $total_in) . "%\n"; + +# commented-out messages can go in the pod section below: +=pod +=cut + +__END__ +how_much_spc "How much " +will_you "will you " +bad_joss "Bad Joss!!\r\n" +crlf "\n" +taipan "Taipan" +do_you_wish "do you wish " +elder_brother_wu "Elder Brother Wu " +li_yuen "Li Yuen" +do_you_want "Do you want " +firm_colon "Firm:" +compradors_report "Comprador's Report\r\n\n" +captains_report " Captain's Report\r\n\n" +overloaded "Your ship is overloaded" +wish_to_trade "Do you wish to trade in your " +ship_for_one "\r\nship for one with " +more_capacity " more capacity by\r\npaying an additional " +gun_offer "Do you wish to buy a ship's gun\r\nfor " +space_ship " ship" +space_attacking " attacking" +your_orders_are "Your orders are: " +we_have " We have" +cur_seaworth "Current seaworthiness: " +what_shall_we_do "what shall we do??\r\n(Fight, Run, Throw cargo)" +aye_fight "Aye, we'll fight 'em" +were_firing "We're firing on 'em" +of_the_buggers " of the buggers" +didnt_sink "Hit 'em, but didn't sink 'em" +ran_away " ran away" +we_have_no_guns "We have no guns" +you_have_on_board "You have the following on board" +what_shall_i_throw "What shall I throw overboard" +how_much "How much" +hope_we_lose_em "Let's hope we lose 'em" +nothing_there "There's nothing there" +aye_run "Aye, we'll run" +we_got_away "We got away from 'em" +couldnt_lose_em "Couldn't lose 'em." +but_we_escaped "But we escaped from " +of_em " of 'em!" +theyre_firing "They're firing on us" +weve_been_hit "We've been hit" +buggers_hit_gun "The buggers hit a gun" +we_got_em_all "We got 'em all" +to_start "to start . . .\r\n\n" +with_cash ") With cash (and a debt)\r\n\n" +with_5_guns ") With five guns and no cash\r\n" +but_no_debt "(But no debt!)" +mchenry_has_arrived "Mc Henry from the Hong Kong\r\nShipyards has arrived!! He says, 'I see\r\nye've a wee bit of damage to yer ship.'\r\nWill ye be wanting repairs? " +tis_a_pity "Och, 'tis a pity to be " +percent_damaged "% damaged.\r\nWe can fix yer whole ship for " +or_partial_repairs ",\r\nor make partial repairs if you wish.\r\n" +will_ye_spend "will ye spend? " +illionaire " I L L I O N A I R E !" +youre_a " Y o u ' r e a" +your_final_status "Your final status:\r\n\nNet cash: " +ship_size "\r\nShip size: " +units_with " units with " +you_traded_for " guns\r\n\nYou traded for " +your_score_is "Your score is " +land_based_job "Have you considered a land based job?\r\n\n\n" +stay_on_shore "The crew has requested that you stay on\r\nshore for their safety!!\r\n\n" +your_rating "Your Rating:\r\n" +ma_tsu "Ma Tsu" +master_taipan "Master Taipan" +compradore "Compradore" +galley_hand "Galley Hand" +play_again "Play again? " +you_have_only "You have only " +you_have_no_cargo "You have no cargo" +move_to_whouse " shall I move\r\nto the warehouse" +whouse_only_hold "Your warehouse will only hold an\r\nadditional " +whouse_full "Your warehouse is full" +move_aboard " shall I move\r\naboard ship" +me_to_go_to "me to go to:\r\n" +already_here "\r\n\nYou're already here" +hostile_ship " hostile ship" +approaching " approaching" +fleet_drove_off "'s fleet drove them off!" +s_pirates "'s pirates" +they_let_us_be "Good joss!! They let us be!!\r\n" +ships_of_fleet " ships of Li Yuen's pirate\r\nfleet" +captured_some_booty "We captured some booty.\r\nIt's worth " +we_made_it "We made it!" +buggers_got_us "The buggers got us" +all_over_now "!\r\nIt's all over, now!!!" +storm "Storm" +think_going_down " I think we're going down!!\r\n\n" +were_going_down "We're going down" +storm_we_made_it " We made it!!\r\n\n" +blown_off_course "We've been blown off course\r\nto " +arriving_at "Arriving at " +asks " asks " +in_donation " in donation\r\nto the temple of Tin Hau, the Sea\r\nGoddess. Will you pay? " +not_enough_cash "you do not have enough cash!!\r\n\n" +make_up_difference "to make up\r\nthe difference for you? " +given_the_diff "has given Li Yuen the\r\ndifference between what he wanted and\r\nyour cash on hand and added the same\r\namount to your debt.\r\n" +very_well "Very well. " +will_not_pay "will not pay\r\nLi Yuen the difference. I would be very\r\nwary of pirates if I were you." +you_only_have "you only have " +do_you_have_biz_with_wu "Do you have business with Elder Brother\r\nWu, the moneylender? " +aware_of_your_plight "Elder Brother is aware of your plight,\r\nTaipan. He is willing to loan you an\r\nadditional " +if_you_will_pay_back " if you will pay back\r\n" +are_you_willing ". Are you willing" +game_is_over "Very well, Taipan, the game is over!\r\n" +very_well_good_joss "Very well, Taipan. Good joss!!\r\n" +to_repay_him "to repay\r\nhim? " +to_borrow "to \r\nborrow? " +wont_loan "\r\n\nHe won't loan you so much" +bodyguards_killed " of your bodyguards have been killed\r\nby cutthroats and you have been robbed\r\nof all of your cash" +the_price_of "!! The price of " +risen "risen" +dropped "dropped" +spc_to_spc " to " +prices_here_are "present prices per unit here are" +general_shortname "General" +shall_i_buy_sell "Shall I Buy, Sell, " +bank_transfer "Visit bank, Transfer\r\ncargo, " +quit_traging "Quit trading" +or_retire ", or Retire" +what_will_you_name_firm " What will you name your" +spc_you_can_spc " You can " +spc_shall " shall" +spc_afford " afford " +i_buy "I buy, " +shall_i_sell " shall\r\nI sell, " +too_much_cash "\r\nYou cannot carry so much cash" +ship_would_sink "\r\nYour ship would sink under the weight\r\nof your riches.\r\n" +deposit "deposit? " +withdraw "withdraw? " +assassinated_1 "you have been assassinated!" +assassinated_2 "As the masked figure plunges the blade\r\ninto your heart, he says:\r\n" +assassinated_3 "regrets to inform you\r\nthat your account has been terminated\r\nwith extreme prejudice." +has_sent "has sent " +braves_to_escort " braves\r\nto escort you to the Wu mansion" +wu_warn_1 "reminds you of the\r\nConfucian ideal of personal worthiness,\r\nand how this applies to paying one's\r\ndebts.\r\n" +wu_warn_2 "He is reminded of a fabled barbarian\r\nwho came to a bad end, after not caring\r\nfor his obligations.\r\n\nHe hopes no such fate awaits you, his\r\nfriend" +siezed_opium "The local authorities have seized your\r\nOpium cargo and have also fined you\r\n" +whouse_theft "Messenger reports large theft\r\nfrom warehouse" +has_sent_lieutenant " has sent a Lieutenant,\r\nTaipan. He says his admiral wishes\r\nto see you in Hong Kong, posthaste!\r\n" +beaten_robbed "You've been beaten up and\r\nrobbed of " +in_cash " in cash" -- cgit v1.2.3