IOWA 1.0.0
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.
- checksums.yaml +7 -0
- data/CONTRIBUTORS +14 -0
- data/README.md +23 -0
- data/RELEASE_NOTES +77 -0
- data/ToDo +21 -0
- data/components/CRUDList/CRUDList.html +13 -0
- data/components/CRUDList/CRUDList.iwa +136 -0
- data/components/Content/Content.html +0 -0
- data/components/Content/Content.iwa +143 -0
- data/components/Content/example/README +9 -0
- data/components/Content/example/cgi/iowa.cgi +10 -0
- data/components/Content/example/demo.rb +30 -0
- data/components/Content/example/doc/index.html +7 -0
- data/components/Content/example/iowa/Content.html +1 -0
- data/components/Content/example/iowa/Content.iwa +1 -0
- data/components/Content/example/iowa/Main.html +6 -0
- data/components/Content/example/iowa/Main.iwa +3 -0
- data/components/Content/example/iowa/_content/body +7 -0
- data/components/Content/example/iowa/_content/body2 +3 -0
- data/components/Content/example/iowa/_content/title +2 -0
- data/components/Content/example/iowa/app.cnf +8 -0
- data/components/Content/example/iowa/app.rb +8 -0
- data/components/Content/example/webrick.rb +38 -0
- data/components/Include/Include.html +1 -0
- data/components/Include/Include.iwa +30 -0
- data/components/Include/readme +5 -0
- data/components/JumpTo/JumpTo.html +8 -0
- data/components/JumpTo/JumpTo.iwa +8 -0
- data/components/JumpTo/readme +6 -0
- data/doc/Architecture.txt +6 -0
- data/doc/History.txt +33 -0
- data/doc/StandardDispatcher.txt +19 -0
- data/examples/blog/README +1 -0
- data/examples/hello_world/README +17 -0
- data/examples/hello_world/htdocs/hello_world_html.html +24 -0
- data/examples/hello_world/htdocs/hello_world_ruby.html +41 -0
- data/examples/hello_world/iowa/HelloWorld.html +14 -0
- data/examples/hello_world/iowa/HelloWorld.iwa +31 -0
- data/examples/hello_world/iowa/Index.html +16 -0
- data/examples/hello_world/iowa/Index.iwa +5 -0
- data/examples/hello_world/iowa/iowa_hello_world.cnf +19 -0
- data/examples/hello_world/iowa/iowa_hello_world.rb +5 -0
- data/examples/hello_world/iowa/mapfile.cnf +6 -0
- data/examples/hw1/iowa/Main.html +1 -0
- data/examples/hw1/iowa/README +9 -0
- data/examples/hw1/iowa/hw.rb +4 -0
- data/examples/hw2/iowa/Main.html +10 -0
- data/examples/hw2/iowa/Main.iwa +7 -0
- data/examples/hw2/iowa/README +16 -0
- data/examples/hw2/iowa/hw.rb +4 -0
- data/examples/hw3/iowa/Main.html +11 -0
- data/examples/hw3/iowa/Main.iwa +7 -0
- data/examples/hw3/iowa/README +22 -0
- data/examples/hw3/iowa/hw.rb +4 -0
- data/examples/hw4/iowa/Greetings.html +10 -0
- data/examples/hw4/iowa/Greetings.iwa +9 -0
- data/examples/hw4/iowa/Main.html +12 -0
- data/examples/hw4/iowa/Main.iwa +10 -0
- data/examples/hw4/iowa/README +28 -0
- data/examples/hw4/iowa/hw.rb +4 -0
- data/examples/hw5/iowa/Footer.html +2 -0
- data/examples/hw5/iowa/Greetings.html +4 -0
- data/examples/hw5/iowa/Greetings.iwa +12 -0
- data/examples/hw5/iowa/Header.html +6 -0
- data/examples/hw5/iowa/Main.html +12 -0
- data/examples/hw5/iowa/Main.iwa +13 -0
- data/examples/hw5/iowa/README +16 -0
- data/examples/hw5/iowa/hw.rb +4 -0
- data/examples/template_server/iowa/Content.iwa +121 -0
- data/examples/template_server/iowa/Content.view +0 -0
- data/examples/template_server/iowa/DBContentDispatcher.rb +112 -0
- data/examples/template_server/iowa/DBContentPage.html +3 -0
- data/examples/template_server/iowa/DBContentPage.iwa +85 -0
- data/examples/template_server/iowa/app.cnf +13 -0
- data/examples/template_server/iowa/app.rb +5 -0
- data/ext/Classifier/classifier.c +256 -0
- data/ext/Classifier/ext_help.h +14 -0
- data/ext/Classifier/extconf.rb +5 -0
- data/ext/Classifier/tst.h +40 -0
- data/ext/Classifier/tst_cleanup.c +24 -0
- data/ext/Classifier/tst_delete.c +146 -0
- data/ext/Classifier/tst_grow_node_free_list.c +38 -0
- data/ext/Classifier/tst_init.c +41 -0
- data/ext/Classifier/tst_insert.c +192 -0
- data/ext/Classifier/tst_search.c +68 -0
- data/ext/http11/README +11 -0
- data/ext/http11/ext_help.h +15 -0
- data/ext/http11/extconf.rb +5 -0
- data/ext/http11/http11.c +534 -0
- data/ext/http11/http11.c.dif +422 -0
- data/ext/http11/http11_parser.c +1243 -0
- data/ext/http11/http11_parser.c.dif +193 -0
- data/ext/http11/http11_parser.h +49 -0
- data/ext/http11/http11_parser.h.dif +20 -0
- data/ext/http11/http11_parser.rl +192 -0
- data/ext/httpmachine/Makefile +149 -0
- data/ext/httpmachine/extconf.rb +33 -0
- data/ext/httpmachine/http.cpp +430 -0
- data/ext/httpmachine/http.h +156 -0
- data/ext/httpmachine/rubyhttp.cpp +165 -0
- data/external/mime-types/LICENCE +18 -0
- data/external/mime-types/README +46 -0
- data/external/mime-types/doc/classes/MIME.html +120 -0
- data/external/mime-types/doc/classes/MIME/InvalidContentType.html +119 -0
- data/external/mime-types/doc/classes/MIME/Type.html +866 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000010.html +22 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000011.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000012.html +19 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000013.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000014.html +26 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000015.html +33 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000016.html +27 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000017.html +35 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000018.html +34 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000019.html +24 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000020.html +38 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000021.html +22 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000022.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000023.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000024.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000025.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000026.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000027.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000028.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000029.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000030.html +19 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000031.html +26 -0
- data/external/mime-types/doc/classes/MIME/Types.html +459 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000001.html +19 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000002.html +32 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000003.html +21 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000004.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000005.html +26 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000006.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000007.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000008.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000009.html +18 -0
- data/external/mime-types/doc/created.rid +1 -0
- data/external/mime-types/doc/files/ChangeLog.html +320 -0
- data/external/mime-types/doc/files/README.html +145 -0
- data/external/mime-types/doc/files/lib/mime/types_rb.html +101 -0
- data/external/mime-types/doc/fr_class_index.html +30 -0
- data/external/mime-types/doc/fr_file_index.html +29 -0
- data/external/mime-types/doc/fr_method_index.html +57 -0
- data/external/mime-types/doc/index.html +24 -0
- data/external/mime-types/doc/rdoc-style.css +208 -0
- data/external/mime-types/lib/mime/types.rb +1558 -0
- data/external/package.rb +672 -0
- data/external/test_support.rb +95 -0
- data/external/tmail/README +7 -0
- data/external/tmail/tmail.rb +4 -0
- data/external/tmail/tmail/address.rb +222 -0
- data/external/tmail/tmail/base64.rb +52 -0
- data/external/tmail/tmail/compat.rb +39 -0
- data/external/tmail/tmail/config.rb +50 -0
- data/external/tmail/tmail/encode.rb +447 -0
- data/external/tmail/tmail/header.rb +895 -0
- data/external/tmail/tmail/info.rb +14 -0
- data/external/tmail/tmail/loader.rb +1 -0
- data/external/tmail/tmail/mail.rb +869 -0
- data/external/tmail/tmail/mailbox.rb +386 -0
- data/external/tmail/tmail/mbox.rb +1 -0
- data/external/tmail/tmail/net.rb +260 -0
- data/external/tmail/tmail/obsolete.rb +123 -0
- data/external/tmail/tmail/parser.rb +1475 -0
- data/external/tmail/tmail/parser.y +372 -0
- data/external/tmail/tmail/port.rb +356 -0
- data/external/tmail/tmail/scanner.rb +17 -0
- data/external/tmail/tmail/scanner_r.rb +243 -0
- data/external/tmail/tmail/stringio.rb +256 -0
- data/external/tmail/tmail/textutils.rb +197 -0
- data/external/tmail/tmail/tmail.rb +1 -0
- data/external/tmail/tmail/utils.rb +23 -0
- data/external/win32-process/README +133 -0
- data/external/win32-process/lib/win32/process.rb +561 -0
- data/external/windows-pr/README +145 -0
- data/external/windows-pr/doc/conversion_guide.txt +25 -0
- data/external/windows-pr/lib/windows/clipboard.rb +72 -0
- data/external/windows-pr/lib/windows/console.rb +323 -0
- data/external/windows-pr/lib/windows/device_io.rb +88 -0
- data/external/windows-pr/lib/windows/directory.rb +80 -0
- data/external/windows-pr/lib/windows/error.rb +313 -0
- data/external/windows-pr/lib/windows/eventlog.rb +120 -0
- data/external/windows-pr/lib/windows/file.rb +349 -0
- data/external/windows-pr/lib/windows/filesystem.rb +16 -0
- data/external/windows-pr/lib/windows/handle.rb +31 -0
- data/external/windows-pr/lib/windows/library.rb +76 -0
- data/external/windows-pr/lib/windows/limits.rb +13 -0
- data/external/windows-pr/lib/windows/memory.rb +117 -0
- data/external/windows-pr/lib/windows/msvcrt/buffer.rb +48 -0
- data/external/windows-pr/lib/windows/msvcrt/file.rb +18 -0
- data/external/windows-pr/lib/windows/msvcrt/string.rb +46 -0
- data/external/windows-pr/lib/windows/national.rb +557 -0
- data/external/windows-pr/lib/windows/path.rb +296 -0
- data/external/windows-pr/lib/windows/pipe.rb +77 -0
- data/external/windows-pr/lib/windows/process.rb +171 -0
- data/external/windows-pr/lib/windows/registry.rb +238 -0
- data/external/windows-pr/lib/windows/security.rb +89 -0
- data/external/windows-pr/lib/windows/service.rb +183 -0
- data/external/windows-pr/lib/windows/shell.rb +88 -0
- data/external/windows-pr/lib/windows/sound.rb +52 -0
- data/external/windows-pr/lib/windows/synchronize.rb +161 -0
- data/external/windows-pr/lib/windows/system_info.rb +70 -0
- data/external/windows-pr/lib/windows/unicode.rb +138 -0
- data/external/windows-pr/lib/windows/window.rb +22 -0
- data/iowa.gemspec +45 -0
- data/microprojects/DiskCache/LICENSE +28 -0
- data/microprojects/DiskCache/README +17 -0
- data/microprojects/DiskCache/external/package.rb +608 -0
- data/microprojects/DiskCache/external/test_support.rb +8 -0
- data/microprojects/DiskCache/setup.rb +22 -0
- data/microprojects/DiskCache/src/iowa/Association.rb +67 -0
- data/microprojects/DiskCache/src/iowa/Constants.rb +159 -0
- data/microprojects/DiskCache/src/iowa/DiskStore.rb +377 -0
- data/microprojects/DiskCache/src/iowa/Hash.rb +63 -0
- data/microprojects/DiskCache/src/iowa/Lockfile.rb +575 -0
- data/microprojects/DiskCache/src/iowa/Mutex.rb +142 -0
- data/microprojects/DiskCache/src/iowa/caches/DiskCache.rb +605 -0
- data/microprojects/DiskCache/src/iowa/caches/LRUCache.rb +287 -0
- data/microprojects/DiskCache/test/TC_DiskCache.rb +218 -0
- data/microprojects/LRUCache/LICENSE +28 -0
- data/microprojects/LRUCache/README +13 -0
- data/microprojects/LRUCache/external/package.rb +608 -0
- data/microprojects/LRUCache/external/test_support.rb +8 -0
- data/microprojects/LRUCache/setup.rb +22 -0
- data/microprojects/LRUCache/src/iowa/Association.rb +57 -0
- data/microprojects/LRUCache/src/iowa/Constants.rb +159 -0
- data/microprojects/LRUCache/src/iowa/Hash.rb +63 -0
- data/microprojects/LRUCache/src/iowa/Mutex.rb +129 -0
- data/microprojects/LRUCache/src/iowa/caches/LRUCache.rb +287 -0
- data/microprojects/LRUCache/test/TC_LRUCache.rb +65 -0
- data/microprojects/LinkedList/LICENSE +28 -0
- data/microprojects/LinkedList/README +13 -0
- data/microprojects/LinkedList/external/package.rb +608 -0
- data/microprojects/LinkedList/external/test_support.rb +8 -0
- data/microprojects/LinkedList/setup.rb +22 -0
- data/microprojects/LinkedList/src/iowa/LinkedList.rb +165 -0
- data/microprojects/LinkedList/test/TC_LinkedList.rb +42 -0
- data/microprojects/README +8 -0
- data/setup.rb +116 -0
- data/share/iowa/app_skeleton/Main.html +8 -0
- data/share/iowa/app_skeleton/Main.iwa +15 -0
- data/share/iowa/app_skeleton/app.cnf +48 -0
- data/share/iowa/app_skeleton/app.rb +58 -0
- data/share/iowa/app_skeleton/models/model.rb +49 -0
- data/src/ihc.rb +223 -0
- data/src/iowa.cgi +29 -0
- data/src/iowa.rb +637 -0
- data/src/iowa/AbstractCache.rb +96 -0
- data/src/iowa/AcceptLanguage.rb +76 -0
- data/src/iowa/Application.rb +928 -0
- data/src/iowa/ApplicationStats.rb +72 -0
- data/src/iowa/Association.rb +67 -0
- data/src/iowa/BindingsParser.rb +62 -0
- data/src/iowa/Breakpoint.rb +273 -0
- data/src/iowa/CSS.rb +564 -0
- data/src/iowa/Client.rb +192 -0
- data/src/iowa/Component.rb +405 -0
- data/src/iowa/ComponentProxy.rb +26 -0
- data/src/iowa/Config.rb +21 -0
- data/src/iowa/Constants.rb +226 -0
- data/src/iowa/Context.rb +218 -0
- data/src/iowa/ContextLogger.rb +16 -0
- data/src/iowa/DbPool.rb +222 -0
- data/src/iowa/DetachedComponent.rb +18 -0
- data/src/iowa/Dispatcher.rb +27 -0
- data/src/iowa/DynamicElements.rb +471 -0
- data/src/iowa/Element.rb +100 -0
- data/src/iowa/Email.rb +287 -0
- data/src/iowa/Extensions/AllExtensions.rb +4 -0
- data/src/iowa/Extensions/Class.rb +94 -0
- data/src/iowa/Extensions/Date.rb +88 -0
- data/src/iowa/Extensions/DateTime.rb +88 -0
- data/src/iowa/Extensions/Hash.rb +22 -0
- data/src/iowa/Extensions/Kernel.rb +6 -0
- data/src/iowa/Extensions/Numeric.rb +47 -0
- data/src/iowa/Extensions/Object.rb +11 -0
- data/src/iowa/Extensions/String.rb +60 -0
- data/src/iowa/Extensions/Time.rb +89 -0
- data/src/iowa/Extensions/TimeExtensions.rb +6 -0
- data/src/iowa/Form.rb +368 -0
- data/src/iowa/Hash.rb +85 -0
- data/src/iowa/ISAAC.rb +175 -0
- data/src/iowa/ImageSize.rb +279 -0
- data/src/iowa/IowaComponentMixins.rb +7 -0
- data/src/iowa/JSON-lexer.rb +296 -0
- data/src/iowa/JSON-objects.rb +201 -0
- data/src/iowa/KeyValueCoding.rb +91 -0
- data/src/iowa/LinkedList.rb +175 -0
- data/src/iowa/Loader.rb +22 -0
- data/src/iowa/Lockfile.rb +575 -0
- data/src/iowa/Logger.rb +74 -0
- data/src/iowa/Monkey.rb +20 -0
- data/src/iowa/Mutex.rb +142 -0
- data/src/iowa/Policy.rb +70 -0
- data/src/iowa/Pool.rb +243 -0
- data/src/iowa/PrettyException.rb +1091 -0
- data/src/iowa/Request.rb +244 -0
- data/src/iowa/Response.rb +133 -0
- data/src/iowa/Session.rb +354 -0
- data/src/iowa/SessionStats.rb +78 -0
- data/src/iowa/String.rb +65 -0
- data/src/iowa/Tag.rb +101 -0
- data/src/iowa/TemplateParser.rb +236 -0
- data/src/iowa/Util.rb +314 -0
- data/src/iowa/Webcache.rb +122 -0
- data/src/iowa/caches/BiLevelCache.rb +65 -0
- data/src/iowa/caches/ClassLimitedCache.rb +67 -0
- data/src/iowa/caches/DiskCache.rb +609 -0
- data/src/iowa/caches/DiskStore.rb +380 -0
- data/src/iowa/caches/LRUCache-alternative.rb +155 -0
- data/src/iowa/caches/LRUCache.rb +290 -0
- data/src/iowa/caches/SimpleLRUCache.rb +112 -0
- data/src/iowa/dispatchers/StandardDispatcher.rb +396 -0
- data/src/iowa/dispatchers/StandardDispatcherWithClassifier.rb +93 -0
- data/src/iowa/js/iowa_jsonrpc.js +381 -0
- data/src/iowa/js/jsonrpc.js +187 -0
- data/src/iowa/js/jsonrpc_async.js +261 -0
- data/src/iowa/loaders/DiskLoader.rb +50 -0
- data/src/iowa/loggers/Analogger.rb +54 -0
- data/src/iowa/loggers/AsyncLogger.rb +54 -0
- data/src/iowa/loggers/BitBucket.rb +38 -0
- data/src/iowa/loggers/Log4R.rb +13 -0
- data/src/iowa/loggers/Log4rLogger.rb +48 -0
- data/src/iowa/loggers/Logger.rb +29 -0
- data/src/iowa/loggers/RubyLogger.rb +9 -0
- data/src/iowa/pools/DBConnectionPool.rb +53 -0
- data/src/iowa/request/Apache.rb +90 -0
- data/src/iowa/request/EMHybrid.rb +59 -0
- data/src/iowa/request/ENV.rb +80 -0
- data/src/iowa/request/FCGI.rb +68 -0
- data/src/iowa/request/HTTPMachine.rb +75 -0
- data/src/iowa/request/Mongrel.rb +68 -0
- data/src/iowa/request/WEBrick.rb +48 -0
- data/src/iowa/version.rb +3 -0
- data/src/iowa/webrick/HTTPServer.rb +43 -0
- data/src/iowa/webrick/WEBrickServlet.rb +28 -0
- data/src/iowa_fcgi_handler.rb +101 -0
- data/src/iowa_httpmachine.rb +141 -0
- data/src/iowa_hybrid.rb +193 -0
- data/src/iowa_hybrid_cluster.rb +231 -0
- data/src/iowa_mongrel.rb +136 -0
- data/src/iowa_webrick.rb +194 -0
- data/src/iowa_webrick_legacy.rb +104 -0
- data/src/mod_iowa.rb +104 -0
- data/tcss.rb +61 -0
- data/test/README.windows +12 -0
- data/test/TC_AcceptLanguage.rb +61 -0
- data/test/TC_AppConfig.rb +43 -0
- data/test/TC_AppConfig/cgi/iowa.cgi +7 -0
- data/test/TC_AppConfig/doc/index.html +1 -0
- data/test/TC_AppConfig/iowa/Main.html +4 -0
- data/test/TC_AppConfig/iowa/Main.iwa +17 -0
- data/test/TC_AppConfig/iowa/README +1 -0
- data/test/TC_AppConfig/iowa/app.cnf +19 -0
- data/test/TC_AppConfig/iowa/app.rb +8 -0
- data/test/TC_AppConfig/webrick.rb +38 -0
- data/test/TC_Association.rb +29 -0
- data/test/TC_BiLevelCache.rb +71 -0
- data/test/TC_CGI_Adaptor.rb +55 -0
- data/test/TC_CGI_Adaptor/cgi/iowa.cgi +7 -0
- data/test/TC_CGI_Adaptor/doc/index.html +1 -0
- data/test/TC_CGI_Adaptor/iowa/Main.html +8 -0
- data/test/TC_CGI_Adaptor/iowa/Main.iwa +14 -0
- data/test/TC_CGI_Adaptor/iowa/README +1 -0
- data/test/TC_CGI_Adaptor/iowa/app.cnf +8 -0
- data/test/TC_CGI_Adaptor/iowa/app.rb +8 -0
- data/test/TC_CGI_Adaptor/webrick.rb +38 -0
- data/test/TC_CSS.rb +660 -0
- data/test/TC_ClassLimitedCache.rb +89 -0
- data/test/TC_Classifier.rb +80 -0
- data/test/TC_DbPool.rb +127 -0
- data/test/TC_DiskCache.rb +218 -0
- data/test/TC_Hybrid.rb +58 -0
- data/test/TC_Hybrid/doc/thing.txt +1 -0
- data/test/TC_Hybrid/iowa/Main.html +3 -0
- data/test/TC_Hybrid/iowa/Main.iwa +7 -0
- data/test/TC_Hybrid/iowa/NewPage.html +1 -0
- data/test/TC_Hybrid/iowa/NewPage.iwa +5 -0
- data/test/TC_Hybrid/iowa/app.cnf +10 -0
- data/test/TC_Hybrid/iowa/app.rb +5 -0
- data/test/TC_IOWAFunctions/doc/Ajax1.html +1 -0
- data/test/TC_IOWAFunctions/doc/Ajax1.iwa +1 -0
- data/test/TC_IOWAFunctions/doc/index.html +1 -0
- data/test/TC_IOWAFunctions/doc/js/dojo.js +9686 -0
- data/test/TC_IOWAFunctions/iowa/Ajax1.html +40 -0
- data/test/TC_IOWAFunctions/iowa/Ajax1.iwa +23 -0
- data/test/TC_IOWAFunctions/iowa/AjaxWidget.iwa +19 -0
- data/test/TC_IOWAFunctions/iowa/AjaxWidget.view +22 -0
- data/test/TC_IOWAFunctions/iowa/DanielTest.html +9 -0
- data/test/TC_IOWAFunctions/iowa/DanielTest.iwa +10 -0
- data/test/TC_IOWAFunctions/iowa/IntervalWidget.html +1 -0
- data/test/TC_IOWAFunctions/iowa/IntervalWidget.iwa +14 -0
- data/test/TC_IOWAFunctions/iowa/Main.html +1 -0
- data/test/TC_IOWAFunctions/iowa/NestedRepeat1.html +12 -0
- data/test/TC_IOWAFunctions/iowa/NestedRepeat1.iwa +24 -0
- data/test/TC_IOWAFunctions/iowa/RPCResponse.iwa +7 -0
- data/test/TC_IOWAFunctions/iowa/RPCResponse.view +1 -0
- data/test/TC_IOWAFunctions/iowa/Repeat1.iwa +31 -0
- data/test/TC_IOWAFunctions/iowa/Repeat1.view +9 -0
- data/test/TC_IOWAFunctions/iowa/Repeat2.iwa +32 -0
- data/test/TC_IOWAFunctions/iowa/Repeat2.view +11 -0
- data/test/TC_IOWAFunctions/iowa/Repeat3.iwa +44 -0
- data/test/TC_IOWAFunctions/iowa/Repeat3.view +18 -0
- data/test/TC_IOWAFunctions/iowa/TesCon.html +1 -0
- data/test/TC_IOWAFunctions/iowa/TesCon.iwa +5 -0
- data/test/TC_IOWAFunctions/iowa/app.cnf +19 -0
- data/test/TC_IOWAFunctions/iowa/app.rb +9 -0
- data/test/TC_IOWAFunctions/iowa/mapfile.cnf +8 -0
- data/test/TC_ISAAC.rb +52 -0
- data/test/TC_ImageSize.rb +84 -0
- data/test/TC_ImageSize/img.bmp +0 -0
- data/test/TC_ImageSize/img.gif +0 -0
- data/test/TC_ImageSize/img.jpg +0 -0
- data/test/TC_ImageSize/img.pcx +0 -0
- data/test/TC_ImageSize/img.pgm +7144 -0
- data/test/TC_ImageSize/img.png +0 -0
- data/test/TC_ImageSize/img.ppm +0 -0
- data/test/TC_ImageSize/img.psd +0 -0
- data/test/TC_ImageSize/img.tiff +0 -0
- data/test/TC_ImageSize/img.xbm +22 -0
- data/test/TC_KeyValueCoding.rb +35 -0
- data/test/TC_LRUCache.rb +296 -0
- data/test/TC_LinkedList.rb +46 -0
- data/test/TC_Lockfile.rb +106 -0
- data/test/TC_Minimal.rb +45 -0
- data/test/TC_Minimal/app.cnf +8 -0
- data/test/TC_Minimal/cgi-bin/iowa.cgi +11 -0
- data/test/TC_Minimal/doc/index.html +1 -0
- data/test/TC_Minimal/iowa/Main.html +1 -0
- data/test/TC_Minimal/iowa/README +1 -0
- data/test/TC_Minimal/iowa/app.rb +3 -0
- data/test/TC_Minimal/webrick.rb +38 -0
- data/test/TC_Mongrel.rb +58 -0
- data/test/TC_Mongrel/doc/thing.txt +1 -0
- data/test/TC_Mongrel/iowa/Main.html +3 -0
- data/test/TC_Mongrel/iowa/Main.iwa +7 -0
- data/test/TC_Mongrel/iowa/NewPage.html +1 -0
- data/test/TC_Mongrel/iowa/NewPage.iwa +5 -0
- data/test/TC_Mongrel/iowa/app.cnf +10 -0
- data/test/TC_Mongrel/iowa/app.rb +5 -0
- data/test/TC_NoSubclass.rb +56 -0
- data/test/TC_NoSubclass/cgi/iowa.cgi +7 -0
- data/test/TC_NoSubclass/doc/index.html +1 -0
- data/test/TC_NoSubclass/iowa/Main.html +8 -0
- data/test/TC_NoSubclass/iowa/Main.iwa +14 -0
- data/test/TC_NoSubclass/iowa/README +1 -0
- data/test/TC_NoSubclass/iowa/app.cnf +8 -0
- data/test/TC_NoSubclass/iowa/app.rb +5 -0
- data/test/TC_NoSubclass/webrick.rb +38 -0
- data/test/TC_Pool.rb +139 -0
- data/test/TC_RenderedCache/doc/thing.txt +1 -0
- data/test/TC_RenderedCache/iowa/BigPage.html +1 -0
- data/test/TC_RenderedCache/iowa/BigPage.iwa +12 -0
- data/test/TC_RenderedCache/iowa/Main.html +3 -0
- data/test/TC_RenderedCache/iowa/Main.iwa +7 -0
- data/test/TC_RenderedCache/iowa/NewPage.html +1 -0
- data/test/TC_RenderedCache/iowa/NewPage.iwa +11 -0
- data/test/TC_RenderedCache/iowa/app.cnf +13 -0
- data/test/TC_RenderedCache/iowa/app.rb +5 -0
- data/test/TC_RenderedCache/iowa/mapfile.map +4 -0
- data/test/TC_ResourceURL.rb +73 -0
- data/test/TC_ResourceURL/iowa/Main.html +2 -0
- data/test/TC_ResourceURL/iowa/Main.iwa +10 -0
- data/test/TC_ResourceURL/iowa/app.cnf +10 -0
- data/test/TC_ResourceURL/iowa/app.rb +5 -0
- data/test/TC_SimpleDetached.rb +41 -0
- data/test/TC_StandardDispatcher.rb +362 -0
- data/test/TC_StandardDispatcherWithClassifier.rb +358 -0
- data/test/TC_String.rb +24 -0
- data/test/TC_Tag.rb +41 -0
- data/test/TC_Webrick.rb +56 -0
- data/test/TC_Webrick/doc/thing.txt +1 -0
- data/test/TC_Webrick/iowa/Main.html +3 -0
- data/test/TC_Webrick/iowa/Main.iwa +7 -0
- data/test/TC_Webrick/iowa/NewPage.html +1 -0
- data/test/TC_Webrick/iowa/NewPage.iwa +5 -0
- data/test/TC_Webrick/iowa/app.cnf +10 -0
- data/test/TC_Webrick/iowa/app.rb +5 -0
- data/test/tc_template.rb +15 -0
- data/test/tests.conf +19 -0
- data/utils/CVS/Entries +3 -0
- data/utils/CVS/Repository +1 -0
- data/utils/CVS/Root +1 -0
- data/utils/QuickCert-1.0.2.tar.gz +0 -0
- data/utils/QuickCert-1.0.2/InstalledFiles +7 -0
- data/utils/QuickCert-1.0.2/MANIFEST +10 -0
- data/utils/QuickCert-1.0.2/Makefile +15 -0
- data/utils/QuickCert-1.0.2/README +56 -0
- data/utils/QuickCert-1.0.2/bin/QuickCert +355 -0
- data/utils/QuickCert-1.0.2/config.save +12 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/README +60 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/drbssl_c.rb +26 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/drbssl_s.rb +35 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/qc_config +21 -0
- data/utils/QuickCert-1.0.2/lib/QuickCert/defaults.rb +28 -0
- data/utils/QuickCert-1.0.2/setup.rb +1312 -0
- data/utils/iowa_apps +422 -0
- data/utils/smtp_sink.rb +9 -0
- data/utils/startup_template.cnf +27 -0
- data/utils/startup_template.rb +73 -0
- metadata +551 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import "Header"
|
|
2
|
+
import "AdvisorHeader"
|
|
3
|
+
import "Footer"
|
|
4
|
+
import "Content"
|
|
5
|
+
import "Products"
|
|
6
|
+
import "CorrelationCalculator"
|
|
7
|
+
import "JumpToInterview"
|
|
8
|
+
|
|
9
|
+
class DBContentPage < Iowa::Component
|
|
10
|
+
|
|
11
|
+
$VERBOSE = nil
|
|
12
|
+
PREVIEW = 'preview'.freeze
|
|
13
|
+
NAME = 'name'.freeze
|
|
14
|
+
COLON = ':'.freeze
|
|
15
|
+
|
|
16
|
+
def self.special_product_page?(uri)
|
|
17
|
+
uri =~ /^(\/products.htm|\/evolution|\/spectrum|\/psi|\/hcm)/
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.products_only_page?(uri)
|
|
21
|
+
uri =~ /^\/products.htm/
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
[:pub,:priv].each do |side|
|
|
25
|
+
::Iowa::Application::ContentClasses::Content.config(side).cache = Iowa::Caches::LRUCache.new(:maxsize => 200)
|
|
26
|
+
::Iowa::Application::ContentClasses::Content.config(side).query = Proc.new do |name, attributes, session|
|
|
27
|
+
@lastcheck ||= Hash.new {|h,k| h[k]=Time.at(1)}
|
|
28
|
+
@lastresult ||= {}
|
|
29
|
+
if Time.now < @lastcheck[name]
|
|
30
|
+
@lastresult[name]
|
|
31
|
+
else
|
|
32
|
+
@lastcheck[name] = Time.now + 30
|
|
33
|
+
|
|
34
|
+
Iowa.app.dbpool[side].obtain do |ksdbh|
|
|
35
|
+
r = ksdbh.select(:ProductUrls) {|pu| pu.product_idx == name}.first
|
|
36
|
+
@lastresult[name] = r ? r.last_modified.to_time.to_i : 0
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
::Iowa::Application::ContentClasses::Content.config(side).retrieve = Proc.new do |name, attributes, session|
|
|
42
|
+
Iowa.app.dbpool[side].obtain do |ksdbh|
|
|
43
|
+
t1 = ksdbh.select(:ProductUrls) {|pu| pu.product_idx == name}.first
|
|
44
|
+
if session.context.request.params[PREVIEW]
|
|
45
|
+
t2 = ksdbh.select(:ProductsPreview) {|pp| pp.field(:id) == name}.first
|
|
46
|
+
else
|
|
47
|
+
t2 = ksdbh.select(:Products) {|pp| pp.field(:id) == name}.first
|
|
48
|
+
end
|
|
49
|
+
r = {}
|
|
50
|
+
r[Cchecksum] = r[Clast_modification] = t1.last_modified.to_time.to_i
|
|
51
|
+
r[Ctitle] = r[Clabel] = t2.name
|
|
52
|
+
r[Cbody] = t2.descrip
|
|
53
|
+
r
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
::Iowa::Application::ContentClasses::Content.config(:internal).cache = Iowa::Caches::LRUCache.new(:maxsize => 20)
|
|
59
|
+
::Iowa::Application::ContentClasses::Content.config(:internal).query = Proc.new do |name, attributes, session|
|
|
60
|
+
Iowa.app.internal_content[name][:query].call(name, attributes, session)
|
|
61
|
+
end
|
|
62
|
+
::Iowa::Application::ContentClasses::Content.config(:internal).retrieve = Proc.new do |name, attributes, session|
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def get_product_id
|
|
66
|
+
session.context[:product_id]
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def get_side
|
|
70
|
+
session.context[:side]
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def product_title
|
|
74
|
+
#LeftColumn.Products[session.context[:product_id]][NAME].split(COLON).last
|
|
75
|
+
''
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
<?
|
|
81
|
+
contentid {
|
|
82
|
+
id = get_product_id
|
|
83
|
+
library = get_side
|
|
84
|
+
}
|
|
85
|
+
?>
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2005 Zed A. Shaw
|
|
3
|
+
* You can redistribute it and/or modify it under the same terms as Ruby.
|
|
4
|
+
*
|
|
5
|
+
* Modified September 2005 by Kirk Haines. This is the UriClassifier that
|
|
6
|
+
* was combined with the http parser in Mongrel under http11. I have
|
|
7
|
+
* separated it from the parser, renamed a few things to give it a more
|
|
8
|
+
* general feel, and made some slight modifications for use with IOWA.
|
|
9
|
+
*
|
|
10
|
+
* This was originally taken from the Mongrel 0.3.13.3 version.
|
|
11
|
+
*/
|
|
12
|
+
#include "ruby.h"
|
|
13
|
+
#include "ext_help.h"
|
|
14
|
+
#include <assert.h>
|
|
15
|
+
#include <string.h>
|
|
16
|
+
#include <ctype.h>
|
|
17
|
+
#include "tst.h"
|
|
18
|
+
|
|
19
|
+
static VALUE mIowa;
|
|
20
|
+
static VALUE cClassifier;
|
|
21
|
+
static int id_handler_map;
|
|
22
|
+
|
|
23
|
+
#define TRIE_INCREASE 30
|
|
24
|
+
|
|
25
|
+
void Classifier_free(void *data)
|
|
26
|
+
{
|
|
27
|
+
if(data) {
|
|
28
|
+
tst_cleanup((struct tst *)data);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
VALUE Classifier_alloc(VALUE klass)
|
|
33
|
+
{
|
|
34
|
+
VALUE obj;
|
|
35
|
+
struct tst *tst = tst_init(TRIE_INCREASE);
|
|
36
|
+
assert(tst && "failed to initialize trie structure");
|
|
37
|
+
|
|
38
|
+
obj = Data_Wrap_Struct(klass, NULL, Classifier_free, tst);
|
|
39
|
+
|
|
40
|
+
return obj;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* call-seq:
|
|
45
|
+
* Classifier.new -> Classifier
|
|
46
|
+
*
|
|
47
|
+
* Initializes a new Classifier object that you can use to associate URI sequences
|
|
48
|
+
* with objects. You can actually use it with any string sequence and any objects,
|
|
49
|
+
* but it's mostly used with URIs.
|
|
50
|
+
*
|
|
51
|
+
* It uses TST from http://www.octavian.org/cs/software.html to build an ternary search
|
|
52
|
+
* trie to hold all of the URIs. It uses this to do an initial search for the a URI
|
|
53
|
+
* prefix, and then to break the URI into SCRIPT_NAME and PATH_INFO portions. It actually
|
|
54
|
+
* will do two searches most of the time in order to find the right handler for the
|
|
55
|
+
* registered prefix portion.
|
|
56
|
+
*
|
|
57
|
+
*/
|
|
58
|
+
VALUE Classifier_init(VALUE self)
|
|
59
|
+
{
|
|
60
|
+
VALUE hash;
|
|
61
|
+
|
|
62
|
+
// we create an internal hash to protect stuff from the GC
|
|
63
|
+
hash = rb_hash_new();
|
|
64
|
+
rb_ivar_set(self, id_handler_map, hash);
|
|
65
|
+
|
|
66
|
+
return self;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* call-seq:
|
|
72
|
+
* uc.insert("/someuri", SampleHandler.new) -> nil
|
|
73
|
+
*
|
|
74
|
+
* Registers the SampleHandler (one for all requests) with the "/someuri".
|
|
75
|
+
* When Classifier::resolve is called with "/someuri" it'll return
|
|
76
|
+
* SampleHandler immediately. When called with "/someuri/iwant" it'll also
|
|
77
|
+
* return SomeHandler immediatly, with no additional searches, but it will
|
|
78
|
+
* return path info with "/iwant".
|
|
79
|
+
*
|
|
80
|
+
* You actually can reuse this class to insert nearly anything and
|
|
81
|
+
* quickly resolve it. This could be used for caching, fast mapping, etc.
|
|
82
|
+
* The downside is it uses much more memory than a Hash, but it can be
|
|
83
|
+
* a lot faster. It's main advantage is that it works on prefixes, which
|
|
84
|
+
* is damn hard to get right with a Hash.
|
|
85
|
+
*/
|
|
86
|
+
VALUE Classifier_insert(VALUE self, VALUE item, VALUE handler)
|
|
87
|
+
{
|
|
88
|
+
int rc = 0;
|
|
89
|
+
void *ptr = NULL;
|
|
90
|
+
struct tst *tst = NULL;
|
|
91
|
+
DATA_GET(self, struct tst, tst);
|
|
92
|
+
|
|
93
|
+
rc = tst_insert((unsigned char *)StringValueCStr(item), (void *)handler , tst, 0, &ptr);
|
|
94
|
+
|
|
95
|
+
if(rc == TST_DUPLICATE_KEY) {
|
|
96
|
+
rb_raise(rb_eStandardError, "Handler already inserted with that name");
|
|
97
|
+
} else if(rc == TST_ERROR) {
|
|
98
|
+
rb_raise(rb_eStandardError, "Memory error inserting handler");
|
|
99
|
+
} else if(rc == TST_NULL_KEY) {
|
|
100
|
+
rb_raise(rb_eStandardError, "Value to insert was empty");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
rb_hash_aset(rb_ivar_get(self, id_handler_map), item, handler);
|
|
104
|
+
|
|
105
|
+
return Qnil;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* call-seq:
|
|
111
|
+
* uc.delete("/someuri")
|
|
112
|
+
*
|
|
113
|
+
* Yep, just removes this uri and it's handler from the trie.
|
|
114
|
+
*/
|
|
115
|
+
VALUE Classifier_delete(VALUE self, VALUE item)
|
|
116
|
+
{
|
|
117
|
+
void *handler = NULL;
|
|
118
|
+
struct tst *tst = NULL;
|
|
119
|
+
DATA_GET(self, struct tst, tst);
|
|
120
|
+
|
|
121
|
+
handler = tst_delete((unsigned char *)StringValueCStr(item), tst);
|
|
122
|
+
|
|
123
|
+
if(handler) {
|
|
124
|
+
rb_hash_delete(rb_ivar_get(self, id_handler_map), item);
|
|
125
|
+
|
|
126
|
+
return (VALUE)handler;
|
|
127
|
+
} else {
|
|
128
|
+
return Qnil;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* call-seq:
|
|
135
|
+
* uc.resolve("/someuri") -> "/someuri", "", handler
|
|
136
|
+
* uc.resolve("/someuri/pathinfo") -> "/someuri", "/pathinfo", handler
|
|
137
|
+
* uc.resolve("/notfound/orhere") -> nil, nil, nil
|
|
138
|
+
* uc.resolve("/") -> "/", "/", handler # if uc.register("/", handler)
|
|
139
|
+
* uc.resolve("/path/from/root") -> "/", "/path/from/root", handler # if uc.register("/", handler)
|
|
140
|
+
*
|
|
141
|
+
* Attempts to resolve either the whole URI or at the longest prefix, returning
|
|
142
|
+
* the prefix (as script_info), path (as path_info), and registered handler
|
|
143
|
+
* (usually an HttpHandler). If it doesn't find a handler registered at the longest
|
|
144
|
+
* match then it returns nil,nil,nil.
|
|
145
|
+
*
|
|
146
|
+
* Because the resolver uses a trie you are able to register a handler at *any* character
|
|
147
|
+
* in the URI and it will be handled as long as it's the longest prefix. So, if you
|
|
148
|
+
* registered handler #1 at "/something/lik", and #2 at "/something/like/that", then a
|
|
149
|
+
* a search for "/something/like" would give you #1. A search for "/something/like/that/too"
|
|
150
|
+
* would give you #2.
|
|
151
|
+
*
|
|
152
|
+
* This is very powerful since it means you can also attach handlers to parts of the ;
|
|
153
|
+
* (semi-colon) separated path params, any part of the path, use off chars, anything really.
|
|
154
|
+
* It also means that it's very efficient to do this only taking as long as the URI has
|
|
155
|
+
* characters.
|
|
156
|
+
*
|
|
157
|
+
* A slight modification to the CGI 1.2 standard is given for handlers registered to "/".
|
|
158
|
+
* CGI expects all CGI scripts to be at some script path, so it doesn't really say anything
|
|
159
|
+
* about a script that handles the root. To make this work, the resolver will detect that
|
|
160
|
+
* the requested handler is at "/", and return that for script_name, and then simply return
|
|
161
|
+
* the full URI back as path_info.
|
|
162
|
+
*
|
|
163
|
+
* It expects strings with no embedded '\0' characters. Don't try other string-like stuff yet.
|
|
164
|
+
*/
|
|
165
|
+
VALUE Classifier_resolve(VALUE self, VALUE item)
|
|
166
|
+
{
|
|
167
|
+
void *handler = NULL;
|
|
168
|
+
int pref_len = 0;
|
|
169
|
+
struct tst *tst = NULL;
|
|
170
|
+
VALUE result;
|
|
171
|
+
unsigned char *item_str = NULL;
|
|
172
|
+
|
|
173
|
+
DATA_GET(self, struct tst, tst);
|
|
174
|
+
item_str = (unsigned char *)StringValueCStr(item);
|
|
175
|
+
|
|
176
|
+
handler = tst_search(item_str, tst, &pref_len);
|
|
177
|
+
|
|
178
|
+
result = rb_ary_new();
|
|
179
|
+
|
|
180
|
+
if(handler) {
|
|
181
|
+
rb_ary_push(result, rb_str_substr (item, 0, pref_len));
|
|
182
|
+
if(pref_len == 1 && item_str[0] == '/') {
|
|
183
|
+
rb_ary_push(result, item);
|
|
184
|
+
} else {
|
|
185
|
+
rb_ary_push(result, rb_str_substr(item, pref_len, RSTRING_LEN(item)));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
rb_ary_push(result, (VALUE)handler);
|
|
189
|
+
} else {
|
|
190
|
+
rb_ary_push(result, Qnil);
|
|
191
|
+
rb_ary_push(result, Qnil);
|
|
192
|
+
rb_ary_push(result, Qnil);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return result;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
VALUE Classifier_match(VALUE self, VALUE item)
|
|
199
|
+
{
|
|
200
|
+
void *handler = NULL;
|
|
201
|
+
int pref_len = 0;
|
|
202
|
+
struct tst *tst = NULL;
|
|
203
|
+
unsigned char *item_str = NULL;
|
|
204
|
+
|
|
205
|
+
DATA_GET(self, struct tst, tst);
|
|
206
|
+
item_str = (unsigned char *)StringValueCStr(item);
|
|
207
|
+
|
|
208
|
+
handler = tst_search(item_str, tst, &pref_len);
|
|
209
|
+
|
|
210
|
+
if(handler) {
|
|
211
|
+
return (VALUE)handler;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return Qnil;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
VALUE Classifier_handler_map(VALUE self) {
|
|
219
|
+
VALUE hm;
|
|
220
|
+
|
|
221
|
+
hm = rb_ivar_get(self,id_handler_map);
|
|
222
|
+
return rb_hash_dup(hm);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
VALUE Classifier_keys(VALUE self) {
|
|
226
|
+
int id_keys;
|
|
227
|
+
id_keys = rb_intern("keys");
|
|
228
|
+
return rb_funcall(rb_ivar_get(self,id_handler_map),id_keys,0);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
VALUE Classifier_inspect(VALUE self) {
|
|
232
|
+
int id_inspect;
|
|
233
|
+
id_inspect = rb_intern("inspect");
|
|
234
|
+
return rb_funcall(rb_ivar_get(self,id_handler_map),id_inspect,0);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
void Init_classifier()
|
|
238
|
+
{
|
|
239
|
+
|
|
240
|
+
mIowa = rb_define_module("Iowa");
|
|
241
|
+
id_handler_map = rb_intern("@handler_map");
|
|
242
|
+
|
|
243
|
+
cClassifier = rb_define_class_under(mIowa, "Classifier", rb_cObject);
|
|
244
|
+
rb_define_alloc_func(cClassifier, Classifier_alloc);
|
|
245
|
+
rb_define_method(cClassifier, "initialize", Classifier_init, 0);
|
|
246
|
+
rb_define_method(cClassifier, "insert", Classifier_insert, 2);
|
|
247
|
+
rb_define_method(cClassifier, "[]=", Classifier_insert, 2);
|
|
248
|
+
rb_define_method(cClassifier, "delete", Classifier_delete, 1);
|
|
249
|
+
rb_define_method(cClassifier, "resolve", Classifier_resolve, 1);
|
|
250
|
+
rb_define_method(cClassifier, "[]", Classifier_match, 1);
|
|
251
|
+
rb_define_method(cClassifier, "handler_map", Classifier_handler_map, 0);
|
|
252
|
+
rb_define_method(cClassifier, "keys", Classifier_keys, 0);
|
|
253
|
+
rb_define_method(cClassifier, "inspect", Classifier_inspect, 0);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#ifndef ext_help_h
|
|
2
|
+
#define ext_help_h
|
|
3
|
+
|
|
4
|
+
#define RAISE_NOT_NULL(T) if(T == NULL) rb_raise(rb_eArgError, "NULL found for " # T " when shouldn't be.");
|
|
5
|
+
#define DATA_GET(from,type,name) Data_Get_Struct(from,type,name); RAISE_NOT_NULL(name);
|
|
6
|
+
#define REQUIRE_TYPE(V, T) if(TYPE(V) != T) rb_raise(rb_eTypeError, "Wrong argument type for " # V " required " # T);
|
|
7
|
+
|
|
8
|
+
#ifdef DEBUG
|
|
9
|
+
#define TRACE() fprintf(stderr, "> %s:%d:%s\n", __FILE__, __LINE__, __FUNCTION__)
|
|
10
|
+
#else
|
|
11
|
+
#define TRACE()
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
#endif
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
struct node
|
|
4
|
+
{
|
|
5
|
+
unsigned char value;
|
|
6
|
+
struct node *left;
|
|
7
|
+
struct node *middle;
|
|
8
|
+
struct node *right;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
struct tst
|
|
12
|
+
{
|
|
13
|
+
int node_line_width;
|
|
14
|
+
struct node_lines *node_lines;
|
|
15
|
+
struct node *free_list;
|
|
16
|
+
struct node *head[127];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
struct node_lines
|
|
20
|
+
{
|
|
21
|
+
struct node *node_line;
|
|
22
|
+
struct node_lines *next;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
enum tst_constants
|
|
26
|
+
{
|
|
27
|
+
TST_OK, TST_ERROR, TST_NULL_KEY, TST_DUPLICATE_KEY, TST_REPLACE
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
struct tst *tst_init(int node_line_width);
|
|
31
|
+
|
|
32
|
+
int tst_insert(unsigned char *key, void *data, struct tst *tst, int option, void **exist_ptr);
|
|
33
|
+
|
|
34
|
+
void *tst_search(unsigned char *key, struct tst *tst, int *prefix_len);
|
|
35
|
+
|
|
36
|
+
void *tst_delete(unsigned char *key, struct tst *tst);
|
|
37
|
+
|
|
38
|
+
void tst_cleanup(struct tst *tst);
|
|
39
|
+
|
|
40
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
#include "tst.h"
|
|
3
|
+
#include <stdio.h>
|
|
4
|
+
#include <stdlib.h>
|
|
5
|
+
|
|
6
|
+
void tst_cleanup(struct tst *tst)
|
|
7
|
+
{
|
|
8
|
+
struct node_lines *current_line;
|
|
9
|
+
struct node_lines *next_line;
|
|
10
|
+
|
|
11
|
+
next_line = tst->node_lines;
|
|
12
|
+
|
|
13
|
+
do
|
|
14
|
+
{
|
|
15
|
+
current_line = next_line;
|
|
16
|
+
next_line = current_line->next;
|
|
17
|
+
free(current_line->node_line);
|
|
18
|
+
free(current_line);
|
|
19
|
+
}
|
|
20
|
+
while(next_line != NULL);
|
|
21
|
+
|
|
22
|
+
free(tst);
|
|
23
|
+
}
|
|
24
|
+
|