rwdeliza 0.03
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ElizaData/database/db.1 +7015 -0
- data/ElizaData/database/db.10 +7001 -0
- data/ElizaData/database/db.11 +7001 -0
- data/ElizaData/database/db.12 +7003 -0
- data/ElizaData/database/db.13 +7003 -0
- data/ElizaData/database/db.14 +7008 -0
- data/ElizaData/database/db.15 +7001 -0
- data/ElizaData/database/db.16 +7001 -0
- data/ElizaData/database/db.17 +7001 -0
- data/ElizaData/database/db.18 +7001 -0
- data/ElizaData/database/db.19 +7001 -0
- data/ElizaData/database/db.2 +7001 -0
- data/ElizaData/database/db.20 +5467 -0
- data/ElizaData/database/db.3 +7001 -0
- data/ElizaData/database/db.4 +7001 -0
- data/ElizaData/database/db.5 +7001 -0
- data/ElizaData/database/db.6 +7001 -0
- data/ElizaData/database/db.7 +7001 -0
- data/ElizaData/database/db.8 +7001 -0
- data/ElizaData/database/db.9 +7001 -0
- data/ElizaData/responses/hello.res +1 -0
- data/ElizaData/responses/i_agree.res +1 -0
- data/ElizaData/responses/i_am_listening_to_you.res +1 -0
- data/ElizaData/responses/please_explain.res +1 -0
- data/ElizaData/responses/thank_you.res +1 -0
- data/ElizaData/tiny.dict +211 -0
- data/ElizaData/words/adjectives1.words +906 -0
- data/ElizaData/words/adjectives2w.words +1 -0
- data/ElizaData/words/noun0.words +15 -0
- data/ElizaData/words/noun1.words +1391 -0
- data/ElizaData/words/noun2.words +1924 -0
- data/ElizaData/words/noun4.words +330 -0
- data/ElizaData/words/pronoun1.words +6 -0
- data/ElizaData/words/verb4.words +350 -0
- data/ElizaData/words/verb42.words +391 -0
- data/ElizaData/words/verb42w.words +1 -0
- data/ElizaData/words/verb43.words +402 -0
- data/ElizaData/words/verb43w.words +1 -0
- data/ElizaData/words/verb45.words +452 -0
- data/ElizaData/words/verb4w.words +1 -0
- data/ElizaData/words/verb5.words +13 -0
- data/ElizaData/words/verb61.words +35 -0
- data/ElizaData/words/verb62.words +41 -0
- data/ElizaData/words/verb83.words +17 -0
- data/Readme.txt +462 -0
- data/bin/rwdeliza +19 -0
- data/code/01rwdcore/01rwdcore.rb +29 -0
- data/code/01rwdcore/02helptexthashbegin.rb +4 -0
- data/code/01rwdcore/03helptexthash.rb +23 -0
- data/code/01rwdcore/04helptextend.rb +6 -0
- data/code/01rwdcore/jumplinkcommand.rb +26 -0
- data/code/01rwdcore/openhelpwindow.rb +31 -0
- data/code/01rwdcore/returntomain.rb +10 -0
- data/code/01rwdcore/rundocuments.rb +10 -0
- data/code/01rwdcore/runeditconfiguration.rb +10 -0
- data/code/01rwdcore/runhelpabout.rb +10 -0
- data/code/01rwdcore/runopentinkerdocument.rb +7 -0
- data/code/01rwdcore/rwdtinkerversion.rb +22 -0
- data/code/01rwdcore/rwdwindowreturn.rb +9 -0
- data/code/01rwdcore/selectiontab.rb +9 -0
- data/code/01rwdcore/setuphelpaboutoptions.rb +13 -0
- data/code/01rwdcore/setuptinkerdocuments.rb +6 -0
- data/code/01rwdcore/test_cases.rb +109 -0
- data/code/01rwdcore/test_harness.rb +13 -0
- data/code/01rwdcore/uploadreturns.rb +62 -0
- data/code/dd0viewphoto/dd0viewphoto.rb +3 -0
- data/code/superant.com.rwdeliza/0uninstallapplet.rb +10 -0
- data/code/superant.com.rwdeliza/eliza01.rb +45 -0
- data/code/superant.com.rwdeliza/helptexthashrwdeliza.rb +39 -0
- data/code/superant.com.rwdeliza/openhelpwindowrwdeliza.rb +23 -0
- data/code/superant.com.rwdeliza/runrwdshellwindow.rb +12 -0
- data/code/superant.com.rwdeliza/rwdtinkerversion.rb +10 -0
- data/code/superant.com.rwdeliza/tagsentence.rb +39 -0
- data/code/superant.com.rwdtinkerbackwindow/diagnostictab.rb +19 -0
- data/code/superant.com.rwdtinkerbackwindow/helptexthashtinkerwin2.rb +61 -0
- data/code/superant.com.rwdtinkerbackwindow/initiateapplets.rb +240 -0
- data/code/superant.com.rwdtinkerbackwindow/installgemapplet.rb +34 -0
- data/code/superant.com.rwdtinkerbackwindow/installremotegem.rb +20 -0
- data/code/superant.com.rwdtinkerbackwindow/listgemdirs.rb +12 -0
- data/code/superant.com.rwdtinkerbackwindow/listgemzips.rb +53 -0
- data/code/superant.com.rwdtinkerbackwindow/listinstalledfiles.rb +12 -0
- data/code/superant.com.rwdtinkerbackwindow/listzips.rb +27 -0
- data/code/superant.com.rwdtinkerbackwindow/loadconfigurationrecord.rb +22 -0
- data/code/superant.com.rwdtinkerbackwindow/loadconfigurationvariables.rb +14 -0
- data/code/superant.com.rwdtinkerbackwindow/network.rb +87 -0
- data/code/superant.com.rwdtinkerbackwindow/openappletname.rb +19 -0
- data/code/superant.com.rwdtinkerbackwindow/openhelpwindowtinkerwin2.rb +38 -0
- data/code/superant.com.rwdtinkerbackwindow/remotegemlist.rb +24 -0
- data/code/superant.com.rwdtinkerbackwindow/removeapplet.rb +46 -0
- data/code/superant.com.rwdtinkerbackwindow/removeappletvariables.rb +52 -0
- data/code/superant.com.rwdtinkerbackwindow/runremoteinstall.rb +11 -0
- data/code/superant.com.rwdtinkerbackwindow/runrwdtinkerbackwindow.rb +15 -0
- data/code/superant.com.rwdtinkerbackwindow/rwdtinkerwin2version.rb +13 -0
- data/code/superant.com.rwdtinkerbackwindow/saveconfigurationrecord.rb +19 -0
- data/code/superant.com.rwdtinkerbackwindow/viewappletcontents.rb +22 -0
- data/code/superant.com.rwdtinkerbackwindow/viewgemappletcontents.rb +24 -0
- data/code/superant.com.words/dictlookup.rb +20 -0
- data/code/superant.com.words/runfortunewindow.rb +14 -0
- data/code/superant.com.words/runrwdwordsbackwindow.rb +10 -0
- data/code/superant.com.words/runrwdwordsversion.rb +14 -0
- data/code/superant.com.words/rwdtinkerversion.rb +10 -0
- data/code/zz0applicationend/zz0end.rb +4 -0
- data/configuration/language.dist +8 -0
- data/configuration/rwdapplicationidentity.dist +3 -0
- data/configuration/rwdtinker.dist +18 -0
- data/configuration/rwdweliza-0.03.dist +31 -0
- data/configuration/tinkerwin2variables.dist +17 -0
- data/gui/00coreguibegin/applicationguitop.rwd +4 -0
- data/gui/frontwindow0/cc0openphoto.rwd +22 -0
- data/gui/frontwindowselections/00selectiontabbegin.rwd +11 -0
- data/gui/frontwindowselections/jumplinkcommands.rwd +15 -0
- data/gui/frontwindowselections/wwselectionend.rwd +3 -0
- data/gui/frontwindowtdocuments/00documentbegin.rwd +6 -0
- data/gui/frontwindowtdocuments/tinkerdocuments.rwd +14 -0
- data/gui/frontwindowtdocuments/zzdocumentend.rwd +8 -0
- data/gui/helpaboutbegin/zzzrwdlasttab.rwd +6 -0
- data/gui/helpaboutbegin/zzzzhelpscreenstart.rwd +3 -0
- data/gui/helpaboutbegin/zzzzzzhelpabouttab.rwd +15 -0
- data/gui/helpaboutzend/helpscreenend.rwd +3 -0
- data/gui/helpaboutzend/zhelpscreenstart2.rwd +3 -0
- data/gui/helpaboutzend/zzzzhelpabout2.rwd +15 -0
- data/gui/helpaboutzend/zzzzhelpscreen2end.rwd +3 -0
- data/gui/tinkerbackwindows/superant.com.refreshwindow/fortunerefreshwindowtwo.rwd +9 -0
- data/gui/tinkerbackwindows/superant.com.rwdeliza/1appname.rwd +5 -0
- data/gui/tinkerbackwindows/superant.com.rwdeliza/1eliza.rwd +21 -0
- data/gui/tinkerbackwindows/superant.com.rwdeliza/4sentance.rwd +21 -0
- data/gui/tinkerbackwindows/superant.com.rwdeliza/98jumplinkcommands.rwd +17 -0
- data/gui/tinkerbackwindows/superant.com.rwdeliza/zbackend.rwd +6 -0
- data/gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/1appname.rwd +5 -0
- data/gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/20downloadftp.rwd +45 -0
- data/gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/67viewconfiguration.rwd +29 -0
- data/gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/70rwddiagnostics.rwd +16 -0
- data/gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/m01menubegin.rwd +18 -0
- data/gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/zvbackend.rwd +6 -0
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/1appname.rwd +5 -0
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/40rwdlistzips.rwd +41 -0
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/45installremotezip.rwd +44 -0
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/50rwdlistapplets.rwd +44 -0
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/60editconfiguration.rwd +30 -0
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/70rwddiagnostics.rwd +29 -0
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/81jumplinkcommands.rwd +17 -0
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/9backend.rwd +6 -0
- data/gui/tinkerbackwindows/superant.com.tinkerhelpwindow/1appname.rwd +31 -0
- data/gui/tinkerbackwindows/superant.com.tinkerhelpwindow/9end.rwd +4 -0
- data/gui/tinkerbackwindows/superant.com.versionwindow/1appname.rwd +19 -0
- data/gui/tinkerbackwindows/superant.com.versionwindow/helpaboutwindow.rwd +17 -0
- data/gui/tinkerbackwindows/superant.com.words/1appname.rwd +4 -0
- data/gui/tinkerbackwindows/superant.com.words/1dictionary.rwd +19 -0
- data/gui/tinkerbackwindows/superant.com.words/3rwdfortune.rwd +14 -0
- data/gui/tinkerbackwindows/superant.com.words/77jumplinkcommands.rwd +17 -0
- data/gui/tinkerbackwindows/superant.com.words/z9end.rwd +6 -0
- data/gui/zzcoreguiend/yy9rwdend.rwd +4 -0
- data/init.rb +277 -0
- data/installed/rwdweliza-0.03.inf +24 -0
- data/installed/temp.rb +1 -0
- data/lang/en/rwdcore/languagefile.rb +58 -0
- data/lang/es/rwdcore/languagefile-es.rb +62 -0
- data/lang/fr/rwdcore/languagefile.rb +64 -0
- data/lang/jp/rwdcore/languagefile.rb +72 -0
- data/lang/nl/rwdcore/languagefile.rb +75 -0
- data/lib/dict.rb +438 -0
- data/lib/druida.rb +499 -0
- data/lib/hashslice.rb +71 -0
- data/lib/linguistics.rb +360 -0
- data/lib/linguistics/en.rb +1601 -0
- data/lib/linguistics/en/infinitive.rb +1148 -0
- data/lib/linguistics/en/linkparser.rb +142 -0
- data/lib/linguistics/en/wordnet.rb +253 -0
- data/lib/linguistics/iso639.rb +456 -0
- data/lib/linkparser.rb +461 -0
- data/lib/linkparser/connection.rb +81 -0
- data/lib/linkparser/connector.rb +201 -0
- data/lib/linkparser/definition.rb +225 -0
- data/lib/linkparser/dictionary.rb +208 -0
- data/lib/linkparser/linkage.rb +185 -0
- data/lib/linkparser/log.rb +39 -0
- data/lib/linkparser/sentence.rb +79 -0
- data/lib/linkparser/utils.rb +540 -0
- data/lib/linkparser/word.rb +92 -0
- data/lib/rconftool.rb +380 -0
- data/lib/rwd/browser.rb +123 -0
- data/lib/rwd/ftools.rb +174 -0
- data/lib/rwd/mime.rb +328 -0
- data/lib/rwd/net.rb +866 -0
- data/lib/rwd/ruby.rb +889 -0
- data/lib/rwd/rwd.rb +1942 -0
- data/lib/rwd/sgml.rb +236 -0
- data/lib/rwd/thread.rb +63 -0
- data/lib/rwd/tree.rb +371 -0
- data/lib/rwd/xml.rb +101 -0
- data/lib/zip/ioextras.rb +114 -0
- data/lib/zip/stdrubyext.rb +111 -0
- data/lib/zip/tempfile_bugfixed.rb +195 -0
- data/lib/zip/zip.rb +1378 -0
- data/lib/zip/zipfilesystem.rb +558 -0
- data/lib/zip/ziprequire.rb +61 -0
- data/rwd_files/HowTo_Eliza.txt +195 -0
- data/rwd_files/HowTo_Tinker.txt +471 -0
- data/rwd_files/HowTo_TinkerWin2.txt +202 -0
- data/rwd_files/Readme.txt +57 -0
- data/rwd_files/RubyWebDialogs.html +6 -0
- data/rwd_files/favicon.ico +0 -0
- data/rwd_files/rdoc-style.css +175 -0
- data/rwd_files/rwdapplications.html +54 -0
- data/rwd_files/tinker.png +0 -0
- data/rwdconfig.dist +21 -0
- data/rwdeliza.rb +1 -0
- data/tests/RubyGauge.rb +179 -0
- data/tests/checkdepends.sh +4 -0
- data/tests/cleancnf.sh +6 -0
- data/tests/makedist-rwdweliza.rb +56 -0
- data/tests/makedist.rb +66 -0
- data/tests/rdep.rb +354 -0
- data/tests/totranslate.lang +93 -0
- data/zips/rwdwaddresses-1.05.zip +0 -0
- data/zips/rwdwcalc-0.61.zip +0 -0
- data/zips/rwdwgutenberg-0.09.zip +0 -0
- data/zips/rwdwschedule-1.04.zip +0 -0
- data/zips/rwdwshell-1.04.zip +0 -0
- data/zips/temp.rb +1 -0
- data/zips/wrubyslippers-1.06.zip +0 -0
- metadata +282 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Spanish Language files for RwdTinker core
|
|
2
|
+
|
|
3
|
+
:applet_installed => '"applet instalado!"',
|
|
4
|
+
:application_version => '"Application Version"',
|
|
5
|
+
:clear => "Clear",
|
|
6
|
+
:cancel => "Cancelaci�n",
|
|
7
|
+
:clickfor_version => '"click para version"' ,
|
|
8
|
+
:clickbelowtoviewlistof_zip => '"click abajo a ver lista de zips"',
|
|
9
|
+
:documents => '"Documentos"',
|
|
10
|
+
:edit => "Editar" ,
|
|
11
|
+
:file_name => '"Fila Nombre:"',
|
|
12
|
+
:fill_record => '"Fill Record"',
|
|
13
|
+
:help => '"Ayuda"',
|
|
14
|
+
:help_about => '"Ayuda sobre"',
|
|
15
|
+
:install_applet => '"instale (rwdtinker) applet"',
|
|
16
|
+
:jumptoapplication_location => '"Jump to Application Location"',
|
|
17
|
+
:list_applets => '"List Applets"',
|
|
18
|
+
:listappletsavailablefor_installation => "List applets available for installation",
|
|
19
|
+
:listappletsinthegem_directory => '"List applets in the Gem Directory"',
|
|
20
|
+
|
|
21
|
+
:list_files => '"Lista de Archivos"',
|
|
22
|
+
:list_installed_gems => '"Lista de Instalado Gems"' ,
|
|
23
|
+
:list_photos => '"Lista de Photos"',
|
|
24
|
+
:list_zips => '"List Zips"',
|
|
25
|
+
:listzipdirappletsavailable => '"Lista (zip directory) applets available for installation"',
|
|
26
|
+
:menu_panel => '"panel de herramientas"',
|
|
27
|
+
:module_unknown => '"Module desconocido"',
|
|
28
|
+
:next => "Siguiente",
|
|
29
|
+
:open => "Abrir",
|
|
30
|
+
:open_document => '"Abrir documento"',
|
|
31
|
+
:openselectedhelp_about => '"Open selected help about"',
|
|
32
|
+
:reload_variables => '"Reload Variables"' ,
|
|
33
|
+
:remove_applet => '"remove applet"',
|
|
34
|
+
:return => "anterior",
|
|
35
|
+
:rwdtinker_window_2 => '"RwdTinker Window 2"',
|
|
36
|
+
:rwdtinker => "RwdTinker",
|
|
37
|
+
:rwdtinker_back_window => '"RwdTinker Ventana Trasera"',
|
|
38
|
+
:rwdtinker_help => '"RwdTinker Ayuda"',
|
|
39
|
+
:rwdtinker_help_window => '"RwdTinker Ventana Ayuda"',
|
|
40
|
+
:showdocument_list => '"Show Document List"',
|
|
41
|
+
:showhelpabout_links => '"Show Help About Links"',
|
|
42
|
+
|
|
43
|
+
:showjump_links => '"Mostrar enlace saltar"',
|
|
44
|
+
|
|
45
|
+
:save => "Guardar" ,
|
|
46
|
+
:save_changes => '"Guardar los cambios"',
|
|
47
|
+
:rwdtinker => "RwdTinker",
|
|
48
|
+
:selection_panel => '"Panel de Selecci�n"',
|
|
49
|
+
|
|
50
|
+
:tinker_logo => '"Insignia de Tinker"',
|
|
51
|
+
:selection_tab => '"Selection Tab"',
|
|
52
|
+
:tinkerback_window => '"Tinker Back Window"',
|
|
53
|
+
:viewapplet_contents => '"View Applet Contents"',
|
|
54
|
+
:viewalreadyinstalled_applications => '"View already installed GEM applications"',
|
|
55
|
+
:viewinstalled_text => '"View Install Text"',
|
|
56
|
+
:view_platform => '"view platform"',
|
|
57
|
+
:viewplatform_information => '"View Platform Information"',
|
|
58
|
+
:view_event => '"Ver evento"',
|
|
59
|
+
:viewinstall_text => '"Ver Texto"' ,
|
|
60
|
+
:viewlistinstall_files => '"View List of Installed Files"',
|
|
61
|
+
:view_photo => '"Ver Photo"' ,
|
|
62
|
+
:window => "Ventana" ,
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# English Language files for RwdTinker core
|
|
2
|
+
|
|
3
|
+
:applet_installed => '"applet installed!"',
|
|
4
|
+
:application_version => '"Application Version"',
|
|
5
|
+
:clear => "Clear",
|
|
6
|
+
:cancel => "Cancel",
|
|
7
|
+
:clickfor_version => "Click for Version" ,
|
|
8
|
+
:clickbelowtoviewlistof_zip => '"click below to view lists of zips"',
|
|
9
|
+
:documents => '"Documents"',
|
|
10
|
+
:edit => "edit" ,
|
|
11
|
+
:file_name => '"File Name:"',
|
|
12
|
+
:fill_record => '"Fill Record"',
|
|
13
|
+
:gemcommands => '"Gem Commands"',
|
|
14
|
+
:gemfiles => '"Gem Files"' ,
|
|
15
|
+
:gemdocs => '"Gem Documents"' ,
|
|
16
|
+
:gem_name => '"Gem Name"' ,
|
|
17
|
+
:help => '"Help"',
|
|
18
|
+
:help_about => '"Help About"',
|
|
19
|
+
:installgem => '"Install Gem"' ,
|
|
20
|
+
:install_applet => '"install (rwdtinker) applet"',
|
|
21
|
+
:jumptoapplication_location => '"Jump to Application Location"',
|
|
22
|
+
:list_applets => '"List Applets"',
|
|
23
|
+
:listappletsinthegem_directory => '"List applets in the Gem Directory"',
|
|
24
|
+
:listappletsavailablefor_installation => "List applets available for installation",
|
|
25
|
+
:list_files => '"List Files"',
|
|
26
|
+
:list_installed_gems => '"List installed Gems"' ,
|
|
27
|
+
:list_photos => '"List Photos"',
|
|
28
|
+
:list_zips => '"List Zips"',
|
|
29
|
+
:listzipdirappletsavailable => '"List (zip directory) applets available for installation"',
|
|
30
|
+
:menu_panel => '"Menu Panel"',
|
|
31
|
+
:module_unknown => '"Unknown Module"',
|
|
32
|
+
:next => '"Next"',
|
|
33
|
+
:open => "Open",
|
|
34
|
+
:open_document => '"Open Document"',
|
|
35
|
+
:openselectedhelp_about => '"Open selected help about"',
|
|
36
|
+
:reload_variables => '"Reload Variables"' ,
|
|
37
|
+
:remove_applet => '"remove applet"',
|
|
38
|
+
:return => "Return",
|
|
39
|
+
:rwdtinker_window_2 => "RwdTinker Window 2",
|
|
40
|
+
:rwdtinker => "RwdTinker",
|
|
41
|
+
:rwdtinker_back_window => '"RwdTinker Back Window"',
|
|
42
|
+
:rwdtinker_help => '"RwdTinker Help"',
|
|
43
|
+
:rwdtinker_help_window => '"RwdTinker Help Window"',
|
|
44
|
+
:showjump_links => '"Show Jump Links"',
|
|
45
|
+
:showdocument_list => '"Show Document List"',
|
|
46
|
+
:showhelpabout_links => '"Show Help About Links"',
|
|
47
|
+
|
|
48
|
+
:save => "Save" ,
|
|
49
|
+
:save_changes => '"Save Changes"',
|
|
50
|
+
:selection_panel => '"Selection Panel"',
|
|
51
|
+
:selection_tab => '"Selection Tab"',
|
|
52
|
+
:tinker_logo => "Tinker Logo",
|
|
53
|
+
:tinkerback_window => '"Tinker Back Window"',
|
|
54
|
+
:viewapplet_contents => '"View Applet Contents"',
|
|
55
|
+
:viewalreadyinstalled_applications => '"View already installed GEM applications"',
|
|
56
|
+
:viewinstalled_text => '"View Install Text"',
|
|
57
|
+
:view_platform => '"view platform"',
|
|
58
|
+
:viewplatform_information => '"View Platform Information"',
|
|
59
|
+
:view_event => '"View event"',
|
|
60
|
+
:view_gem => '"View Gem"',
|
|
61
|
+
:viewinstall_text => '"View Install Text"' ,
|
|
62
|
+
:viewlistinstall_files => '"View List of Installed Files"',
|
|
63
|
+
:view_photo => '"View Photo"',
|
|
64
|
+
:window => "Window" ,
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Japanese Language files for RwdTinker core
|
|
2
|
+
:cancel => "とりけし",
|
|
3
|
+
:open => "あける",
|
|
4
|
+
:view_event => "けんかい ぎょうじょ",
|
|
5
|
+
:edit_event => "しゅうろく",
|
|
6
|
+
:install_gem => "インストール",
|
|
7
|
+
:list_installed_gems => "かきつらねる",
|
|
8
|
+
:view_gem => "けんかい",
|
|
9
|
+
:edit => "しゅうろく",
|
|
10
|
+
:gem_commands => "コマンド",
|
|
11
|
+
:gem_files => "ファイル",
|
|
12
|
+
:gem_docs => "しょるい",
|
|
13
|
+
:gem_name => "こうもくめい",
|
|
14
|
+
:selection_panel => "せんたく",
|
|
15
|
+
:documents => "オンラインマニュアル",
|
|
16
|
+
|
|
17
|
+
# English Language files for RwdTinker core
|
|
18
|
+
|
|
19
|
+
:applet_installed => '"applet installed!"',
|
|
20
|
+
:application_version => '"Application Version"',
|
|
21
|
+
:clear => "Clear",
|
|
22
|
+
:clickfor_version => "Click for Version" ,
|
|
23
|
+
:clickbelowtoviewlistof_zip => '"click below to view lists of zips"',
|
|
24
|
+
|
|
25
|
+
:file_name => '"File Name:"',
|
|
26
|
+
:fill_record => '"Fill Record"',
|
|
27
|
+
:help => '"Help"',
|
|
28
|
+
:help_about => '"Help About"',
|
|
29
|
+
|
|
30
|
+
:install_applet => '"install (rwdtinker) applet"',
|
|
31
|
+
:jumptoapplication_location => '"Jump to Application Location"',
|
|
32
|
+
:list_applets => '"List Applets"',
|
|
33
|
+
:listappletsinthegem_directory => '"List applets in the Gem Directory"',
|
|
34
|
+
:listappletsavailablefor_installation => "List applets available for installation",
|
|
35
|
+
:list_files => '"List Files"',
|
|
36
|
+
|
|
37
|
+
:list_photos => '"List Photos"',
|
|
38
|
+
:list_zips => '"List Zips"',
|
|
39
|
+
:listzipdirappletsavailable => '"List (zip directory) applets available for installation"',
|
|
40
|
+
:menu_panel => '"Menu Panel"',
|
|
41
|
+
:module_unknown => '"Unknown Module"',
|
|
42
|
+
:next => '"Next"',
|
|
43
|
+
|
|
44
|
+
:open_document => '"Open Document"',
|
|
45
|
+
:openselectedhelp_about => '"Open selected help about"',
|
|
46
|
+
:reload_variables => '"Reload Variables"' ,
|
|
47
|
+
:remove_applet => '"remove applet"',
|
|
48
|
+
:return => "Return",
|
|
49
|
+
:rwdtinker_window_2 => "RwdTinker Window 2",
|
|
50
|
+
:rwdtinker => "RwdTinker",
|
|
51
|
+
:rwdtinker_back_window => '"RwdTinker Back Window"',
|
|
52
|
+
:rwdtinker_help => '"RwdTinker Help"',
|
|
53
|
+
:rwdtinker_help_window => '"RwdTinker Help Window"',
|
|
54
|
+
:showjump_links => '"Show Jump Links"',
|
|
55
|
+
:showdocument_list => '"Show Document List"',
|
|
56
|
+
:showhelpabout_links => '"Show Help About Links"',
|
|
57
|
+
|
|
58
|
+
:save => "Save" ,
|
|
59
|
+
:save_changes => '"Save Changes"',
|
|
60
|
+
|
|
61
|
+
:selection_tab => '"Selection Tab"',
|
|
62
|
+
:tinker_logo => "Tinker Logo",
|
|
63
|
+
:tinkerback_window => '"Tinker Back Window"',
|
|
64
|
+
:viewapplet_contents => '"View Applet Contents"',
|
|
65
|
+
:viewalreadyinstalled_applications => '"View already installed GEM applications"',
|
|
66
|
+
:viewinstalled_text => '"View Install Text"',
|
|
67
|
+
:view_platform => '"view platform"',
|
|
68
|
+
:viewplatform_information => '"View Platform Information"',
|
|
69
|
+
:viewinstall_text => '"View Install Text"' ,
|
|
70
|
+
:viewlistinstall_files => '"View List of Installed Files"',
|
|
71
|
+
:view_photo => '"View Photo"',
|
|
72
|
+
:window => "Window" ,
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# English Language files for RwdTinker core
|
|
2
|
+
|
|
3
|
+
:cancel => '"Annuleren"',
|
|
4
|
+
:open => '"Openen"',
|
|
5
|
+
:save => '"Opslaan"',
|
|
6
|
+
:window => '"Venster"',
|
|
7
|
+
:applet_installed => '"Applet geinstalleerd"',
|
|
8
|
+
:clickfor_version => '"Klier hier voor de Versie"',
|
|
9
|
+
:documents => '"Documenten"',
|
|
10
|
+
:help => '"Help"',
|
|
11
|
+
:module_unknown => '"Module onbekend"',
|
|
12
|
+
:next => '"Volgende"',
|
|
13
|
+
:rwdtinker => '"RWDTinker"',
|
|
14
|
+
:rwdtinker_help_window => '"RWDTinker Help Venster"',
|
|
15
|
+
:rwdtinker_help => '"RWDTinker Help"',
|
|
16
|
+
:rwdtinker_window_2 => '"RWDTinker Venster 2"',
|
|
17
|
+
:rwdtinker_back_window => '"RwdTinker Back Venster"',
|
|
18
|
+
:tinker_logo => '"RWDTinker Logo"',
|
|
19
|
+
:selection_panel => '"Selectie Paneel"',
|
|
20
|
+
# English Language files for RwdTinker core
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
:applet_installed => '"applet installed!"',
|
|
24
|
+
:application_version => '"Application Version"',
|
|
25
|
+
:clear => "Clear",
|
|
26
|
+
:clickfor_version => "Click for Version" ,
|
|
27
|
+
:clickbelowtoviewlistof_zip => '"click below to view lists of zips"',
|
|
28
|
+
|
|
29
|
+
:edit => "edit" ,
|
|
30
|
+
:file_name => '"File Name:"',
|
|
31
|
+
:fill_record => '"Fill Record"',
|
|
32
|
+
:help => '"Help"',
|
|
33
|
+
:help_about => '"Help About"',
|
|
34
|
+
:install_applet => '"install (rwdtinker) applet"',
|
|
35
|
+
:jumptoapplication_location => '"Jump to Application Location"',
|
|
36
|
+
:list_applets => '"List Applets"',
|
|
37
|
+
:listappletsinthegem_directory => '"List applets in the Gem Directory"',
|
|
38
|
+
:listappletsavailablefor_installation => "List applets available for installation",
|
|
39
|
+
:list_files => '"List Files"',
|
|
40
|
+
:list_installed_gems => '"List installed Gems"' ,
|
|
41
|
+
:list_photos => '"List Photos"',
|
|
42
|
+
:list_zips => '"List Zips"',
|
|
43
|
+
:listzipdirappletsavailable => '"List (zip directory) applets available for installation"',
|
|
44
|
+
:menu_panel => '"Menu Panel"',
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
:open_document => '"Open Document"',
|
|
48
|
+
:openselectedhelp_about => '"Open selected help about"',
|
|
49
|
+
:reload_variables => '"Reload Variables"' ,
|
|
50
|
+
:remove_applet => '"remove applet"',
|
|
51
|
+
:return => "Return",
|
|
52
|
+
:rwdtinker_window_2 => "RwdTinker Window 2",
|
|
53
|
+
:rwdtinker => "RwdTinker",
|
|
54
|
+
:rwdtinker_back_window => '"RwdTinker Back Window"',
|
|
55
|
+
:rwdtinker_help => '"RwdTinker Help"',
|
|
56
|
+
:rwdtinker_help_window => '"RwdTinker Help Window"',
|
|
57
|
+
:showjump_links => '"Show Jump Links"',
|
|
58
|
+
:showdocument_list => '"Show Document List"',
|
|
59
|
+
:showhelpabout_links => '"Show Help About Links"',
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
:save_changes => '"Save Changes"',
|
|
63
|
+
:selection_tab => '"Selection Tab"',
|
|
64
|
+
:tinker_logo => "Tinker Logo",
|
|
65
|
+
:tinkerback_window => '"Tinker Back Window"',
|
|
66
|
+
:viewapplet_contents => '"View Applet Contents"',
|
|
67
|
+
:viewalreadyinstalled_applications => '"View already installed GEM applications"',
|
|
68
|
+
:viewinstalled_text => '"View Install Text"',
|
|
69
|
+
:view_platform => '"view platform"',
|
|
70
|
+
:viewplatform_information => '"View Platform Information"',
|
|
71
|
+
:view_event => '"View event"',
|
|
72
|
+
:viewinstall_text => '"View Install Text"' ,
|
|
73
|
+
:viewlistinstall_files => '"View List of Installed Files"',
|
|
74
|
+
:view_photo => '"View Photo"',
|
|
75
|
+
|
data/lib/dict.rb
ADDED
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
# dict.rb - a client-side implementation of the DICT protocol (RFC 2229)
|
|
2
|
+
#
|
|
3
|
+
# $Id: dict.rb,v 1.25 2003/04/19 06:53:41 ianmacd Exp $
|
|
4
|
+
#
|
|
5
|
+
# Version : 0.9.2
|
|
6
|
+
# Author : Ian Macdonald <ian@caliban.org>
|
|
7
|
+
#
|
|
8
|
+
# Copyright (C) 2002-2003 Ian Macdonald
|
|
9
|
+
#
|
|
10
|
+
# This program is free software; you can redistribute it and/or modify
|
|
11
|
+
# it under the terms of the GNU General Public License as published by
|
|
12
|
+
# the Free Software Foundation; either version 2, or (at your option)
|
|
13
|
+
# any later version.
|
|
14
|
+
#
|
|
15
|
+
# This program is distributed in the hope that it will be useful,
|
|
16
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18
|
+
# GNU General Public License for more details.
|
|
19
|
+
#
|
|
20
|
+
# You should have received a copy of the GNU General Public License
|
|
21
|
+
# along with this program; if not, write to the Free Software Foundation,
|
|
22
|
+
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
23
|
+
|
|
24
|
+
=begin
|
|
25
|
+
|
|
26
|
+
= NAME
|
|
27
|
+
Ruby/DICT - client-side DICT protocol library
|
|
28
|
+
= SYNOPSIS
|
|
29
|
+
|
|
30
|
+
require 'dict'
|
|
31
|
+
|
|
32
|
+
dict = DICT.new('dict.org', DICT::DEFAULT_PORT)
|
|
33
|
+
dict.client('a Ruby/DICT client')
|
|
34
|
+
definitions = dict.define(DICT::ALL_DATABASES, 'ruby')
|
|
35
|
+
|
|
36
|
+
if definitions
|
|
37
|
+
definitions.each do |d|
|
|
38
|
+
printf("From %s [%s]:\n\n", d.description, d.database)
|
|
39
|
+
d.definition.each { |line| print line }
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
dict.disconnect
|
|
44
|
+
|
|
45
|
+
= DESCRIPTION
|
|
46
|
+
Ruby/DICT is a client-side library implementation of the DICT protocol,
|
|
47
|
+
as described in ((<RFC 2229|URL:ftp://ftp.isi.edu/in-notes/rfc2229.txt>)).
|
|
48
|
+
= CLASS METHODS
|
|
49
|
+
--- DICT.new(hosts, port = DICT::DEFAULT_PORT, debug = false, verbose = false)
|
|
50
|
+
This creates a new instance of the DICT class. A DICT object has four
|
|
51
|
+
instance variables: ((|capabilities|)), ((|code|)), ((|message|)) and
|
|
52
|
+
((|msgid|)). ((|capabilities|)) is an array of Strings relating to
|
|
53
|
+
capabilities implemented on the server, ((|code|)) is the last status
|
|
54
|
+
code returned by the server, ((|message|)) is the text of the message
|
|
55
|
+
related to ((|code|)), and ((|msgid|)) is the message ID returned by the
|
|
56
|
+
server.
|
|
57
|
+
= INSTANCE METHODS
|
|
58
|
+
--- DICT#disconnect
|
|
59
|
+
Disconnect from the server.
|
|
60
|
+
--- DICT#define(database, word)
|
|
61
|
+
Obtain definitions for ((|word|)) from ((|database|)). A list of valid
|
|
62
|
+
databases can be obtained using DICT#show(DICT::DATABASES).
|
|
63
|
+
|
|
64
|
+
To show just the first definition found, use ((|DICT::FIRST_DATABASE|))
|
|
65
|
+
as the database name. To show definitions from all databases, use
|
|
66
|
+
((|DICT::ALL_DATABASES|)).
|
|
67
|
+
|
|
68
|
+
On success, this returns an array of Struct:Definition objects.
|
|
69
|
+
((*nil*)) is returned on failure.
|
|
70
|
+
--- DICT#match(database, strategy, word)
|
|
71
|
+
Obtain matches for ((|word|)) from ((|database|)) using ((|strategy|)).
|
|
72
|
+
|
|
73
|
+
On success, a hash of arrays is returned. The keys of the hash are the
|
|
74
|
+
database names and the values are arrays of word matches that were found
|
|
75
|
+
in that database. ((*nil*)) is returned on failure.
|
|
76
|
+
--- DICT#show_server
|
|
77
|
+
This method retrieves information on the server itself.
|
|
78
|
+
|
|
79
|
+
A String is returned on success, while ((*nil*)) is returned on failure.
|
|
80
|
+
--- DICT#show_db
|
|
81
|
+
This method retrieves information on the databases offered by the server.
|
|
82
|
+
|
|
83
|
+
A Hash indexed on database name and containing database descriptions
|
|
84
|
+
is returned on success, while ((*nil*)) is returned on failure.
|
|
85
|
+
--- DICT#show_info(database)
|
|
86
|
+
This method retrieves information on a particular database offered by
|
|
87
|
+
the server.
|
|
88
|
+
|
|
89
|
+
A String is returned on success, while ((*nil*)) is returned on failure.
|
|
90
|
+
--- DICT#show_strat
|
|
91
|
+
This method retrieves information on the strategies offered by the server.
|
|
92
|
+
|
|
93
|
+
A Hash indexed on strategy name and containing strategy descriptions
|
|
94
|
+
is returned on success, while ((*nil*)) is returned on failure.
|
|
95
|
+
--- DICT#status
|
|
96
|
+
This method returns a single line String of status information from the
|
|
97
|
+
server.
|
|
98
|
+
--- DICT#help
|
|
99
|
+
This method returns a String of help information from the server,
|
|
100
|
+
describing the commands it implements.
|
|
101
|
+
--- DICT#client
|
|
102
|
+
This method sends a single line String of information describing a client
|
|
103
|
+
application to the server.
|
|
104
|
+
--- DICT#auth(user, secret)
|
|
105
|
+
This method attempts to authenticate ((|user|)) to the server using
|
|
106
|
+
((|secret|)). Note that ((|secret|)) is not literally passed to the server.
|
|
107
|
+
= CONSTANTS
|
|
108
|
+
Ruby/DICT uses a lot of constants, mostly for the status codes
|
|
109
|
+
returned by DICT servers. See the source for details.
|
|
110
|
+
|
|
111
|
+
Some of the more interesting other constants:
|
|
112
|
+
: DICT::FIRST_DATABASE
|
|
113
|
+
Define or match, stopping at first database where match is found
|
|
114
|
+
: DICT::ALL_DATABASES
|
|
115
|
+
Define or match, gathering matches from all databases
|
|
116
|
+
: DICT::DEFAULT_MATCH_STRATEGY
|
|
117
|
+
Match using a server-dependent default strategy, which should be the best
|
|
118
|
+
strategy available for interactive spell checking
|
|
119
|
+
: DICT::DEFAULT_PORT
|
|
120
|
+
The default port used by DICT servers, namely 2628
|
|
121
|
+
: DICT::ERROR
|
|
122
|
+
A Regex constant matching any server status code indicating an error
|
|
123
|
+
= EXCEPTIONS
|
|
124
|
+
Exception classes are subclasses of the container class DICTError, which is,
|
|
125
|
+
itself, a subclass of RuntimeError
|
|
126
|
+
--- ConnectError.new(message, code = 2)
|
|
127
|
+
A ConnectError is raised if DICT::new is unable to connect to the chosen
|
|
128
|
+
DICT server for any reason. Program execution will terminate.
|
|
129
|
+
--- ProtocolError.new(message, code = 3)
|
|
130
|
+
A ProtocolError exception can be used if a server operation returns a
|
|
131
|
+
status code matching DICT::ERROR. This does not happen automatically. The
|
|
132
|
+
code is stored in the ((|code|)) attribute of the instance of the DICT
|
|
133
|
+
object. Program execution will terminate.
|
|
134
|
+
= AUTHOR
|
|
135
|
+
Written by Ian Macdonald <ian@caliban.org>
|
|
136
|
+
= COPYRIGHT
|
|
137
|
+
Copyright (C) 2002-2003 Ian Macdonald
|
|
138
|
+
|
|
139
|
+
This is free software; see the source for copying conditions.
|
|
140
|
+
There is NO warranty; not even for MERCHANTABILITY or FITNESS
|
|
141
|
+
FOR A PARTICULAR PURPOSE.
|
|
142
|
+
= SEE ALSO
|
|
143
|
+
* ((<"Ruby/DICT home page - http://www.caliban.org/ruby/"|URL:http://www.caliban.org/ruby/>))
|
|
144
|
+
* ((<"The DICT development group - http://www.dict.org/"|URL:http://www.dict.org/>))
|
|
145
|
+
* ((<"RFC 2229 - ftp://ftp.isi.edu/in-notes/rfc2229.txt"|URL:ftp://ftp.isi.edu/in-notes/rfc2229.txt>))
|
|
146
|
+
= BUGS
|
|
147
|
+
Send all bug reports, enhancement requests and patches to the
|
|
148
|
+
author.
|
|
149
|
+
= HISTORY
|
|
150
|
+
$Id: dict.rb,v 1.25 2003/04/19 06:53:41 ianmacd Exp $
|
|
151
|
+
|
|
152
|
+
=end
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
require 'socket'
|
|
156
|
+
require 'md5'
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
# lines that start with .. need to be reduced to .
|
|
160
|
+
#
|
|
161
|
+
class String
|
|
162
|
+
def undot!
|
|
163
|
+
sub!(/^\.\./, '.')
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
# a basic exception class for DICT errors
|
|
169
|
+
#
|
|
170
|
+
class DICTError < RuntimeError
|
|
171
|
+
def initialize(message, code = 1)
|
|
172
|
+
$stderr.puts message
|
|
173
|
+
exit code
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
# deal with connection errors
|
|
179
|
+
#
|
|
180
|
+
class ConnectError < DICTError
|
|
181
|
+
def initialize(message, code = 2)
|
|
182
|
+
super
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
# deal with status code errors
|
|
188
|
+
#
|
|
189
|
+
class ProtocolError < DICTError
|
|
190
|
+
def initialize(message, code = 3)
|
|
191
|
+
super
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# a structure for definitions
|
|
196
|
+
#
|
|
197
|
+
Definition = Struct.new('Definition', :word, :definition, :database,
|
|
198
|
+
:description)
|
|
199
|
+
|
|
200
|
+
class DICT
|
|
201
|
+
attr_reader :capabilities, :code, :message, :msgid
|
|
202
|
+
|
|
203
|
+
DATABASES_PRESENT = '110'
|
|
204
|
+
STRATEGIES_AVAILABLE = '111'
|
|
205
|
+
DATABASE_INFORMATION = '112'
|
|
206
|
+
HELP_TEXT = '113'
|
|
207
|
+
SERVER_INFORMATION = '114'
|
|
208
|
+
CHALLENGE_FOLLOWS = '130'
|
|
209
|
+
DEFINITIONS_RETRIEVED = '150'
|
|
210
|
+
WORD_DEFINITION = '151'
|
|
211
|
+
MATCHES_PRESENT = '152'
|
|
212
|
+
STATUS_RESPONSE = '210'
|
|
213
|
+
CONNECTION_ESTABLISHED = '220'
|
|
214
|
+
CLOSING_CONNECTION = '221'
|
|
215
|
+
AUTHENTICATION_SUCCESSFUL = '230'
|
|
216
|
+
OK = '250'
|
|
217
|
+
SEND_RESPONSE = '330'
|
|
218
|
+
TEMPORARILY_UNAVAILABLE = '420'
|
|
219
|
+
SHUTTING_DOWN = '421'
|
|
220
|
+
UNRECOGNISED_COMMAND = '500'
|
|
221
|
+
ILLEGAL_PARAMETERS = '501'
|
|
222
|
+
COMMAND_NOT_IMPLEMENTED = '502'
|
|
223
|
+
PARAMETER_NOT_IMPLEMENTED = '503'
|
|
224
|
+
ACCESS_DENIED = '530'
|
|
225
|
+
AUTH_DENIED = '531'
|
|
226
|
+
UNKNOWN_MECHANISM = '532'
|
|
227
|
+
INVALID_DATABASE = '550'
|
|
228
|
+
INVALID_STRATEGY = '551'
|
|
229
|
+
NO_MATCH = '552'
|
|
230
|
+
NO_DATABASES_PRESENT = '554'
|
|
231
|
+
NO_STRATEGIES_AVAILABLE = '555'
|
|
232
|
+
|
|
233
|
+
ALL_DATABASES = '*'
|
|
234
|
+
DEFAULT_MATCH_STRATEGY = '.'
|
|
235
|
+
DEFAULT_PORT = 2628
|
|
236
|
+
ERROR = /^[45]/
|
|
237
|
+
FIRST_DATABASE = '!'
|
|
238
|
+
MAX_LINE_LENGTH = 1024
|
|
239
|
+
PAIR = /^(\S+)\s"(.+)"\r$/
|
|
240
|
+
REPLY_CODE = /^\d\d\d/
|
|
241
|
+
|
|
242
|
+
def initialize(hosts, port = DEFAULT_PORT, debug = false, verbose = false)
|
|
243
|
+
hosts.each do |host|
|
|
244
|
+
@debug = debug
|
|
245
|
+
@verbose = verbose
|
|
246
|
+
printf("Attempting to connect to %s:%d...\n", host, port) if @verbose
|
|
247
|
+
|
|
248
|
+
begin
|
|
249
|
+
@sock = TCPSocket.open(host, port)
|
|
250
|
+
rescue
|
|
251
|
+
next # cycle through list of servers, if more than one
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
break # continue if connection to this host succeeded
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
# catch failure
|
|
258
|
+
raise ConnectError, 'Unable to connect to host' unless defined? @sock
|
|
259
|
+
|
|
260
|
+
# check status line on connect
|
|
261
|
+
line = get_line
|
|
262
|
+
raise ConnectError, line if line =~ ERROR
|
|
263
|
+
|
|
264
|
+
caps, @msgid = /<(.+?)>\s(<.+>)/.match(line)[1..2]
|
|
265
|
+
@capabilities = caps.split(/\./)
|
|
266
|
+
if @verbose
|
|
267
|
+
printf("Capabilities: %s\n", @capabilities.join(', '))
|
|
268
|
+
printf("Msgid: %s\n", @msgid)
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
private
|
|
273
|
+
|
|
274
|
+
# output a line to the server
|
|
275
|
+
#
|
|
276
|
+
def send_line(command)
|
|
277
|
+
line = command + "\r\n"
|
|
278
|
+
$stderr.printf("SEND: %s", line) if @debug
|
|
279
|
+
@sock.print(line)
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# get a line of input from the server
|
|
283
|
+
#
|
|
284
|
+
def get_line
|
|
285
|
+
line = @sock.readline("\r\n")
|
|
286
|
+
$stderr.printf("RECV: %s", line) if @debug
|
|
287
|
+
line
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
# send a command and get a response
|
|
291
|
+
#
|
|
292
|
+
def exec_cmd(command)
|
|
293
|
+
send_line(command)
|
|
294
|
+
line = get_line
|
|
295
|
+
@code, @message = /^(\d\d\d)\s(.*)$/.match(line)[1..2]
|
|
296
|
+
# remember the command just executed
|
|
297
|
+
@command = command
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
# determine whether we're at the end of this response
|
|
301
|
+
#
|
|
302
|
+
def end_of_text?(line)
|
|
303
|
+
line =~ /^\.\r$/ ? true : false
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
# generic method to issue command and parse response
|
|
307
|
+
#
|
|
308
|
+
def parse_response
|
|
309
|
+
return nil if @code =~ ERROR
|
|
310
|
+
|
|
311
|
+
while line = get_line
|
|
312
|
+
# on first pass through loop, create list as either a hash
|
|
313
|
+
# or a string, depending # on what data looks like
|
|
314
|
+
list ||= line =~ PAIR ? Hash.new : ''
|
|
315
|
+
|
|
316
|
+
# check for end of data
|
|
317
|
+
return list if line =~ REPLY_CODE
|
|
318
|
+
|
|
319
|
+
if ! end_of_text? line
|
|
320
|
+
line.undot!
|
|
321
|
+
(list << line; next) if list.is_a?(String) # list is just text
|
|
322
|
+
|
|
323
|
+
# list is a hash of data pairings
|
|
324
|
+
name, desc = PAIR.match(line)[1..2]
|
|
325
|
+
if @command =~ /^MATCH/
|
|
326
|
+
list[name] = Array.new unless list[name]
|
|
327
|
+
list[name] << desc
|
|
328
|
+
else
|
|
329
|
+
list[name] = desc
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
end
|
|
333
|
+
end
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
public
|
|
337
|
+
|
|
338
|
+
# QUIT from the server
|
|
339
|
+
#
|
|
340
|
+
def disconnect
|
|
341
|
+
exec_cmd('QUIT')
|
|
342
|
+
@sock.close
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
# DEFINE a word
|
|
346
|
+
#
|
|
347
|
+
def define(db, word)
|
|
348
|
+
definitions = Array.new
|
|
349
|
+
d = Definition.new
|
|
350
|
+
d.word = word
|
|
351
|
+
d.definition = Array.new
|
|
352
|
+
|
|
353
|
+
exec_cmd('DEFINE %s "%s"' % [ db, word ])
|
|
354
|
+
|
|
355
|
+
return nil if @code =~ ERROR
|
|
356
|
+
|
|
357
|
+
while line = get_line
|
|
358
|
+
return definitions if line =~ /^#{OK}/
|
|
359
|
+
|
|
360
|
+
if line =~ /^#{WORD_DEFINITION}/
|
|
361
|
+
word, d.database, d.description =
|
|
362
|
+
/^\d\d\d\s"(.+?)"\s(\S+)\s"(.+)"\r$/.match(line)[1..3]
|
|
363
|
+
elsif end_of_text? line # finish definition and start a new one
|
|
364
|
+
definitions << d
|
|
365
|
+
d = Definition.new
|
|
366
|
+
d.word = word
|
|
367
|
+
d.definition = Array.new
|
|
368
|
+
else
|
|
369
|
+
line.undot!
|
|
370
|
+
d.definition << line
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
end
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
# MATCH a word
|
|
377
|
+
#
|
|
378
|
+
def match(db, strategy, word)
|
|
379
|
+
exec_cmd('MATCH %s %s "%s"' % [ db, strategy, word ])
|
|
380
|
+
parse_response
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
# get database list
|
|
384
|
+
#
|
|
385
|
+
def show_db
|
|
386
|
+
exec_cmd("SHOW DB")
|
|
387
|
+
parse_response
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
# get strategy list
|
|
391
|
+
#
|
|
392
|
+
def show_strat
|
|
393
|
+
exec_cmd("SHOW STRAT")
|
|
394
|
+
parse_response
|
|
395
|
+
end
|
|
396
|
+
|
|
397
|
+
# get information on database
|
|
398
|
+
#
|
|
399
|
+
def show_info(db)
|
|
400
|
+
exec_cmd('SHOW INFO %s' % db)
|
|
401
|
+
parse_response
|
|
402
|
+
end
|
|
403
|
+
|
|
404
|
+
# get server information
|
|
405
|
+
#
|
|
406
|
+
def show_server
|
|
407
|
+
exec_cmd("SHOW SERVER")
|
|
408
|
+
parse_response
|
|
409
|
+
end
|
|
410
|
+
|
|
411
|
+
# request server STATUS information
|
|
412
|
+
#
|
|
413
|
+
def status
|
|
414
|
+
exec_cmd('STATUS')
|
|
415
|
+
@message
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
# request server-side HELP
|
|
419
|
+
#
|
|
420
|
+
def help
|
|
421
|
+
exec_cmd('HELP')
|
|
422
|
+
parse_response
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
# send CLIENT information
|
|
426
|
+
#
|
|
427
|
+
def client(info)
|
|
428
|
+
exec_cmd('CLIENT %s' % info)
|
|
429
|
+
end
|
|
430
|
+
|
|
431
|
+
# AUTHorise user
|
|
432
|
+
#
|
|
433
|
+
def auth(user, secret)
|
|
434
|
+
auth = MD5::new(@msgid + secret).hexdigest
|
|
435
|
+
exec_cmd('AUTH %s %s' % [ user, auth ])
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
end
|