From 14494df9b07f9256870227ebfe7437f1be5dbcf6 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 16 Aug 2008 02:12:00 +0700 Subject: [PATCH] current version --- gclib2/CMakeLists.txt | 58 + gclib2/Doxyfile | 1190 +++++ gclib2/Makefile | 765 +++ gclib2/TestModules.txt | 1 + gclib2/build.sh | 5 + gclib2/cmake_install.cmake | 38 + gclib2/config.h | 7 + gclib2/fix_headers.pl | 10 + gclib2/fixdoxy.pl | 19 + gclib2/headers.txt | 25 + gclib2/include/Buf.h | 36 + gclib2/include/FTP.h | 26 + gclib2/include/MMP.h | 50 + gclib2/include/Macroses.h | 40 + gclib2/include/Object.h | 23 + gclib2/include/Pkt.h | 25 + gclib2/include/Poll.h | 33 + gclib2/include/Proto.h | 62 + gclib2/include/StdHeaders.h | 17 + gclib2/include/StdNetwork.h | 16 + gclib2/include/String.h | 38 + gclib2/include/Tree.h | 45 + gclib2/include/best_names.h | 26 + gclib2/include/darray.h | 41 + gclib2/include/dconnection.h | 105 + gclib2/include/dexec.h | 29 + gclib2/include/dheapsort.h | 30 + gclib2/include/djob_t.h | 31 + gclib2/include/djobs.h | 39 + gclib2/include/dlist.h | 92 + gclib2/include/dns.h | 77 + gclib2/include/dpbuf.h | 63 + gclib2/include/dudp.h | 26 + gclib2/include/earray.h | 47 + gclib2/include/elist.h | 60 + gclib2/include/gc_io.h | 44 + gclib2/include/gc_network.h | 36 + gclib2/include/gc_strings.h | 50 + gclib2/include/gclib2.h | 60 + gclib2/include/http.h | 13 + gclib2/include/hv.h | 77 + gclib2/include/ipc.h | 23 + gclib2/include/network.h | 32 + gclib2/install.sh | 8 + gclib2/intro.html | 772 +++ gclib2/main.aap | 50 + gclib2/modules/Core/Buf.cxx | 163 + gclib2/modules/Core/Buf.h | 36 + gclib2/modules/Core/Object.cxx | 26 + gclib2/modules/Core/Object.h | 23 + gclib2/modules/Core/String.cxx | 88 + gclib2/modules/Core/String.h | 38 + gclib2/modules/Core/Tree.cxx | 191 + gclib2/modules/Core/Tree.h | 45 + gclib2/modules/Core/darray.cxx | 121 + gclib2/modules/Core/darray.h | 41 + gclib2/modules/Core/dexec.cxx | 136 + gclib2/modules/Core/dexec.h | 29 + gclib2/modules/Core/djob_t.h | 31 + gclib2/modules/Core/djobs.cxx | 126 + gclib2/modules/Core/djobs.h | 39 + gclib2/modules/Core/dlist.cxx | 222 + gclib2/modules/Core/dlist.h | 92 + gclib2/modules/Core/dpbuf.cxx | 237 + gclib2/modules/Core/dpbuf.h | 63 + gclib2/modules/Core/earray.cxx | 286 ++ gclib2/modules/Core/earray.h | 47 + gclib2/modules/Core/elist.cxx | 266 + gclib2/modules/Core/elist.h | 60 + gclib2/modules/Core/hv.cxx | 295 ++ gclib2/modules/Core/hv.h | 77 + gclib2/modules/Crypt/base64.cxx | 96 + gclib2/modules/Crypt/digests.cxx | 60 + gclib2/modules/Crypt/scode.cxx | 24 + gclib2/modules/IO/IO.cxx | 538 ++ gclib2/modules/IO/dfiles.cxx | 42 + gclib2/modules/IO/gc_io.h | 44 + gclib2/modules/IPC/ipc.cxx | 215 + gclib2/modules/IPC/ipc.h | 23 + gclib2/modules/Linux/linux_specific.cxx | 50 + gclib2/modules/Misc/Pack/count.cxx | 69 + gclib2/modules/Misc/Pack/internals.h | 21 + gclib2/modules/Misc/Pack/pack.cxx | 154 + gclib2/modules/Misc/Pack/pack_countBList.cxx | 30 + gclib2/modules/Misc/Pack/pack_countHash.cxx | 30 + gclib2/modules/Misc/Pack/pack_countList.cxx | 28 + gclib2/modules/Misc/Pack/pack_countTree.cxx | 52 + gclib2/modules/Misc/Pack/unpack.cxx | 108 + gclib2/modules/Misc/Pack/unpack_listhash.cxx | 65 + gclib2/modules/Misc/Pkt.cxx | 95 + gclib2/modules/Misc/Pkt.h | 25 + gclib2/modules/Misc/dheapsort.cxx | 74 + gclib2/modules/Misc/dsplit.cxx | 64 + gclib2/modules/Misc/gc_strings.h | 50 + gclib2/modules/Misc/join.cxx | 93 + gclib2/modules/Misc/misc.cxx | 99 + gclib2/modules/Misc/split.cxx | 134 + gclib2/modules/Misc/strings.cxx | 437 ++ gclib2/modules/Net/DNS/dns.cxx | 854 ++++ gclib2/modules/Net/DNS/dns.h | 77 + gclib2/modules/Net/DNS/internals.h | 72 + gclib2/modules/Net/FTP/FTP.cxx | 124 + gclib2/modules/Net/FTP/FTP.h | 26 + gclib2/modules/Net/HTTP/http.cxx | 282 ++ gclib2/modules/Net/HTTP/http.h | 13 + gclib2/modules/Net/HTTP/http_context.h | 28 + gclib2/modules/Net/HTTP/internals.h | 19 + gclib2/modules/Net/INET/Poll.cxx | 137 + gclib2/modules/Net/INET/Poll.h | 33 + gclib2/modules/Net/INET/dconnection.cxx | 563 +++ gclib2/modules/Net/INET/dconnection.h | 105 + gclib2/modules/Net/INET/dudp.cxx | 30 + gclib2/modules/Net/INET/dudp.h | 26 + gclib2/modules/Net/INET/gc_network.h | 36 + gclib2/modules/Net/INET/network.cxx | 327 ++ gclib2/modules/Net/INET/url.cxx | 87 + gclib2/modules/Net/MMP/MMP.h | 50 + gclib2/modules/Net/MMP/mmp_engine.cxx | 338 ++ gclib2/modules/Net/MMP/mmp_proto.h | 270 + gclib2/modules/Net/MMP/protocol.html | 544 ++ gclib2/unit_tests/1.html | 8 + gclib2/unit_tests/CMakeLists.txt | 19 + gclib2/unit_tests/base64.cxx | 19 + gclib2/unit_tests/buf.cxx | 34 + gclib2/unit_tests/clone.cxx | 29 + gclib2/unit_tests/connection.cxx | 61 + gclib2/unit_tests/connection2.cxx | 74 + gclib2/unit_tests/dns.cxx | 36 + gclib2/unit_tests/dns2.cxx | 31 + gclib2/unit_tests/ftp.cxx | 22 + gclib2/unit_tests/http.cxx | 18 + gclib2/unit_tests/ipc.cxx | 37 + gclib2/unit_tests/mmp.cxx | 30 + gclib2/unit_tests/pack.cxx | 58 + gclib2/unit_tests/split_join.cxx | 58 + gclib2/unit_tests/strreplace.cxx | 25 + gclib2/unit_tests/url.cxx | 19 + silentbob/AAP/main.aap | 100 + silentbob/AUTHORS | 5 + silentbob/COPYING | 340 ++ silentbob/ChangeLog | 11 + silentbob/INSTALL | 14 + silentbob/INSTALL_generic | 167 + silentbob/Makefile.am | 9 + silentbob/Makefile.cvs | 8 + silentbob/Makefile.in | 688 +++ silentbob/NEWS | 0 silentbob/README | 200 + silentbob/Scons/SConstruct | 36 + silentbob/SilentBobDoc.html | 121 + silentbob/SilentBobDoc_ru.html | 126 + silentbob/bootstrap.sh | 2 + silentbob/config.guess | 1500 ++++++ silentbob/config.h.in | 55 + silentbob/config.sub | 1608 ++++++ silentbob/configure.in | 14 + silentbob/data/silent_bob_immune | 58 + silentbob/debian/README.Debian | 6 + silentbob/debian/changelog | 6 + silentbob/debian/compat | 1 + silentbob/debian/control | 19 + silentbob/debian/copyright | 22 + silentbob/debian/cron.d.ex | 4 + silentbob/debian/dirs | 2 + silentbob/debian/docs | 2 + silentbob/debian/emacsen-install.ex | 45 + silentbob/debian/emacsen-remove.ex | 15 + silentbob/debian/emacsen-startup.ex | 25 + silentbob/debian/init.d.ex | 74 + silentbob/debian/manpage.1.ex | 59 + silentbob/debian/manpage.sgml.ex | 156 + silentbob/debian/manpage.xml.ex | 148 + silentbob/debian/menu.ex | 2 + silentbob/debian/package.links | 9 + silentbob/debian/postinst.ex | 42 + silentbob/debian/postrm.ex | 38 + silentbob/debian/preinst.ex | 38 + silentbob/debian/prerm.ex | 38 + silentbob/debian/rules | 109 + silentbob/debian/silentbob-default.ex | 10 + silentbob/debian/silentbob.doc-base.EX | 22 + silentbob/debian/watch.ex | 22 + silentbob/depcomp | 530 ++ silentbob/doc/FAQ_koi8r | 36 + silentbob/doc/FAQ_utf8 | 36 + silentbob/gclib/AUTHORS | 1 + silentbob/gclib/Makefile.am | 1 + silentbob/gclib/Makefile.in | 479 ++ silentbob/gclib/include/gclib/best_names.h | 18 + silentbob/gclib/include/gclib/darray.h | 40 + silentbob/gclib/include/gclib/dexec.h | 14 + silentbob/gclib/include/gclib/dhash.h | 33 + silentbob/gclib/include/gclib/dheapsort.h | 29 + silentbob/gclib/include/gclib/djob_t.h | 30 + silentbob/gclib/include/gclib/djobs.h | 32 + silentbob/gclib/include/gclib/dlist.h | 88 + silentbob/gclib/include/gclib/earray.h | 47 + silentbob/gclib/include/gclib/ehash.h | 29 + silentbob/gclib/include/gclib/elist.h | 36 + silentbob/gclib/include/gclib/gclib.h | 93 + silentbob/gclib/include/gclib/gclib_c.h | 106 + silentbob/gclib/src/Makefile.am | 16 + silentbob/gclib/src/Makefile.in | 518 ++ silentbob/gclib/src/darray.cxx | 126 + silentbob/gclib/src/deprecated_dsplit.cxx | 41 + silentbob/gclib/src/dhash.cxx | 141 + silentbob/gclib/src/dheapsort.cxx | 71 + silentbob/gclib/src/djobs.cxx | 126 + silentbob/gclib/src/dlist.cxx | 222 + silentbob/gclib/src/dsplit.cxx | 66 + silentbob/gclib/src/earray.cxx | 244 + silentbob/gclib/src/ehash.cxx | 142 + silentbob/gclib/src/elist.cxx | 88 + silentbob/gclib/src/fs.cxx | 126 + silentbob/gclib/src/gclib.cxx | 11 + silentbob/gclib/src/gclib_c.c | 676 +++ silentbob/ideas/Sardar_Java.txt | 7 + silentbob/ideas/Sardar_Java_koi8r.txt | 7 + silentbob/include/TT.h | 38 + silentbob/include/bob_flags.h | 43 + silentbob/include/bugs.h | 18 + silentbob/include/dbg.h | 33 + silentbob/include/env.h | 48 + silentbob/include/head.h | 29 + silentbob/include/inline.h | 115 + silentbob/include/log.h | 23 + silentbob/include/mod.h | 50 + silentbob/include/proto.h | 126 + silentbob/include/structs.h | 72 + silentbob/include/temp_names.h | 14 + silentbob/include/the_fly.hpp | 9 + silentbob/include/the_tt.h | 21 + silentbob/include/wit.h | 28 + silentbob/install-sh | 323 ++ silentbob/ltmain.sh | 6871 ++++++++++++++++++++++++++ silentbob/missing | 360 ++ silentbob/mkinstalldirs | 111 + silentbob/plugins/Makefile.am | 39 + silentbob/plugins/Makefile.in | 593 +++ silentbob/plugins/plugin_aap.cxx | 187 + silentbob/plugins/plugin_cache.cxx | 104 + silentbob/plugins/plugin_compile.cxx | 342 ++ silentbob/plugins/plugin_csharp.cxx | 159 + silentbob/plugins/plugin_editor.cxx | 114 + silentbob/plugins/plugin_foreach.cxx | 94 + silentbob/plugins/plugin_grep.cxx | 203 + silentbob/plugins/plugin_make.cxx | 204 + silentbob/plugins/plugin_perl.cxx | 282 ++ silentbob/plugins/plugin_perlpackages.cxx | 132 + silentbob/plugins/plugin_python.cxx | 233 + silentbob/plugins/plugin_scons.cxx | 200 + silentbob/plugins/plugin_test.cxx | 109 + silentbob/plugins/plugin_xml_project.cxx | 115 + silentbob/sblib/Makefile.am | 7 + silentbob/sblib/Makefile.in | 472 ++ silentbob/sblib/Sblib.cxx | 1277 +++++ silentbob/sblib/TT.cxx | 94 + silentbob/sblib/py_tt.cxx | 189 + silentbob/sblib/t_op.cxx | 85 + silentbob/sblib/t_op2.cxx | 34 + silentbob/sblib/the_fly.cxx | 340 ++ silentbob/sblib/the_tt.cxx | 413 ++ silentbob/sblib/wit.cxx | 134 + silentbob/scripts/SConstruct | 38 + silentbob/scripts/build_bob.bob | 107 + silentbob/scripts/build_bob.sh | 105 + silentbob/scripts/clean.sh | 31 + silentbob/scripts/fixdoxy.pl | 19 + silentbob/scripts/install.sh | 12 + silentbob/scripts/main.aap | 103 + silentbob/scripts/make.sed | 2 + silentbob/scripts/package.sh | 15 + silentbob/scripts/recode_texts.sh | 5 + silentbob/silent_bob.1 | 228 + silentbob/silent_bob.pod | 93 + silentbob/silentbob-1.5.ebuild | 23 + silentbob/src/Makefile.am | 24 + silentbob/src/Makefile.in | 498 ++ silentbob/src/cFiles.cxx | 18 + silentbob/src/callTags.cxx | 151 + silentbob/src/call_tags | 590 +++ silentbob/src/cgrep.cxx | 191 + silentbob/src/ctags.cxx | 89 + silentbob/src/file.cxx | 63 + silentbob/src/indent.cxx | 119 + silentbob/src/init.cxx | 72 + silentbob/src/interactive.cxx | 31 + silentbob/src/kinds.cxx | 50 + silentbob/src/main.cxx | 173 + silentbob/src/modding.cxx | 277 ++ silentbob/src/opts_funcs.cxx | 102 + silentbob/src/opts_kinds.cxx | 48 + silentbob/src/opts_list.cxx | 39 + silentbob/src/opts_settings.cxx | 157 + silentbob/src/structs.cxx | 94 + silentbob/src/tree.cxx | 232 + silentbob/src/usage.cxx | 37 + silentbob/templates/simple_plugin.cxx | 79 + 298 files changed, 43161 insertions(+) create mode 100644 gclib2/CMakeLists.txt create mode 100755 gclib2/Doxyfile create mode 100644 gclib2/Makefile create mode 100644 gclib2/TestModules.txt create mode 100755 gclib2/build.sh create mode 100644 gclib2/cmake_install.cmake create mode 100644 gclib2/config.h create mode 100755 gclib2/fix_headers.pl create mode 100755 gclib2/fixdoxy.pl create mode 100644 gclib2/headers.txt create mode 100644 gclib2/include/Buf.h create mode 100644 gclib2/include/FTP.h create mode 100644 gclib2/include/MMP.h create mode 100755 gclib2/include/Macroses.h create mode 100644 gclib2/include/Object.h create mode 100755 gclib2/include/Pkt.h create mode 100644 gclib2/include/Poll.h create mode 100644 gclib2/include/Proto.h create mode 100755 gclib2/include/StdHeaders.h create mode 100755 gclib2/include/StdNetwork.h create mode 100644 gclib2/include/String.h create mode 100644 gclib2/include/Tree.h create mode 100644 gclib2/include/best_names.h create mode 100644 gclib2/include/darray.h create mode 100755 gclib2/include/dconnection.h create mode 100644 gclib2/include/dexec.h create mode 100644 gclib2/include/dheapsort.h create mode 100644 gclib2/include/djob_t.h create mode 100644 gclib2/include/djobs.h create mode 100644 gclib2/include/dlist.h create mode 100644 gclib2/include/dns.h create mode 100644 gclib2/include/dpbuf.h create mode 100644 gclib2/include/dudp.h create mode 100644 gclib2/include/earray.h create mode 100644 gclib2/include/elist.h create mode 100644 gclib2/include/gc_io.h create mode 100644 gclib2/include/gc_network.h create mode 100644 gclib2/include/gc_strings.h create mode 100644 gclib2/include/gclib2.h create mode 100644 gclib2/include/http.h create mode 100644 gclib2/include/hv.h create mode 100644 gclib2/include/ipc.h create mode 100644 gclib2/include/network.h create mode 100755 gclib2/install.sh create mode 100644 gclib2/intro.html create mode 100644 gclib2/main.aap create mode 100644 gclib2/modules/Core/Buf.cxx create mode 100644 gclib2/modules/Core/Buf.h create mode 100644 gclib2/modules/Core/Object.cxx create mode 100644 gclib2/modules/Core/Object.h create mode 100644 gclib2/modules/Core/String.cxx create mode 100644 gclib2/modules/Core/String.h create mode 100755 gclib2/modules/Core/Tree.cxx create mode 100644 gclib2/modules/Core/Tree.h create mode 100644 gclib2/modules/Core/darray.cxx create mode 100644 gclib2/modules/Core/darray.h create mode 100644 gclib2/modules/Core/dexec.cxx create mode 100644 gclib2/modules/Core/dexec.h create mode 100644 gclib2/modules/Core/djob_t.h create mode 100644 gclib2/modules/Core/djobs.cxx create mode 100644 gclib2/modules/Core/djobs.h create mode 100644 gclib2/modules/Core/dlist.cxx create mode 100644 gclib2/modules/Core/dlist.h create mode 100755 gclib2/modules/Core/dpbuf.cxx create mode 100644 gclib2/modules/Core/dpbuf.h create mode 100644 gclib2/modules/Core/earray.cxx create mode 100644 gclib2/modules/Core/earray.h create mode 100644 gclib2/modules/Core/elist.cxx create mode 100644 gclib2/modules/Core/elist.h create mode 100755 gclib2/modules/Core/hv.cxx create mode 100644 gclib2/modules/Core/hv.h create mode 100755 gclib2/modules/Crypt/base64.cxx create mode 100755 gclib2/modules/Crypt/digests.cxx create mode 100755 gclib2/modules/Crypt/scode.cxx create mode 100644 gclib2/modules/IO/IO.cxx create mode 100644 gclib2/modules/IO/dfiles.cxx create mode 100644 gclib2/modules/IO/gc_io.h create mode 100755 gclib2/modules/IPC/ipc.cxx create mode 100644 gclib2/modules/IPC/ipc.h create mode 100755 gclib2/modules/Linux/linux_specific.cxx create mode 100644 gclib2/modules/Misc/Pack/count.cxx create mode 100644 gclib2/modules/Misc/Pack/internals.h create mode 100644 gclib2/modules/Misc/Pack/pack.cxx create mode 100644 gclib2/modules/Misc/Pack/pack_countBList.cxx create mode 100644 gclib2/modules/Misc/Pack/pack_countHash.cxx create mode 100644 gclib2/modules/Misc/Pack/pack_countList.cxx create mode 100644 gclib2/modules/Misc/Pack/pack_countTree.cxx create mode 100644 gclib2/modules/Misc/Pack/unpack.cxx create mode 100644 gclib2/modules/Misc/Pack/unpack_listhash.cxx create mode 100755 gclib2/modules/Misc/Pkt.cxx create mode 100755 gclib2/modules/Misc/Pkt.h create mode 100644 gclib2/modules/Misc/dheapsort.cxx create mode 100644 gclib2/modules/Misc/dsplit.cxx create mode 100644 gclib2/modules/Misc/gc_strings.h create mode 100644 gclib2/modules/Misc/join.cxx create mode 100755 gclib2/modules/Misc/misc.cxx create mode 100644 gclib2/modules/Misc/split.cxx create mode 100644 gclib2/modules/Misc/strings.cxx create mode 100755 gclib2/modules/Net/DNS/dns.cxx create mode 100644 gclib2/modules/Net/DNS/dns.h create mode 100644 gclib2/modules/Net/DNS/internals.h create mode 100644 gclib2/modules/Net/FTP/FTP.cxx create mode 100644 gclib2/modules/Net/FTP/FTP.h create mode 100644 gclib2/modules/Net/HTTP/http.cxx create mode 100644 gclib2/modules/Net/HTTP/http.h create mode 100644 gclib2/modules/Net/HTTP/http_context.h create mode 100644 gclib2/modules/Net/HTTP/internals.h create mode 100644 gclib2/modules/Net/INET/Poll.cxx create mode 100644 gclib2/modules/Net/INET/Poll.h create mode 100755 gclib2/modules/Net/INET/dconnection.cxx create mode 100755 gclib2/modules/Net/INET/dconnection.h create mode 100644 gclib2/modules/Net/INET/dudp.cxx create mode 100644 gclib2/modules/Net/INET/dudp.h create mode 100644 gclib2/modules/Net/INET/gc_network.h create mode 100755 gclib2/modules/Net/INET/network.cxx create mode 100644 gclib2/modules/Net/INET/url.cxx create mode 100644 gclib2/modules/Net/MMP/MMP.h create mode 100755 gclib2/modules/Net/MMP/mmp_engine.cxx create mode 100755 gclib2/modules/Net/MMP/mmp_proto.h create mode 100644 gclib2/modules/Net/MMP/protocol.html create mode 100644 gclib2/unit_tests/1.html create mode 100644 gclib2/unit_tests/CMakeLists.txt create mode 100644 gclib2/unit_tests/base64.cxx create mode 100644 gclib2/unit_tests/buf.cxx create mode 100644 gclib2/unit_tests/clone.cxx create mode 100644 gclib2/unit_tests/connection.cxx create mode 100644 gclib2/unit_tests/connection2.cxx create mode 100644 gclib2/unit_tests/dns.cxx create mode 100644 gclib2/unit_tests/dns2.cxx create mode 100644 gclib2/unit_tests/ftp.cxx create mode 100644 gclib2/unit_tests/http.cxx create mode 100644 gclib2/unit_tests/ipc.cxx create mode 100644 gclib2/unit_tests/mmp.cxx create mode 100644 gclib2/unit_tests/pack.cxx create mode 100644 gclib2/unit_tests/split_join.cxx create mode 100644 gclib2/unit_tests/strreplace.cxx create mode 100644 gclib2/unit_tests/url.cxx create mode 100644 silentbob/AAP/main.aap create mode 100644 silentbob/AUTHORS create mode 100644 silentbob/COPYING create mode 100644 silentbob/ChangeLog create mode 100644 silentbob/INSTALL create mode 100644 silentbob/INSTALL_generic create mode 100644 silentbob/Makefile.am create mode 100644 silentbob/Makefile.cvs create mode 100644 silentbob/Makefile.in create mode 100644 silentbob/NEWS create mode 100644 silentbob/README create mode 100644 silentbob/Scons/SConstruct create mode 100644 silentbob/SilentBobDoc.html create mode 100644 silentbob/SilentBobDoc_ru.html create mode 100755 silentbob/bootstrap.sh create mode 100755 silentbob/config.guess create mode 100644 silentbob/config.h.in create mode 100755 silentbob/config.sub create mode 100644 silentbob/configure.in create mode 100644 silentbob/data/silent_bob_immune create mode 100644 silentbob/debian/README.Debian create mode 100644 silentbob/debian/changelog create mode 100644 silentbob/debian/compat create mode 100644 silentbob/debian/control create mode 100644 silentbob/debian/copyright create mode 100644 silentbob/debian/cron.d.ex create mode 100644 silentbob/debian/dirs create mode 100644 silentbob/debian/docs create mode 100644 silentbob/debian/emacsen-install.ex create mode 100644 silentbob/debian/emacsen-remove.ex create mode 100644 silentbob/debian/emacsen-startup.ex create mode 100644 silentbob/debian/init.d.ex create mode 100644 silentbob/debian/manpage.1.ex create mode 100644 silentbob/debian/manpage.sgml.ex create mode 100644 silentbob/debian/manpage.xml.ex create mode 100644 silentbob/debian/menu.ex create mode 100644 silentbob/debian/package.links create mode 100644 silentbob/debian/postinst.ex create mode 100644 silentbob/debian/postrm.ex create mode 100644 silentbob/debian/preinst.ex create mode 100644 silentbob/debian/prerm.ex create mode 100755 silentbob/debian/rules create mode 100644 silentbob/debian/silentbob-default.ex create mode 100644 silentbob/debian/silentbob.doc-base.EX create mode 100644 silentbob/debian/watch.ex create mode 100755 silentbob/depcomp create mode 100644 silentbob/doc/FAQ_koi8r create mode 100644 silentbob/doc/FAQ_utf8 create mode 100644 silentbob/gclib/AUTHORS create mode 100644 silentbob/gclib/Makefile.am create mode 100644 silentbob/gclib/Makefile.in create mode 100644 silentbob/gclib/include/gclib/best_names.h create mode 100644 silentbob/gclib/include/gclib/darray.h create mode 100644 silentbob/gclib/include/gclib/dexec.h create mode 100644 silentbob/gclib/include/gclib/dhash.h create mode 100644 silentbob/gclib/include/gclib/dheapsort.h create mode 100644 silentbob/gclib/include/gclib/djob_t.h create mode 100644 silentbob/gclib/include/gclib/djobs.h create mode 100644 silentbob/gclib/include/gclib/dlist.h create mode 100644 silentbob/gclib/include/gclib/earray.h create mode 100644 silentbob/gclib/include/gclib/ehash.h create mode 100644 silentbob/gclib/include/gclib/elist.h create mode 100644 silentbob/gclib/include/gclib/gclib.h create mode 100644 silentbob/gclib/include/gclib/gclib_c.h create mode 100644 silentbob/gclib/src/Makefile.am create mode 100644 silentbob/gclib/src/Makefile.in create mode 100644 silentbob/gclib/src/darray.cxx create mode 100644 silentbob/gclib/src/deprecated_dsplit.cxx create mode 100644 silentbob/gclib/src/dhash.cxx create mode 100644 silentbob/gclib/src/dheapsort.cxx create mode 100644 silentbob/gclib/src/djobs.cxx create mode 100644 silentbob/gclib/src/dlist.cxx create mode 100644 silentbob/gclib/src/dsplit.cxx create mode 100644 silentbob/gclib/src/earray.cxx create mode 100644 silentbob/gclib/src/ehash.cxx create mode 100644 silentbob/gclib/src/elist.cxx create mode 100644 silentbob/gclib/src/fs.cxx create mode 100644 silentbob/gclib/src/gclib.cxx create mode 100644 silentbob/gclib/src/gclib_c.c create mode 100644 silentbob/ideas/Sardar_Java.txt create mode 100644 silentbob/ideas/Sardar_Java_koi8r.txt create mode 100644 silentbob/include/TT.h create mode 100644 silentbob/include/bob_flags.h create mode 100644 silentbob/include/bugs.h create mode 100644 silentbob/include/dbg.h create mode 100644 silentbob/include/env.h create mode 100644 silentbob/include/head.h create mode 100644 silentbob/include/inline.h create mode 100644 silentbob/include/log.h create mode 100644 silentbob/include/mod.h create mode 100644 silentbob/include/proto.h create mode 100644 silentbob/include/structs.h create mode 100644 silentbob/include/temp_names.h create mode 100644 silentbob/include/the_fly.hpp create mode 100644 silentbob/include/the_tt.h create mode 100644 silentbob/include/wit.h create mode 100755 silentbob/install-sh create mode 100644 silentbob/ltmain.sh create mode 100755 silentbob/missing create mode 100755 silentbob/mkinstalldirs create mode 100644 silentbob/plugins/Makefile.am create mode 100644 silentbob/plugins/Makefile.in create mode 100644 silentbob/plugins/plugin_aap.cxx create mode 100644 silentbob/plugins/plugin_cache.cxx create mode 100644 silentbob/plugins/plugin_compile.cxx create mode 100644 silentbob/plugins/plugin_csharp.cxx create mode 100644 silentbob/plugins/plugin_editor.cxx create mode 100644 silentbob/plugins/plugin_foreach.cxx create mode 100644 silentbob/plugins/plugin_grep.cxx create mode 100644 silentbob/plugins/plugin_make.cxx create mode 100644 silentbob/plugins/plugin_perl.cxx create mode 100644 silentbob/plugins/plugin_perlpackages.cxx create mode 100644 silentbob/plugins/plugin_python.cxx create mode 100644 silentbob/plugins/plugin_scons.cxx create mode 100644 silentbob/plugins/plugin_test.cxx create mode 100644 silentbob/plugins/plugin_xml_project.cxx create mode 100644 silentbob/sblib/Makefile.am create mode 100644 silentbob/sblib/Makefile.in create mode 100644 silentbob/sblib/Sblib.cxx create mode 100644 silentbob/sblib/TT.cxx create mode 100644 silentbob/sblib/py_tt.cxx create mode 100644 silentbob/sblib/t_op.cxx create mode 100644 silentbob/sblib/t_op2.cxx create mode 100644 silentbob/sblib/the_fly.cxx create mode 100644 silentbob/sblib/the_tt.cxx create mode 100644 silentbob/sblib/wit.cxx create mode 100644 silentbob/scripts/SConstruct create mode 100755 silentbob/scripts/build_bob.bob create mode 100755 silentbob/scripts/build_bob.sh create mode 100755 silentbob/scripts/clean.sh create mode 100755 silentbob/scripts/fixdoxy.pl create mode 100755 silentbob/scripts/install.sh create mode 100644 silentbob/scripts/main.aap create mode 100644 silentbob/scripts/make.sed create mode 100755 silentbob/scripts/package.sh create mode 100755 silentbob/scripts/recode_texts.sh create mode 100644 silentbob/silent_bob.1 create mode 100644 silentbob/silent_bob.pod create mode 100644 silentbob/silentbob-1.5.ebuild create mode 100644 silentbob/src/Makefile.am create mode 100644 silentbob/src/Makefile.in create mode 100644 silentbob/src/cFiles.cxx create mode 100644 silentbob/src/callTags.cxx create mode 100644 silentbob/src/call_tags create mode 100644 silentbob/src/cgrep.cxx create mode 100644 silentbob/src/ctags.cxx create mode 100644 silentbob/src/file.cxx create mode 100644 silentbob/src/indent.cxx create mode 100644 silentbob/src/init.cxx create mode 100644 silentbob/src/interactive.cxx create mode 100644 silentbob/src/kinds.cxx create mode 100644 silentbob/src/main.cxx create mode 100644 silentbob/src/modding.cxx create mode 100644 silentbob/src/opts_funcs.cxx create mode 100644 silentbob/src/opts_kinds.cxx create mode 100644 silentbob/src/opts_list.cxx create mode 100644 silentbob/src/opts_settings.cxx create mode 100644 silentbob/src/structs.cxx create mode 100644 silentbob/src/tree.cxx create mode 100644 silentbob/src/usage.cxx create mode 100644 silentbob/templates/simple_plugin.cxx diff --git a/gclib2/CMakeLists.txt b/gclib2/CMakeLists.txt new file mode 100644 index 0000000..ef20268 --- /dev/null +++ b/gclib2/CMakeLists.txt @@ -0,0 +1,58 @@ +#set (CMAKE_VERBOSE_MAKEFILE true) + +message(" +Configuration +------------- +CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE} +CXXFLAGS = $ENV{CXXFLAGS} +CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS} +LDFLAGS = $ENV{LDFLAGS} +CMAKE_EXE_LINKER_FLAGS = ${CMAKE_EXE_LINKER_FLAGS} +CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX} +") + +include_directories ("include") +project ("gclib2") +add_library (gclib2 SHARED modules/Core/String.cxx + modules/Core/dexec.cxx + modules/Core/dpbuf.cxx + modules/Core/earray.cxx + modules/Core/hv.cxx + modules/Core/djobs.cxx + modules/Core/Tree.cxx + modules/Core/elist.cxx + modules/Core/darray.cxx + modules/Core/Buf.cxx + modules/Core/Object.cxx + modules/Core/dlist.cxx + modules/Misc/strings.cxx + modules/Misc/dsplit.cxx + modules/Misc/join.cxx + modules/Misc/dheapsort.cxx + modules/Misc/Pkt.cxx + modules/Misc/misc.cxx + modules/Misc/Pack/pack.cxx + modules/Misc/Pack/unpack.cxx + modules/Misc/Pack/unpack_listhash.cxx + modules/Misc/Pack/count.cxx + modules/Misc/Pack/pack_countList.cxx + modules/Misc/Pack/pack_countBList.cxx + modules/Misc/Pack/pack_countHash.cxx + modules/Misc/Pack/pack_countTree.cxx + modules/Misc/split.cxx + modules/Linux/linux_specific.cxx + modules/IPC/ipc.cxx + modules/Net/FTP/FTP.cxx + modules/Net/HTTP/http.cxx + modules/Net/INET/network.cxx + modules/Net/INET/dudp.cxx + modules/Net/INET/dconnection.cxx + modules/Net/INET/url.cxx + modules/Net/INET/Poll.cxx + modules/Net/DNS/dns.cxx + modules/Net/MMP/mmp_engine.cxx + modules/IO/IO.cxx + modules/IO/dfiles.cxx + modules/Crypt/digests.cxx + modules/Crypt/scode.cxx + modules/Crypt/base64.cxx ) diff --git a/gclib2/Doxyfile b/gclib2/Doxyfile new file mode 100755 index 0000000..b9eabad --- /dev/null +++ b/gclib2/Doxyfile @@ -0,0 +1,1190 @@ +PROJECT_NAME = GCLib2 +#PROJECT_NUMBER = +#OUTPUT_DIRECTORY = + + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, +# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, +# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, +# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, +# Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explicit @brief command for a brief description. + +JAVADOC_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to +# include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a caller dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_WIDTH = 1024 + +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_HEIGHT = 1024 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that a graph may be further truncated if the graph's +# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH +# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), +# the graph is not depth-constrained. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff --git a/gclib2/Makefile b/gclib2/Makefile new file mode 100644 index 0000000..013687a --- /dev/null +++ b/gclib2/Makefile @@ -0,0 +1,765 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 2.4 + +# Default target executed when no arguments are given to make. +default_target: all + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canoncical targets will work. +.SUFFIXES: + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# The program to use to edit the cache. +CMAKE_EDIT_COMMAND = /usr/bin/ccmake + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/oleg/SVN/silentbob/GCLib2 + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/oleg/SVN/silentbob/GCLib2 + +# Include the progress variables for this target. +include CMakeFiles/progress.make + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." + /usr/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache + +# The main all target +all: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/oleg/SVN/silentbob/GCLib2/CMakeFiles $(CMAKE_ALL_PROGRESS) + $(MAKE) -f CMakeFiles/Makefile2 all + $(CMAKE_COMMAND) -E cmake_progress_start /home/oleg/SVN/silentbob/GCLib2/CMakeFiles 0 + +# The main clean target +clean: + $(MAKE) -f CMakeFiles/Makefile2 clean + +# The main clean target +clean/fast: clean + +# Prepare targets for installation. +preinstall: all + $(MAKE) -f CMakeFiles/Makefile2 preinstall + +# Prepare targets for installation. +preinstall/fast: + $(MAKE) -f CMakeFiles/Makefile2 preinstall + +# clear depends +depend: + $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 + +#============================================================================= +# Target rules for targets named gclib2 + +# Build rule for target. +gclib2: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 gclib2 + +# fast build rule for target. +gclib2/fast: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/build + +# target to build an object file +modules/Core/Buf.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/Buf.o + +# target to preprocess a source file +modules/Core/Buf.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/Buf.i + +# target to generate assembly for a file +modules/Core/Buf.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/Buf.s + +# target to build an object file +modules/Core/Object.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/Object.o + +# target to preprocess a source file +modules/Core/Object.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/Object.i + +# target to generate assembly for a file +modules/Core/Object.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/Object.s + +# target to build an object file +modules/Core/String.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/String.o + +# target to preprocess a source file +modules/Core/String.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/String.i + +# target to generate assembly for a file +modules/Core/String.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/String.s + +# target to build an object file +modules/Core/Tree.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/Tree.o + +# target to preprocess a source file +modules/Core/Tree.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/Tree.i + +# target to generate assembly for a file +modules/Core/Tree.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/Tree.s + +# target to build an object file +modules/Core/darray.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/darray.o + +# target to preprocess a source file +modules/Core/darray.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/darray.i + +# target to generate assembly for a file +modules/Core/darray.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/darray.s + +# target to build an object file +modules/Core/dexec.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/dexec.o + +# target to preprocess a source file +modules/Core/dexec.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/dexec.i + +# target to generate assembly for a file +modules/Core/dexec.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/dexec.s + +# target to build an object file +modules/Core/djobs.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/djobs.o + +# target to preprocess a source file +modules/Core/djobs.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/djobs.i + +# target to generate assembly for a file +modules/Core/djobs.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/djobs.s + +# target to build an object file +modules/Core/dlist.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/dlist.o + +# target to preprocess a source file +modules/Core/dlist.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/dlist.i + +# target to generate assembly for a file +modules/Core/dlist.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/dlist.s + +# target to build an object file +modules/Core/dpbuf.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/dpbuf.o + +# target to preprocess a source file +modules/Core/dpbuf.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/dpbuf.i + +# target to generate assembly for a file +modules/Core/dpbuf.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/dpbuf.s + +# target to build an object file +modules/Core/earray.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/earray.o + +# target to preprocess a source file +modules/Core/earray.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/earray.i + +# target to generate assembly for a file +modules/Core/earray.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/earray.s + +# target to build an object file +modules/Core/elist.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/elist.o + +# target to preprocess a source file +modules/Core/elist.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/elist.i + +# target to generate assembly for a file +modules/Core/elist.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/elist.s + +# target to build an object file +modules/Core/hv.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/hv.o + +# target to preprocess a source file +modules/Core/hv.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/hv.i + +# target to generate assembly for a file +modules/Core/hv.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Core/hv.s + +# target to build an object file +modules/Crypt/base64.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Crypt/base64.o + +# target to preprocess a source file +modules/Crypt/base64.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Crypt/base64.i + +# target to generate assembly for a file +modules/Crypt/base64.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Crypt/base64.s + +# target to build an object file +modules/Crypt/digests.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Crypt/digests.o + +# target to preprocess a source file +modules/Crypt/digests.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Crypt/digests.i + +# target to generate assembly for a file +modules/Crypt/digests.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Crypt/digests.s + +# target to build an object file +modules/Crypt/scode.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Crypt/scode.o + +# target to preprocess a source file +modules/Crypt/scode.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Crypt/scode.i + +# target to generate assembly for a file +modules/Crypt/scode.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Crypt/scode.s + +# target to build an object file +modules/IO/IO.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/IO/IO.o + +# target to preprocess a source file +modules/IO/IO.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/IO/IO.i + +# target to generate assembly for a file +modules/IO/IO.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/IO/IO.s + +# target to build an object file +modules/IO/dfiles.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/IO/dfiles.o + +# target to preprocess a source file +modules/IO/dfiles.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/IO/dfiles.i + +# target to generate assembly for a file +modules/IO/dfiles.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/IO/dfiles.s + +# target to build an object file +modules/IPC/ipc.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/IPC/ipc.o + +# target to preprocess a source file +modules/IPC/ipc.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/IPC/ipc.i + +# target to generate assembly for a file +modules/IPC/ipc.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/IPC/ipc.s + +# target to build an object file +modules/Linux/linux_specific.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Linux/linux_specific.o + +# target to preprocess a source file +modules/Linux/linux_specific.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Linux/linux_specific.i + +# target to generate assembly for a file +modules/Linux/linux_specific.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Linux/linux_specific.s + +# target to build an object file +modules/Misc/Pack/count.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/count.o + +# target to preprocess a source file +modules/Misc/Pack/count.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/count.i + +# target to generate assembly for a file +modules/Misc/Pack/count.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/count.s + +# target to build an object file +modules/Misc/Pack/pack.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/pack.o + +# target to preprocess a source file +modules/Misc/Pack/pack.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/pack.i + +# target to generate assembly for a file +modules/Misc/Pack/pack.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/pack.s + +# target to build an object file +modules/Misc/Pack/pack_countBList.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/pack_countBList.o + +# target to preprocess a source file +modules/Misc/Pack/pack_countBList.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/pack_countBList.i + +# target to generate assembly for a file +modules/Misc/Pack/pack_countBList.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/pack_countBList.s + +# target to build an object file +modules/Misc/Pack/pack_countHash.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/pack_countHash.o + +# target to preprocess a source file +modules/Misc/Pack/pack_countHash.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/pack_countHash.i + +# target to generate assembly for a file +modules/Misc/Pack/pack_countHash.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/pack_countHash.s + +# target to build an object file +modules/Misc/Pack/pack_countList.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/pack_countList.o + +# target to preprocess a source file +modules/Misc/Pack/pack_countList.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/pack_countList.i + +# target to generate assembly for a file +modules/Misc/Pack/pack_countList.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/pack_countList.s + +# target to build an object file +modules/Misc/Pack/pack_countTree.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/pack_countTree.o + +# target to preprocess a source file +modules/Misc/Pack/pack_countTree.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/pack_countTree.i + +# target to generate assembly for a file +modules/Misc/Pack/pack_countTree.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/pack_countTree.s + +# target to build an object file +modules/Misc/Pack/unpack.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/unpack.o + +# target to preprocess a source file +modules/Misc/Pack/unpack.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/unpack.i + +# target to generate assembly for a file +modules/Misc/Pack/unpack.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/unpack.s + +# target to build an object file +modules/Misc/Pack/unpack_listhash.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/unpack_listhash.o + +# target to preprocess a source file +modules/Misc/Pack/unpack_listhash.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/unpack_listhash.i + +# target to generate assembly for a file +modules/Misc/Pack/unpack_listhash.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pack/unpack_listhash.s + +# target to build an object file +modules/Misc/Pkt.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pkt.o + +# target to preprocess a source file +modules/Misc/Pkt.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pkt.i + +# target to generate assembly for a file +modules/Misc/Pkt.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/Pkt.s + +# target to build an object file +modules/Misc/dheapsort.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/dheapsort.o + +# target to preprocess a source file +modules/Misc/dheapsort.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/dheapsort.i + +# target to generate assembly for a file +modules/Misc/dheapsort.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/dheapsort.s + +# target to build an object file +modules/Misc/dsplit.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/dsplit.o + +# target to preprocess a source file +modules/Misc/dsplit.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/dsplit.i + +# target to generate assembly for a file +modules/Misc/dsplit.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/dsplit.s + +# target to build an object file +modules/Misc/join.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/join.o + +# target to preprocess a source file +modules/Misc/join.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/join.i + +# target to generate assembly for a file +modules/Misc/join.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/join.s + +# target to build an object file +modules/Misc/misc.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/misc.o + +# target to preprocess a source file +modules/Misc/misc.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/misc.i + +# target to generate assembly for a file +modules/Misc/misc.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/misc.s + +# target to build an object file +modules/Misc/split.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/split.o + +# target to preprocess a source file +modules/Misc/split.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/split.i + +# target to generate assembly for a file +modules/Misc/split.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/split.s + +# target to build an object file +modules/Misc/strings.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/strings.o + +# target to preprocess a source file +modules/Misc/strings.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/strings.i + +# target to generate assembly for a file +modules/Misc/strings.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Misc/strings.s + +# target to build an object file +modules/Net/DNS/dns.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/DNS/dns.o + +# target to preprocess a source file +modules/Net/DNS/dns.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/DNS/dns.i + +# target to generate assembly for a file +modules/Net/DNS/dns.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/DNS/dns.s + +# target to build an object file +modules/Net/FTP/FTP.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/FTP/FTP.o + +# target to preprocess a source file +modules/Net/FTP/FTP.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/FTP/FTP.i + +# target to generate assembly for a file +modules/Net/FTP/FTP.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/FTP/FTP.s + +# target to build an object file +modules/Net/HTTP/http.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/HTTP/http.o + +# target to preprocess a source file +modules/Net/HTTP/http.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/HTTP/http.i + +# target to generate assembly for a file +modules/Net/HTTP/http.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/HTTP/http.s + +# target to build an object file +modules/Net/INET/Poll.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/INET/Poll.o + +# target to preprocess a source file +modules/Net/INET/Poll.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/INET/Poll.i + +# target to generate assembly for a file +modules/Net/INET/Poll.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/INET/Poll.s + +# target to build an object file +modules/Net/INET/dconnection.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/INET/dconnection.o + +# target to preprocess a source file +modules/Net/INET/dconnection.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/INET/dconnection.i + +# target to generate assembly for a file +modules/Net/INET/dconnection.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/INET/dconnection.s + +# target to build an object file +modules/Net/INET/dudp.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/INET/dudp.o + +# target to preprocess a source file +modules/Net/INET/dudp.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/INET/dudp.i + +# target to generate assembly for a file +modules/Net/INET/dudp.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/INET/dudp.s + +# target to build an object file +modules/Net/INET/network.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/INET/network.o + +# target to preprocess a source file +modules/Net/INET/network.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/INET/network.i + +# target to generate assembly for a file +modules/Net/INET/network.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/INET/network.s + +# target to build an object file +modules/Net/INET/url.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/INET/url.o + +# target to preprocess a source file +modules/Net/INET/url.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/INET/url.i + +# target to generate assembly for a file +modules/Net/INET/url.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/INET/url.s + +# target to build an object file +modules/Net/MMP/mmp_engine.o: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/MMP/mmp_engine.o + +# target to preprocess a source file +modules/Net/MMP/mmp_engine.i: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/MMP/mmp_engine.i + +# target to generate assembly for a file +modules/Net/MMP/mmp_engine.s: + $(MAKE) -f CMakeFiles/gclib2.dir/build.make CMakeFiles/gclib2.dir/modules/Net/MMP/mmp_engine.s + +# Help Target +help:: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... gclib2" + @echo "... rebuild_cache" + @echo "... modules/Core/Buf.o" + @echo "... modules/Core/Buf.i" + @echo "... modules/Core/Buf.s" + @echo "... modules/Core/Object.o" + @echo "... modules/Core/Object.i" + @echo "... modules/Core/Object.s" + @echo "... modules/Core/String.o" + @echo "... modules/Core/String.i" + @echo "... modules/Core/String.s" + @echo "... modules/Core/Tree.o" + @echo "... modules/Core/Tree.i" + @echo "... modules/Core/Tree.s" + @echo "... modules/Core/darray.o" + @echo "... modules/Core/darray.i" + @echo "... modules/Core/darray.s" + @echo "... modules/Core/dexec.o" + @echo "... modules/Core/dexec.i" + @echo "... modules/Core/dexec.s" + @echo "... modules/Core/djobs.o" + @echo "... modules/Core/djobs.i" + @echo "... modules/Core/djobs.s" + @echo "... modules/Core/dlist.o" + @echo "... modules/Core/dlist.i" + @echo "... modules/Core/dlist.s" + @echo "... modules/Core/dpbuf.o" + @echo "... modules/Core/dpbuf.i" + @echo "... modules/Core/dpbuf.s" + @echo "... modules/Core/earray.o" + @echo "... modules/Core/earray.i" + @echo "... modules/Core/earray.s" + @echo "... modules/Core/elist.o" + @echo "... modules/Core/elist.i" + @echo "... modules/Core/elist.s" + @echo "... modules/Core/hv.o" + @echo "... modules/Core/hv.i" + @echo "... modules/Core/hv.s" + @echo "... modules/Crypt/base64.o" + @echo "... modules/Crypt/base64.i" + @echo "... modules/Crypt/base64.s" + @echo "... modules/Crypt/digests.o" + @echo "... modules/Crypt/digests.i" + @echo "... modules/Crypt/digests.s" + @echo "... modules/Crypt/scode.o" + @echo "... modules/Crypt/scode.i" + @echo "... modules/Crypt/scode.s" + @echo "... modules/IO/IO.o" + @echo "... modules/IO/IO.i" + @echo "... modules/IO/IO.s" + @echo "... modules/IO/dfiles.o" + @echo "... modules/IO/dfiles.i" + @echo "... modules/IO/dfiles.s" + @echo "... modules/IPC/ipc.o" + @echo "... modules/IPC/ipc.i" + @echo "... modules/IPC/ipc.s" + @echo "... modules/Linux/linux_specific.o" + @echo "... modules/Linux/linux_specific.i" + @echo "... modules/Linux/linux_specific.s" + @echo "... modules/Misc/Pack/count.o" + @echo "... modules/Misc/Pack/count.i" + @echo "... modules/Misc/Pack/count.s" + @echo "... modules/Misc/Pack/pack.o" + @echo "... modules/Misc/Pack/pack.i" + @echo "... modules/Misc/Pack/pack.s" + @echo "... modules/Misc/Pack/pack_countBList.o" + @echo "... modules/Misc/Pack/pack_countBList.i" + @echo "... modules/Misc/Pack/pack_countBList.s" + @echo "... modules/Misc/Pack/pack_countHash.o" + @echo "... modules/Misc/Pack/pack_countHash.i" + @echo "... modules/Misc/Pack/pack_countHash.s" + @echo "... modules/Misc/Pack/pack_countList.o" + @echo "... modules/Misc/Pack/pack_countList.i" + @echo "... modules/Misc/Pack/pack_countList.s" + @echo "... modules/Misc/Pack/pack_countTree.o" + @echo "... modules/Misc/Pack/pack_countTree.i" + @echo "... modules/Misc/Pack/pack_countTree.s" + @echo "... modules/Misc/Pack/unpack.o" + @echo "... modules/Misc/Pack/unpack.i" + @echo "... modules/Misc/Pack/unpack.s" + @echo "... modules/Misc/Pack/unpack_listhash.o" + @echo "... modules/Misc/Pack/unpack_listhash.i" + @echo "... modules/Misc/Pack/unpack_listhash.s" + @echo "... modules/Misc/Pkt.o" + @echo "... modules/Misc/Pkt.i" + @echo "... modules/Misc/Pkt.s" + @echo "... modules/Misc/dheapsort.o" + @echo "... modules/Misc/dheapsort.i" + @echo "... modules/Misc/dheapsort.s" + @echo "... modules/Misc/dsplit.o" + @echo "... modules/Misc/dsplit.i" + @echo "... modules/Misc/dsplit.s" + @echo "... modules/Misc/join.o" + @echo "... modules/Misc/join.i" + @echo "... modules/Misc/join.s" + @echo "... modules/Misc/misc.o" + @echo "... modules/Misc/misc.i" + @echo "... modules/Misc/misc.s" + @echo "... modules/Misc/split.o" + @echo "... modules/Misc/split.i" + @echo "... modules/Misc/split.s" + @echo "... modules/Misc/strings.o" + @echo "... modules/Misc/strings.i" + @echo "... modules/Misc/strings.s" + @echo "... modules/Net/DNS/dns.o" + @echo "... modules/Net/DNS/dns.i" + @echo "... modules/Net/DNS/dns.s" + @echo "... modules/Net/FTP/FTP.o" + @echo "... modules/Net/FTP/FTP.i" + @echo "... modules/Net/FTP/FTP.s" + @echo "... modules/Net/HTTP/http.o" + @echo "... modules/Net/HTTP/http.i" + @echo "... modules/Net/HTTP/http.s" + @echo "... modules/Net/INET/Poll.o" + @echo "... modules/Net/INET/Poll.i" + @echo "... modules/Net/INET/Poll.s" + @echo "... modules/Net/INET/dconnection.o" + @echo "... modules/Net/INET/dconnection.i" + @echo "... modules/Net/INET/dconnection.s" + @echo "... modules/Net/INET/dudp.o" + @echo "... modules/Net/INET/dudp.i" + @echo "... modules/Net/INET/dudp.s" + @echo "... modules/Net/INET/network.o" + @echo "... modules/Net/INET/network.i" + @echo "... modules/Net/INET/network.s" + @echo "... modules/Net/INET/url.o" + @echo "... modules/Net/INET/url.i" + @echo "... modules/Net/INET/url.s" + @echo "... modules/Net/MMP/mmp_engine.o" + @echo "... modules/Net/MMP/mmp_engine.i" + @echo "... modules/Net/MMP/mmp_engine.s" + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 + diff --git a/gclib2/TestModules.txt b/gclib2/TestModules.txt new file mode 100644 index 0000000..157ce94 --- /dev/null +++ b/gclib2/TestModules.txt @@ -0,0 +1 @@ +FTP Pack Connection diff --git a/gclib2/build.sh b/gclib2/build.sh new file mode 100755 index 0000000..78394f6 --- /dev/null +++ b/gclib2/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash -v + +cmake . +make + diff --git a/gclib2/cmake_install.cmake b/gclib2/cmake_install.cmake new file mode 100644 index 0000000..3474e08 --- /dev/null +++ b/gclib2/cmake_install.cmake @@ -0,0 +1,38 @@ +# Install script for directory: /home/oleg/SVN/silentbob/GCLib2 + +# Set the install prefix +IF(NOT DEFINED CMAKE_INSTALL_PREFIX) + SET(CMAKE_INSTALL_PREFIX "/usr/local") +ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX) +STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +IF(NOT CMAKE_INSTALL_CONFIG_NAME) + IF(BUILD_TYPE) + STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + ELSE(BUILD_TYPE) + SET(CMAKE_INSTALL_CONFIG_NAME "") + ENDIF(BUILD_TYPE) + MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +ENDIF(NOT CMAKE_INSTALL_CONFIG_NAME) + +# Set the component getting installed. +IF(NOT CMAKE_INSTALL_COMPONENT) + IF(COMPONENT) + MESSAGE(STATUS "Install component: \"${COMPONENT}\"") + SET(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + ELSE(COMPONENT) + SET(CMAKE_INSTALL_COMPONENT) + ENDIF(COMPONENT) +ENDIF(NOT CMAKE_INSTALL_COMPONENT) + +IF(CMAKE_INSTALL_COMPONENT) + SET(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") +ELSE(CMAKE_INSTALL_COMPONENT) + SET(CMAKE_INSTALL_MANIFEST "install_manifest.txt") +ENDIF(CMAKE_INSTALL_COMPONENT) +FILE(WRITE "/home/oleg/SVN/silentbob/GCLib2/${CMAKE_INSTALL_MANIFEST}" "") +FOREACH(file ${CMAKE_INSTALL_MANIFEST_FILES}) + FILE(APPEND "/home/oleg/SVN/silentbob/GCLib2/${CMAKE_INSTALL_MANIFEST}" "${file}\n") +ENDFOREACH(file) diff --git a/gclib2/config.h b/gclib2/config.h new file mode 100644 index 0000000..1af9c7a --- /dev/null +++ b/gclib2/config.h @@ -0,0 +1,7 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +//#define HAVE_OPENSSL diff --git a/gclib2/fix_headers.pl b/gclib2/fix_headers.pl new file mode 100755 index 0000000..0577528 --- /dev/null +++ b/gclib2/fix_headers.pl @@ -0,0 +1,10 @@ +#!/usr/bin/perl + +open (FILE, "< headers.txt") or die "open file"; +@files = ; +foreach $file (@files) { + chomp $file; + print "cp -f $file include/\n"; + system "cp -f $file include/"; +} +close FILE; diff --git a/gclib2/fixdoxy.pl b/gclib2/fixdoxy.pl new file mode 100755 index 0000000..235684e --- /dev/null +++ b/gclib2/fixdoxy.pl @@ -0,0 +1,19 @@ +#!/usr/bin/perl + +my $fileName; +foreach $fileName (@ARGV) { + fixFile ($fileName); +} + +sub fixFile ($) { + my $m_fileName = shift; + open (FILE, "< $m_fileName") or die "Не могу открыть файл $m_fileName"; + @allData = ; + close FILE; + $data = join ("", @allData); + $data =~ s/charset=iso-8859-1/charset=utf8/g; + open (FILE, "> $m_fileName"); + print FILE $data; + close FILE; +} + diff --git a/gclib2/headers.txt b/gclib2/headers.txt new file mode 100644 index 0000000..7bcdd1f --- /dev/null +++ b/gclib2/headers.txt @@ -0,0 +1,25 @@ +modules/Core/dlist.h +modules/Core/dpbuf.h +modules/Core/Buf.h +modules/Core/Object.h +modules/Core/djobs.h +modules/Core/String.h +modules/Core/djob_t.h +modules/Core/earray.h +modules/Core/Tree.h +modules/Core/elist.h +modules/Core/darray.h +modules/Core/hv.h +modules/Core/dexec.h +modules/IO/gc_io.h +modules/IPC/ipc.h +modules/Net/INET/gc_network.h +modules/Net/INET/dconnection.h +modules/Net/INET/Poll.h +modules/Net/INET/dudp.h +modules/Net/DNS/dns.h +modules/Net/FTP/FTP.h +modules/Net/HTTP/http.h +modules/Net/MMP/MMP.h +modules/Misc/gc_strings.h +modules/Misc/Pkt.h diff --git a/gclib2/include/Buf.h b/gclib2/include/Buf.h new file mode 100644 index 0000000..6df635d --- /dev/null +++ b/gclib2/include/Buf.h @@ -0,0 +1,36 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_BUF_H +#define DEFINE_BUF_H + +#include + +class Buf; +class Buf : public DPBuf +{ + public: + Buf (); + Buf (int len); + Buf (char * ptr, int len); + ~Buf (); + + char * seek (int offset, int whence); + int available (); + char * position (); + Buf * shift (int count); + int unshift (Buf * m_buf); + + char * readString (); // v2.3 + + bool operator == (Buf * m_buf); + bool operator != (Buf * m_buf); +}; + +void buf_free (void * ptr); + +#endif + diff --git a/gclib2/include/FTP.h b/gclib2/include/FTP.h new file mode 100644 index 0000000..09291ac --- /dev/null +++ b/gclib2/include/FTP.h @@ -0,0 +1,26 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_FTP_H +#define DEFINE_FTP_H + +class FTP : Connection +{ + public: + FTP (); + ~FTP (); + + int connect (char * server, uint16_t port = 21); + int login (char * l, char * p); + + private: + List * waitReply (); + int checkReply (int needle); + int typeI (); +}; + +#endif + diff --git a/gclib2/include/MMP.h b/gclib2/include/MMP.h new file mode 100644 index 0000000..83f3fc8 --- /dev/null +++ b/gclib2/include/MMP.h @@ -0,0 +1,50 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_MMP_H +#define DEFINE_MMP_H + +#ifndef DEFINE_MRIM_HDR +struct mrim_hdr; +#endif + +class MMP +{ + public: + MMP (); + ~MMP (); + + int init (); + int login (char * login, char * pass); + int logout (); + int sendMessage (char * to, char * message, bool bulticast = false); + int ping (); + int pingInterval (); + int socket (); + int timeout (); + int setTimeOut (int t); + + private: + mrim_hdr * mk_pkt (u_long msg, char * attach = NULL, uint8_t len = 0); + char * rcv (int * len); + int real_connect (char *addr, int len); + void LPS (char ** pkt, char *str); + void UL (char ** pkt, int N); + int hello (); + + int fd; + char ** cmds_out; + struct sockaddr_in caddr; + struct sockaddr_in saddr; + int last_seq; + int m_ping; + int m_timeout; + +}; + + +#endif + diff --git a/gclib2/include/Macroses.h b/gclib2/include/Macroses.h new file mode 100755 index 0000000..adea945 --- /dev/null +++ b/gclib2/include/Macroses.h @@ -0,0 +1,40 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_MACROSES_H +#define DEFINE_MACROSES_H + +/// \brief Макрос, определяющий экспортировать ли функцию. +#define __export + +/*! \brief Освободить память если занята затем установить в ноль. + * \param arga - указатель для освобождения. + */ +#ifdef __cplusplus +#define DROP(arga) if (arga) { ::free (arga); arga = NULL; } +#else +#define DROP(arga) if (arga) { free (arga); arga = NULL; } +#endif + +/*! \brief Выделить память. + * \param arga - тип элементов. + * \param argb - нужное количество элементов. + */ +#define CNEW(arga,argb) (arga *)malloc (sizeof (arga)*(argb)) + +/// \brief Эквивалент !strcmp. +#define EQ(arga, argb) (!strcmp (arga, argb)) +/// \brief Эквивалент strcmp. +#define NE(arga, argb) (strcmp (arga, argb)) + +/*! Удалить последний символ в строке. + * \param arga - соответственно строка. + */ +#define chop(arg1) arg1[strlen(arg1) - 1] = 0 +#define LPCHAR(arg) ((char *) arg) + +#endif + diff --git a/gclib2/include/Object.h b/gclib2/include/Object.h new file mode 100644 index 0000000..0429471 --- /dev/null +++ b/gclib2/include/Object.h @@ -0,0 +1,23 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_OBJECT_H +#define DEFINE_OBJECT_H + +#include + +class Object +{ + public: + Object (); + ~Object (); + + virtual Buf * pack (); + virtual Object * unpack (Buf *); +}; + +#endif + diff --git a/gclib2/include/Pkt.h b/gclib2/include/Pkt.h new file mode 100755 index 0000000..a9ac262 --- /dev/null +++ b/gclib2/include/Pkt.h @@ -0,0 +1,25 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_PKT_H +#define DEFINE_PKT_H + +/*** Функции низкоуровневой обработки пакетов. ***/ +__export void pkt_W8 (char ** pkt, unsigned char data) ; +__export void pkt_W16 (char ** pkt, uint16_t data) ; +__export void pkt_W32 (char ** pkt, unsigned int data) ; +__export void pkt_WS (char ** pkt, char *S) ; +__export void pkt_WSZ (char ** pkt, char *S) ; +__export void pkt_WD (char ** pkt, char *S, int size) ; +__export unsigned char pkt_R8 (char ** pkt) ; +__export uint16_t pkt_R16 (char ** pkt) ; +__export uint32_t pkt_R32 (char ** pkt) ; +__export char * pkt_RD (char ** pkt, int len) ; +#define pkt_Wstruct(pkt, s) do { pkt_WD (pkt, (char *) s, sizeof (*s)); } while (0) +#define pkt_Rstruct(arga, argb) (argb *) pkt_RD (arga, sizeof (argb)) + +#endif + diff --git a/gclib2/include/Poll.h b/gclib2/include/Poll.h new file mode 100644 index 0000000..e46fa51 --- /dev/null +++ b/gclib2/include/Poll.h @@ -0,0 +1,33 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_POLL_H +#define DEFINE_POLL_H + +class Poll +{ + public: + Poll (); + ~Poll (); + + Connection * add (Connection * c); + Connection * unlink (Connection * c); + pollfd * poll_build (int * nfds); + int poll (int timeout); + Connection * scan (); + int count (); + List * connections (); + + private: + Connection * __findConnection (Connection * c); + Connection * __findName (char * str); + + List * m_connections; + pollfd * pull; +}; + +#endif + diff --git a/gclib2/include/Proto.h b/gclib2/include/Proto.h new file mode 100644 index 0000000..375cb21 --- /dev/null +++ b/gclib2/include/Proto.h @@ -0,0 +1,62 @@ +/* + * (c) Oleg Puchinin 2006-2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_PROTO_H +#define DEFINE_PROTO_H + +#ifndef __export +#define __export +#endif + +#ifdef __cplusplus +#include "earray.h" +#include +#include "djob_t.h" + +#ifdef __linux +__export char * dcp (char * S) ; +__export void Dzero (void * ptr) ; +__export int Dsched_yield () ; +int Dclone (int (*fn)(void *), void * param) ; +#endif + +__export int Dpoll_add (EArray * d_array, int fd, short events) ; +__export int Dpoll_coallesce (EArray * d, struct pollfd ** p) ; +__export int Dsplit (char * STR, char *ch, DList * to_list) ; +__export int Dsplit (char * buf, size_t buflen, char *str, EList * to_list) ; + +#undef __export +#define __export extern "C" + +#endif + +__export uchar_t * base64_code (unsigned char * S, int SIZE) ; +__export uchar_t * base64_decode (unsigned char * S, int SIZE) ; +__export int dexec_wflags (int flags) ; +__export int dexec_rflags (int flags) ; +//__export int Dexec_op (struct __dexec_t *buf, int count, struct __djob_t *ctx) ; +__export void Dexec_init (struct __djob_t * ctx) ; +//__export int Dexec (int ops, struct __dexec_t *other_buf, int count, char *cmd, struct __djob_t *ctx) ; +__export __djob_t * Dexec (unsigned int opts, char * cmd); + +__export int Dexec_done (struct __djob_t *ctx) ; + +__export void Dtimer () ; +__export struct timeval *the_time () ; +__export void print_the_time (FILE * file_my) ; +__export int Dterm_one_kick (int fd) ; +__export char *Dversion () ; +__export char * Dtimestr (char * buf, int max) ; + +#include +#include +#include + +#endif + +#undef __export +#define __export + diff --git a/gclib2/include/StdHeaders.h b/gclib2/include/StdHeaders.h new file mode 100755 index 0000000..5fe6a12 --- /dev/null +++ b/gclib2/include/StdHeaders.h @@ -0,0 +1,17 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_STDHEADERS_H +#define DEFINE_STDHEADERS_H + +#include +#include +#include +#include +#include + +#endif + diff --git a/gclib2/include/StdNetwork.h b/gclib2/include/StdNetwork.h new file mode 100755 index 0000000..60f2194 --- /dev/null +++ b/gclib2/include/StdNetwork.h @@ -0,0 +1,16 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#ifndef STD_NETWORK_H +#define STD_NETWORK_H + +#include +#include +#include +#include + +#endif + diff --git a/gclib2/include/String.h b/gclib2/include/String.h new file mode 100644 index 0000000..558a9ce --- /dev/null +++ b/gclib2/include/String.h @@ -0,0 +1,38 @@ +/* + * (c) Oleg Puchinin 2007,2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_STRING_H +#define DEFINE_STRING_H + +class String; +class String +{ + public: + String (); + String (char * str); + String (const char * str); + ~String (); + + String & operator + (char * str); + String & operator + (String & str); + String & operator = (char * str); + String & operator = (const char * str); + String & operator = (String & str); + + inline operator char *() { + return m_buf; + } + String & operator << (char * str); + String & operator << (int num); + char * c_str (); + + private: + char * m_buf; +}; + +#endif + + diff --git a/gclib2/include/Tree.h b/gclib2/include/Tree.h new file mode 100644 index 0000000..7d8d4bb --- /dev/null +++ b/gclib2/include/Tree.h @@ -0,0 +1,45 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_TREE_H +#define DEFINE_TREE_H + +#include "elist.h" +struct node_t; +struct node_t +{ + char * key; + char * userData; + uint32_t ID; + node_t * parentNode; + List * childNodes; // node_t * +}; + +typedef void (node_f) (node_t *); + +/// Класс - дерево. +class Tree +{ + public: + Tree (); + ~Tree (); + + node_t * rootNode; + char * userData; + + node_t * newNode (node_t * parent, char * key = NULL, char * userData = NULL); + char * freeNode (node_t * node, Dfunc_t f); + List * childs (node_t * node); + node_t * searchDown (node_t * node, char *key, uint32_t ID = 0); + node_t * searchUp (node_t * node, char *key, uint32_t ID = 0); + List * keyChilds (node_t * node, char * key, uint32_t ID = 0); + void foreach (node_f fn, node_t * m_node = NULL); + + private: + uint16_t lastID; +}; + +#endif diff --git a/gclib2/include/best_names.h b/gclib2/include/best_names.h new file mode 100644 index 0000000..ef73509 --- /dev/null +++ b/gclib2/include/best_names.h @@ -0,0 +1,26 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_BEST_NAMES_H +#define DEFINE_BEST_NAMES_H + +class HV; +class EList; +class EArray; +class DConnection; +class DJobs; +class DPoll; +class DHeapSort; + +typedef HV Hash; +typedef EList List; +typedef EArray Array; +typedef DConnection Connection; +typedef DJobs Jobs; +typedef DHeapSort HeapSort; + +#endif + diff --git a/gclib2/include/darray.h b/gclib2/include/darray.h new file mode 100644 index 0000000..2eeff1a --- /dev/null +++ b/gclib2/include/darray.h @@ -0,0 +1,41 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DARRAY_H +#define DEFINE_DARRAY_H + +/// Класс - массив (char *). +class DArray +{ +public: + DArray (int asize = 0); + ~DArray (); + + bool add (char * VALUE); + void drop (); + char * get (int NUM); + int get_size (); + int set_size (int); + inline char ** get_skeleton () + { + return values; + } + void foreach (Dfunc_t); + void set (long, char *); + void init (int asize); + bool from_file (char * __from); + inline int get_real_size () { + return size; + } + +private: + char ** values; + int size; + int used; + +}; + +#endif diff --git a/gclib2/include/dconnection.h b/gclib2/include/dconnection.h new file mode 100755 index 0000000..14d87f7 --- /dev/null +++ b/gclib2/include/dconnection.h @@ -0,0 +1,105 @@ +/* + * (c) Oleg Puchinin 2006,2007 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DCONNECTION_H +#define DEFINE_DCONNECTION_H + +#include + +#ifndef DEFINE_DUDP_H +#include +#endif + +class DConnection; +/// Класс "соединение". +class DConnection +{ + public: + DConnection (); + DConnection (int sd); + ~DConnection (); + + int init (); + int initUdp (); + int reuseAddr (); + int bind (char *ip, uint16_t port); + int connect (char *ip, uint16_t port = 0); + int connectUdp (char *ip, uint16_t port); + int listen (int N); + Connection * accept (); + int send (char * buf, int len); + int sendTo (char * buf, int len); + int recv (char * buf, int len); + int recvFrom (char *buf, int len, char * IP, uint16_t * PORT); + DUdp * recvUdp (int bufLen = 65535); + void updateCTime (time_t d_time = 0); + void updateMTime (time_t d_time = 0); + int ioNRead (); + int select (int secs, int usecs); + Connection * clone (); + int setBroadcast (); + int setSocket (int m_sd, bool dirty = true); + int socket (); + int setTimeOut (int t); + int timeout (); + int close (); + + void setName (char * m_name); + void setGroup (char * m_group); + void setRevents (int m_set); + void setPollFlags (int m_set); + + int open (char *f_name, int openmode, int filemode = 0644); + int read (char *m_buf, int len); + int write (char *m_buf, int len); + char * getsockname (); + char * getpeername (); + uint16_t getpeerport (); + uint16_t getsockport (); + time_t get_ctime (); + time_t get_mtime (); + bool broadcast (); + + char * name (); + char * group (); + int revents (); + int pollFlags (); + + /* v2.3 */ + Buf * read (); + Buf * recv (int opts = 0); + int write (Buf *); + int send (Buf *, int opts = 0); + List * recvStrings (); + int shutdown (int how); + char * userData (); + char * setUserData (char * ptr); + + /**/ + + private: + char * c_user_data; + int c_sd; + int c_type; + char * c_name; + char * c_group; + time_t c_mtime; + time_t c_ctime; + char * c_cname; // client address + char * c_pname; // server address + uint16_t c_cport; + uint16_t c_pport; + char * c_status; // other data + int c_poll_flags; + int c_revents; + bool c_bcast; + bool dirtySocket; + int c_timeout; + void prepare (); +}; + +#endif + diff --git a/gclib2/include/dexec.h b/gclib2/include/dexec.h new file mode 100644 index 0000000..0795738 --- /dev/null +++ b/gclib2/include/dexec.h @@ -0,0 +1,29 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEXEC_H +#define DEXEC_H + +enum { + DEXEC_INULL = (1<<3), + DEXEC_ONULL = (1<<4), + DEXEC_ENULL = (1<<5), + DEXEC_EXEC = (1<<6), + DEXEC_IPIPE = (1<<7), + DEXEC_OPIPE = (1<<8), + DEXEC_EPIPE = (1<<9), + DEXEC_OTMP = (1<<10), + DEXEC_ETMP = (1<<11), + DEXEC_WAIT = (1<<12), +}; + +struct __dexec_t { + int cmd; + long param; +}; + +#endif + diff --git a/gclib2/include/dheapsort.h b/gclib2/include/dheapsort.h new file mode 100644 index 0000000..7d9e049 --- /dev/null +++ b/gclib2/include/dheapsort.h @@ -0,0 +1,30 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DHEAP_SORT_H +#define DHEAP_SORT_H + +/// Класс бинарной кучи (для сортировки). +class DHeapSort +{ + public: + char ** h; + int size; + + DHeapSort (int); + ~DHeapSort (); + + char * add (char *x); + char * extract_min (); + + private: + void checkup (int c); + void checkdown (int c); + +}; + +#endif + diff --git a/gclib2/include/djob_t.h b/gclib2/include/djob_t.h new file mode 100644 index 0000000..ab91c7e --- /dev/null +++ b/gclib2/include/djob_t.h @@ -0,0 +1,31 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DJOB_T_H +#define DEFINE_DJOB_T_H + +/// Контрольная структура дочернего процесса. +struct __djob_t +{ + __pid_t pid; + int exit_status; + char status_ready; + char * user_data; + int stdIn; + int stdOut; + int stdErr; + int pipe_in[2]; + int pipe_out[2]; + int pipe_err[2]; + char * shared_mem; + int shm_size; + char child; + char *otmp_name; + char *etmp_name; +}; + +#endif + diff --git a/gclib2/include/djobs.h b/gclib2/include/djobs.h new file mode 100644 index 0000000..4c58777 --- /dev/null +++ b/gclib2/include/djobs.h @@ -0,0 +1,39 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DJOBS_H +#define DEFINE_DJOBS_H +#include "djob_t.h" +#include "elist.h" + +/*! \class DJobs + * \brief Класс контроля дочерних процессов. */ + +#ifdef __cplusplus +class DJobs : public EList +{ + public: + DJobs (); + ~DJobs (); + + __djob_t * add (int pid, char * user_data = NULL); + __djob_t * attach (__djob_t * j); + __djob_t * zombie (); + __djob_t * by_pid (pid_t pid); + __djob_t * fork (); + __djob_t * wait_all (); + + private: + __djob_t * alloc_job (); + void __close_job_fds (__djob_t * j); + __djob_t * __do_zombie (pid_t pid, int status); +}; +#endif + + +#endif + + diff --git a/gclib2/include/dlist.h b/gclib2/include/dlist.h new file mode 100644 index 0000000..56d18ee --- /dev/null +++ b/gclib2/include/dlist.h @@ -0,0 +1,92 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DLIST_H +#define DEFINE_DLIST_H + +struct __dlist_entry_t; +typedef struct __dlist_entry_t { + char * data; + __dlist_entry_t * next; + __dlist_entry_t * prev; +}; + +#ifdef __cplusplus +/// Класс - простой список. +class DList { + public: + inline DList () { + head = NULL; + tail = NULL; + dont_free = false; + ecount = 0; + } + + ~DList (); + + inline char * init (char * one) { + head = new_one (one); + tail = head; + return one; + } + + char * init (__dlist_entry_t * one); + char * add_head (char *); + char * add_tail (char *); + void rm (__dlist_entry_t *); + + inline void del (__dlist_entry_t *entry) { + rm (entry); + } + + inline void remove (__dlist_entry_t *entry) { + rm (entry); + } + + void detach (__dlist_entry_t * one); + char * add_after (__dlist_entry_t *, char *); + char * add_before (__dlist_entry_t *, char *); + char * add_entry_head (__dlist_entry_t * one); + char * add_entry_tail (__dlist_entry_t * one); + char * add_entry_after (__dlist_entry_t *, __dlist_entry_t *); + char * add_entry_before (__dlist_entry_t *, __dlist_entry_t *); + void foreach (Dfunc_t); + + inline __dlist_entry_t * new_one (char * one) { + __dlist_entry_t *entry; + entry = new __dlist_entry_t; + memset (entry, 0, sizeof (__dlist_entry_t)); + entry->data = one; + ++ecount; + return entry; + } + + inline int count () { + return ecount; + } + + inline __dlist_entry_t * get_head () { + return head; + } + + inline __dlist_entry_t * get_tail () { + return tail; + } + + __dlist_entry_t * get_entry_at (int N); + char * get_at (int N); + + bool dont_free; + + protected: + __dlist_entry_t * head; + __dlist_entry_t * tail; + int ecount; +}; +#endif + +#endif + diff --git a/gclib2/include/dns.h b/gclib2/include/dns.h new file mode 100644 index 0000000..e50a8fc --- /dev/null +++ b/gclib2/include/dns.h @@ -0,0 +1,77 @@ +/* + * (c) Oleg Puchinin 2006-2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DNS_H +#define DEFINE_DNS_H + +#ifndef DEFINE_GCLIB2_H +#include +#endif + +#ifndef DEFINE_DNS_INTERNALS_H +struct dns_query; +struct dns_reply; +struct dns_header; +#endif + +class DNS +{ + public: + DNS (); + ~DNS (); + + int init (); + dns_query * loop () ; + void set_timeout (int sec) ; + int get_socket () ; + void clean () ; + char * A (char *host) ; + char * async_A (char *host, dns_query ** qRet = NULL) ; + char * MX (char *host) ; + char * async_MX (char *IP, dns_query ** qRet = NULL) ; + char * ip2name (char *IP) ; + char * async_ip2name (char *IP, dns_query ** qRet = NULL) ; + + private: + char * bestServer () ; + dns_query * query_async (uint16_t flags, uint16_t dr_type, uint16_t dr_class, char * host) ; + List * query_sync(uint16_t flags, uint16_t dr_type, uint16_t dr_class, char * host, + char ** d_resp = NULL, int *d_resp_len = NULL) ; + dns_reply * scan (List *list, uint16_t dr_type, uint16_t dr_class) ; + __dlist_entry_t * inquiries_scan (char * host, uint16_t dr_type, uint16_t dr_class) ; + dns_reply * bestMXReply (List * list) ; + char * __name2dns (char *name, int *len) ; + char * __ddup (char * ptr, unsigned char ch) ; + char * __dns_rd_chunk (DPBuf * p, char ** ptr, char * done) ; + char * __dns_resp_domain (DPBuf * p, char * domain, char **domain_end) ; + char * make_dns_pkt (uint16_t id, uint16_t flags, uint16_t d_type, + uint16_t d_class, char * domain, int *len) ; + List * resp_split (dns_header *hdr, char *pkt, int len) ; + void resp_clean (List * list) ; + char * ip2arpa (char *IP) ; + void clean_query (dns_query * q) ; + + int dns_sock; + int dns_last_id; + int dns_timeout; + List * dns_servers; + List * dns_inquiries; +}; + + +__export int dns_init () ; +__export char * dns_A (char *host) ; +__export char * dns_async_A (char *host, dns_query ** qRet = NULL) ; +__export char * dns_MX (char *host) ; +__export char * dns_async_MX (char *IP, dns_query ** qRet = NULL) ; +__export char * dns_ip2name (char *IP) ; +__export char * dns_async_ip2name (char *IP, dns_query ** qRet = NULL) ; +__export void dns_clean () ; +__export int dns_get_socket () ; +dns_query * dns_loop () ; + +#endif + diff --git a/gclib2/include/dpbuf.h b/gclib2/include/dpbuf.h new file mode 100644 index 0000000..d46dbea --- /dev/null +++ b/gclib2/include/dpbuf.h @@ -0,0 +1,63 @@ +/* + * (c) Oleg Puchinin 2006,2007 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DPBUF_H +#define DEFINE_DPBUF_H + +#include +#include +#include + +/// Класс - устойчивый буфер. +class DPBuf +{ + public: + DPBuf (); + DPBuf (char *, int len); + ~DPBuf (); + + char * set_pos (char * ptr); + void init (char *ptr, int len); + FILE * file (); + + void s8 (void); + void s16 (void); + void s32 (void); + void sd (int count); + + unsigned char r8 (char *ptr = NULL); + uint16_t r16 (char *ptr = NULL); + uint32_t r32 (char *ptr = NULL); + char * rd (char *ptr, int len); + + void w8 (char ch); + void w16 (uint16_t word); + void w32 (uint32_t dword); + void wd (char * buf, int len); + + bool check (char *ptr, int count); + char * strcat (char *ptr, char *S); + char * memmem (char * buf, char * needle, size_t needlelen); + char * ch (char *buf, char ch); + + inline char * data () { + return begin; + } + inline int len () { + return end - begin; + } + + bool ok; + + protected: + char * begin; + char * carret; + char * end; + FILE * m_file; +}; + +#endif + diff --git a/gclib2/include/dudp.h b/gclib2/include/dudp.h new file mode 100644 index 0000000..51af491 --- /dev/null +++ b/gclib2/include/dudp.h @@ -0,0 +1,26 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DUDP_H +#define DEFINE_DUDP_H + +#ifndef DEFINE_DPBUF_H +#include +#endif + +class DUdp : public DPBuf +{ + public: + DUdp (); + ~DUdp (); + + int init (char * data, int len, char * IP, uint16_t PORT); + char * ip; + uint16_t port; +}; + +#endif + diff --git a/gclib2/include/earray.h b/gclib2/include/earray.h new file mode 100644 index 0000000..c15e5fd --- /dev/null +++ b/gclib2/include/earray.h @@ -0,0 +1,47 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_EARRAY_H +#define DEFINE_EARRAY_H + +#include "darray.h" + +/// Класс - улучшенный массив. +class EArray : public DArray +{ + public: + EArray (int asize = 0); + + int find (char * d_find); + int sfind (char * d_find); + int snfind (char * d_find); + int add (long d_one); + List * toList (); + + int inline add (char * d_one) { + return add ((long) d_one); + } + + inline char * operator [] (int n) { + return get (n); + } + + void push (char ** d_push); + int snfind_fast (char *str, int n); + char * join (char * mid = NULL, int *len_out = NULL); + + int from_pipe (int fd); + int strings_to_file (char *f_name); + int expand (EArray * e); + int expand (char *S, char * split); + int dump (char * d_join); + + EArray & operator <<(char *); + +}; + +#endif + diff --git a/gclib2/include/elist.h b/gclib2/include/elist.h new file mode 100644 index 0000000..a4bc3c9 --- /dev/null +++ b/gclib2/include/elist.h @@ -0,0 +1,60 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_ELIST_H +#define DEFINE_ELIST_H + +#include "dlist.h" + +#ifdef __cplusplus + +/// Класс - список. +class EList : public DList +{ + public: + EList (); + ~EList (); + + char * get (); + char * first (); + char * last (); + char * next (); + char * prev (); + char * rm (); + + // v2.2 + char * get_first (); + char * get_last (); + char * add_before (char * S); + char * add_after (char * S); + char * shift (); + char * unshift (char * S); + char * push (char *S); + char * pop (); + void dump (); + void bdump (); + __dlist_entry_t * get_entry (); + Array * toArray (); + /**/ + + bool eol (); + inline char * add (char *S) { + return add_tail (S); + } + EList & operator << (char *); + char * operator [] (int offset); + List & operator = (List &); + bool operator == (List &); + bool operator != (List &); + List & operator + (List & l); + + private: + __dlist_entry_t * pos; +}; +#endif + +#endif + diff --git a/gclib2/include/gc_io.h b/gclib2/include/gc_io.h new file mode 100644 index 0000000..4318f4e --- /dev/null +++ b/gclib2/include/gc_io.h @@ -0,0 +1,44 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_GC_IO_H +#define DEFINE_GC_IO_H + +/*** ./IO.cxx ***/ +__export int Dfnwrite (char * p_lpsz_filename, void * p_lp_buffer,int int_size) ; +__export int Dfnread (char * f_name, void * p_lp_buffer, int int_size) ; +__export int Dselect (int FILENO, int SEC, int USEC) ; +__export char * DFILE (const char * m_filename, int *rsize) ; +__export struct stat * DSTAT (const char * S) ; +__export struct stat * DLSTAT (const char * S) ; +__export int DIONREAD (int fd) ; +__export int fsize (const char * S) ; +__export int fdsize (int fd) ; +__export char * DFDMAP (int fd) ; +__export char * DFMAP (const char *d_file, int *out_fd, int *d_out_size) ; +__export char * Dread_to_eof (int fd, int *d_out_size) ; +__export char * allData (int fd, int * d_out_size) ; +__export int move_stream (int fd_in, int fd_out) ; +__export int move_stream_file (FILE * m_src, FILE * m_dst) ; +__export int Dnonblock (int fd) ; +__export int close_pipe (int *fds) ; +__export int Dtmpfd (char *name) ; +__export FILE * Dtmpfile (char *name) ; +__export int fdclose (int * fd) ; +__export char * fext (char *name) ; +__export int logToFile (char * fileName, char * fmt, ...) ; +__export int copyFile (char * sourceName, char * destName) ; +__export char * DSTR (FILE * m_file) ; +__export int Dcopyfd (int m_source, int m_dest, int N) ; +__export int Dcopyfile (FILE * m_source, FILE * m_dest, int N) ; + +__export List * file (char * fileName); // v2.2 + +/*** ./dfiles.cxx ***/ +__export List * Dfiles (char * path) ; + +#endif + diff --git a/gclib2/include/gc_network.h b/gclib2/include/gc_network.h new file mode 100644 index 0000000..b79a252 --- /dev/null +++ b/gclib2/include/gc_network.h @@ -0,0 +1,36 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_NETWORK_H +#define DEFINE_NETWORK_H + +#include +#include +#include + +__export int sendToPath(void * lp_data,int int_size,char * lpsz_path) ; +__export int sendToSocket (int sock, void * lp_data, int int_size, const char * address, uint16_t port) ; +__export int sendTo (void * lp_data, int int_size, const char * address, uint16_t port); +__export int dBind (int sock, char * addr, int port) ; +__export int dReuseAddr (int sock) ; + +__export int dSocket () ; +__export int dUdpSocket () ; +__export int dConnect (int sock, const char * addr, uint16_t port) ; +__export int getHostByName(const char * hostName,struct in_addr * address) ; +__export char * getNameByHost(struct in_addr * addr) ; +__export int recvFrom (int sd, char * buf, int size, char * peer_ip, uint16_t * peer_port) ; +__export int setBroadcast (int fd) ; +__export int pollScan (struct pollfd *p, int count, int pos) ; + +__export char * url_protocol (char * url) ; +__export char * url_host (char * url) ; +__export char * url_file (char * url) ; + +bool isIP (char * S); + +#endif + diff --git a/gclib2/include/gc_strings.h b/gclib2/include/gc_strings.h new file mode 100644 index 0000000..993b183 --- /dev/null +++ b/gclib2/include/gc_strings.h @@ -0,0 +1,50 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_STRINGS_H +#define DEFINE_STRINGS_H + +#include + +/*** ./strings.cxx ***/ +__export char * gc_realloc (char * PTR, int old_size, int new_size) ; +__export void * memdup (void * PTR, int size) ; +__export char * Dstrmid (char * lpsz_string,char * param1, char * param2) ; +__export char * chomp (char * S) ; +__export char * strchr_r (char * S, char ch, int d_len) ; +__export char * strchrs (char *S, char ch, char ch2, char ch3, char ch4) ; +__export char * Dstrstr_r (char *where, char * str) ; +__export int Dsyms (char * from, char * to, char sym) ; +__export char * Dmemchr (char * from, int n, char ch) ; +__export char * Dstrndup (char *ptr, int n) ; +__export char * Dmid_strchr (char *ptr, char *end, char ch) ; +__export char * Dmid_getstr (char *buf, char *end) ; +__export char * Drand_str (char * buf, int count) ; +__export char * int2str (int i) ; +__export char * stail (char *S) ; +__export char * strmov (char *buf, char * S) ; +__export char * strnmov (char *buf, char * S, int N) ; +__export char * strip (char *str) ; +__export char * strip2 (char *str) ; +__export char * Dmemmem (char *haystack, size_t haystacklen, char *needle, size_t needlelen) ; +__export char * Dmid_memmem (char * begin, char * last, char * needle, int needlelen) ; +__export char * Dsprintf (char * fmt, ...) ; + +__export List * split (char * buf, char * spl) ; // v2.2 +__export List * bsplit (Buf * m_buf, int c) ; //v2.2 +__export List * csplit (Buf * m_buf, Buf * spl, int c = 0) ; // v2.2 + +__export char * join (List * m_list, char * jn) ; // v2.2 +__export Buf * bjoin (List * m_list, Buf * jn); // v2.2 + +Buf * pack (char * fmt, ...) ; +int unpack (Buf * m_buf, char * fmt, ...) ; // v2.2 + +__export char * strinsert (char * base, char *ptr, char *ins, int rewrite) ; // v2.2 +__export char * strreplace (char * buf, char * oldstr, char * newstr) ; // v2.2 + +#endif + diff --git a/gclib2/include/gclib2.h b/gclib2/include/gclib2.h new file mode 100644 index 0000000..b0e087a --- /dev/null +++ b/gclib2/include/gclib2.h @@ -0,0 +1,60 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_GCLIB2_H +#define DEFINE_GCLIB2_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +typedef void (*Dfunc_t)(void *); +typedef void (*Dhash_f)(char *, char *); + +struct dkey_t { + char *KEY; + char *VALUE; +}; + +#ifdef __cplusplus + +typedef unsigned int uint32_t; +#include +#include +#include "dlist.h" +#include "elist.h" +#include "darray.h" +#include "earray.h" +#include "Tree.h" +#include "dheapsort.h" +#include "dpbuf.h" +#include +#include "dconnection.h" +#include "Poll.h" +#include "djobs.h" +#include "dudp.h" +#include "String.h" +#include +#endif +typedef unsigned char uchar_t; + +#include "djob_t.h" +#include "dexec.h" +#include + +#endif + diff --git a/gclib2/include/http.h b/gclib2/include/http.h new file mode 100644 index 0000000..b19ca1b --- /dev/null +++ b/gclib2/include/http.h @@ -0,0 +1,13 @@ +/* + * (c) Oleg Puchinin 2007,2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_HTTP_H +#define DEFINE_HTTP_H + +char * http_get (char * url, int * size); + +#endif + diff --git a/gclib2/include/hv.h b/gclib2/include/hv.h new file mode 100644 index 0000000..f71f3ef --- /dev/null +++ b/gclib2/include/hv.h @@ -0,0 +1,77 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_HV_H +#define DEFINE_HV_H + +/// Класс - хэш с сортировкой ключей. +class HV +{ + public: + HV (); + ~HV (); + + /* v2.0 */ + char * get (char * key) ; + char * set (char * key, char * value) ; + + inline void sort () { + do_sort (false); + } + inline void clean () { + do_sort (true); + } + inline int autoSort () { + return dfa; + } + inline int setAutoSort (int d_set) { + dfa = d_set; + return dfa; + } + inline bool autoCheck () { + return b_ac; + } + inline bool setAutoCheck (bool d_set) { + b_ac = d_set; + return b_ac; + } + inline EArray * sortedElements () { + return elements; + } + inline EArray * dirtyElements () { + return dirty_elements; + } + /***/ + + /* v2.2 */ + List * keys (); + List * values (); + int from_file (char *f_name); + void foreach (Dhash_f f); + void dump (); + + char * operator [] (char *S); + /**/ + + private: + dkey_t * __find_item (char * key) ; + dkey_t * __find_dirty_item (char * key) ; + void do_sort (bool b_clean) ; + char * pack_item (char * key, char * value) ; + char * set_item_value (char * pack, char * value) ; + char * get_item (char * key) ; + dkey_t * unpackItem (char * item, dkey_t * data); + List * keys_or_values (bool val); + + char ** heap; + int dfa; // Dirty elements before autosorting. + bool b_ac; + EArray * elements; + EArray * dirty_elements; +}; + +#endif + diff --git a/gclib2/include/ipc.h b/gclib2/include/ipc.h new file mode 100644 index 0000000..010ad34 --- /dev/null +++ b/gclib2/include/ipc.h @@ -0,0 +1,23 @@ +/* + * (c) oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_IPC_H +#define DEFINE_IPC_H + +/*** ./ipc.cxx ***/ +int sem_init (int * KEY) ; +int sem_get (int KEY) ; +int down (int sem) ; +int up (int sem) ; +int sem_init_rw (int * KEY) ; +int down_read (int sem) ; +int up_read (int sem) ; +int down_write (int sem) ; +int up_write (int sem) ; +int msg_init (int *KEY) ; + +#endif + diff --git a/gclib2/include/network.h b/gclib2/include/network.h new file mode 100644 index 0000000..d892c65 --- /dev/null +++ b/gclib2/include/network.h @@ -0,0 +1,32 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_NETWORK_H +#define DEFINE_NETWORK_H + +#include +#include +#include + +__export int sendToPath(void * lp_data,int int_size,char * lpsz_path) ; +__export int sendToSocket (int sock, void * lp_data, int int_size, const char * address, uint16_t port) ; +__export int sendTo (void * lp_data, int int_size, const char * address, uint16_t port); +__export int dBind (int sock, char * addr, int port) ; +__export int dSocket () ; +__export int dUdpSocket () ; +__export int dConnect (int sock, const char * addr, uint16_t port) ; +__export int getHostByName(const char * hostName,struct in_addr * address) ; +__export char * getNameByHost(struct in_addr * addr) ; +__export int recvFrom (int sd, char * buf, int size, char * peer_ip, uint16_t * peer_port) ; +__export int setBroadcast (int fd) ; +__export int pollScan (struct pollfd *p, int count, int pos) ; + +__export char * url_protocol (char * url) ; +__export char * url_host (char * url) ; +__export char * url_file (char * url) ; + +#endif + diff --git a/gclib2/install.sh b/gclib2/install.sh new file mode 100755 index 0000000..6767511 --- /dev/null +++ b/gclib2/install.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +rm -fr /usr/include/gclib2 +mkdir /usr/include/gclib2 +cp -a ./include/*.h /usr/include/gclib2/ +cp ./libgclib2.* /usr/lib/ +ldconfig + diff --git a/gclib2/intro.html b/gclib2/intro.html new file mode 100644 index 0000000..3f71a69 --- /dev/null +++ b/gclib2/intro.html @@ -0,0 +1,772 @@ + + + + + + + + + + + +

Практическое +применение GCLib2

+

В связи с тем, что +означенная библиотека имеет большое +количество функций для решения самых +различных задач, возникла необходимость +в документе, который бы помог +сориентироваться и правильно применить +всю мощь имеющегося кода. Упор в данном +тексте будет делаться не на справочную +информацию по функциям, а именно на +методы и области применения. +

+


+

+

Базовые классы.

+

В +библиотеке имеется несколько базовых +классов (массив, список, хэш). Эти классы +не требуют пояснения. В библиотеке не +используется STL или glib по той простой +причине, что GCLib «заточена» под +операционную систему Linux и только Linux. +Т.е. вы скорее найдете обертку для нового +системного вызова tee, нежели очередную +«кроссплатформенную» функцию +«connect».

+


+

+

Обработка +данных.

+

В +GCLib2 большое количество функций направлено +именно на обработку данных. При помощи +низкоуровневых функций был написан +полностью рабочий модуль DNS, код которого +составляют всего ~500 строк. Другие +аналогичные библиотеки доступа к DNS, не +использующие GCLib2, имеют несколько тысяч +строк и требуют много времени чтобы +разобраться в их API. Модуль DNS в GCLib +предоставляет пару функций, назначение +которых не требует даже документирования +(dns_A, dns_MX, dns_ip2name).

+


+

+

Строковые +функции.

+

К +строковым функциям относятся функции +управления памятью и функции поиска и +выборки определенных данных из имеющегося +блока памяти. Блоки памяти, зачастую +это сетевые пакеты, либо обычные файлы. +

+

К +функциям распределения памяти относятся +две функции : изменения размера блока +и копирования блока (gc_realloc и memdup +соответственно).

+

К +простым строковым примитивам относятся +следующие функции :

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

chop

+
+

Удалить последний + символ строки.

+
+

chomp

+
+

Удалить конец строки.

+
+

strchr_r

+
+

Найти символ (с конца).

+
+

strchrs

+
+

Поиск одного из + символов.

+
+

Dstrstr_r

+
+

Поиск строки (с конца).

+
+

Dsyms

+
+

Посчитать количество + символов.

+
+

Dmemchr

+
+

Поиск символа (в блоке).

+
+

Dstrndup

+
+

Скопировать несколько + символов строки.

+
+

Dmid_strchr

+
+

Поиск символа между + двумя указателями (началом и концом).

+
+

Dmid_getstr

+
+

Взять строку из буфера.

+
+

Dstrmid

+
+

Выбрать строку между + двух других.

+
+

Dsplit

+
+

Разбить строку.

+
+

Drand_str

+
+

Случайная строка.

+
+

int2str

+
+

Число в новую строку.

+
+

stail

+
+

Указатель на последний + ноль.

+
+

strmov

+
+

Копировать строку.

+
+

strip

+
+

Удалить начальные + пробельные символы.

+
+

strip2

+
+

Удалить конечные + пробельные символы.

+
+

Dmemmem

+
+

Аналог memmem (3)

+
+

Dmid_memmem

+
+

Найти блок между + указателями.

+
+

Dsprintf

+
+

Отформатированная + строка (не более 512 символов).

+
+


+

+

Список.

+

Для +создания разного рода списков существует +класс EList. Элементы добавляются функциями +add_head (добавление в начало) и add_tail +(добавление в конец). Навигация по +элементам – first (перемещение к первому +элементу), last (перемещение к последнему +элементу), next (следующий элемент), prev +(предыдущий элемент). Выход за границы +списка определяется функцией eol () +(возвращает true, если курсор вышел за +границу списка).

+


+

+

«Пакетные» +функции.

+

К +пакетным функциям относится код, +оперирующий с блоками данных, полученных +сетевым путем. Конечно, данный функционал +можно применять и на другие данные.

+


+

+

Пакетные +примитивы.

+

К +пакетным примитивам относятся функции +записи в пакет :

+

pkt_W8, +pkt_W16, pkt_W32, pkt_WS, pkt_WSZ, pkt_WD +

+

каждая +из которых записывает определенные +данные : байт, два байта, четыре байта, +строку, строку с нулем, блок данных.

+

Так +же функции чтения из пакета : pkt_R8, pkt_R16, +pkt_R32, pkt_RD.

+

При +использовании пакетных примитивов +обязателен контроль выхода за границу +буфера. Эти функции предназначены для +програм на Си. Для программ на Си++ +рекомендую использовать DPBuf.

+


+

+

Устойчивый +буфер.

+

Для +«защищенного» доступа к любым +данным, без риска выхода за границу +пакета, существует класс - «устойчивый +буфер» DPBuf. Класс позволяет читать +данные и перемещаться в любую позицию +пакета. Если в какой-то момент произошел +выход за границу, переменная «ok» +буфера установится в false. При этом чтения +данных не произойдет. Реализованы +функции чтения (r*), смещения (s*), записи +(w*). Так же можно получить +

+

поток +FILE * (командой file ()).

+


+

+

Файловая +система.

+

Системные +вызовы контролирующие файловую систему +на столько базовые, что работа с ними +представляется делом очень нудным и не +рациональным. Неумение пользоваться +данными системными вызовами приводит +либо к отказу от разработки под +операционную систему Linux, либо к переходу +на языки «более высокого уровня». +На практике же достаточно написать пару +функций-оберток, которые будут иметь +удобный интерфейс пользователя и +сохранят всю мощь системного +программирования. В библиотеке GCLib2 я и +реализовал все эти функции. +

+

Функции +быстрого доступа к данным из файла :

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Dfnwrite

+
+

Записать непосредственно в + файл.

+
+

Dfnread

+
+

Прочитать непосредственно из + файла.

+
+

DFILE

+
+

Прочитать весь файл.

+
+

DFDMAP

+
+

mmap'нуть дескриптор файла (все + данные из него).

+
+

DFMAP

+
+

mmap'нуть файл.

+
+

Dread_to_eof

+
+

Прочитать все из дескриптора.

+
+

Dtmpfd

+
+

Вернуть дескриптор временного + файла.

+
+

logToFile

+
+

Записать строчку в конец файл.

+
+

DSTR

+
+

Прочитать строчку из файла.

+
+

copyFile

+
+

Скопировать файл.

+
+

Функции +контроля файловой системы :

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Dselect

+
+

Ожидать данные.

+
+

DSTAT

+
+

stat (2)

+
+

DLSTAT

+
+

lstat (2)

+
+

DIONREAD

+
+

Количество байт, доступных + для чтения.

+
+

fsize

+
+

Размер файла (по имени).

+
+

fdsize

+
+

Размер файла (по дескриптору).

+
+

move_stream +

+
+

Переместить все данные из + одного дескриптора в другой.

+
+

Dnonblock

+
+

Включить неблокируемый режим.

+
+

close_pipe

+
+

Закрыть трубу.

+
+

fdclose

+
+

Закрыть (открытый) дескриптор.

+
+

fext

+
+

Получить расширение файла.

+
+

Dfiles

+
+

Получить список файлов в + директории.

+
+


+

+

Сетевой модуль.

+

При +системном программировании вы бы +использовали функии bind,connect,send,recv и иже +с ними. На самом деле вам необходимо +две-три функции, объединяющие эти +системные вызовы («сетевых примитивов»). +Здесь вы их и найдете. Все функции +работают (на данный момент) только с +IPv4. Все порты – не сетевой формат. Все +адреса – строка вида «xxx.xxx.xxx.xxx». +Т.е. sockaddr_in нигде не используется.

+


+

+

Сетевые +примитивы :

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

dSocket

+
+

Новый сокет.

+
+

dUdpSocket

+
+

Новый UDP сокет.

+
+

sendToPath

+
+

послать UDP в именнованый канал. + (unix socket).

+
+

sendToSocket

+
+

послать UDP используя существующий + сокет.

+
+

sendTo

+
+

Послать UDP непосредственно + адресату.

+
+

dBind

+
+

bind'нуть сокет.

+
+

dConnect

+
+

Подключить сокет.

+
+

getHostByName

+
+

Адрес по имени.

+
+

getNameByHost

+
+

Имя по адресу.

+
+

recvFrom

+
+

Получить UDP.

+
+

setBroadcast

+
+

Включить BROADCAST на сокет.

+
+

pollScan

+
+

Найти "готовый" pollfd.

+
+

Dpoll_add

+
+

Добавить дескриптор в пул. пул + – EArray с элементами pollfd *

+
+

Dpoll_coallesce

+
+

Собрать пул для poll (2).

+
+


+

+

Сетевые классы.

+

Для +доступа к сети так же есть два класса – +DConnection и DPoll. Первый обобщает всю +информацию, которая может быть необходима +при обработке соединения. Для инициализации +соединения – выполняется «init», и +далее «bind» или «connect». Для +UDP необходимо использовать initUdp и +connectUdp. После «подключения» вы +можете использовать sendTo, передавая в +качестве аргумента только пакет и его +размер.

+

Использование +DPoll тоже не должно быть проблемой. +Выполняется добавление нужных соединений +или дескрипторов, затем poll_build и в цикле +poll_rebuild. Поиск «готовых» выполняется +при помощи scan или непосредственно через +get_poll.

+


+

+

Контроль +дочерних процессов.

+

+В Линуксе при создании приложений, +рассчитанных на многопроцессорные +системы, в основном используют «треды» +(threads'), и, соответственно стандартную +библиотеку pthread. Использование данной +библиотеки ведет к увеличению кода, +зачастую на порядок (по сравнению с +однопроцессорной версией программы). +Поэтому многопроцессорное ПО берутся +писать только такие монстры как apache. На +деле же код написанный для pthread вообще +не несет смысловую нагрузку. Если не +брать в расчет не хилое API pthread, а докопаться +до сути, мы увидим только один системный +вызов – fork. Т.е. нам нужна только «вилка» +! Треды считаются «лучше», потому +что у дочернего потока и родительского +процесса одно адресное пространство и +потоки быстрее создаются. Что же видим +на практике ? Одно адресное пространство +заставляет «бояться» практически +любых функций. На доступ к своим же +данным надо ставить заглушки/замки в +виде семафоров. Польза же от быстрого +создания потока стремиться к нулю, ибо +все необходимые процессы могут быть +созданы один раз, при запуске программы.

+


+

+

+Да, конечно, применение тредов, +в некоторых случаях, вполне обосновано. +С другой стороны существует огромное +множество программ, которые не поддерживают +многопроцессорные системы «в +принципе». А ведь для того чтобы +программа начала работать на любом +количестве процессоров, необходимо и +достаточно только «вилки» ! Плюс, +конечно, грамотная структура программы. + +

+


+

+

+В GCLib существуют средства более +высокого уровня, нежели простой fork. К +этим средствам относится единственный +класс Djobs. Данный класс может создавать +дочерние процессы, ведя их учет. Поэтому +чтобы дождаться завершения всех дочерних +процессов достаточно вызвать функцию +wait_all.

+


+

+


+

+


+

+


+

+ + \ No newline at end of file diff --git a/gclib2/main.aap b/gclib2/main.aap new file mode 100644 index 0000000..49cf1fb --- /dev/null +++ b/gclib2/main.aap @@ -0,0 +1,50 @@ +:variant Build + release + CXXFLAGS=-Iinclude + OPTIMIZE=3 + debug + CXXFLAGS=-Iinclude -g3 + OPTIMIZE=0 + +:dll gclib2 : modules/Core/Buf.cxx + modules/Core/djobs.cxx + modules/Core/Tree.cxx + modules/Core/String.cxx + modules/Core/dlist.cxx + modules/Core/dpbuf.cxx + modules/Core/elist.cxx + modules/Core/darray.cxx + modules/Core/dexec.cxx + modules/Core/hv.cxx + modules/Core/earray.cxx + modules/IO/dfiles.cxx + modules/IO/IO.cxx + modules/Net/FTP/FTP.cxx + modules/Net/HTTP/http.cxx + modules/Net/MMP/mmp_engine.cxx + modules/Net/INET/url.cxx + modules/Net/INET/network.cxx + modules/Net/INET/dudp.cxx + modules/Net/INET/dconnection.cxx + modules/Net/INET/Poll.cxx + modules/Net/DNS/dns.cxx + modules/Linux/linux_specific.cxx + modules/Misc/Pack/pack_countList.cxx + modules/Misc/Pack/pack_countBList.cxx + modules/Misc/Pack/pack.cxx + modules/Misc/Pack/unpack.cxx + modules/Misc/Pack/pack_countHash.cxx + modules/Misc/Pack/count.cxx + modules/Misc/Pack/unpack_listhash.cxx + modules/Misc/Pack/pack_countTree.cxx + modules/Misc/strings.cxx + modules/Misc/split.cxx + modules/Misc/misc.cxx + modules/Misc/join.cxx + modules/Misc/Pkt.cxx + modules/Misc/dheapsort.cxx + modules/Misc/dsplit.cxx + modules/IPC/ipc.cxx + modules/Crypt/scode.cxx + modules/Crypt/base64.cxx + modules/Crypt/digests.cxx diff --git a/gclib2/modules/Core/Buf.cxx b/gclib2/modules/Core/Buf.cxx new file mode 100644 index 0000000..b29d4a9 --- /dev/null +++ b/gclib2/modules/Core/Buf.cxx @@ -0,0 +1,163 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include + +void buf_free (void * ptr) +{ + Buf * b; + b = (Buf *) ptr; + if (b) + delete b; +} + +Buf::Buf () +{ +} + +Buf::Buf (int len) +{ + char * m_buf; + m_buf = CNEW (char, len); + init (m_buf, len); +} + +Buf::Buf (char * ptr, int len) +{ + init (ptr, len); +} + +Buf::~Buf () +{ + delete begin; +} + +char * Buf::seek (int offset, int whence) +{ + switch (whence) { + case SEEK_SET: + carret = &begin[offset]; + break; + + case SEEK_CUR: + carret = &carret[offset]; + break; + + case SEEK_END: + carret = &end[offset]; + break; + } + + check (carret, 1); + return carret; +} + +int Buf::available () +{ + return end - carret; +} + +char * Buf::position () +{ + return carret; +} + +Buf * Buf::shift (int count) +{ + Buf * b; + char * ptr; + + if (count <= 0) + return NULL; + + b = new Buf (count); + memcpy (b->data (), begin, count); + carret += count; + + count = available (); + ptr = CNEW (char, count); + memcpy (ptr, carret, count); + + DROP (begin); + begin = ptr; + end = &ptr[count]; + carret = begin; + + return b; +} + +int Buf::unshift (Buf * m_buf) +{ + int len1; + int len2; + char * ptr; + char * buf; + + if (! m_buf) + return len (); + + len1 = len (); + len2 = m_buf->len (); + buf = CNEW (char, len1+len2); + + ptr = buf; + memcpy (ptr,m_buf->data (), len2); + ptr += len2; + memcpy (ptr, data (), len1); + + DROP (begin); + begin = buf; + end = &begin[len1 + len2]; + carret = begin; + + return len1 + len2; +} + +char * Buf::readString () +{ + char * ptr; + char * Ret = 0; + + ptr = ch (carret, '\0'); + if (! ptr) + return NULL; + Ret = strdup (carret); + set_pos (++ptr); + + return Ret; +} + +bool Buf::operator == (Buf * m_buf) +{ + char * ptr; + char * ptr2; + int len1; + int len2; + + if (! m_buf) + return false; + + ptr = data (); + ptr2 = m_buf->data (); + len1 = len (); + len2 = m_buf->len (); + + if (len1 != len2) + return false; + + if (! memcmp (ptr, ptr2, len1)) + return true; + + return false; +} + +bool Buf::operator != (Buf * m_buf) +{ + return !(*this == m_buf); +} + + diff --git a/gclib2/modules/Core/Buf.h b/gclib2/modules/Core/Buf.h new file mode 100644 index 0000000..6df635d --- /dev/null +++ b/gclib2/modules/Core/Buf.h @@ -0,0 +1,36 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_BUF_H +#define DEFINE_BUF_H + +#include + +class Buf; +class Buf : public DPBuf +{ + public: + Buf (); + Buf (int len); + Buf (char * ptr, int len); + ~Buf (); + + char * seek (int offset, int whence); + int available (); + char * position (); + Buf * shift (int count); + int unshift (Buf * m_buf); + + char * readString (); // v2.3 + + bool operator == (Buf * m_buf); + bool operator != (Buf * m_buf); +}; + +void buf_free (void * ptr); + +#endif + diff --git a/gclib2/modules/Core/Object.cxx b/gclib2/modules/Core/Object.cxx new file mode 100644 index 0000000..eacdcaf --- /dev/null +++ b/gclib2/modules/Core/Object.cxx @@ -0,0 +1,26 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include + +Object::Object () +{ +} + +Object::~Object () +{ +} + +Buf * Object::pack () +{ + return NULL; +} + +Object * Object::unpack (Buf *) +{ + return NULL; +} + diff --git a/gclib2/modules/Core/Object.h b/gclib2/modules/Core/Object.h new file mode 100644 index 0000000..0429471 --- /dev/null +++ b/gclib2/modules/Core/Object.h @@ -0,0 +1,23 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_OBJECT_H +#define DEFINE_OBJECT_H + +#include + +class Object +{ + public: + Object (); + ~Object (); + + virtual Buf * pack (); + virtual Object * unpack (Buf *); +}; + +#endif + diff --git a/gclib2/modules/Core/String.cxx b/gclib2/modules/Core/String.cxx new file mode 100644 index 0000000..717b0b1 --- /dev/null +++ b/gclib2/modules/Core/String.cxx @@ -0,0 +1,88 @@ +/* + * (c) Oleg Puchinin 2007,2008 + * graycardinalster@gmail.com + * + */ + +#include +#include + +String::String () +{ + m_buf = strdup (""); +} + +String::String (const char * str) +{ + m_buf = strdup (str); +} + +String::String (char * str) +{ + m_buf = str; +} + +String::~String () +{ + DROP (m_buf); +} + +String & String::operator + (char * str) +{ + char * m_new; + char * S; + m_new = CNEW (char, strlen (m_buf) + strlen (str) + 1); + S = strmov (m_new, m_buf); + strmov (S, str); + DROP (m_buf); + m_buf = m_new; + return *this; +} + +String & String::operator + (String & str) +{ + return (*this) + str.c_str (); +} + +String & String::operator = (char * str) +{ + if (! str) + return *this; + DROP (m_buf); + m_buf = str; + return *this; +} + +String & String::operator = (const char * str) +{ + if (! str) + return *this; + DROP (m_buf); + m_buf = strdup (str); + return *this; +} + +String & String::operator = (String & str) +{ + DROP (m_buf); + m_buf = strdup (str.c_str ()); + return *this; +} + +String & String::operator << (char * str) +{ + return (*this + str); +} + +String & String::operator << (int num) +{ + char m_buf[64]; + sprintf (m_buf, "%i", num); + return (*this + m_buf); +} + +char * String::c_str () +{ + return m_buf; +} + diff --git a/gclib2/modules/Core/String.h b/gclib2/modules/Core/String.h new file mode 100644 index 0000000..558a9ce --- /dev/null +++ b/gclib2/modules/Core/String.h @@ -0,0 +1,38 @@ +/* + * (c) Oleg Puchinin 2007,2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_STRING_H +#define DEFINE_STRING_H + +class String; +class String +{ + public: + String (); + String (char * str); + String (const char * str); + ~String (); + + String & operator + (char * str); + String & operator + (String & str); + String & operator = (char * str); + String & operator = (const char * str); + String & operator = (String & str); + + inline operator char *() { + return m_buf; + } + String & operator << (char * str); + String & operator << (int num); + char * c_str (); + + private: + char * m_buf; +}; + +#endif + + diff --git a/gclib2/modules/Core/Tree.cxx b/gclib2/modules/Core/Tree.cxx new file mode 100755 index 0000000..99a065c --- /dev/null +++ b/gclib2/modules/Core/Tree.cxx @@ -0,0 +1,191 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + * 30/01/07 + */ + +#include +#include +#include +#include +#include +#include "gclib2.h" + +Tree::Tree () +{ + rootNode = NULL; + srand (time (NULL)); + lastID = 0; +} + +Tree::~Tree () +{ + freeNode (rootNode, NULL); +} + +/// Удалить нод функцией f. +char * Tree::freeNode (node_t * node, Dfunc_t f) +{ + EList * list; + char * userData; + node_t * n; + if (! node) + return NULL; + + if (node->parentNode) { + list = node->parentNode->childNodes; + list->first (); + while ((n = (node_t *) list->get ()) && n && n != node) + list->next (); + if (n) + list->rm (); + node->parentNode = NULL; + } + + userData = node->userData; + list = node->childNodes; + while ((n = (node_t *) list->first ()) && n) { + n->parentNode = NULL; + freeNode (n, f); + list->rm (); + if (f) + f (n); + } + + if (f) + f (node); + + delete list; + delete node; + return userData; +} + +/// Добавить нод. +node_t * Tree::newNode (node_t * parent, char * key, char * userData) +{ + node_t * n; + + n = CNEW (node_t, 1); + memset (n, 0, sizeof (node_t)); + n->key = key; + n->ID = ++lastID; + n->userData = userData; + n->childNodes = new EList; + + if (parent) { + n->parentNode = parent; + parent->childNodes->add (LPCHAR (n)); + } else + rootNode = n; + + return n; +} + +/// Получить список всех дочерних нодов. +EList * Tree::childs (node_t * node) +{ + if (! node) + return NULL; + return node->childNodes; +} + +/// Искать ключ (вниз по дереву). +node_t * Tree::searchDown (node_t * node, char * key, uint32_t ID) +{ + EList * list; + node_t * n; + + if (! node || ! key) + return NULL; + + list = node->childNodes; + if (! list) + return NULL; + + list->first (); + while ((n = (node_t *) list->get ()) && n) { + if (key) { + if (EQ (n->key, key)) + return n; + } else { + if (ID == n->ID) + return n; + } + + list->next (); + } + + list->first (); + while ((n = (node_t *) list->get ()) && n) { + n = searchDown (n, key); + if (n) + return n; + list->next (); + } + + return NULL; +} + +/// Искать ключ (вверх). +node_t * Tree::searchUp (node_t * node, char * key, uint32_t ID) +{ + node_t * n; + + if (! node) + return NULL; + + n = node->parentNode; + while (n) { + if (key) { + if (EQ (key, n->key)) + return n; + } else { + if (ID == n->ID) + return n; + } + n = n->parentNode; + } + + return n; +} + +/// Вернуть все дочерние ноды ключа key. +EList * Tree::keyChilds (node_t * node, char * key, uint32_t ID) +{ + node_t * n; + + if (node) + n = node; + else + n = rootNode; + n = searchDown (n, key, ID); + if (n) + return n->childNodes; + + return NULL; +} + +void Tree::foreach (node_f fn, node_t * m_node) +{ + node_t * n; + + if (! m_node) + m_node = rootNode; + if (! fn) + return; + + fn (m_node); + if (! m_node->childNodes) + return; + + m_node->childNodes->first (); + while (true) { + n = (node_t *) m_node->childNodes->get (); + if (! n) + break; + foreach (fn, n); + m_node->childNodes->next (); + } +} + diff --git a/gclib2/modules/Core/Tree.h b/gclib2/modules/Core/Tree.h new file mode 100644 index 0000000..7d8d4bb --- /dev/null +++ b/gclib2/modules/Core/Tree.h @@ -0,0 +1,45 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_TREE_H +#define DEFINE_TREE_H + +#include "elist.h" +struct node_t; +struct node_t +{ + char * key; + char * userData; + uint32_t ID; + node_t * parentNode; + List * childNodes; // node_t * +}; + +typedef void (node_f) (node_t *); + +/// Класс - дерево. +class Tree +{ + public: + Tree (); + ~Tree (); + + node_t * rootNode; + char * userData; + + node_t * newNode (node_t * parent, char * key = NULL, char * userData = NULL); + char * freeNode (node_t * node, Dfunc_t f); + List * childs (node_t * node); + node_t * searchDown (node_t * node, char *key, uint32_t ID = 0); + node_t * searchUp (node_t * node, char *key, uint32_t ID = 0); + List * keyChilds (node_t * node, char * key, uint32_t ID = 0); + void foreach (node_f fn, node_t * m_node = NULL); + + private: + uint16_t lastID; +}; + +#endif diff --git a/gclib2/modules/Core/darray.cxx b/gclib2/modules/Core/darray.cxx new file mode 100644 index 0000000..de2eacd --- /dev/null +++ b/gclib2/modules/Core/darray.cxx @@ -0,0 +1,121 @@ +/* + * (c) Oleg Puchinin 2005,2006,2007 + * graycardinalster@gmail.com + * + */ + +#include + +DArray::DArray (int asize) +{ + init (asize); +} + +DArray::~DArray () +{ + drop (); +} + +char * DArray::get (int NUM) +{ + if (NUM >= size) + return NULL; + if (NUM < 0) + return NULL; + return values[NUM]; +} + +bool DArray::add (char * VALUE) +{ + if (values == NULL) { + used = 0; + size = 16; + values = CNEW(char *,size); + memset (values, 0, sizeof (char *) * size); + } + + if (used < size) { + values[used] = VALUE; + used++; + } else { + values = (char **) gc_realloc ((char *)values, + (sizeof (char *)*size), + (sizeof (char *) * (size << 1))); + if (values == NULL) + return false; + size <<= 1; + values[used] = VALUE; + used++; + } + return true; +} + +void DArray::drop () +{ + if (values) { + delete [] values; + values = NULL; + } + used = 0; + size = 0; +} + +int DArray::get_size () +{ + return used; +} + +int DArray::set_size (int a_used) +{ + int old = used; + used = a_used; + return old; +} + +void DArray::foreach (Dfunc_t FUNC) +{ + for (int i = 0; i < used; i++) + FUNC(values[i]); +} + +void DArray::set (long ARGA, char * S) +{ + values[ARGA] = S; +} + +void DArray::init (int asize) +{ + values = NULL; + used = 0; + if (asize > 0) { + size = asize; + } else { + size = 16; + asize = 16; + } + + values = CNEW(char *, asize); + memset (values, 0, asize * sizeof (char *)); +} + +bool DArray::from_file (char * __from) +{ + char * buf; + FILE * m_file; + + m_file = fopen (__from, "r"); + if (m_file == NULL) + return false; + + buf = CNEW (char, 256); + while (true) { + if (fgets (buf, 256, m_file) == NULL) + break; + add (strdup (buf)); + } + + fclose (m_file); + DROP (buf); + return true; +} + diff --git a/gclib2/modules/Core/darray.h b/gclib2/modules/Core/darray.h new file mode 100644 index 0000000..2eeff1a --- /dev/null +++ b/gclib2/modules/Core/darray.h @@ -0,0 +1,41 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DARRAY_H +#define DEFINE_DARRAY_H + +/// Класс - массив (char *). +class DArray +{ +public: + DArray (int asize = 0); + ~DArray (); + + bool add (char * VALUE); + void drop (); + char * get (int NUM); + int get_size (); + int set_size (int); + inline char ** get_skeleton () + { + return values; + } + void foreach (Dfunc_t); + void set (long, char *); + void init (int asize); + bool from_file (char * __from); + inline int get_real_size () { + return size; + } + +private: + char ** values; + int size; + int used; + +}; + +#endif diff --git a/gclib2/modules/Core/dexec.cxx b/gclib2/modules/Core/dexec.cxx new file mode 100644 index 0000000..789e549 --- /dev/null +++ b/gclib2/modules/Core/dexec.cxx @@ -0,0 +1,136 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include + +__export void Dexec_init (struct __djob_t * ctx) +{ + memset (ctx, 0, sizeof (struct __djob_t)); + ctx->stdIn = -1; + ctx->stdOut = -1; + ctx->stdErr = -1; + ctx->pipe_in[0] = -1; + ctx->pipe_in[1] = -1; + ctx->pipe_out[0] = -1; + ctx->pipe_out[1] = -1; + ctx->pipe_err[0] = -1; + ctx->pipe_err[1] = -1; + ctx->otmp_name = (char *) malloc (128); + ctx->etmp_name = (char *) malloc (128); + ctx->otmp_name[0] = '\0'; + ctx->etmp_name[0] = '\0'; + ctx->shared_mem = NULL; + ctx->pid = 0; +} + +void __dexec_init_pipes (__djob_t * ctx, uint32_t opts) +{ + if (! ctx) + return; + if (opts & DEXEC_IPIPE) + pipe (ctx->pipe_in); + if (opts & DEXEC_OPIPE) + pipe (ctx->pipe_out); + if (opts & DEXEC_EPIPE) + pipe (ctx->pipe_err); +} + +void __dexec_parent (__djob_t * ctx, int opts, char * cmd) +{ + int status; + + if (! ctx) + return; + if (opts & DEXEC_IPIPE) + fdclose (&ctx->pipe_in[0]); + if (opts & DEXEC_OPIPE) + fdclose (&ctx->pipe_out[1]); + if (opts & DEXEC_EPIPE) + fdclose (&ctx->pipe_err[1]); + if (opts & DEXEC_WAIT) + waitpid (ctx->pid, &status, 0); +} + +void __dexec_child (__djob_t * ctx, int opts, char * cmd) +{ + int fd; + + if (! ctx) + return; + + if (opts & DEXEC_IPIPE) { + fdclose (&ctx->pipe_in[1]); + dup2 (ctx->pipe_in[0], fileno (stdin)); + } + + if (opts & DEXEC_OPIPE) { + fdclose (&ctx->pipe_out[0]); + dup2 (ctx->pipe_out[1], fileno (stdout)); + } + + if (opts & DEXEC_EPIPE) { + fdclose (&ctx->pipe_err[0]); + dup2 (ctx->pipe_err[1], fileno (stderr)); + } + + if (opts & DEXEC_INULL) { + fd = open ("/dev/null", O_RDONLY); + dup2 (fd, fileno (stdin)); + } + + if (opts & DEXEC_ONULL) { + fd = open ("/dev/null", O_WRONLY); + dup2 (fd, fileno (stdout)); + } + + if (opts & DEXEC_ENULL) { + fd = open ("/dev/null", O_WRONLY); + dup2 (fd, fileno (stderr)); + } + + if (cmd) + exit (execlp ("/bin/sh", "/bin/sh", "-c", cmd, NULL)); +} + +__export __djob_t * Dexec (unsigned int opts, char * cmd) +{ + __djob_t * ctx; + int fdo = -1; + int fde = -1; + + ctx = CNEW (__djob_t, 1); + Dexec_init (ctx); + __dexec_init_pipes (ctx, opts); + + if (opts & DEXEC_OTMP) + fdo = Dtmpfd (ctx->otmp_name); + if (opts & DEXEC_ETMP) + fde = Dtmpfd (ctx->etmp_name); + + ctx->pid = fork (); + if (ctx->pid == 0) { + if (opts & DEXEC_OTMP) { + dup2 (fdo, fileno (stdout)); + fdclose (&fdo); + } + if (opts & DEXEC_ETMP) { + dup2 (fde, fileno (stderr)); + fdclose (&fde); + } + __dexec_child (ctx, opts, cmd); + } else if (ctx->pid > 0) { + fdclose (&fdo); + fdclose (&fde); + __dexec_parent (ctx, opts, cmd); + return ctx; + } else + return NULL; + + return ctx; +} + diff --git a/gclib2/modules/Core/dexec.h b/gclib2/modules/Core/dexec.h new file mode 100644 index 0000000..0795738 --- /dev/null +++ b/gclib2/modules/Core/dexec.h @@ -0,0 +1,29 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEXEC_H +#define DEXEC_H + +enum { + DEXEC_INULL = (1<<3), + DEXEC_ONULL = (1<<4), + DEXEC_ENULL = (1<<5), + DEXEC_EXEC = (1<<6), + DEXEC_IPIPE = (1<<7), + DEXEC_OPIPE = (1<<8), + DEXEC_EPIPE = (1<<9), + DEXEC_OTMP = (1<<10), + DEXEC_ETMP = (1<<11), + DEXEC_WAIT = (1<<12), +}; + +struct __dexec_t { + int cmd; + long param; +}; + +#endif + diff --git a/gclib2/modules/Core/djob_t.h b/gclib2/modules/Core/djob_t.h new file mode 100644 index 0000000..ab91c7e --- /dev/null +++ b/gclib2/modules/Core/djob_t.h @@ -0,0 +1,31 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DJOB_T_H +#define DEFINE_DJOB_T_H + +/// Контрольная структура дочернего процесса. +struct __djob_t +{ + __pid_t pid; + int exit_status; + char status_ready; + char * user_data; + int stdIn; + int stdOut; + int stdErr; + int pipe_in[2]; + int pipe_out[2]; + int pipe_err[2]; + char * shared_mem; + int shm_size; + char child; + char *otmp_name; + char *etmp_name; +}; + +#endif + diff --git a/gclib2/modules/Core/djobs.cxx b/gclib2/modules/Core/djobs.cxx new file mode 100644 index 0000000..5c3fcd0 --- /dev/null +++ b/gclib2/modules/Core/djobs.cxx @@ -0,0 +1,126 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include "gclib2.h" +#include +#include +#include + +DJobs::DJobs () +{ + +} + +DJobs::~DJobs () +{ + +} + +/// Добавить процесс (на контроль). +__djob_t * DJobs::add (int pid, char * user_data) +{ + __djob_t * j; + j = alloc_job (); + j->pid = pid; + j->user_data = user_data; + add_tail (LPCHAR(j)); + return j; +} + +__djob_t * DJobs::attach (__djob_t * j) +{ + if (! j) + return NULL; + + return (__djob_t *) add_tail (LPCHAR(j)); +} + +__djob_t * DJobs::zombie () +{ + pid_t pid; + int status; + + if (! first ()) + return NULL; + + pid = waitpid (-1, &status, WNOHANG); + if (pid <= 0) + return NULL; + + return __do_zombie (pid, status); +} + +__djob_t * DJobs::__do_zombie (pid_t pid, int exit_status) +{ + __djob_t * j = by_pid (pid); + if (j) { + rm (); + j->exit_status = exit_status; + } + return j; +} + +__djob_t * DJobs::wait_all () +{ + __djob_t * j; + int status; + pid_t pid; + + while (first ()) { + pid = waitpid (-1, &status, 0); + if (pid <= 0) + break; + j = __do_zombie (pid, status); + return j; + } + + return NULL; +} + +__djob_t * DJobs::alloc_job () +{ + __djob_t * j; + j = CNEW (__djob_t, 1); + Dexec_init (j); + return j; +} + +__djob_t * DJobs::by_pid (pid_t pid) +{ + __djob_t * j; + first (); + while ((j = (__djob_t *) get ()) && j) { + if (j->pid == pid) + return j; + next (); + } + return NULL; +} + +__djob_t * DJobs::fork () +{ + pid_t pid; + __djob_t *j; + + pid = ::fork (); + if (pid < 0) + return NULL; + + j = alloc_job (); + Dexec_init (j); + if (pid > 0) + j->pid = pid; + else { + j->pid = getpid (); + j->child = 1; + } + + attach (j); + return j; +} + + + diff --git a/gclib2/modules/Core/djobs.h b/gclib2/modules/Core/djobs.h new file mode 100644 index 0000000..4c58777 --- /dev/null +++ b/gclib2/modules/Core/djobs.h @@ -0,0 +1,39 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DJOBS_H +#define DEFINE_DJOBS_H +#include "djob_t.h" +#include "elist.h" + +/*! \class DJobs + * \brief Класс контроля дочерних процессов. */ + +#ifdef __cplusplus +class DJobs : public EList +{ + public: + DJobs (); + ~DJobs (); + + __djob_t * add (int pid, char * user_data = NULL); + __djob_t * attach (__djob_t * j); + __djob_t * zombie (); + __djob_t * by_pid (pid_t pid); + __djob_t * fork (); + __djob_t * wait_all (); + + private: + __djob_t * alloc_job (); + void __close_job_fds (__djob_t * j); + __djob_t * __do_zombie (pid_t pid, int status); +}; +#endif + + +#endif + + diff --git a/gclib2/modules/Core/dlist.cxx b/gclib2/modules/Core/dlist.cxx new file mode 100644 index 0000000..5f64f04 --- /dev/null +++ b/gclib2/modules/Core/dlist.cxx @@ -0,0 +1,222 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +/* 2006-05-25 */ + +#include +#include +#include +#include "gclib2.h" + +DList::~DList () +{ + __dlist_entry_t * one; + __dlist_entry_t * d_del; + if (! head || dont_free) + return; + + one = head; + while (one) { + d_del = one; + one = one->next; + free (d_del); + } + head = NULL; + tail = NULL; +} + +char * DList::init (__dlist_entry_t * one) +{ + head = one; + tail = one; + return one->data; +} + +char * DList::add_head (char * one) +{ + __dlist_entry_t *entry; + + if (head == NULL) + return init (one); + + entry = new_one (one); + head->prev = entry; + entry->next = head; + head = entry; + + return one; +} + +char * DList::add_tail (char * one) +{ + __dlist_entry_t * entry; + if (tail == NULL) + return init (one); + + entry = new_one (one); + tail->next = entry; + entry->prev = tail; + tail = entry; + + return one; +} + +void DList::rm (__dlist_entry_t * one) +{ + if (! one) + return; + + --ecount; + if (one == tail && one == head) { + free (one); + head = NULL; + tail = NULL; + return; + } + + if (one == head) { + head = one->next; + head->prev = NULL; + free (one); + return; + } + + if (one == tail) { + tail = one->prev; + tail->next = NULL; + free (one); + return; + } + + one->prev->next = one->next; + one->next->prev = one->prev; + free (one); +} + +void DList::detach (__dlist_entry_t * one) +{ + if (! one) + return; + + if (one == tail && one == head) { + head = NULL; + tail = NULL; + return; + } + + if (one == head) { + head = one->next; + head->prev = NULL; + return; + } + + if (one == tail) { + tail = one->prev; + tail->next = NULL; + return; + } + + one->prev->next = one->next; + one->next->prev = one->prev; +} + + +char * DList::add_after (__dlist_entry_t *two, char * one) +{ + __dlist_entry_t * entry; + + if (! two || ! one) + return NULL; + + if (two == tail) + return add_tail (one); + + entry = new_one (one); + if (two->next) { + entry->prev = two; + entry->next = two->next; + two->next->prev = entry; + two->next = entry; + } else + return NULL; + + return one; +} + +char * DList::add_before (__dlist_entry_t *two, char * one) +{ + __dlist_entry_t * entry; + + if (! two || ! one) + return NULL; + + if (two == head) + return add_head (one); + + entry = new_one (one); + if (two->prev) { + entry->next = two; + entry->prev = two->prev; + two->prev->next = entry; + two->prev = entry; + } else + return NULL; + + return one; +} + +void DList::foreach (Dfunc_t f) +{ + __dlist_entry_t * entry; + entry = head; + while (entry) { + f((void *) entry->data); + entry = entry->next; + } +} + +char * DList::add_entry_head (__dlist_entry_t * one) +{ + if (head == NULL) + return init (one); + head->prev = one; + one->next = head; + one->prev = NULL; + head = one; + return one->data; +} + +char * DList::add_entry_tail (__dlist_entry_t * one) +{ + if (tail == NULL) + return init (one); + tail->next = one; + one->prev = tail; + one->next = NULL; + tail = one; + return one->data; +} + +__dlist_entry_t * DList::get_entry_at (int N) +{ + __dlist_entry_t * one; + one = get_head (); + if (! one || ! N) + return NULL; + while ((one = one->next) && one && --N); + return NULL; +} + +char * DList::get_at (int N) +{ + __dlist_entry_t * one; + one = get_entry_at (N); + if (! one) + return NULL; + else + return one->data; +} + diff --git a/gclib2/modules/Core/dlist.h b/gclib2/modules/Core/dlist.h new file mode 100644 index 0000000..56d18ee --- /dev/null +++ b/gclib2/modules/Core/dlist.h @@ -0,0 +1,92 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DLIST_H +#define DEFINE_DLIST_H + +struct __dlist_entry_t; +typedef struct __dlist_entry_t { + char * data; + __dlist_entry_t * next; + __dlist_entry_t * prev; +}; + +#ifdef __cplusplus +/// Класс - простой список. +class DList { + public: + inline DList () { + head = NULL; + tail = NULL; + dont_free = false; + ecount = 0; + } + + ~DList (); + + inline char * init (char * one) { + head = new_one (one); + tail = head; + return one; + } + + char * init (__dlist_entry_t * one); + char * add_head (char *); + char * add_tail (char *); + void rm (__dlist_entry_t *); + + inline void del (__dlist_entry_t *entry) { + rm (entry); + } + + inline void remove (__dlist_entry_t *entry) { + rm (entry); + } + + void detach (__dlist_entry_t * one); + char * add_after (__dlist_entry_t *, char *); + char * add_before (__dlist_entry_t *, char *); + char * add_entry_head (__dlist_entry_t * one); + char * add_entry_tail (__dlist_entry_t * one); + char * add_entry_after (__dlist_entry_t *, __dlist_entry_t *); + char * add_entry_before (__dlist_entry_t *, __dlist_entry_t *); + void foreach (Dfunc_t); + + inline __dlist_entry_t * new_one (char * one) { + __dlist_entry_t *entry; + entry = new __dlist_entry_t; + memset (entry, 0, sizeof (__dlist_entry_t)); + entry->data = one; + ++ecount; + return entry; + } + + inline int count () { + return ecount; + } + + inline __dlist_entry_t * get_head () { + return head; + } + + inline __dlist_entry_t * get_tail () { + return tail; + } + + __dlist_entry_t * get_entry_at (int N); + char * get_at (int N); + + bool dont_free; + + protected: + __dlist_entry_t * head; + __dlist_entry_t * tail; + int ecount; +}; +#endif + +#endif + diff --git a/gclib2/modules/Core/dpbuf.cxx b/gclib2/modules/Core/dpbuf.cxx new file mode 100755 index 0000000..eb1e5d4 --- /dev/null +++ b/gclib2/modules/Core/dpbuf.cxx @@ -0,0 +1,237 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include + +DPBuf::DPBuf () +{ + init (NULL, 0); +} + +DPBuf::DPBuf (char *ptr, int len) +{ + init (ptr, len); +} + +DPBuf::~DPBuf () +{ + if (m_file) { + fclose (m_file); + m_file = NULL; + } +} + +/// Прочитать байт из пакета. +unsigned char DPBuf::r8 (char *ptr) +{ + unsigned char *S; + S = (unsigned char *) (ptr ? ptr : carret); + if (check ((char *) S, 1)) + return *S; + return 0; +} + +/// Прочитать слово из пакета. +uint16_t DPBuf::r16 (char *ptr) +{ + uint16_t *S; + S = (uint16_t *) (ptr ? ptr : carret); + if (check ((char *) S, 2)) + return *S; + return 0; +} + +/// Прочитать двойное слово из пакета. +uint32_t DPBuf::r32 (char *ptr) +{ + uint32_t *S; + S = (uint32_t *) (ptr ? ptr : carret); + if (check ((char *) S, 4)) + return *S; + return 0; +} + +/// Прочитать данные из пакета. +char * DPBuf::rd (char *ptr, int len) +{ + char *S; + S = ptr ? ptr : carret; + if (check ((char *)S, len)) { + carret += len; + return S; + } + return 0; +} + +/// Установить позицию чтения. +char * DPBuf::set_pos (char * ptr) +{ + if (check (ptr, 1)) { + carret = ptr; + return ptr; + } else + return carret; +} + +/// Инициализировать устойчивый буфер для пакета. +void DPBuf::init (char *ptr, int len) +{ + m_file = NULL; + + if (ptr && len) { + begin = ptr; + end = begin+len; + carret = begin; + } else { + begin = NULL; + carret = NULL; + end = NULL; + } + ok = true; +} + +/// Пропустить байт. +void DPBuf::s8 (void) +{ + check (carret, 1); + ++carret; +} + +/// Пропустить слово. +void DPBuf::s16 (void) +{ + check (carret, 2); + carret += 2; +} + +/// Пропустить двойное слово. +void DPBuf::s32 (void) +{ + check (carret, 4); + carret += 4; +} + +/// Пропустить блок. +void DPBuf::sd (int len) +{ + if (check (carret, len)) + carret += len; +} + +/// Записать байт. +void DPBuf::w8 (char ch) +{ + if (! check (carret, 1)) + return; + carret[0] = ch; + ++carret; +} + +/// Записать слово. +void DPBuf::w16 (uint16_t word) +{ + if (! check (carret, 2)) + return; + ((uint16_t *) carret)[0] = word; +} + +/// Запиать двойное слово. +void DPBuf::w32 (uint32_t dword) +{ + if (! check (carret, 4)) + return; + ((uint32_t *) carret)[0] = dword; +} + +void DPBuf::wd (char * buf, int len) +{ + if (! buf) + return; + if (! check (carret, len)) + return; + memcpy (carret, buf, len); + carret += len; +} + +/// Проверить корректность операции. +bool DPBuf::check (char *ptr, int count) +{ + if (! ptr) + ptr = carret; + if (((ptr + count) > end) || ptr < begin) { + ok = false; + return false; + } + return true; +} + +/// Конкатенция строк. +char * DPBuf::strcat (char *ptr, char *S) +{ + int len; + if (! S) { + ok = false; + return NULL; + } + + if (! ptr) + ptr = carret; + + if (! check (ptr, 1)) + return NULL; + + len = strlen (S); + if (! check (ptr, len+1)) { + ok = false; + return NULL; + } + + memcpy (ptr, S, len); + ptr[len] = '\0'; + return &ptr[len]; +} + +/// Найти блок needle. +char * DPBuf::memmem (char * buf, char * needle, size_t needlelen) +{ + int count; + char * ptr; + + ptr = buf ? buf : carret; + if (! check (ptr, 1)) + return NULL; + count = end-ptr; + + return (char *) Dmemmem (ptr, count, needle, needlelen); +} + +/// Найти следующий символ ch. +char * DPBuf::ch (char *buf, char ch) +{ + if (! buf) + buf = carret; + + if (! check (buf, 1)) + return NULL; + + while (buf != end && *buf != ch) + ++buf; + + if (buf == end) { + ok = false; + return NULL; + } else + return buf; +} + +FILE * DPBuf::file () +{ + if (m_file != NULL) + fclose (m_file); + m_file = fmemopen (data (), len (), "rw"); + return m_file; +} + diff --git a/gclib2/modules/Core/dpbuf.h b/gclib2/modules/Core/dpbuf.h new file mode 100644 index 0000000..d46dbea --- /dev/null +++ b/gclib2/modules/Core/dpbuf.h @@ -0,0 +1,63 @@ +/* + * (c) Oleg Puchinin 2006,2007 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DPBUF_H +#define DEFINE_DPBUF_H + +#include +#include +#include + +/// Класс - устойчивый буфер. +class DPBuf +{ + public: + DPBuf (); + DPBuf (char *, int len); + ~DPBuf (); + + char * set_pos (char * ptr); + void init (char *ptr, int len); + FILE * file (); + + void s8 (void); + void s16 (void); + void s32 (void); + void sd (int count); + + unsigned char r8 (char *ptr = NULL); + uint16_t r16 (char *ptr = NULL); + uint32_t r32 (char *ptr = NULL); + char * rd (char *ptr, int len); + + void w8 (char ch); + void w16 (uint16_t word); + void w32 (uint32_t dword); + void wd (char * buf, int len); + + bool check (char *ptr, int count); + char * strcat (char *ptr, char *S); + char * memmem (char * buf, char * needle, size_t needlelen); + char * ch (char *buf, char ch); + + inline char * data () { + return begin; + } + inline int len () { + return end - begin; + } + + bool ok; + + protected: + char * begin; + char * carret; + char * end; + FILE * m_file; +}; + +#endif + diff --git a/gclib2/modules/Core/earray.cxx b/gclib2/modules/Core/earray.cxx new file mode 100644 index 0000000..0cb3a82 --- /dev/null +++ b/gclib2/modules/Core/earray.cxx @@ -0,0 +1,286 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include "gclib2.h" + +/* Extendent array */ +EArray::EArray (int asize) +{ +} + +/// Добавить элемент в массив. +int EArray::add (long one) +{ + return DArray::add (LPCHAR (one)); +} + +/// Найти элемента +int EArray::find (char * d_find) +{ + int i; + int d_size = get_size (); + + if (! d_find) + return -1; + + for (i = 0; i < d_size; ++i) { + if (get (i) == d_find) + return i; + } + + return -1; +} + +/// Искать строку в массиве. +int EArray::sfind (char * d_find) +{ + int i; + int d_size = get_size (); + char ** d_array = get_skeleton (); + + if (! d_find) + return -1; + + for (i = 0; i < d_size; i++) { + if (EQ (d_find, d_array[i])) + return i; + } + + return -1; +} + +/// Искать начало строки в массиве. +int EArray::snfind (char * d_find) +{ + int i; + int d_size = get_size (); + char ** d_array = get_skeleton (); + + for (i = 0; i < d_size; i++) { + if (!strncmp (d_find, d_array[i], strlen (d_array[i]))) + return i; + } + + return -1; +} + +/// Добавить вектор к массиву. +void EArray::push (char ** d_push) +{ + int i = 0; + if (d_push == NULL) + return; + + while (d_push[i]) { + add ((long) d_push[i]); + ++i; + } +} + +/// Быстро найти начало строки в отсортированном массиве. +int EArray::snfind_fast (char *str, int n) +{ + int first; + int last; + int fact; + int check; + int move; + + first = 0; + last = get_size (); + --last; + if (last < 0) + return -1; + + if (strcmp (get (0), str) > 0) + return -1; + + while (true) { + move = (last - first) >> 1; + if (! move) { + if (EQ (get (first), str)) + return first; + if (EQ (get (last), str)) + return last; + return -1; + } + + check = first + move; + if (n) + fact = strncmp (get (check), str, n); + else + fact = strcmp (get (check), str); + + if (fact < 0) { // [check] < str + first = check; + } else if (! fact) { // [check] == str + return check; + } else if (fact > 0) { // [chec] > str + last = check; + } + } + + if (EQ (get (first), str)) + return first; + + return -1; +} + +/// Прочитать массив из трубы. +int EArray::from_pipe (int fd) +{ + char * buf; + FILE * m_file; + + m_file = fdopen (fd, "r"); + if (m_file == NULL) + return false; + + buf = CNEW (char, 256); + while (true) { + if (fgets (buf, 256, m_file) == NULL) + break; + add (strdup (buf)); + } + + fclose (m_file); + DROP (buf); + return get_size (); +} + +/// Объеденить массив (элементами mid). +char * EArray::join (char * mid, int *len_out) +{ + char *Ret; + char *ptr; + int count; + int len = 0; + int mid_len; + int i; + + if (! mid) { + mid_len = 0; + mid = ""; + } else + mid_len = strlen (mid); + + count = get_size (); + for (i = 0; i < count; i++) + len += strlen (get (i)); + + if (mid) + len += count * mid_len; + + len++; + Ret = CNEW (char, len); + ptr = Ret; + for (i = 0; i < count; i++) { + strcpy (ptr, (char *) get (i)); + ptr += strlen (get (i)); + strcpy (ptr, mid); + ptr += mid_len; + } + + if (len_out) + *len_out = len; + + return Ret; +} + +/// Записать вектор строк в файл. +int EArray::strings_to_file (char * f_name) +{ + FILE * d_file; + int d_len; + int i; + + d_file = fopen (f_name, "w"); + if (! d_file) + return -1; + + d_len = get_size (); + for (i = 0; i < d_len; ++i) + fprintf (d_file, "%s\n", get (i)); + + fclose (d_file); + return d_len; +} + +EArray & EArray::operator << (char *S) +{ + add (S); + return *this; +} + +int EArray::expand (EArray * e) +{ + int count; + int i; + + if (! e) + return get_size (); + + count = e->get_size (); + if (! count) + return get_size (); + + for (i = 0; i < count; ++i) + add (e->get (i)); + + return get_size (); +} + +int EArray::expand (char *buf, char * split) +{ + char * S; + char * ptr = buf; + int split_len; + char * last; + + if (!buf || !split || !(*buf)) + return -1; + + last = &buf[strlen (buf)-1]; + split_len = strlen (split); + while((S = Dmid_memmem (ptr, last, split, split_len)) && S) { + add (Dstrndup (ptr, S - ptr)); + S += split_len; + ptr = S; + } + + if (ptr <= last) + add (Dstrndup (ptr, last-ptr+1)); + + return get_size (); +} + +/// Распечатать массив (в stdout) +int EArray::dump (char * d_join) +{ + int i; + int count; + + count = get_size (); + for (i = 0; i < count; ++i) + printf ("%s%s", get (i), d_join); + + return count; +} + +List * EArray::toList () +{ + List * m_list; + int count; + int i; + + count = get_size (); + m_list = new List; + for (i = 0; i < count; ++i) + m_list->add (get (i)); + + return m_list; +} + diff --git a/gclib2/modules/Core/earray.h b/gclib2/modules/Core/earray.h new file mode 100644 index 0000000..c15e5fd --- /dev/null +++ b/gclib2/modules/Core/earray.h @@ -0,0 +1,47 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_EARRAY_H +#define DEFINE_EARRAY_H + +#include "darray.h" + +/// Класс - улучшенный массив. +class EArray : public DArray +{ + public: + EArray (int asize = 0); + + int find (char * d_find); + int sfind (char * d_find); + int snfind (char * d_find); + int add (long d_one); + List * toList (); + + int inline add (char * d_one) { + return add ((long) d_one); + } + + inline char * operator [] (int n) { + return get (n); + } + + void push (char ** d_push); + int snfind_fast (char *str, int n); + char * join (char * mid = NULL, int *len_out = NULL); + + int from_pipe (int fd); + int strings_to_file (char *f_name); + int expand (EArray * e); + int expand (char *S, char * split); + int dump (char * d_join); + + EArray & operator <<(char *); + +}; + +#endif + diff --git a/gclib2/modules/Core/elist.cxx b/gclib2/modules/Core/elist.cxx new file mode 100644 index 0000000..cdf9001 --- /dev/null +++ b/gclib2/modules/Core/elist.cxx @@ -0,0 +1,266 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include "gclib2.h" + +EList::EList () +{ + pos = NULL; +} + +EList::~EList () +{ +} + +char * EList::get () +{ + if (! pos) + return NULL; + else + return pos->data; +} + +char * EList::first () +{ + pos = get_head (); + return get (); +} + +char * EList::get_first () +{ + __dlist_entry_t * one = head; + if (one) + return one->data; + return NULL; +} + +char * EList::last () +{ + pos = get_tail (); + return get (); +} + +char * EList::get_last () +{ + __dlist_entry_t * one = tail; + if (one) + return one->data; + return NULL; +} + +char * EList::next () +{ + if (! pos->next) + pos = NULL; + else + pos = pos->next; + return get (); +} + +char * EList::prev () +{ + if (! pos->prev) + pos = NULL; + else + pos = pos->prev; + return get (); +} + +char * EList::rm () +{ + __dlist_entry_t *ptr; + char * Ret; + + if (! pos) + return NULL; + + ptr = pos; + Ret = ptr->data; + + if (ptr->next) + pos = ptr->next; + else if (ptr->prev) + pos = ptr->prev; + else + pos = NULL; + + DList::rm (ptr); + return Ret; +} + +EList & EList::operator << (char * S) +{ + add_tail (S); + return *this; +} + +bool EList::eol () +{ + return pos ? false : true; +} + +char * EList::add_before (char * S) +{ + if (! pos) + return NULL; + DList::add_before (pos, S); + return S; +} + +char * EList::add_after (char * S) +{ + if (! pos) + return NULL; + DList::add_after (pos, S); + return S; +} + +char * EList::operator [] (int offset) +{ + int i; + first (); + for (i = 0; i < offset; ++i) + next (); + return get (); +} + +char * EList::shift () +{ + char * S; + S = first (); + rm (); + return S; +} + +char * EList::unshift (char * S) +{ + return add_head (S); +} + +char * EList::push (char * S) +{ + return add_tail (S); +} + +char * EList::pop () +{ + char *S; + S = last (); + rm (); + return S; +} + +void EList::dump () +{ + char *S; + first (); + while (true) { + S = get (); + if (! S) + break; + printf ("%s\n", S); + next (); + } +} + +void EList::bdump () +{ + Buf * b; + + first (); + while (true) { + b = (Buf *) get (); + if (! b) + break; + + if (b->len ()) + write (1, b->data (), b->len ()); + else { + printf (""); + fflush (stdout); + } + + printf ("\n"); + fflush (stdout); + next (); + } +} + +__dlist_entry_t * EList::get_entry () +{ + return pos; +} + +bool EList::operator == (EList & m_list) +{ + Buf * b1; + Buf * b2; + bool Ret = true;; + + first (); + m_list.first (); + while (true) { + b1 = (Buf *) get (); + b2 = (Buf *) m_list.get (); + + if (!b1 || !b2) + break; + + if (*b1 != b2) { + Ret = false; + break; + } + + next (); + m_list.next (); + } + + if (b1 || b2) + Ret = false; + + return Ret; +} + +bool EList::operator != (List & m_list) +{ + return (!(*this == m_list)); +} + +Array * EList::toArray () +{ + Array * a; + char * ptr; + + a = new Array (count ()); + first (); + while (! eol ()) { + ptr = get (); + a->add (ptr); + next (); + } + + return a; +} + +List & EList::operator = (List & l) +{ + while (first ()) + rm (); + + for (char * one = l.first (); one = l.get (); l.next ()) + add (one); + + return *this; +} + +List & EList::operator + (List & l) +{ + for (char * one = l.first (); one = l.get (); l.next ()) + push (one); + + return *this; +} + diff --git a/gclib2/modules/Core/elist.h b/gclib2/modules/Core/elist.h new file mode 100644 index 0000000..a4bc3c9 --- /dev/null +++ b/gclib2/modules/Core/elist.h @@ -0,0 +1,60 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_ELIST_H +#define DEFINE_ELIST_H + +#include "dlist.h" + +#ifdef __cplusplus + +/// Класс - список. +class EList : public DList +{ + public: + EList (); + ~EList (); + + char * get (); + char * first (); + char * last (); + char * next (); + char * prev (); + char * rm (); + + // v2.2 + char * get_first (); + char * get_last (); + char * add_before (char * S); + char * add_after (char * S); + char * shift (); + char * unshift (char * S); + char * push (char *S); + char * pop (); + void dump (); + void bdump (); + __dlist_entry_t * get_entry (); + Array * toArray (); + /**/ + + bool eol (); + inline char * add (char *S) { + return add_tail (S); + } + EList & operator << (char *); + char * operator [] (int offset); + List & operator = (List &); + bool operator == (List &); + bool operator != (List &); + List & operator + (List & l); + + private: + __dlist_entry_t * pos; +}; +#endif + +#endif + diff --git a/gclib2/modules/Core/hv.cxx b/gclib2/modules/Core/hv.cxx new file mode 100755 index 0000000..aab6340 --- /dev/null +++ b/gclib2/modules/Core/hv.cxx @@ -0,0 +1,295 @@ +/* + * (c) Oleg Puchinin 2007,2008 + * graycardinalster@gmail.com + * + */ + +#include +#include "best_names.h" +#include + +void __hv_free_item (char * ptr) +{ + ptr -= sizeof (char *); + free (ptr); +} + +HV::HV () +{ + elements = new Array(4); + dirty_elements = new EArray(1024); + b_ac = true; + dfa = 0; +} + +HV::~HV () +{ + elements->foreach ((Dfunc_t) __hv_free_item); + dirty_elements->foreach ((Dfunc_t) __hv_free_item); + delete elements; + delete dirty_elements; +} + +char * HV::pack_item (char * key, char * value) +{ + char * pack; + if (! key || ! value) + return NULL; + pack = CNEW (char, strlen (key) + 1 + sizeof (char *)); + *((char **) pack) = value; + pack += sizeof (char *); + strcpy (pack, key); + return pack; +} + +dkey_t * HV::unpackItem (char * pack, dkey_t * item) +{ + if (! pack || ! item) + return NULL; + item->KEY = pack; + pack -= sizeof (char *); + pack = *((char **) pack); + item->VALUE = pack; + return item; +} + +char * HV::set_item_value (char * pack, char * value) +{ + pack -= sizeof (char *); + *((char **) pack) = value; + return value; +} + +char * HV::get_item (char * key) +{ + char * ptr; + int count; + int i; + + if (! key) + return NULL; + + i = elements->snfind_fast (key, 0); + if (i >= 0) + return elements->get (i); + + count = dirty_elements->get_size (); + for (i = 0; i < count; ++i) { + ptr = dirty_elements->get (i); + if (EQ (ptr, key)) + return ptr; + } + + return NULL; +} + +/// Получить значение по ключу. +char * HV::get (char * key) +{ + dkey_t one; + if (unpackItem (get_item (key), &one)) + return one.VALUE; + return NULL; +} + +/// Установить значение ключа. +char * HV::set (char * key, char * value) +{ + char * pack; + + if (b_ac) { + pack = get_item (key); + if (pack) { + set_item_value (pack, value); + return value; + } + } + + dirty_elements->add (pack_item (key, value)); + if (dfa && (dirty_elements->get_size () >= dfa)) + do_sort (false); + + return value; +} + +/// Сортировать ключи. +void HV::do_sort (bool b_clean) +{ + DHeapSort * heap; + dkey_t item; + char * S; + int count; + int dirty_count; + int i; + + count = elements->get_size (); + dirty_count = dirty_elements->get_size (); + heap = new DHeapSort (count + dirty_count); + for (i = 0; i < count; ++i) { + if (b_clean) { + unpackItem ((*elements)[i], &item); + if (! item.VALUE) + continue; + } + heap->add ((*elements)[i]); + } + + for (i = 0; i < dirty_count; ++i) { + S = dirty_elements->get (i); + if (b_clean) { + unpackItem (S, &item); + if (item.VALUE) + heap->add (S); + else + delete (S - sizeof (char *)); + } else + heap->add (S); + } + + delete elements; + elements = new EArray (count + dirty_count); + i = 0; + while ((S = heap->extract_min ()) && S) { + ++i; + elements->add (S); + } + + delete dirty_elements; + dirty_elements = new EArray(1024); + delete heap; +} + +List * HV::keys_or_values (bool val) +{ + List * m_list; + dkey_t one; + int s; + int i; + + m_list = new List; + s = elements->get_size (); + for (i = 0; i < s; ++i) { + unpackItem (elements->get (i), &one); + if (! val) + m_list->add (one.KEY); + else + m_list->add (one.VALUE); + } + + s = dirty_elements->get_size (); + for (i = 0; i < s; ++i) { + unpackItem (dirty_elements->get (i), &one); + if (! val) + m_list->add (one.KEY); + else + m_list->add (one.VALUE); + } + + return m_list; +} + +List * HV::keys () +{ + return keys_or_values (false); +} + +List * HV::values () +{ + return keys_or_values (true); +} + +int HV::from_file (char *f_name) +{ + FILE * f; + char * m_buf; + char * d_set; + + m_buf = CNEW (char, 4096); + f = fopen (f_name, "r"); + if (! f) + return -1; + + while (true) { + if (fgets (m_buf, 256, f) == NULL) + break; + + if (m_buf[0] == '#') + continue; + + chomp (m_buf); + d_set = strchr (m_buf, '='); + if (! d_set) + continue; + + *d_set = '\0'; + ++d_set; + strip (d_set); + strip2 (m_buf); + set (m_buf, strdup (d_set)); + } + + fclose (f); + DROP (m_buf); + return 0; +} + + +void HV::foreach (Dhash_f f) +{ + List * m_keys; + List * m_values; + char * k; + char * v; + + m_keys = keys (); + m_values = values (); + + if (!m_keys || !m_values) + return; + + m_keys->first (); + m_values->first (); + while (true) { + k = m_keys->get (); + v = m_values->get (); + f (k, v); + + if (m_keys->next () == NULL) + break; + + m_values->next (); + } + + delete m_keys; + delete m_values; +} + +char * HV::operator [] (char *S) +{ + return get (S); +} + +void HV::dump () +{ + List * m_keys; + List * m_values; + + m_keys = keys (); + m_values = values (); + + if (!m_keys || !m_values) + return; + + m_keys->first (); + m_values->first (); + while (m_keys->get ()) { + printf ("%s => %s\n", m_keys->get (), m_values->get ()); + m_keys->next (); + m_values->next (); + } + + + delete m_keys; + delete m_values; +} + diff --git a/gclib2/modules/Core/hv.h b/gclib2/modules/Core/hv.h new file mode 100644 index 0000000..f71f3ef --- /dev/null +++ b/gclib2/modules/Core/hv.h @@ -0,0 +1,77 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_HV_H +#define DEFINE_HV_H + +/// Класс - хэш с сортировкой ключей. +class HV +{ + public: + HV (); + ~HV (); + + /* v2.0 */ + char * get (char * key) ; + char * set (char * key, char * value) ; + + inline void sort () { + do_sort (false); + } + inline void clean () { + do_sort (true); + } + inline int autoSort () { + return dfa; + } + inline int setAutoSort (int d_set) { + dfa = d_set; + return dfa; + } + inline bool autoCheck () { + return b_ac; + } + inline bool setAutoCheck (bool d_set) { + b_ac = d_set; + return b_ac; + } + inline EArray * sortedElements () { + return elements; + } + inline EArray * dirtyElements () { + return dirty_elements; + } + /***/ + + /* v2.2 */ + List * keys (); + List * values (); + int from_file (char *f_name); + void foreach (Dhash_f f); + void dump (); + + char * operator [] (char *S); + /**/ + + private: + dkey_t * __find_item (char * key) ; + dkey_t * __find_dirty_item (char * key) ; + void do_sort (bool b_clean) ; + char * pack_item (char * key, char * value) ; + char * set_item_value (char * pack, char * value) ; + char * get_item (char * key) ; + dkey_t * unpackItem (char * item, dkey_t * data); + List * keys_or_values (bool val); + + char ** heap; + int dfa; // Dirty elements before autosorting. + bool b_ac; + EArray * elements; + EArray * dirty_elements; +}; + +#endif + diff --git a/gclib2/modules/Crypt/base64.cxx b/gclib2/modules/Crypt/base64.cxx new file mode 100755 index 0000000..7e67993 --- /dev/null +++ b/gclib2/modules/Crypt/base64.cxx @@ -0,0 +1,96 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include "StdHeaders.h" +#include "Macroses.h" +#include + + +/*! \file base64.c Кодирование/декодирование в/из Base64. + */ + +const static char base64ABC[] = +"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +typedef unsigned char uchar_t; + +#define S_(a) S[n * 3 + a] +#define S__(a,b) (S[n * 3 + a] & b) +#define S__l(a,b,c) ((S[n * 3 + a] & b) << c) + +#define B1 buf[(n<<2)] = base64ABC[ (S_(0) >> 2) ]; +#define B2 buf[(n<<2) + 1] = base64ABC [ (S__l(0,0x3,4)) | S_(1) >> 4 ]; +#define B3 buf[(n<<2) + 2] = base64ABC [ S__l(1,0x0F,2) | S_(2) >> 6]; +#define B4 buf[(n<<2) + 3] = base64ABC [ S__(2,0x3F) ]; + +/*! \brief Закодировать в Base64. + * \param S - исходный буфер. + * \param SIZE - размер исходного буфера. + */ +__export uchar_t * base64_code (unsigned char * S, int SIZE) +{ + uchar_t c, *buf; + int n; + + c = (SIZE == 0) ? strlen ((const char *) S) % 3 : SIZE % 3; + SIZE = (SIZE == 0) ? strlen ((const char *) S) / 3 : SIZE / 3; + + buf = (uchar_t *) malloc (SIZE * 4 + 5); + + for (n = 0; n < SIZE; ++n) { + B1; B2; B3; B4; + } + + switch (c) { + case 1: + B1; B2; + buf[(n<<2) + 2] = '='; + buf[(n<<2) + 3] = '='; + ++n; + break; + case 2: + B1; B2; B3; + buf[(n<<2) + 3] = '='; + ++n; + break; + } + buf[(n<<2)] = 0; + return buf; +} + +#define BASE64(a) ((unsigned char) (strchr (base64ABC, S[(n<<2) + a]) - base64ABC)) + +/*! \brief Перекодировать из Base64. + * \param S - исходный буфер. + * \param SIZE - размер исходного буфера. + */ +__export uchar_t * base64_decode (unsigned char * S, int SIZE) +{ + unsigned char * ptr; + int n; + + if (SIZE % 4) + return NULL; + + SIZE = SIZE ? SIZE / 4 : strlen ((const char *) S) / 4; + ptr = (uchar_t *) malloc (SIZE * 4 + 5); + + for (n = 0; n < SIZE; n++) { + ptr[n * 3] = (BASE64(0) << 2) | ( BASE64(1) >> 4); + if (S[(n<<2) + 2] != '=') { + ptr[n * 3 + 1] = ((BASE64(1) & 0x0F) << 4) | (BASE64(2) >> 2); + if (S[(n<<2) + 3] != '=') + ptr[n * 3 + 2] = ((BASE64(2) & 0x03) << 6) | BASE64(3); + else + ptr[n * 3 + 2] = 0; + } else + ptr[n * 3 +1] = 0; + } + + ++n; + ptr [n * 3] = 0; + return ptr; +} + diff --git a/gclib2/modules/Crypt/digests.cxx b/gclib2/modules/Crypt/digests.cxx new file mode 100755 index 0000000..8e18280 --- /dev/null +++ b/gclib2/modules/Crypt/digests.cxx @@ -0,0 +1,60 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include "gclib2.h" + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifndef HAVE_OPENSSL +unsigned char * Ddigest (void * data, int len, char *name, unsigned int * out_len) +{ + if (out_len) + *out_len = 0; + return NULL; +} +#else +#include +/*! \brief Посчитать хэш (к примеру - MD5) + * \param data - исходные данные. + * \param len - длина исходных данных. + * \param name - тип хэша (к примеру - "MD5"). + * \param out_len - результирующий размер хэша. + * \note Результирующий хэш НЕ null-terminated string. + */ +unsigned char * Ddigest (void * data, int len, char *name, + unsigned int * out_len) +{ + EVP_MD_CTX mdctx; + const EVP_MD *md; + unsigned char * digest;; + unsigned int md_len; + + if (!data || !name) + return NULL; + + OpenSSL_add_all_digests(); + md = EVP_get_digestbyname(name); + + EVP_MD_CTX_init(&mdctx); + EVP_DigestInit_ex(&mdctx, md, NULL); + EVP_DigestUpdate(&mdctx, data, len); + digest = CNEW (unsigned char, EVP_MAX_MD_SIZE); + EVP_DigestFinal_ex(&mdctx, digest, &md_len); + EVP_MD_CTX_cleanup(&mdctx); + + if (out_len) + *out_len = md_len; + + return digest; +} + +#endif + diff --git a/gclib2/modules/Crypt/scode.cxx b/gclib2/modules/Crypt/scode.cxx new file mode 100755 index 0000000..9eebcf6 --- /dev/null +++ b/gclib2/modules/Crypt/scode.cxx @@ -0,0 +1,24 @@ +/* + * (c) Oleg Puchinin 2006,2007 + * graycardinalster@gmail.com + * + */ + +/*! \brief Простое шифрование через XOR + * \param data - входные данные. + * \param size - размер входных данных. + * \param key - ключ для шифровки/дешифровки. + * \param key_size - размер ключа. + */ +void bxor (char * data, int size, char *key, int key_size) +{ + int i,k; + k = 0; + + for (i = 0; i < size; ++i || ++k) { + if (k == key_size) + k = 0; + data[i] ^= key[k]; + } +} + diff --git a/gclib2/modules/IO/IO.cxx b/gclib2/modules/IO/IO.cxx new file mode 100644 index 0000000..efa1cd5 --- /dev/null +++ b/gclib2/modules/IO/IO.cxx @@ -0,0 +1,538 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include "gclib2.h" +#include +#include +#include +#include +#include + +#define __export + +struct stat *cur_stat = NULL; + +/*! \brief Записать непосредственно в файл. + * \param p_lpsz_filename - имя требуемого файла. + * \param p_lp_buffer - буфер данных. + * \param int_size - размер буфера данных. + */ +__export int Dfnwrite (char * p_lpsz_filename, void * p_lp_buffer,int int_size) +{ + int result; + FILE * myfile; + myfile = fopen(p_lpsz_filename,"w"); + if(!myfile) + return 0; + result = fwrite(p_lp_buffer,1,int_size,myfile); + fclose(myfile); + return result; +} + +/*! \brief Прочитать непосредственно из файла. + * \param f_name - имя требуемого файла. + * \param p_lp_buffer - буфер данных. + * \param int_size - размер буфера данных. + */ +__export int Dfnread (char * f_name, void * p_lp_buffer, int int_size) +{ + int n_bytes = int_size > fsize (f_name) ? fsize (f_name) : int_size; + int fd; + + fd = open (f_name, O_RDONLY); + if (fd < 0) + return fd; + + if (read (fd, p_lp_buffer, n_bytes) < 0) + n_bytes = -1; + + close (fd); + return n_bytes; +} + +/*! \brief Ожидать поступления данных (с одного дескриптора). + * \param FILENO - требуемый дескриптор. + * \param SEC - таймаут (секунды). + * \param USEC - таймаут (микросекунды). + */ +__export int Dselect (int FILENO, int SEC, int USEC) +{ + struct timeval m_timeval; + fd_set m_fdset; + + FD_ZERO (&m_fdset); + FD_SET (FILENO, &m_fdset); + m_timeval.tv_sec = SEC; + m_timeval.tv_usec = USEC; + + if (!m_timeval.tv_sec && !m_timeval.tv_usec) + return select (FILENO+1, &m_fdset, NULL, NULL, NULL);// &m_timeval); + else + return select (FILENO+1, &m_fdset, NULL, NULL, &m_timeval); +} + +/*! \brief Получить весь файл. + * \param m_filename - имя требуемого файла. + * \param rsize - размер результирующих данных. + */ +__export char * DFILE (const char * m_filename, int *rsize) +{ + char * m_file; + struct stat m_stat; + char * ptr; + int count; + int len; + int fd; + + if (m_filename == NULL) + return NULL; + + if (lstat (m_filename, &m_stat) < 0) + return NULL; + + fd = open (m_filename, O_RDONLY); + if (fd < 0) + return NULL; + + m_file = CNEW (char, m_stat.st_size + 1); + if (m_file == NULL) + return NULL; + + ptr = m_file; + len = m_stat.st_size; + while (-1) { + count = read (fd, ptr, len); + if (count <= 0) + break; + ptr+=count; + len-=count; + } + + if (rsize) + *rsize = m_stat.st_size; + + m_file[m_stat.st_size] = '\0'; + close (fd); + return m_file; +} + +/// stat (2) для файла (не реентрантная !). +__export struct stat * DSTAT (const char * S) +{ + if (!cur_stat) + cur_stat = (struct stat *) malloc (sizeof (struct stat)); + stat (S, cur_stat); + return cur_stat; +} + +/// lstat (2) для файла (не реентрантная !). +__export struct stat * DLSTAT (const char * S) +{ + if (! cur_stat) + cur_stat = (struct stat *) malloc (sizeof (struct stat)); + lstat (S, cur_stat); + return cur_stat; +} + +/// Возвращает размер доступных для чтения данных. +__export int DIONREAD (int fd) +{ + int ret = -1; + if (ioctl (fd, FIONREAD, &ret) != 0) + return -1; + return ret; +} + +/// Возвращает размер файла. +__export int fsize (const char * S) +{ + struct stat m_stat; + if (lstat (S, &m_stat) < 0) + return -1; + return m_stat.st_size; +} + +/// Возвращает размер файла (вариант для дескриптора). +__export int fdsize (int fd) +{ + struct stat m_stat; + if (fstat (fd, &m_stat) < 0) + return -1; + return m_stat.st_size; +} + +/// mmap'нуть все данные дескриптора. +__export char * DFDMAP (int fd) +{ + return (char *) mmap (NULL, fdsize (fd), PROT_READ, MAP_SHARED, fd, 0); +} + +/*! \brief mmap'нуть весь файл. + * \param d_file - имя нужного файла. + * \param out_fd - результирующий дескриптор файл. + * \param d_out_size - результирующий размер mmap'нутого блока. + */ +__export char * DFMAP (const char *d_file, int *out_fd, int *d_out_size) +{ + char *S = NULL; + int d_size; + int fd; + + fd = open (d_file, O_RDONLY); + if (fd < 0) + return NULL; + + d_size = fdsize (fd); + + if (d_out_size) + *d_out_size = d_size; + + if (out_fd) + *out_fd = fd; + + S = (char *) mmap (NULL, d_size, PROT_READ, MAP_SHARED, fd, 0); + if ((long) S == -1) { + close (fd); + return NULL; + } + + return S; +} + +/*! \brief прочитать все данные из дескриптора. + * \param fd - дескриптор + * \param d_out_size - результирующий размер данных. + */ +__export char * Dread_to_eof (int fd, int *d_out_size) +{ + char * d_buf = (char *) malloc (4096); + int d_size = 4096; + int d_pos = 0; + int d_ret = 0; + + if (fd < 0) + return NULL; + + if (d_out_size) + *d_out_size = 0; + + while (-1) { + d_ret = read (fd, &d_buf[d_pos], d_size - d_pos - 1); + if (d_ret == -1) + return NULL; + + if (d_ret == 0) //EOF + break; + + d_pos += d_ret; + if ((d_size - d_pos) < 4096) { + d_buf = gc_realloc (d_buf, d_size, d_size << 1); + d_size<<=1; + if (d_buf == NULL) { + if (d_out_size) + *d_out_size = 0; + return NULL; + } + } + } + + if (d_out_size) + *d_out_size = d_pos; + + d_buf[d_pos] = 0; + return d_buf; +} + +__export char * allData (int fd, int * d_out_size) // v2.2 +{ + int count; + char * b; + + count = DIONREAD (fd); + if (count <= 0) + return NULL; + b = CNEW (char, count + 1); + read (fd, b, count); + b[count] = '\0'; + + if (d_out_size) + *d_out_size = count; + + return b; +} + +/// Переписать (с блокировкой) все из fd_in в fd_out. +__export int move_stream (int fd_in, int fd_out) +{ + char * m_buf = NULL; + int i; + int Ret = 0; + + m_buf = (char *) malloc (4096); + + while (-1) { + i = read (fd_in, m_buf, 4096); + if (i <= 0) + break; + Ret += i; + write (fd_out, m_buf, i); + } + + free (m_buf); + return Ret; +} + +__export int move_stream_file (FILE * m_src, FILE * m_dst) +{ + char * m_buf = NULL; + int i; + int Ret = 0; + + if (!m_src || !m_dst) + return -1; + + m_buf = (char *) malloc (4096); + + while (-1) { + i = fread (m_buf, 1, 4096, m_src); + if (i <= 0) + break; + Ret += i; + fwrite (m_buf, 1, i, m_dst); + } + + + free (m_buf); + return Ret; +} + +/// Установить неблокируемый режим. +__export int Dnonblock(int fd) +{ + int flags = fcntl(fd, F_GETFL); + return fcntl(fd, F_SETFL, flags | O_NONBLOCK); +} + +/// Закрыть трубу. +__export int close_pipe (int *fds) +{ + int Ret1 = 0; + int Ret2 = 0; + + if (fds[0] != -1) { + Ret1 = close (fds[0]); + fds[0] = -1; + } + + if (fds[1] != -1) { + Ret2 = close (fds[1]); + fds[1] = -1; + } + + return Ret1 ? Ret1 : Ret2; +} + +/// Получить временный дескриптор. +__export int Dtmpfd (char *name) +{ + char m_buf[128]; + char tmpstr[64]; + int fd; + + Drand_str (tmpstr, 63); + sprintf (m_buf, "/tmp/%s", tmpstr); + fd = open (m_buf, O_CREAT | O_RDWR, 0600); + if (fd < 0) { + perror ("open"); + return -1; + } + + if (name) { + if (fd >= 0) + strcpy (name, m_buf); + else + name[0] = '\0'; + } + + return fd; +} + +/// Получить временный файл. +__export FILE * Dtmpfile (char *name) +{ + char tmpstr[64]; + char m_buf[128]; + Drand_str (tmpstr, 63); + sprintf (m_buf, "/tmp/%s", tmpstr); + if (name) + strcpy (name, m_buf); + return fopen (m_buf, "w+"); +} + +/// Закрыть дескриптор *fd (если не -1) и установить *fd в -1. +__export int fdclose (int * fd) +{ + if (! fd) + return 0; + + if (*fd != -1) { + close (*fd); + *fd = -1; + } + return 0; +} + +/// Получить расширение файла. +__export char * fext (char *name) +{ + if (! name) + return NULL; + return rindex (name, '.'); +} + +/// Записать отформатированную строку непосредственно в файл. +__export int logToFile (char * fileName, char * fmt, ...) +{ + va_list alist; + FILE * myfile; + myfile = fopen (fileName, "a"); + if (! myfile) { + myfile = fopen (fileName, "w"); + if (! myfile) + return -1; + } + va_start (alist, fmt); + vfprintf (myfile, fmt, alist); + va_end (alist); + fclose (myfile); + return 0; +} + +/// Скопировать файл. +__export int copyFile (char * sourceName, char * destName) +{ + int sourceFD = -1;; + int destFD = -1; + struct stat st; + char * copyBuf = NULL; + int ret; + int count = 0; + + if (! sourceName || ! destName) + return -1; + + sourceFD = open (sourceName, O_RDONLY); + fstat (sourceFD, &st); + destFD = open (destName, O_WRONLY | O_CREAT, st.st_mode); + if ((sourceFD < 0) || (destFD < 0)) { + count = -1; + goto copyFile_out; + } + + copyBuf = CNEW (char, 4096); + while (-1) { + ret = read (sourceFD, copyBuf, 4096); + if (ret <= 0) + break; + if (write (destFD, copyBuf, ret) < 0) + break; + count += ret; + } + +copyFile_out: + + DROP (copyBuf); + fdclose (&sourceFD); + fdclose (&destFD); + return count; +} + +/// Прочитать строку из файла (реентрантная). +__export char * DSTR (FILE * m_file) +{ + char *S; + if (m_file == NULL) + return NULL; + + S = (char *) malloc (256); + if (fgets (S, 256, m_file) != S) + return NULL; + + return S; +} + +/// Копировать из m_source в m_dest не более N байт. +__export int Dcopyfd (int m_source, int m_dest, int N) +{ + int count; + int len = 0; + char * m_buf; + + m_buf = CNEW (char, 4096); + while (N > 0) { + count = N > 4096 ? 4096 : N; + count = read (m_source, m_buf, count); + if (count <= 0) + break; + write (m_dest, m_buf, count); + len += count; + N -= count; + } + + DROP (m_buf); + return len; +} + +/// Копировать из m_source в m_dest не более N байт. +__export int Dcopyfile (FILE * m_source, FILE * m_dest, int N) +{ + int count; + int len = 0; + char * m_buf; + + if (! m_source || ! m_dest) + return -1; + + m_buf = CNEW (char, 4096); + while (N > 0) { + count = N > 4096 ? 4096 : N; + count = fread (m_buf, 1, count, m_source); + if (count <= 0) + break; + fwrite (m_buf, 1, count, m_dest); + len += count; + N -= count; + } + + DROP (m_buf); + return len; +} + +__export List * file (char * fileName) +{ + List * m_list; + char * m_buf; + FILE * m_file; + + if (! fileName) + return NULL; + + m_file = fopen (fileName, "r"); + if (! m_file) + return NULL; + + m_list = new List; + m_buf = CNEW (char, 4096); + m_buf[4095] = '\0'; + + while (fgets (m_buf, 4095, m_file) > 0) + m_list->push (strdup (m_buf)); + + DROP (m_buf); + fclose (m_file); + return m_list; +} + diff --git a/gclib2/modules/IO/dfiles.cxx b/gclib2/modules/IO/dfiles.cxx new file mode 100644 index 0000000..3a82913 --- /dev/null +++ b/gclib2/modules/IO/dfiles.cxx @@ -0,0 +1,42 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include +#include + +/* 24/06/06 */ +/// Получить массив со списком файлов из указанной директории. +__export List * Dfiles (char * path) +{ + DIR * m_dir; + List * Ret; + struct dirent * m_dirent; + + if (! path) + return NULL; + + m_dir = opendir (path); + if (! m_dir) + return NULL; + + Ret = new List; + while (true) { + m_dirent = readdir (m_dir); + if (! m_dirent) + break; + m_dirent = (struct dirent *) memdup (m_dirent, sizeof (struct dirent)); + Ret->add (LPCHAR (strdup (m_dirent->d_name))); + DROP (m_dirent); + } + + closedir (m_dir); + return Ret; +} + diff --git a/gclib2/modules/IO/gc_io.h b/gclib2/modules/IO/gc_io.h new file mode 100644 index 0000000..4318f4e --- /dev/null +++ b/gclib2/modules/IO/gc_io.h @@ -0,0 +1,44 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_GC_IO_H +#define DEFINE_GC_IO_H + +/*** ./IO.cxx ***/ +__export int Dfnwrite (char * p_lpsz_filename, void * p_lp_buffer,int int_size) ; +__export int Dfnread (char * f_name, void * p_lp_buffer, int int_size) ; +__export int Dselect (int FILENO, int SEC, int USEC) ; +__export char * DFILE (const char * m_filename, int *rsize) ; +__export struct stat * DSTAT (const char * S) ; +__export struct stat * DLSTAT (const char * S) ; +__export int DIONREAD (int fd) ; +__export int fsize (const char * S) ; +__export int fdsize (int fd) ; +__export char * DFDMAP (int fd) ; +__export char * DFMAP (const char *d_file, int *out_fd, int *d_out_size) ; +__export char * Dread_to_eof (int fd, int *d_out_size) ; +__export char * allData (int fd, int * d_out_size) ; +__export int move_stream (int fd_in, int fd_out) ; +__export int move_stream_file (FILE * m_src, FILE * m_dst) ; +__export int Dnonblock (int fd) ; +__export int close_pipe (int *fds) ; +__export int Dtmpfd (char *name) ; +__export FILE * Dtmpfile (char *name) ; +__export int fdclose (int * fd) ; +__export char * fext (char *name) ; +__export int logToFile (char * fileName, char * fmt, ...) ; +__export int copyFile (char * sourceName, char * destName) ; +__export char * DSTR (FILE * m_file) ; +__export int Dcopyfd (int m_source, int m_dest, int N) ; +__export int Dcopyfile (FILE * m_source, FILE * m_dest, int N) ; + +__export List * file (char * fileName); // v2.2 + +/*** ./dfiles.cxx ***/ +__export List * Dfiles (char * path) ; + +#endif + diff --git a/gclib2/modules/IPC/ipc.cxx b/gclib2/modules/IPC/ipc.cxx new file mode 100755 index 0000000..854b09d --- /dev/null +++ b/gclib2/modules/IPC/ipc.cxx @@ -0,0 +1,215 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include + +/// \file ipc.c Межпроцессорные функции. + +/*! \page IPCModule Межпроцессорное взаимодействие. + * \see ipc.c + */ + +inline void __semset (struct sembuf * action, int num, int op) +{ + action->sem_flg = SEM_UNDO; + action->sem_num = num; + action->sem_op = op; +} + +enum { + hold_read = 0, + hold_write = 1, +}; + +inline void __sem_zero (int sem, int num) // = 0 +{ + semctl (sem, num, SETVAL, 0); +} + +int __sem_try_key (int *KEY, int count) // = 1 +{ + int key = 9900; + int id; + + while (key < 10000) { + id = semget (key, count, (0600|IPC_CREAT)); + if (id < 0) { + key++; + continue; + } + + if (KEY) + *KEY = key; + + return id; + } + + return -1; +} + +int __sem_init_one (int key, int count) // = 1 +{ + int id; + id = semget (key, 1, (0600|IPC_CREAT)); + if (id > 0) + __sem_zero (id, 0); + return id; +} + +/*! \brief Инициализировать семафор. + * \param KEY - указатель на номер ключа. Если не задан - выбирается рандомный и записывается в *KEY. + * \return Код (id) семафора, который используется во всех остальных функциях. + */ +int sem_init (int * KEY) +{ + int key = 9900; + int id; + + if (KEY && *KEY) + id = __sem_init_one (*KEY, 1); + else + id = __sem_try_key (&key, 1); + + if (id < 0) + return id; + + __sem_zero (id, 0); + if (KEY) + *KEY = key; + + return id; +} + +/// Получить идентификатор существующего семафора. +int sem_get (int key) +{ + return semget (key, 1, 0600); +} + +/*! \brief Заблокировать семафор. + * \param sem - код (id) семафора. + */ +int down (int sem) +{ + struct sembuf actions[2]; + __semset (&actions[0], 0, 0); + __semset (&actions[1], 0, +1); + return semop (sem, actions, 2); +} + +/*! \brief Разблокировать семафор. + * \param sem - код (id) семафора. + */ +int up (int sem) +{ + struct sembuf actions[1]; + __semset (&actions[0], 0, -1); + return semop (sem, actions, 1); +} + +/*! \brief Инициализировать семафор (чтение/запись). + * \param KEY - указатель на номер ключа. Если не задан - выбирается рандомный и записывается в *KEY. + * \return Код (id) семафора, который используется во всех остальных функциях. + */ +int sem_init_rw (int * KEY) +{ + int id; + + if (KEY && *KEY) + id = __sem_init_one (*KEY, 2); + else + id = __sem_try_key (KEY, 2); + + if (id < 0) + return id; + + __sem_zero (id, hold_read); + __sem_zero (id, hold_write); + + return id; +} + +/*! \brief Заблокировать семафор (чтение). + * \param sem - код (id) семафора. + */ +int down_read (int sem) +{ + struct sembuf actions[2]; + __semset (&actions[0], hold_write, 0); + __semset (&actions[1], hold_read, +1); + return semop (sem, actions, 2); +} + +/*! \brief Разблокировать семафор (чтение). + * \param sem - код (id) семафора. + */ +int up_read (int sem) +{ + struct sembuf actions[1]; + __semset (&actions[0], hold_read, -1); + return semop (sem, actions, 1); +} + +/*! \brief Заблокировать семафор (запись). + * \param sem - код (id) семафора. + */ +int down_write (int sem) +{ + struct sembuf actions[3]; + __semset (&actions[0], hold_read, 0); + __semset (&actions[1], hold_write, 0); + __semset (&actions[2], hold_write, +1); + return semop (sem, actions, 3); +} + +/*! \brief Разлокировать семафор (запись). + * \param sem - код (id) семафора. + */ +int up_write (int sem) +{ + struct sembuf actions[2]; + __semset (&actions[0], hold_write, -1); + return semop (sem, actions, 1); +} + +int __msg_try_key (int *KEY) +{ + int key = 9900; + int id; + + if (KEY && *KEY != 0) { + id = msgget (key, (0600|IPC_CREAT|IPC_EXCL)); + return id; + } + + while (key < 10000) { + id = msgget (key, (0600|IPC_CREAT|IPC_EXCL)); + if (id < 0) { + ++key; + continue; + } + + if (KEY) + *KEY = key; + + return id; + } + + return -1; +} + +/*! \brief Инициализировать пул сообщений. + * \param KEY - указатель на номер ключа. Если не задан - выбирается рандомный и записывается в *KEY. + * \return Код (id) пула сообщений, который используется во всех остальных функциях. + */ +int msg_init (int *KEY) +{ + return __msg_try_key (KEY); +} + diff --git a/gclib2/modules/IPC/ipc.h b/gclib2/modules/IPC/ipc.h new file mode 100644 index 0000000..010ad34 --- /dev/null +++ b/gclib2/modules/IPC/ipc.h @@ -0,0 +1,23 @@ +/* + * (c) oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_IPC_H +#define DEFINE_IPC_H + +/*** ./ipc.cxx ***/ +int sem_init (int * KEY) ; +int sem_get (int KEY) ; +int down (int sem) ; +int up (int sem) ; +int sem_init_rw (int * KEY) ; +int down_read (int sem) ; +int up_read (int sem) ; +int down_write (int sem) ; +int up_write (int sem) ; +int msg_init (int *KEY) ; + +#endif + diff --git a/gclib2/modules/Linux/linux_specific.cxx b/gclib2/modules/Linux/linux_specific.cxx new file mode 100755 index 0000000..5b84575 --- /dev/null +++ b/gclib2/modules/Linux/linux_specific.cxx @@ -0,0 +1,50 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#ifdef __linux + +#include +#include +#include +#include +#include +#include +#include + +/// Копировать выделенный блок (не строку) памяти. +__export char * dcp (char * S) +{ + int len = malloc_usable_size (S); + char * ret = CNEW (char, len); + if (!ret) + return NULL; + memcpy (ret, S, len); + return ret; +} + +/// Обнулить блок (не строку) памяти. +__export void Dzero (void * ptr) +{ + memset (ptr, 0, malloc_usable_size (ptr)); +} + +__export int Dsched_yield () +{ + return sched_yield (); +} + +int Dclone (int (*fn)(void *), void * param) +{ + char * m_buf; + char * S; + + m_buf = CNEW (char, 4096); + S = &m_buf[4088]; + return clone (fn, S, CLONE_FS | CLONE_FILES | CLONE_PTRACE | CLONE_VM, param); +} + +#endif + diff --git a/gclib2/modules/Misc/Pack/count.cxx b/gclib2/modules/Misc/Pack/count.cxx new file mode 100644 index 0000000..01edeb1 --- /dev/null +++ b/gclib2/modules/Misc/Pack/count.cxx @@ -0,0 +1,69 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include "internals.h" + +int pack_countBuf (char * fmt, va_list ap) +{ + char *S; + int len = 0; + char * m_sarg; + List * m_larg; + Hash * m_harg; + Buf * b; + + if (! fmt) + return 0; + + S = fmt; + while (*S) { + switch (*S) { + case 'a': // uchar_t + va_arg (ap, int); + ++len; + break; + case 'b': // uint16_t + va_arg (ap, int); + len += 2; + break; + case 'c': // int + va_arg (ap, int); + len += 4; + break; + case 'd': // uint64_t + va_arg (ap, uint64_t); + len += sizeof (uint64_t); + break; + case 's': // Нуль-терминатед строка + m_sarg = va_arg (ap, char *); + len += strlen (m_sarg) + 1; + break; + + case 'e': // Buf * + b = va_arg (ap, Buf *); + if (b) + len += b->len (); + len += 4; + break; + + case 'l': // List * (char *) + m_larg = va_arg (ap, List *); + len += pack_countList (m_larg); + break; + case 'h': // Hash * + m_harg = va_arg (ap, Hash *); + len += pack_countHash (m_harg); + break; + } + ++S; + } + + return len; +} + diff --git a/gclib2/modules/Misc/Pack/internals.h b/gclib2/modules/Misc/Pack/internals.h new file mode 100644 index 0000000..b021131 --- /dev/null +++ b/gclib2/modules/Misc/Pack/internals.h @@ -0,0 +1,21 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_INTERNALS_H +#define DEFINE_INTERNALS_H + +int pack_countList (List * m_list) ; +int pack_countBList (List * m_list) ; +int pack_countHash (Hash * m_hash) ; +int pack_countTreeNode (node_t * m_node) ; +int pack_countTree (Tree * m_tree) ; +int pack_countBuf (char * fmt, va_list ap) ; + +char * unpack_unpacklist (char * ptr, List ** m_ret) ; +char * unpack_unpackhash (char * ptr, Hash ** m_hash) ; + +#endif + diff --git a/gclib2/modules/Misc/Pack/pack.cxx b/gclib2/modules/Misc/Pack/pack.cxx new file mode 100644 index 0000000..3bb8bc3 --- /dev/null +++ b/gclib2/modules/Misc/Pack/pack.cxx @@ -0,0 +1,154 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include "internals.h" + +/* + * a - char + * b - int16_t + * c - int + * d - double + * + * e - Buf * (disabled) + * s - строка с нулём на конце + * l - список строк. + * L - бинарный список (disabled) + * h - хэш + * t - дерево (disabled) + * + */ + +char * __pack_bytes (char * ptr, char fmt, int arg) +{ + switch (fmt) { + case 'a': + pkt_W8 (&ptr, arg); + break; + case 'b': + pkt_W16 (&ptr, arg); + break; + case 'c': + pkt_W32 (&ptr, arg); + break; + } + + return ptr; +} + +char * __pack_d (char * ptr, uint64_t dbl) +{ + ((uint64_t *) ptr)[0] = dbl; + return ptr += sizeof (uint64_t); +} + +char * __pack_list (char * ptr, List * m_list) +{ + char * S; + + if (!ptr || !m_list) + return NULL; + + pkt_W32 (&ptr, m_list->count ()); + m_list->first (); + while (true) { + S = m_list->get (); + if (! S) + break; + ptr = strmov (ptr, S); + ++ptr; + m_list->next (); + } + + return ptr; +} + +char * __pack (char * buf, int len, char * fmt, va_list ap) +{ + char * ptr; + char * S; + char * sparam; + List * lparam; + Hash * hparam; + Buf * b; + int param; + uint64_t dbl; + + if (!buf || !fmt) + return NULL; + + ptr = buf; + S = fmt; + while (*S) { + switch (*S) { + case 's': + sparam = va_arg (ap, char *); + ptr = strmov (ptr, sparam); + ++ptr; + break; + + case 'e': // Buf * + b = va_arg (ap, Buf *); + if (! b) { + pkt_W32 (&ptr, 0); + break; + } + + pkt_W32 (&ptr, b->len ()); + if (b->len ()) + pkt_WD (&ptr, b->data (), b->len ()); + break; + + case 'l': + lparam = va_arg (ap, List *); + ptr = __pack_list (ptr, lparam); + break; + + case 'h': + hparam = va_arg (ap, Hash *); + ptr = __pack_list (ptr, hparam->keys ()); + ptr = __pack_list (ptr, hparam->values ()); + break; + + case 'a': + case 'b': + case 'c': + param = va_arg (ap, int); + ptr = __pack_bytes (ptr, *S, param); + break; + + case 'd': + dbl = va_arg (ap, uint64_t); + ptr = __pack_d (ptr, dbl); + break; + } + ++S; + } + + return ptr; +} + +Buf * pack (char * fmt, ...) +{ + va_list ap; + Buf * m_buf = NULL; + int len; + + va_start (ap, fmt); + len = pack_countBuf (fmt, ap); + va_end (ap); + + m_buf = new Buf(len); + + va_start (ap, fmt); + __pack (m_buf->data (), m_buf->len (), fmt, ap); + va_end (ap); + + return m_buf; +} + diff --git a/gclib2/modules/Misc/Pack/pack_countBList.cxx b/gclib2/modules/Misc/Pack/pack_countBList.cxx new file mode 100644 index 0000000..5201c82 --- /dev/null +++ b/gclib2/modules/Misc/Pack/pack_countBList.cxx @@ -0,0 +1,30 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include + +int pack_countBList (List * m_list) +{ + Buf * b; + int i = 0; + + if (! m_list) + return 0; + + m_list->first (); + while (true) { + b = (Buf *) m_list->get (); + if (! b) + break; + i += b->len (); + m_list->next (); + } + + return i; +} + diff --git a/gclib2/modules/Misc/Pack/pack_countHash.cxx b/gclib2/modules/Misc/Pack/pack_countHash.cxx new file mode 100644 index 0000000..c547451 --- /dev/null +++ b/gclib2/modules/Misc/Pack/pack_countHash.cxx @@ -0,0 +1,30 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include "internals.h" + +int pack_countHash (Hash * m_hash) +{ + List * m_list; + int len = 0; + + if (! m_hash) + return 0; + + m_list = m_hash->keys (); + len += pack_countList (m_list); + delete m_list; + + m_list = m_hash->values (); + len += pack_countList (m_list); + delete m_list; + + return len; +} + diff --git a/gclib2/modules/Misc/Pack/pack_countList.cxx b/gclib2/modules/Misc/Pack/pack_countList.cxx new file mode 100644 index 0000000..a366b97 --- /dev/null +++ b/gclib2/modules/Misc/Pack/pack_countList.cxx @@ -0,0 +1,28 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include + +int pack_countList (List * m_list) +{ + int len = 4; + char * S; + + if (! m_list) + return 0; + + m_list->first (); + while (m_list->get ()) { + S = m_list->get (); + len += strlen (S) + 1; + m_list->next (); + } + + return len; +} + diff --git a/gclib2/modules/Misc/Pack/pack_countTree.cxx b/gclib2/modules/Misc/Pack/pack_countTree.cxx new file mode 100644 index 0000000..ac2f5ad --- /dev/null +++ b/gclib2/modules/Misc/Pack/pack_countTree.cxx @@ -0,0 +1,52 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include "internals.h" + +int pack_countTreeNode (node_t * m_node) +{ + int len; + node_t * n; + + if (! m_node) + return 0; + + len = 9; + if (m_node->key) + len += strlen (m_node->key); + + if (! m_node->childNodes) + return len; + + m_node->childNodes->first (); + while (true) { + n = (node_t *) m_node->childNodes->get (); + if (! n) + break; + len += pack_countTreeNode (n); + m_node->childNodes->next (); + } + + return len; +} + +int pack_countTree (Tree * m_tree) +{ + node_t * n; + int len; + + if (! m_tree) + return 0; + n = m_tree->rootNode; + len = pack_countTreeNode (n); + + return len; +} + + diff --git a/gclib2/modules/Misc/Pack/unpack.cxx b/gclib2/modules/Misc/Pack/unpack.cxx new file mode 100644 index 0000000..5ae6bd7 --- /dev/null +++ b/gclib2/modules/Misc/Pack/unpack.cxx @@ -0,0 +1,108 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include "internals.h" + +char * __unpack_simple (char * ptr, char ch, char * param) +{ + char * aparam = (char *) param; + uint16_t * bparam = (uint16_t *) param; + int * cparam = (int *) param; + uint64_t * dparam = (uint64_t *) param; + + switch (ch) { + case 'a': + *aparam = pkt_R8 (&ptr); + break; + case 'b': + *bparam = pkt_R16 (&ptr); + break; + case 'c': + *cparam = pkt_R32 (&ptr); + break; + case 'd': + memcpy ((char *) dparam, (char *) ptr, sizeof (uint64_t)); + ptr += sizeof (uint64_t); + break; + } + + return ptr; +} + +int __unpack (Buf * buf, char * fmt, va_list ap) +{ + char * ptr; + char *S; + char * str; + int len; + char * aparam; + int16_t * bparam; + int * cparam; + double * dparam; + char ** sparam; + Buf ** eparam; + List ** lparam; + Hash ** hparam; + + if (!buf || !fmt) + return -1; + + ptr = buf->data (); + S = fmt; + while (*S) { + switch (*S) { + case 'a': + case 'b': + case 'c': + case 'd': + ptr = __unpack_simple (ptr, *S, va_arg (ap, char *)); + break; + + case 'e': // Buf * + eparam = va_arg (ap, Buf **); + len = pkt_R32 (&ptr); + str = pkt_RD (&ptr, len); + *eparam = new Buf (str, len); + break; + + case 's': + sparam = va_arg (ap, char **); // LPSZ + len = strlen (ptr); + *sparam = strdup (ptr); + ptr += len + 1; + break; + + case 'l': + lparam = va_arg (ap, List **); // List + ptr = unpack_unpacklist (ptr, lparam); + break; + + case 'h': + hparam = va_arg (ap, Hash **); // HV + ptr = unpack_unpackhash (ptr, hparam); + break; + } + ++S; + } + + return 0; +} + +int unpack (Buf * m_buf, char * fmt, ...) +{ + va_list ap; + int Ret; + + va_start (ap, fmt); + Ret = __unpack (m_buf, fmt, ap); + va_end (ap); + + return Ret; +} + diff --git a/gclib2/modules/Misc/Pack/unpack_listhash.cxx b/gclib2/modules/Misc/Pack/unpack_listhash.cxx new file mode 100644 index 0000000..fca994e --- /dev/null +++ b/gclib2/modules/Misc/Pack/unpack_listhash.cxx @@ -0,0 +1,65 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include + +char * unpack_unpacklist (char * ptr, List ** m_ret) +{ + int count; + int len; + int i; + + if (!ptr || !m_ret) + return NULL; + + *m_ret = new List; + count = pkt_R32 (&ptr); + + for (i = 0; i < count; ++i) { + len = strlen (ptr); + (*m_ret)->add(strdup (ptr)); + ptr += len + 1; + } + + return ptr; +} + +char * unpack_unpackhash (char * ptr, Hash ** m_hash) +{ + List * m_keys; + List * m_values; + char * key; + char * value; + + if (!ptr || !m_hash) + return NULL; + + ptr = unpack_unpacklist (ptr, &m_keys); + ptr = unpack_unpacklist (ptr, &m_values); + + *m_hash = new Hash; + m_keys->first (); + m_values->first (); + while (true) { + key = m_keys->get (); + value = m_values->get (); + if (!key || !value) + break; + (*m_hash)->set (key, strdup (value)); + m_keys->next (); + m_values->next (); + } + + m_keys->foreach (free); + m_values->foreach (free); + delete m_keys; + delete m_values; + + return ptr; +} + diff --git a/gclib2/modules/Misc/Pkt.cxx b/gclib2/modules/Misc/Pkt.cxx new file mode 100755 index 0000000..148b5bb --- /dev/null +++ b/gclib2/modules/Misc/Pkt.cxx @@ -0,0 +1,95 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#include + +/// \file Pkt.c Низкоуровневые функции сборки пакетов данных. + +/// Записать байт в пакет. +__export void pkt_W8 (char ** pkt, unsigned char data) +{ + unsigned char *ptr = (unsigned char *) *pkt; + *ptr = data; + (*pkt)++; +} + +/// Записать слово в пакет. +__export void pkt_W16 (char ** pkt, uint16_t data) +{ + uint16_t *ptr = (uint16_t *) *pkt; + *ptr = data; + (*pkt)+=2; +} + +/// Записать двойное слово в пакет. +__export void pkt_W32 (char ** pkt, unsigned int data) +{ + unsigned int *ptr = (unsigned int *) *pkt; + *ptr = data; + (*pkt)+=4; +} + +/// Записать строку в пакет (без нуля). +__export void pkt_WS (char ** pkt, char *S) +{ + char * ptr = *pkt; + memcpy (ptr, S, strlen (S)); + (*pkt) += strlen (S); +} + +/// Записать строку в пакет (с нулем). +__export void pkt_WSZ (char ** pkt, char *S) +{ + char * ptr = *pkt; + strcpy (ptr, S); + (*pkt) += strlen (S) + 1; +} + +/// Записать данные в пакет. +__export void pkt_WD (char ** pkt, char *S, int size) +{ + char * ptr = *pkt; + memcpy (ptr, S, size); + (*pkt) += size; +} + +/// Прочитать байт из пакета. +__export unsigned char pkt_R8 (char ** pkt) +{ + unsigned char ch = 0; + ch = *((unsigned char *) *pkt); + ++(*pkt); + return ch; +} + +/// Прочитать слово из пакета. +__export uint16_t pkt_R16 (char ** pkt) +{ + uint16_t ret = 0; + ret = *((uint16_t *) *pkt); + (*pkt) += 2; + return ret; +} + +/// Прочитать двойное слово из пакета. +__export uint32_t pkt_R32 (char ** pkt) +{ + uint32_t ret = 0; + ret = *((uint32_t *) *pkt); + (*pkt) += 4; + return ret; +} + +/// Прочитать данные (с копированием памяти) из пакета. +__export char * pkt_RD (char ** pkt, int len) +{ + char * ret = NULL; + ret = (char *) malloc (len); + memcpy (ret, *pkt, len); + (*pkt) += len; + return ret; +} + diff --git a/gclib2/modules/Misc/Pkt.h b/gclib2/modules/Misc/Pkt.h new file mode 100755 index 0000000..a9ac262 --- /dev/null +++ b/gclib2/modules/Misc/Pkt.h @@ -0,0 +1,25 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_PKT_H +#define DEFINE_PKT_H + +/*** Функции низкоуровневой обработки пакетов. ***/ +__export void pkt_W8 (char ** pkt, unsigned char data) ; +__export void pkt_W16 (char ** pkt, uint16_t data) ; +__export void pkt_W32 (char ** pkt, unsigned int data) ; +__export void pkt_WS (char ** pkt, char *S) ; +__export void pkt_WSZ (char ** pkt, char *S) ; +__export void pkt_WD (char ** pkt, char *S, int size) ; +__export unsigned char pkt_R8 (char ** pkt) ; +__export uint16_t pkt_R16 (char ** pkt) ; +__export uint32_t pkt_R32 (char ** pkt) ; +__export char * pkt_RD (char ** pkt, int len) ; +#define pkt_Wstruct(pkt, s) do { pkt_WD (pkt, (char *) s, sizeof (*s)); } while (0) +#define pkt_Rstruct(arga, argb) (argb *) pkt_RD (arga, sizeof (argb)) + +#endif + diff --git a/gclib2/modules/Misc/dheapsort.cxx b/gclib2/modules/Misc/dheapsort.cxx new file mode 100644 index 0000000..770c2ab --- /dev/null +++ b/gclib2/modules/Misc/dheapsort.cxx @@ -0,0 +1,74 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include "gclib2.h" + +/// Инициализировать кучу для N элементов. +DHeapSort::DHeapSort (int n) +{ + size = 0; + h = (char **) malloc (sizeof (char *) * n+10); +} + +DHeapSort::~DHeapSort() +{ + if (h) + free (h); +} + +/// Добавить элемент. +char * DHeapSort::add(char * x) +{ + h[++size]=x; + checkup(size); + return x; +} + +/// Выбрать минимальный элемент. +char * DHeapSort::extract_min() +{ + char *x; + if(size <= 0) + return NULL; + x = h[1]; + h[1] = h[size--]; + checkdown (1); + return x; +} + +void DHeapSort::checkup(int c) { + int p; + char * tmp; + p = c>>1; + if (! p) + return; + if (strcmp (h[p], h[c]) > 0) { + tmp = h[p]; h[p] = h[c]; h[c] = tmp; + checkup(p); + } +} + +void DHeapSort::checkdown(int p) +{ + int c; + char * tmp; + c = p<<1; + if (c > size) + return; + if ( ((c+1) <= size) && strcmp (h[c + 1], h[c]) < 0) + ++c; + if (strcmp (h[c], h[p]) < 0) { + tmp = h[c]; + h[c] = h[p]; + h[p] = tmp; + checkdown (c); + } +} + diff --git a/gclib2/modules/Misc/dsplit.cxx b/gclib2/modules/Misc/dsplit.cxx new file mode 100644 index 0000000..7235fdc --- /dev/null +++ b/gclib2/modules/Misc/dsplit.cxx @@ -0,0 +1,64 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include "gclib2.h" + +/* 2006-06-07 */ +__export int Dsplit (char * STR, char *ch, DList * to_list) +{ + DList * ret = to_list; + char * S; + char * ptr = STR; + int ch_len; + int count = 0; + + if (!STR || !ch || !ret) + return -1; + + ch_len = strlen (ch); + while((S = strstr (ptr, ch)) && S) { + ret->add_tail (Dstrndup (ptr, S - ptr)); + S += ch_len; + ptr = S; + ++count; + } + + if (strlen (ptr)) { + ret->add_tail (strdup (ptr)); + ++count; + } + + return count; +} + +__export int Dsplit (char * buf, size_t buflen, char *str, EList * to_list) +{ + char * S; + char * ptr = buf; + int str_len; + int count = 0; + char * last; + + if (!buf || !str || !to_list) + return -1; + + last = &buf[buflen-1]; + str_len = strlen (str); + while((S = Dmid_memmem (ptr, last, str, str_len)) && S) { + *to_list << Dstrndup (ptr, S - ptr); + S += str_len; + ptr = S; + ++count; + } + + if (ptr <= last) { + *to_list << Dstrndup (ptr, last-ptr+1); + ++count; + } + + return count; +} + diff --git a/gclib2/modules/Misc/gc_strings.h b/gclib2/modules/Misc/gc_strings.h new file mode 100644 index 0000000..993b183 --- /dev/null +++ b/gclib2/modules/Misc/gc_strings.h @@ -0,0 +1,50 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_STRINGS_H +#define DEFINE_STRINGS_H + +#include + +/*** ./strings.cxx ***/ +__export char * gc_realloc (char * PTR, int old_size, int new_size) ; +__export void * memdup (void * PTR, int size) ; +__export char * Dstrmid (char * lpsz_string,char * param1, char * param2) ; +__export char * chomp (char * S) ; +__export char * strchr_r (char * S, char ch, int d_len) ; +__export char * strchrs (char *S, char ch, char ch2, char ch3, char ch4) ; +__export char * Dstrstr_r (char *where, char * str) ; +__export int Dsyms (char * from, char * to, char sym) ; +__export char * Dmemchr (char * from, int n, char ch) ; +__export char * Dstrndup (char *ptr, int n) ; +__export char * Dmid_strchr (char *ptr, char *end, char ch) ; +__export char * Dmid_getstr (char *buf, char *end) ; +__export char * Drand_str (char * buf, int count) ; +__export char * int2str (int i) ; +__export char * stail (char *S) ; +__export char * strmov (char *buf, char * S) ; +__export char * strnmov (char *buf, char * S, int N) ; +__export char * strip (char *str) ; +__export char * strip2 (char *str) ; +__export char * Dmemmem (char *haystack, size_t haystacklen, char *needle, size_t needlelen) ; +__export char * Dmid_memmem (char * begin, char * last, char * needle, int needlelen) ; +__export char * Dsprintf (char * fmt, ...) ; + +__export List * split (char * buf, char * spl) ; // v2.2 +__export List * bsplit (Buf * m_buf, int c) ; //v2.2 +__export List * csplit (Buf * m_buf, Buf * spl, int c = 0) ; // v2.2 + +__export char * join (List * m_list, char * jn) ; // v2.2 +__export Buf * bjoin (List * m_list, Buf * jn); // v2.2 + +Buf * pack (char * fmt, ...) ; +int unpack (Buf * m_buf, char * fmt, ...) ; // v2.2 + +__export char * strinsert (char * base, char *ptr, char *ins, int rewrite) ; // v2.2 +__export char * strreplace (char * buf, char * oldstr, char * newstr) ; // v2.2 + +#endif + diff --git a/gclib2/modules/Misc/join.cxx b/gclib2/modules/Misc/join.cxx new file mode 100644 index 0000000..c9d848b --- /dev/null +++ b/gclib2/modules/Misc/join.cxx @@ -0,0 +1,93 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include + +char * join (List * m_list, char * jn) +{ + int jn_len; + int len = 0; + char * one; + char *S; + char * m_buf; + + if (!jn || !m_list) + return NULL; + + jn_len = strlen (jn); + + m_list->first (); + while (true) { + S = m_list->get (); + if (!S) + break; + len += strlen (S); + m_list->next (); + } + + len = len + jn_len * (m_list->count () - 1); + m_buf = CNEW (char, len + 1); + S = m_buf; + m_list->first (); + while (true) { + one = m_list->get (); + if (! one) + break; + S = strmov (S, one); + if (m_list->next ()) + S = strmov (S, jn); + } + + return m_buf; +} + +Buf * bjoin (List * m_list, Buf * jn) +{ + int jn_len = 0; + int count = 0; + Buf * b; + Buf * m_buf; + char * m_pos; + + if (! m_list) + return NULL; + + if (jn) + jn_len = jn->len (); + + m_list->first (); + while (true) { + b = (Buf *) m_list->get (); + if (! b) + break; + count += b->len (); + if (m_list->next ()) + count += jn_len; + } + + m_buf = new Buf (count); + m_pos = m_buf->data (); + m_list->first (); + while (true) { + b = (Buf *) m_list->get (); + if (! b) + break; + + if (b->len () > 0) { + memcpy (m_pos, b->data (), b->len ()); + m_pos += b->len (); + } + + if (m_list->next () && jn) { + memcpy (m_pos, jn->data (), jn->len ()); + m_pos += jn_len; + } + } + + m_list->first (); + return m_buf; +} + diff --git a/gclib2/modules/Misc/misc.cxx b/gclib2/modules/Misc/misc.cxx new file mode 100755 index 0000000..64c4027 --- /dev/null +++ b/gclib2/modules/Misc/misc.cxx @@ -0,0 +1,99 @@ +/* + * (c) Oleg Puchinin 2006,2007 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include +#include +#define __export + +struct timeval *cur_tv = NULL; + +/*! Инициализировать таймер. + * \note Функция не реентрантная. + */ +__export void Dtimer () +{ + if (! cur_tv) + cur_tv = (struct timeval *) malloc (sizeof (struct timeval)); + gettimeofday(cur_tv, NULL); +} + +/*! \brief Время прощедшее с последнего запуска таймера. + * \note Функция не реентрантная. + */ +__export struct timeval *the_time () +{ + struct timeval new_tv; + + if (cur_tv == NULL) + return NULL; + + gettimeofday (&new_tv, NULL); + cur_tv->tv_sec = new_tv.tv_sec - cur_tv->tv_sec; + if (new_tv.tv_usec >= cur_tv->tv_usec) + cur_tv->tv_usec = new_tv.tv_usec - cur_tv->tv_usec; + else { + cur_tv->tv_sec--; + cur_tv->tv_usec = cur_tv->tv_usec - new_tv.tv_usec; + } + + return cur_tv; +} + +/*! \brief Вывести строку со временем, прошедшим от запуска таймера. + * \param file_my - поток для вывода строчки. + * \note Функция не реентрантная. + */ +__export void print_the_time (FILE * file_my) +{ + if (! the_time ()) + return; + + if (file_my) + fprintf (file_my, "The time : %i.%06i\n", + (int) cur_tv->tv_sec, + (int) cur_tv->tv_usec); + else + printf ("The time : %i.%06i\n", + (int) cur_tv->tv_sec, (int) cur_tv->tv_usec); + +} + +/*! \brief Переключить терминал в режим посимвольного ввода. + * \param fd - дескриптор, подключенный к терминалу. + */ +__export int Dterm_one_kick (int fd) +{ + struct termios ttystate; + tcgetattr (fd, &ttystate); + ttystate.c_lflag &= -ICANON; + ttystate.c_cc[VMIN] = 1; + return tcsetattr (fd, TCSANOW, &ttystate); +} + +/// Вернуть строку с версией библиотеки GCLib. +__export char *Dversion () +{ + return "2.5"; +} + +/*! \brief Заполнить буфер текущей датой и временем. + * \param buf - буфер для заполнения. + * \param max - размер буфера. + */ +__export char * Dtimestr (char * buf, int max) +{ + time_t t; + time (&t); + if (! buf) + return NULL; + strftime (buf, max, "%H:%M:%S %d.%m.%Y", localtime (&t)); + return buf; +} + diff --git a/gclib2/modules/Misc/split.cxx b/gclib2/modules/Misc/split.cxx new file mode 100644 index 0000000..858669e --- /dev/null +++ b/gclib2/modules/Misc/split.cxx @@ -0,0 +1,134 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include + +List * split (char * buf, char * spl) +{ + List * m_list; + char * S; + char * ptr = buf; + int spl_len; + int count = 0; + + if (!buf || !spl) + return NULL; + + m_list = new List; + + spl_len = strlen (spl); + while((S = strstr (ptr, spl)) && S) { + m_list->add_tail (Dstrndup (ptr, S - ptr)); + S += spl_len; + ptr = S; + ++count; + } + + if (strlen (ptr)) { + m_list->add_tail (strdup (ptr)); + ++count; + } + + return m_list; +} + +List * bsplit (Buf * m_buf, int c) +{ + List * m_list; + int count; + Buf * b; + + if (! m_buf) + return NULL; + + m_buf->seek (0, SEEK_SET); + m_list = new List; + while (true) { + count = m_buf->available () >= c ? c : m_buf->available (); + if (count <= 0) + break; + b = new Buf (count); + memcpy (b->data (), m_buf->position (), count); + m_buf->seek (count, SEEK_CUR); + m_list->add (LPCHAR (b)); + } + + return m_list; +} + +void __add_null_buf (List * m_list) +{ + Buf * b; + + b = new Buf; + m_list->add (LPCHAR (b)); +} + +List * csplit (Buf * m_buf, Buf * spl, int c) +{ + List * m_list; + Buf * b; + char * newbuf; + char * m_spl; + int spl_len; + char * ptr; + char * m_old; + int count; + + if (!m_buf || !spl) + return NULL; + + m_spl = spl->data (); + spl_len = spl->len (); + m_list = new List; + ptr = m_buf->data (); + m_buf->seek (0, SEEK_SET); + m_buf->ok = true; + + while (true) { + m_old = ptr; + ptr = m_buf->memmem (ptr, m_spl, spl_len); + + if (! ptr) + break; + + count = ptr - m_old; + if (count < 0) + break; + + if (count == 0) { + __add_null_buf (m_list); + ptr += spl_len; + continue; + } + + newbuf = (char *) memdup ((void *) m_old, count); + b = new Buf(newbuf, count); + m_list->add (LPCHAR (b)); + + ptr += spl_len; + m_buf->set_pos (ptr); + + if (! m_buf->ok) + break; + + if (c && (--c == 0)) + break; + } + + count = m_buf->available (); + if (! m_buf->ok) + __add_null_buf (m_list); + else if (count > 0) { + newbuf = (char *) memdup ((void *) m_old, count); + b = new Buf (newbuf, count); + m_list->add (LPCHAR (b)); + } + + m_buf->seek (0, SEEK_SET); + return m_list; +} + diff --git a/gclib2/modules/Misc/strings.cxx b/gclib2/modules/Misc/strings.cxx new file mode 100644 index 0000000..7695a81 --- /dev/null +++ b/gclib2/modules/Misc/strings.cxx @@ -0,0 +1,437 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include +#include +#define __export + +/// Увеличить размер блока (с копированием). +__export char * gc_realloc (char * PTR, int old_size, int new_size) +{ + int i; + char * S = (char *) malloc (new_size); + if (S == NULL) + return NULL; + + i = (new_size >= old_size) ? old_size : new_size; + memcpy (S, PTR, i); + free (PTR); + return S; +} + +/// Скопировать блок памяти. +__export void * memdup (void * PTR, int size) +{ + char * Ret; + Ret = (char *) malloc (size); + memcpy (Ret, PTR, size); + return (void *) Ret; +} + +/* 2005 */ +/// Разбить текст строкой (аналог "split" perl'а). +__export int Dsplit(char * lpsz_String, char *ch, char ** outbuffer, int int_buffersize) +{ + char * S; + int i; + + i = 1; + --int_buffersize; + + if(!lpsz_String) + return 0; + + if(int_buffersize > 0) { + S = lpsz_String; + outbuffer[0] = S; + } else + return 0; + + S = strstr(S,ch); + while(S && (int_buffersize--)) { + S[0] = 0; + ++S; + outbuffer[i] = S; + S = strstr(S,ch); + ++i; + } + return i; +} + +/// lpsz_string =~ m/param1(.*)param2/ +__export char * Dstrmid(char * lpsz_string,char * param1, char * param2) +{ + char * Result; + char *S; + char *S2; + int int_strsize; + + if(! strlen (param1)) + return 0; + + S = strstr (lpsz_string,param1); + if(! S) + return 0; + S += strlen (param1); + S2 = strstr (S,param2); + if(! S2) + return 0; + + int_strsize = S2 - S; + if(! int_strsize) + return 0; + + Result = (char *) malloc (int_strsize + 1); + memcpy (Result, S, int_strsize); + Result [int_strsize] = 0; + return Result; +} + +/// Убить конец строки. +__export char * chomp (char * S) +{ + char * str; + if (S == NULL) + return NULL; + str = strchrs (S, 13, 10, 0, 0); + if (str) + *str = 0; + return S; +} + +/// Найти символ (с конца строки). d_len - исходной строки (если известна). +__export char * strchr_r (char * S, char ch, int d_len) +{ + if (! d_len) + d_len = strlen (S); + + S += d_len - 1; + while (d_len > 0) { + if (*S == ch) + break; + --S; + --d_len; + } + + return S; +} + +/// Найти один из символов. +__export char * strchrs (char *S, char ch, char ch2, char ch3, char ch4) +{ + while (*S) { + if (*S == ch) + break; + + if (*S == ch2) + break; + + if (*S == ch3) + break; + + if (*S == ch4) + break; + + ++S; + } + + if (*S == ch || *S == ch2 || *S == ch3 || *S == ch4) + return S; + + return NULL; +} + +/* 2006-05-25 */ +/// Найти строку (с конца исходной). +__export char * Dstrstr_r (char *where, char * str) +{ + char * S; + int len; + + if (! where || ! str || strlen (where) == 0) + return NULL; + + S = &where[strlen (where)]; + len = strlen (str); + + while (--S != where) { + if (! strncmp (S, str, len)) + return S; + } + + return NULL; +} + +/// Посчитать Количество символов от from до to-1. +__export int Dsyms (char * from, char * to, char sym) +{ + int count = 0; + do { + if (*from == sym) + ++count; + } while (++from != to); + return count; +} + +/// Найти символ в буфере. +__export char * Dmemchr (char * from, int n, char ch) +{ + while (n--) { + if (*from == ch) + return from; + ++from; + } + return NULL; +} + +/// Скопировать не более n символов строки ptr. +__export char * Dstrndup (char *ptr, int n) +{ + char *S; + char *buf; + + if (ptr == NULL || n <= 0) + return NULL; + + buf = (char *) malloc (n+1); + S = buf; + while (*ptr && n--) { + *S = *ptr; + ++S; ++ptr; + } + *S = '\0'; + + return buf; +} + +/// Найти символ между ptr и end (включительно). +__export char * Dmid_strchr (char *ptr, char *end, char ch) +{ + while (ptr <= end) { + if (*ptr == ch) + return ptr; + ++ptr; + } + return NULL; +} + +/// Выбрать (с копирование памяти) строку между buf и end (включительно). +__export char * Dmid_getstr (char *buf, char *end) +{ + char *S; + char *out; + int s_len; + + if (! buf || ! end) + return NULL; + + S = Dmid_strchr (buf, end, '\n'); + if (! S) + S = end; + + s_len = S-buf+1; + out = (char *) malloc (s_len+1); + memcpy (out, buf, s_len); + out[s_len] = '\0'; + + return out; +} + +/// Получить рандомную строку на count символов. +__export char * Drand_str (char * buf, int count) +{ + int i; + unsigned char ch; + + if (! buf) + return NULL; + + --count; + for (i = 0; i < count; ++i) { + ch = rand () % ('z' - 'a' - 1); + buf[i] = ch + 'a'; + } + + buf[i] = 0; + return buf; +} + +/// Перевести число в строку (результат - новая LPSZ строка). +__export char * int2str (int i) +{ + char buf[64]; + sprintf (buf, "%i", i); + return strdup (buf); +} + +/// Вернуть указатель на последний ноль строки. +__export char * stail (char *S) +{ + if (! S) + return NULL; + return &S[strlen (S)]; +} + +/// Копировать строку. Результат - конец результирующей строки. +__export char * strmov (char *buf, char * S) +{ + if (! buf || ! S) + return NULL; + strcpy (buf, S); + return buf+strlen (S); +} + +__export char * strnmov (char *buf, char * S, int N) +{ + int len; + + if (! buf || ! S) + return NULL; + + strncpy (buf, S, N); + len = strlen (S); + len = (len >= N) ? N : len; + buf[len] = '\0'; + + return &buf[len]; +} + +/// Убрать все начальные пробельные символы. +__export char * strip (char *str) +{ + char *S; + if (! str) + return NULL; + S = str; + while (*S && (*S == '\t' || *S == ' ')) + ++S; + if (S != str) + strcpy (str, S); + return str; +} + +/// Убрать все конечные пробельные символы. +__export char * strip2 (char *str) +{ + char *S; + if (! str) + return NULL; + S = stail (str); + --S; + while (S != str && (*S == ' ' || *S == '\t')) + --S; + ++S; + *S = '\0'; + return str; +} + +/// Кросс-платформенный аналог memmem (3) +__export char * Dmemmem (char *haystack, size_t haystacklen, char *needle, size_t needlelen) +{ + char * ptr; + char * end; + + if (! haystack || ! needle) + return NULL; + + if (haystacklen < needlelen) + return NULL; + + ptr = haystack; + end = &haystack[haystacklen] - needlelen + 1; + while (ptr != end && memcmp (ptr, needle, needlelen)) + ++ptr; + + if (ptr == end) + return NULL; + + return ptr; +} + +/// Найти блок между begin и last (включительно). +__export char * Dmid_memmem (char * begin, char * last, char * needle, int needlelen) +{ + char * ptr; + + if (! begin || ! needle) + return NULL; + + if ((last - begin - 1) < needlelen) + return NULL; + + last -= needlelen; + ++last; + ptr = begin; + while (ptr <= last && memcmp (ptr, needle, needlelen)) + ++ptr; + + if (ptr > last) + return NULL; + + return ptr; +} + +/// Создать новую форматированную строку (не более 511 символов). +__export char * Dsprintf (char * fmt, ...) +{ + char m_buf[512]; + va_list ap; + m_buf[511] = '\0'; + va_start (ap, fmt); + vsnprintf (m_buf, 511, fmt, ap); + va_end (ap); + return strdup (m_buf); +} + +__export char * strinsert (char * base, char *ptr, char *ins, int rewrite) +{ + int ins_len; + int part1_len; + int part2_len; + char * m_buf; + char *S; + + if (!base || !ptr || !ins) + return NULL; + + ins_len = strlen (ins); + part1_len = ptr - base; + part2_len = strlen (&ptr[rewrite]); + + m_buf = CNEW (char, ins_len + part1_len + part2_len + 1); + m_buf = CNEW (char, 4096); + m_buf[0] = '\0'; + + S = strnmov (m_buf, base, part1_len); + S = strmov (S, ins); + S = strmov (S, &ptr[rewrite]); + + return m_buf; +} + +__export char * strreplace (char * buf, char * oldstr, char * newstr) +{ + List * m_list; + char * m_buf; + + if (!buf || !oldstr || !newstr) + return NULL; + + m_list = split (buf, oldstr); + if (! m_list) + return NULL; + m_buf = join (m_list, newstr); + m_list->foreach (free); + + delete m_list; + return m_buf; +} + + diff --git a/gclib2/modules/Net/DNS/dns.cxx b/gclib2/modules/Net/DNS/dns.cxx new file mode 100755 index 0000000..ab65520 --- /dev/null +++ b/gclib2/modules/Net/DNS/dns.cxx @@ -0,0 +1,854 @@ +/* + * (c) Oleg Puchinin 2006,2007 + * graycardinalster@gmail.com + * + */ + +#include +#include "internals.h" +#include "dns.h" +#include +#include + +DNS * m_current_dns = NULL; + +DNS::DNS () +{ + init (); +} + +DNS::~DNS () +{ + clean (); +} + +char * DNS::bestServer () +{ + dns_server * d_server; + char * Ret; + + d_server = (dns_server *) dns_servers->shift (); + Ret = d_server->IP; + dns_servers->push (LPCHAR (d_server)); + + return Ret; +} + +__export dns_query * DNS::loop () +{ + int count; + char * buf = NULL; + int resp_len; + dns_header * hdr = NULL; + dns_query * q = NULL; + dns_query * Ret = NULL; + +dloop_check_again: + count = DIONREAD (dns_sock); + if (count <= 0) + return Ret; + + buf = CNEW (char, count); + resp_len = recvFrom (dns_sock, buf, count, NULL, 0); + if (resp_len < (int) sizeof (dns_header)) + goto dq_outclean; + hdr = (dns_header *) buf; + + q = (dns_query *) dns_inquiries->first (); + while (true) { + q = (dns_query *) dns_inquiries->get (); + if (! q) + break; + + if (q->id == htons (hdr->id)) { + q->reply_pkt = buf; + q->reply_pkt_len = resp_len; + break; + } + + dns_inquiries->next (); + } + + if (q) { + Ret = q; + goto dloop_check_again; + } + +dq_outclean: + DROP (buf); + return Ret; + +} + +dns_query * DNS::query_async(uint16_t flags, uint16_t dr_type, uint16_t dr_class, char * host) +{ + dns_query * q; + char * pkt; + int len; + + if (! host) + return NULL; + + pkt = make_dns_pkt (++dns_last_id, 0x0100, dr_type, dr_class, host, &len); + if (sendToSocket (dns_sock, pkt, len, bestServer (), 53) < 0) { + DROP (pkt); + return NULL; + } + + q = CNEW (dns_query, 1); + memset (q, 0, sizeof (dns_query)); + + q->id = dns_last_id; + q->flags = flags; + q->dr_type = dr_type; + q->dr_class = dr_class; + q->host = strdup (host); + dns_inquiries->add (LPCHAR (q)); + + return q; +} + +List * DNS::query_sync(uint16_t flags, uint16_t dr_type, uint16_t dr_class, + char * host, char ** d_resp, int *d_resp_len) +{ + char * pkt; + int len; + int count = 0; + int resp_len; + char * buf; + struct dns_header *hdr; + List * list; + + if (! host) + return NULL; + + pkt = make_dns_pkt (++dns_last_id, 0x0100, dr_type, dr_class, host, &len); + if (sendToSocket (dns_sock, pkt, len, bestServer (), 53) < 0) { + DROP (pkt); + return NULL; + } + + if (Dselect (dns_sock, dns_timeout, 0) <= 0) { + DROP (pkt); + return NULL; + } + + count = DIONREAD (dns_sock); + buf = CNEW (char, count); + resp_len = recvFrom (dns_sock, buf, count, NULL, 0); + if (resp_len <= 0) + return NULL; + + hdr = (dns_header *) pkt; + list = resp_split (hdr, buf, resp_len); + + if (d_resp) + *d_resp = buf; + else + DROP (buf); + + if (d_resp_len) + *d_resp_len = resp_len; + + return list; +} + +dns_reply * DNS::scan (List *list, uint16_t dr_type, uint16_t dr_class) +{ + dns_reply *Ret = NULL; + dns_reply *reply = NULL; + + if (! list) + return NULL; + + reply = (dns_reply *) list->first (); + if (! reply) + return NULL; + + while (true) { + reply = (dns_reply *) list->get (); + if (! reply) + break; + if ((reply->dr_type == dr_type) && (reply->dr_class == dr_class)) { + Ret = reply; + break; + } + list->next (); + } + + return Ret; +} + +__dlist_entry_t * DNS::inquiries_scan (char * host, uint16_t dr_type, uint16_t dr_class) +{ + dns_query * q; + + if (! host) + return NULL; + + dns_inquiries->first (); + while (true) { + q = (dns_query *) dns_inquiries->get (); + if (! q) + break; + if (q->dr_type == dr_type && q->dr_class == dr_class && + EQ (q->host, host)) + return dns_inquiries->get_entry (); + dns_inquiries->next (); + } + + return NULL; +} + +int DNS::init () +{ + FILE * f_resolv; + dns_server * one; + char m_buf[256]; + int n = 0; + char *S; + + f_resolv = fopen ("/etc/resolv.conf", "r"); + if (! f_resolv) + return -1; + + dns_sock = dUdpSocket (); + if (dns_sock < 0) { + fclose (f_resolv); + return -1; + } + + dns_inquiries = new List; + m_buf[255] = 0; + dns_servers = new List; + while (fgets (m_buf, 255, f_resolv)) { + chomp (m_buf); + if (strncmp (m_buf, "nameserver", 10)) // != nameserver + continue; + + S = &m_buf[10]; + ++S; + while (*S && (*S == ' ' || *S == '\t')) + ++S; + + if (! strlen (m_buf)) + continue; + + one = CNEW (dns_server, 1); + one->IP = strdup (S); + one->ms = 0; + dns_servers->add_tail (LPCHAR (one)); + ++n; + } + + fclose (f_resolv); + if (n == 0) { + fdclose (&dns_sock); + return -1; + } + + dns_last_id = rand (); + return 0; +} + +__export void DNS::set_timeout (int sec) +{ + dns_timeout = sec; +} + +__export int DNS::get_socket () +{ + return dns_sock; +} + +__export void DNS::clean () +{ + dns_query * q; + + while (true) { + q = (dns_query *) dns_inquiries->first (); + if (! q) + break; + dns_inquiries->rm (); + clean_query (q); + } +} + +__export char * DNS::A (char *host) +{ + struct dns_reply *reply; + List * list; + char * Ret = NULL; + + list = query_sync (0x0100, DNS_A, 1, host); + reply = scan (list, DNS_A, 1); + if (reply) + Ret = strdup (inet_ntoa (*((in_addr *) reply->data))); + + resp_clean (list); + return Ret; +} + +__export char * DNS::async_A (char *host, dns_query ** qRet) +{ + __dlist_entry_t * one; + struct dns_reply *reply; + dns_query * q; + List * list; + char * Ret = NULL; + + one = inquiries_scan (host, DNS_A, 1); + if (! one) { + q = query_async (0x0100, DNS_A, 1, host); + if (qRet) + *qRet = q; + return NULL; + } + + q = (dns_query *) one->data; + if (q->reply_pkt == NULL) + return NULL; + + dns_inquiries->del (one); + list = resp_split ((dns_header *) q->reply_pkt, q->reply_pkt, q->reply_pkt_len); + reply = scan (list, DNS_A, 1); + if (reply) + Ret = strdup (inet_ntoa (*((in_addr *) reply->data))); + + resp_clean (list); + DROP (q->host); + DROP (q->reply_pkt); + DROP (q); + return Ret; +} + + +dns_reply * DNS::bestMXReply (List * list) +{ + struct dns_reply *reply; + struct dns_reply *best_reply = NULL; + uint16_t d_min = 0xFFFF; + char * ptr; + int i; + + if (! list) + return NULL; + + if (! list->first ()) + return NULL; + + while (true) { + reply = (dns_reply *) list->get (); + if (! reply) + break; + + if (reply->dr_type == 15) { + ptr = (char *) reply; + i = htons (pkt_R16(&ptr)); + if (i < d_min) { + d_min = i; + best_reply = reply; + } + } + list->next (); + } + + return best_reply; +} + +/// Получить (лучшую) MX запись для хоста. +__export char * DNS::MX (char *host) +{ + struct dns_reply *best_reply; + List * list; + char * Ret = NULL; + char * resp; + int resp_len; + char * mx; + DPBuf * p; + + list = query_sync (0x0100, DNS_MX, 1, host, &resp, &resp_len); + if (! list) + return NULL; + + best_reply = bestMXReply (list); + if (! best_reply) { + resp_clean (list); + return NULL; + } + + mx = best_reply->pkt_data_ptr; + mx += 2; + p = new DPBuf (resp, resp_len); + Ret = __dns_resp_domain (p, mx, NULL); + + delete p; + DROP (resp); + resp_clean (list); + return Ret; +} + +__export char * DNS::async_MX (char *IP, dns_query ** qRet) +{ + __dlist_entry_t * one; + struct dns_reply *reply; + dns_query * q; + List * list; + char * Ret = NULL; + DPBuf * p; + char * mx; + + if (! IP) + return NULL; + + one = inquiries_scan (IP, DNS_MX, 1); + if (! one) { + q = query_async (0x0100, DNS_MX, 1, IP); + if (qRet) + *qRet = q; + return NULL; + } + + q = (dns_query *) one->data; + if (q->reply_pkt == NULL) + return NULL; + dns_inquiries->del (one); + + list = resp_split ((dns_header *) q->reply_pkt, q->reply_pkt, q->reply_pkt_len); + reply = bestMXReply (list); + + if (! reply) { + clean_query (q); + resp_clean (list); + return NULL; + } + + mx = reply->pkt_data_ptr; + mx += 2; + p = new DPBuf (q->reply_pkt, q->reply_pkt_len); + Ret = __dns_resp_domain (p, mx, NULL); + + delete p; + clean_query (q); + resp_clean (list); + return Ret; +} + +__export char * DNS::ip2name (char *IP) +{ + struct dns_reply *reply; + char *buf; + List * list; + char * Ret = NULL; + char * resp; + int resp_len; + DPBuf * p; + char * name; + + if (! IP) + return NULL; + + buf = ip2arpa (IP); + list = query_sync (0x0100, DNS_PTR, 1, buf, &resp, &resp_len); + DROP (buf); + reply =scan (list, DNS_PTR, 1); + + if (! reply) + goto dip_out; + + name = reply->pkt_data_ptr; + p = new DPBuf (resp, resp_len); + Ret = __dns_resp_domain (p, name, NULL); + delete p; + DROP (resp); + +dip_out: + resp_clean (list); + return Ret; +} + +__export char * DNS::async_ip2name (char *IP, dns_query ** qRet) +{ + __dlist_entry_t * one; + struct dns_reply *reply; + dns_query * q; + List * list; + char * Ret = NULL; + char * arpa_name; + DPBuf * p; + char * name; + + arpa_name = ip2arpa (IP); + if (! arpa_name) + return NULL; + + one = inquiries_scan (arpa_name, DNS_PTR, 1); + if (! one) { + q = query_async (0x0100, DNS_PTR, 1, arpa_name); + if (qRet) + *qRet = q; + return NULL; + } + + q = (dns_query *) one->data; + if (q->reply_pkt == NULL) + return NULL; + dns_inquiries->del (one); + + list = resp_split ((dns_header *) q->reply_pkt, q->reply_pkt, q->reply_pkt_len); + reply = scan (list, DNS_PTR, 1); + if (! reply) { + clean_query (q); + resp_clean (list); + return NULL; + } + + name = reply->pkt_data_ptr; + p = new DPBuf (q->reply_pkt, q->reply_pkt_len); + Ret = __dns_resp_domain (p, name, NULL); + delete p; + + clean_query (q); + resp_clean (list); + return Ret; +} + +/// Упаковать доменное имя. +char * DNS::__name2dns (char *name, int *len) +{ + char * d_buf; + char * ptr; + List * list; + __dlist_entry_t * one; + + list = new List; + Dsplit (name, ".", list); + d_buf = CNEW (char, 70); + ptr = d_buf; + + one = list->get_head (); + while (one) { + pkt_W8 (&ptr, strlen (one->data)); + pkt_WS (&ptr, one->data); + one = one->next; + } + + pkt_W8 (&ptr, 0); + delete list; + if (len) + *len = ptr - d_buf; + + return d_buf; +} + +char * DNS::__ddup (char * ptr, unsigned char ch) +{ + char *S = CNEW (char, ch+2); + memcpy (S, ptr, ch); + S[ch] = '.'; + S[ch+1] = '\0'; + return S; +} + +char * DNS::__dns_rd_chunk (DPBuf * p, char ** ptr, char * done) +{ + char * ret; + unsigned char ch; + + if (! p->check (*ptr, 1)) + return NULL; + + ch = pkt_R8 (ptr); + if (! ch) { + *done = -1; + return NULL; + } + + if (ch & 0xc0) { + ret = NULL; + --(*ptr); + } else { + if (! p->check (*ptr, ch)) + return NULL; + ret = __ddup (*ptr, ch); + (*ptr) += ch; + } + + return ret; +} + +char * DNS::__dns_resp_domain (DPBuf * p, char * domain, char **domain_end) +{ + unsigned char ch; + uint16_t offset; + char * ptr; + char buf[128]; + char *S; + char done = 0; + bool d_try = true; + int n = 20; + + if (! p || ! domain) + return NULL; + + buf[0] = 0; + memset (buf, 0, 128); + ptr = domain; + +drd_try: + while (true) { + S = __dns_rd_chunk (p, &ptr, &done); + if (done || ! S) + break; + + strcat (buf, S); + DROP (S); + } + + if ((domain_end != NULL) & d_try) + *domain_end = ptr; + + if (! done) { + if (! p->check (ptr, 2)) + return NULL; + + if (! --n) + return NULL; + + ch = pkt_R8 (&ptr); + offset = (ch &= ~0xc0) << 8; + offset += pkt_R8 (&ptr); + d_try = false; + ptr = &p->data ()[offset]; + goto drd_try; + } + + if (domain_end && ! d_try) + *domain_end += 2; + + chop (buf); + if (strlen (buf) > 0) + return strdup (buf); + else + return NULL; +} + +/// Собрать пакет-запрос DNS. +char * DNS::make_dns_pkt (uint16_t id, uint16_t flags, uint16_t d_type, + uint16_t d_class, char * domain, int *len) +{ + char * pkt; + char * ptr; + char * dns_name; + int dns_len; + struct dns_header hdr; + + pkt = CNEW (char, 512); + ptr = pkt; + memset (&hdr, 0, sizeof (struct dns_header)); + hdr.id = htons (id); + hdr.flags = htons (flags); + hdr.nr = htons (1); + pkt_Wstruct (&ptr, &hdr); + + dns_name = __name2dns (domain, &dns_len); + memcpy (ptr, dns_name, dns_len); + DROP (dns_name); + ptr += dns_len; + + pkt_W16 (&ptr, htons (d_type)); // "A" + pkt_W16 (&ptr, htons (d_class)); // Internet + + if (len) + *len = ptr-pkt; + + return pkt; +} + +/// Разбить ответ на части. +List * DNS::resp_split (dns_header *hdr, char *pkt, int len) +{ + dns_header *query_hdr; + dns_rheader *res_hdr = NULL; + dns_reply *reply = NULL; + char * d_end; + char * d_name; + uint16_t dr_type; + uint16_t dr_class; + DPBuf * p = NULL; + char * ptr; + List * ret; + + p = new DPBuf (pkt, len); + query_hdr = (dns_header *) p->rd (pkt, sizeof (dns_header)); + if (! p->ok) + goto drs_out; + + if (query_hdr->id != hdr->id) + goto drs_out; + + ptr = &p->data ()[sizeof (dns_header)]; + d_name = __dns_resp_domain (p, ptr, &d_end); + if (d_name == NULL) + goto drs_out; + + DROP (d_name); + ptr = d_end; + + if (! p->check (ptr, 4)) + goto drs_out; + + dr_type = htons (pkt_R16 (&ptr)); + dr_class = htons (pkt_R16 (&ptr)); + + reply = NULL; + ret = new List; + + while (true) { + reply = CNEW (dns_reply, 1); + memset (reply, 0, sizeof (dns_reply)); + + reply->domain = __dns_resp_domain (p, ptr, &d_end); + if (! reply->domain) + break; + + ptr = d_end; + res_hdr = NULL; + + if (! p->check (ptr, sizeof (struct dns_rheader))) + break; + + res_hdr = pkt_Rstruct (&ptr, dns_rheader); + reply->TTL = htonl (res_hdr->TTL); + reply->data_len = htons (res_hdr->len); + reply->dr_type = htons (res_hdr->dr_type); + reply->dr_class = htons (res_hdr->dr_class); + if (! p->check (ptr, reply->data_len)) + goto drs_out; + + reply->pkt_data_ptr = ptr; + reply->data = pkt_RD (&ptr, reply->data_len); + ret->add_tail (LPCHAR (reply)); + } + + delete p; + return ret; + +drs_out: + if (reply) { + DROP (reply->domain); + DROP (reply); + DROP (reply->data); + } + + DROP (res_hdr); + delete p; + return NULL; + +} + +void DNS::resp_clean (List * list) +{ + dns_reply * reply; + + if (! list) + return; + + while (true) { + reply = (dns_reply *) list->first (); + if (! reply) + break; + + DROP (reply->domain); + DROP (reply->data); + DROP (reply); + list->rm (); + } + + delete list; +} + +char * DNS::ip2arpa (char *IP) +{ + char buf[256]; + unsigned int tmp[4]; + + sscanf (IP, "%u.%u.%u.%u", &tmp[3], &tmp[2], &tmp[1], &tmp[0]); + sprintf (buf, "%u.%u.%u.%u.in-addr.arpa", tmp[0], tmp[1], tmp[2], tmp[3]); + return strdup (buf); +} + +void DNS::clean_query (dns_query * q) +{ + if (! q) + return; + delete q->host; + delete q->reply_pkt; + delete q; +} + +__export int dns_init () +{ + if (! m_current_dns) + m_current_dns = new DNS; + return 0; +} + +__export char * dns_A (char *host) +{ + dns_init (); + return m_current_dns->A (host); +} + +__export char * dns_async_A (char *host, dns_query ** qRet) +{ + dns_init (); + return m_current_dns->async_A (host, qRet); +} + +__export char * dns_MX (char *host) +{ + dns_init (); + return m_current_dns->MX (host); +} + +__export char * dns_async_MX (char *IP, dns_query ** qRet) +{ + dns_init (); + return m_current_dns->async_MX (IP, qRet); +} + +__export char * dns_ip2name (char *IP) +{ + dns_init (); + return m_current_dns->ip2name (IP); +} + +__export char * dns_async_ip2name (char *IP, dns_query ** qRet) +{ + dns_init (); + return m_current_dns->async_ip2name (IP, qRet); +} + +__export void dns_clean () +{ + if (m_current_dns) { + delete m_current_dns; + m_current_dns = NULL; + } +} + +__export int dns_get_socket () +{ + if (m_current_dns) + return m_current_dns->get_socket (); + return -1; +} + +dns_query * dns_loop () +{ + if (m_current_dns) + return m_current_dns->loop (); + return NULL; +} + diff --git a/gclib2/modules/Net/DNS/dns.h b/gclib2/modules/Net/DNS/dns.h new file mode 100644 index 0000000..e50a8fc --- /dev/null +++ b/gclib2/modules/Net/DNS/dns.h @@ -0,0 +1,77 @@ +/* + * (c) Oleg Puchinin 2006-2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DNS_H +#define DEFINE_DNS_H + +#ifndef DEFINE_GCLIB2_H +#include +#endif + +#ifndef DEFINE_DNS_INTERNALS_H +struct dns_query; +struct dns_reply; +struct dns_header; +#endif + +class DNS +{ + public: + DNS (); + ~DNS (); + + int init (); + dns_query * loop () ; + void set_timeout (int sec) ; + int get_socket () ; + void clean () ; + char * A (char *host) ; + char * async_A (char *host, dns_query ** qRet = NULL) ; + char * MX (char *host) ; + char * async_MX (char *IP, dns_query ** qRet = NULL) ; + char * ip2name (char *IP) ; + char * async_ip2name (char *IP, dns_query ** qRet = NULL) ; + + private: + char * bestServer () ; + dns_query * query_async (uint16_t flags, uint16_t dr_type, uint16_t dr_class, char * host) ; + List * query_sync(uint16_t flags, uint16_t dr_type, uint16_t dr_class, char * host, + char ** d_resp = NULL, int *d_resp_len = NULL) ; + dns_reply * scan (List *list, uint16_t dr_type, uint16_t dr_class) ; + __dlist_entry_t * inquiries_scan (char * host, uint16_t dr_type, uint16_t dr_class) ; + dns_reply * bestMXReply (List * list) ; + char * __name2dns (char *name, int *len) ; + char * __ddup (char * ptr, unsigned char ch) ; + char * __dns_rd_chunk (DPBuf * p, char ** ptr, char * done) ; + char * __dns_resp_domain (DPBuf * p, char * domain, char **domain_end) ; + char * make_dns_pkt (uint16_t id, uint16_t flags, uint16_t d_type, + uint16_t d_class, char * domain, int *len) ; + List * resp_split (dns_header *hdr, char *pkt, int len) ; + void resp_clean (List * list) ; + char * ip2arpa (char *IP) ; + void clean_query (dns_query * q) ; + + int dns_sock; + int dns_last_id; + int dns_timeout; + List * dns_servers; + List * dns_inquiries; +}; + + +__export int dns_init () ; +__export char * dns_A (char *host) ; +__export char * dns_async_A (char *host, dns_query ** qRet = NULL) ; +__export char * dns_MX (char *host) ; +__export char * dns_async_MX (char *IP, dns_query ** qRet = NULL) ; +__export char * dns_ip2name (char *IP) ; +__export char * dns_async_ip2name (char *IP, dns_query ** qRet = NULL) ; +__export void dns_clean () ; +__export int dns_get_socket () ; +dns_query * dns_loop () ; + +#endif + diff --git a/gclib2/modules/Net/DNS/internals.h b/gclib2/modules/Net/DNS/internals.h new file mode 100644 index 0000000..556f596 --- /dev/null +++ b/gclib2/modules/Net/DNS/internals.h @@ -0,0 +1,72 @@ +/* + * (c) Oleg Puchinin 2006,2007 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DNS_INTERNALS_H +#define DEFINE_DNS_INTERNALS_H + +#ifndef DEFINE_GCLIB2_H +#include +#endif + +#pragma pack(1) + +struct dns_header +{ + uint16_t id; + uint16_t flags; + uint16_t nr; + uint16_t nrr; + uint16_t nrr2; + uint16_t nrr3; +}; + +struct dns_rheader +{ + uint16_t dr_type; + uint16_t dr_class; + uint32_t TTL; + uint16_t len; +}; + +struct dns_reply +{ + char * domain; + uint16_t dr_type; + uint16_t dr_class; + uint32_t TTL; + char * data; + char * pkt_data_ptr; + uint16_t data_len; +}; + +struct dns_server +{ + char * IP; + int ms; +}; + +struct dns_query +{ + uint16_t id; + uint16_t flags; + uint16_t dr_type; + uint16_t dr_class; + char * host; + char * reply_pkt; + int reply_pkt_len; + char * user_data; +}; + +#define DNS_A 1 +#define DNS_NS 2 +#define DNS_CNAME 5 +#define DNS_PTR 12 +#define DNS_HINFO 13 +#define DNS_MX 15 +#define DNS_ANY 255 + +#endif + diff --git a/gclib2/modules/Net/FTP/FTP.cxx b/gclib2/modules/Net/FTP/FTP.cxx new file mode 100644 index 0000000..20e236c --- /dev/null +++ b/gclib2/modules/Net/FTP/FTP.cxx @@ -0,0 +1,124 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include + +const char * lpsz_typeI = "TYPE I\r\n"; + +FTP::FTP () +{ + init (); +} + +FTP::~FTP () +{ +} + +List * FTP::waitReply () +{ + List * Ret; + char * S; + int i = 0; + + while (true) { + Ret = recvStrings (); + S = Ret->last (); + if (S[3] != '-') + break; + Ret->foreach (free); + delete Ret; + } + + return Ret; +} + +int FTP::connect (char * server, uint16_t port) +{ + int Ret; + + if (isIP (server)) + Ret = Connection::connect (server, port); + else + Ret = Connection::connect (dns_A (server), port); + + if (Ret < 0) + return Ret; + + return checkReply (220); +} + +int FTP::checkReply (int needle) +{ + List * res; + char * S; + int Ret = 0; + int i; + + res = waitReply (); + if (!res) + return -1; + + S = res->last (); + if (! S) { + delete res; + return -1; + } + + if (needle && (atoi (S) != needle)) + Ret = -1; + + res->foreach (free); + delete res; + return Ret; +} + +int FTP::typeI () +{ + send ((char *) lpsz_typeI, strlen (lpsz_typeI)); + return checkReply (0); +} + +int FTP::login (char * l, char * p) +{ + char * m_buf; + int count; + char * S; + int Ret = 0; + + if (! l || ! p) + return -1; + + m_buf = CNEW (char, 4096); + + sprintf (m_buf, "USER %s\r\n", l); + if (send (m_buf, strlen (m_buf)) < 0) { + DROP (m_buf); + return -1; + } + + if (checkReply (331) < 0) { + delete m_buf; + return -1; + } + + sprintf (m_buf, "PASS %s\r\n", p); + if (send (m_buf, strlen (m_buf)) < 0) { + DROP (m_buf); + return -1; + } + + if (checkReply (230)) { + delete m_buf; + return -1; + } + + DROP (m_buf); + return Ret; +} + diff --git a/gclib2/modules/Net/FTP/FTP.h b/gclib2/modules/Net/FTP/FTP.h new file mode 100644 index 0000000..09291ac --- /dev/null +++ b/gclib2/modules/Net/FTP/FTP.h @@ -0,0 +1,26 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_FTP_H +#define DEFINE_FTP_H + +class FTP : Connection +{ + public: + FTP (); + ~FTP (); + + int connect (char * server, uint16_t port = 21); + int login (char * l, char * p); + + private: + List * waitReply (); + int checkReply (int needle); + int typeI (); +}; + +#endif + diff --git a/gclib2/modules/Net/HTTP/http.cxx b/gclib2/modules/Net/HTTP/http.cxx new file mode 100644 index 0000000..cddc314 --- /dev/null +++ b/gclib2/modules/Net/HTTP/http.cxx @@ -0,0 +1,282 @@ +/* + * (c) Oleg Puchinin 2007,2008 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include "http.h" +#include "internals.h" +#include "http_context.h" +#include + +int http_send_request (http_context * ctx) +{ + int Ret; + char m_buf[512]; + + if (! ctx) + return -1; + sprintf (m_buf, "GET %s HTTP/1.1\r\nHost: %s\r\n\r\n", ctx->file, ctx->serverName); + Ret = send (ctx->serverSd, m_buf, strlen (m_buf), 0); + shutdown (ctx->serverSd, 1); + + return Ret; +} + +int http_write_header (http_context * ctx, int tmpfd) +{ + char * m_header; + + if (! ctx) + return -1; + m_header = CNEW (char, ctx->resOffset); + read (ctx->resFd, m_header, ctx->resOffset); + write (tmpfd, m_header, ctx->resOffset); + DROP (m_header); + + return 0; +} + +int http_chunked_result_join (http_context * ctx) +{ + char tmpfilename[256]; + char * m_buf; + int m_tmpfd; + uint32_t count = 0; + FILE * m_oldfile; + FILE * m_newfile; + + if (! ctx) + return -1; + + + m_tmpfd = Dtmpfd (tmpfilename); + if (m_tmpfd < 0) + return -1; + + http_write_header (ctx, m_tmpfd); + + m_oldfile = fdopen (ctx->resFd, "r"); + if (m_oldfile == NULL) + return -1; + + fseek (m_oldfile, ctx->resOffset, SEEK_SET); + m_newfile = fdopen (m_tmpfd, "r+"); + + m_buf = CNEW (char, 4096); + while (true) { + m_buf[0] = 0; + fgets (m_buf, 4096, m_oldfile); + if (feof (m_oldfile)) + break; + + sscanf (m_buf, "%x", &count); + if (count == 0) + break; + fread (m_buf, 1, 2, m_oldfile); + Dcopyfile (m_oldfile, m_newfile, count); + } + fclose (m_oldfile); + fclose (m_newfile); + DROP (m_buf); + + unlink (ctx->resFileName); + ctx->resFd = open (tmpfilename, O_RDONLY | O_LARGEFILE); + strcpy (ctx->resFileName, tmpfilename); + lseek (ctx->resFd, ctx->resOffset, SEEK_SET); + + return 0; +} + +const char * TransferEncoding = "Transfer-Encoding: "; + +int http_parse_result (http_context * ctx) +{ + char m_buf[512]; + bool m_chunked; + char * S; + int header_len = 0; + FILE * m_resFile; + + if (! ctx) + return -1; + + lseek (ctx->resFd, 0, SEEK_SET); + m_resFile = fdopen (ctx->resFd, "r+"); + fgets (m_buf, 512, m_resFile); + header_len = strlen (m_buf); + + sscanf (m_buf, "HTTP/1.1 %d", &ctx->retCode); + m_chunked = false; + while (fgets (m_buf, 512, m_resFile)) { + header_len += strlen (m_buf); + chomp (m_buf); + if (strlen (m_buf) == 0) + break; + + if (! strncmp (m_buf, TransferEncoding, strlen (TransferEncoding))) { + S = strstr (m_buf, ": "); + S += 2; + if (EQ (S, "chunked")) + m_chunked = true; + } + } + fclose (m_resFile); + ctx->resFd = open (ctx->resFileName, O_RDONLY); + ctx->resOffset = header_len; + + if (m_chunked) + http_chunked_result_join (ctx); + + return 0; +} + +http_context * http_context_alloc () +{ + http_context * ctx; + ctx = CNEW (http_context, 1); + memset (ctx, 0, sizeof (http_context)); + ctx->serverSd = -1; + ctx->resFd = -1; + return ctx; +} + +int http_context_clean (http_context * ctx) +{ + if (! ctx) + return -1; + + fdclose (&ctx->serverSd); + fdclose (&ctx->resFd); + + DROP (ctx->file); + DROP (ctx->serverName); + DROP (ctx->serverIP); + if (strlen (ctx->resFileName)) + unlink (ctx->resFileName); + DROP (ctx); + + return 0; +} + +int http_connect (http_context * ctx) +{ + if (! ctx) + return -1; + + if (isIP (ctx->serverName)) + ctx->serverIP = strdup (ctx->serverName); + else + ctx->serverIP = dns_A (ctx->serverName); + + if (! ctx->serverIP) + return -1; + + ctx->serverSd = dSocket (); + if (ctx->serverSd < 0) + return -1; + if (dConnect (ctx->serverSd, ctx->serverIP, 80)) { + close (ctx->serverSd); + return -1; + } + + return ctx->serverSd; +} + +int http_send_request (int sd, char * m_server, char * m_link) +{ + int Ret; + char m_buf[512]; + sprintf (m_buf, "GET %s HTTP/1.1\r\nHost: %s\r\n\r\n", m_link, m_server); + Ret = send (sd, m_buf, strlen (m_buf), 0); + shutdown (sd, 1); + return Ret; +} + +int http_recv_response (http_context * ctx) +{ + srand (time (NULL)); + + if (! ctx) + return -1; + + ctx->resFd = Dtmpfd (ctx->resFileName); + if (ctx->resFd < 0) + return -1; + + move_stream (ctx->serverSd, ctx->resFd); + lseek (ctx->resFd, 0, SEEK_SET); + + return ctx->resFd; +} + +http_context * __http_get (char * addr) +{ + http_context * ctx; + char m_buf[512]; + char * S; + + if (! addr) + return NULL; + + ctx = http_context_alloc (); + strcpy (m_buf, addr); + S = strstr (m_buf, "://"); + if (S) { + *S = '\0'; + if (NE (m_buf, "http")) + return NULL; + S += 3; + strcpy (m_buf, S); + } + + S = strchr (m_buf, '/'); + if (S) { + ctx->file = strdup (S); + *S = '\0'; + } else + ctx->file = strdup ("/"); + + ctx->serverName = strdup (m_buf); + + if (http_connect (ctx) < 0) + goto httperrout; + + if (http_send_request (ctx) < 0) + goto httperrout; + + if (http_recv_response (ctx) < 0) + goto httperrout; + + if (http_parse_result (ctx) < 0) + goto httperrout; + + return ctx; + +httperrout: + http_context_clean (ctx); + return NULL; +} + +char * http_get (char * url, int * m_size) +{ + http_context * ctx; + char * m_buf; + + ctx = __http_get (url); + if (! ctx) { + if (m_size) + *m_size = 0; + return NULL; + } + + lseek (ctx->resFd, ctx->resOffset, SEEK_SET); + m_buf = Dread_to_eof (ctx->resFd, m_size); + http_context_clean (ctx); + return m_buf; +} + diff --git a/gclib2/modules/Net/HTTP/http.h b/gclib2/modules/Net/HTTP/http.h new file mode 100644 index 0000000..b19ca1b --- /dev/null +++ b/gclib2/modules/Net/HTTP/http.h @@ -0,0 +1,13 @@ +/* + * (c) Oleg Puchinin 2007,2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_HTTP_H +#define DEFINE_HTTP_H + +char * http_get (char * url, int * size); + +#endif + diff --git a/gclib2/modules/Net/HTTP/http_context.h b/gclib2/modules/Net/HTTP/http_context.h new file mode 100644 index 0000000..a30d0fe --- /dev/null +++ b/gclib2/modules/Net/HTTP/http_context.h @@ -0,0 +1,28 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_CONNECTION_CONTEXT_H +#define DEFINE_CONNECTION_CONTEXT_H + +struct http_context +{ + char * file; + char * serverName; + char * serverIP; + int serverSd; + + int retCode; + int resFd; + int resOffset; + char resFileName[256]; + +}; + +http_context * http_context_alloc (); +int http_context_clean (http_context * ctx); + +#endif + diff --git a/gclib2/modules/Net/HTTP/internals.h b/gclib2/modules/Net/HTTP/internals.h new file mode 100644 index 0000000..0e99a0e --- /dev/null +++ b/gclib2/modules/Net/HTTP/internals.h @@ -0,0 +1,19 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_INTERNALS_H +#define DEFINE_INTERNALS_H + +#include "http.h" +#include "http_context.h" + +int http_connect (http_context * ctx); +int http_send_request (http_context * ctx); +int http_parse_result (http_context * ctx); +int http_chunked_result_join (http_context * ctx); + +#endif + diff --git a/gclib2/modules/Net/INET/Poll.cxx b/gclib2/modules/Net/INET/Poll.cxx new file mode 100644 index 0000000..1052998 --- /dev/null +++ b/gclib2/modules/Net/INET/Poll.cxx @@ -0,0 +1,137 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include + +Poll::Poll () +{ + m_connections = new List; + pull = NULL; +} + +Poll::~Poll () +{ + delete m_connections; +} + +Connection * Poll::__findConnection (Connection * c) +{ + m_connections->first (); + while (true) { + if (m_connections->get () == NULL) + return NULL; + if (((Connection *) m_connections->get ()) == c) + return c; + m_connections->next (); + } + return NULL; +} + +Connection * Poll::__findName (char * str) +{ + Connection * c; + m_connections->first (); + while (true) { + c = (Connection *) m_connections->get (); + if (! c) + return NULL; + if (EQ (c->name (), str)) + return c; + m_connections->next (); + } + return NULL; +} + +Connection * Poll::add (Connection * c) +{ + m_connections->add (LPCHAR (c)); + return c; +} + +Connection * Poll::unlink (Connection * c) +{ + if (__findConnection (c)) + m_connections->rm (); + return c; +} + +pollfd * Poll::poll_build (int * nfds) +{ + int count; + int i = 0; + Connection * c; + + if (pull) + DROP (pull); + + count = m_connections->count (); + pull = CNEW (pollfd, count); + m_connections->first (); + while (true) { + c = (Connection *) m_connections->get (); + if (! c) + break; + + pull[i].fd = c->socket (); + pull[i].events = c->pollFlags(); + pull[i].revents = 0; + + m_connections->next (); + ++i; + } + + if (nfds) + *nfds = count; + + return pull; +} + +Connection * Poll::scan () +{ + Connection * c; + int p_pos = 0; + + if (! pull) + return NULL; + + m_connections->first (); + while (true) { + c = (Connection *) m_connections->get (); + if (! c) + break; + if (pull[p_pos].revents) { + c->setRevents (pull[p_pos].revents); + pull[p_pos].revents = 0; + return c; + } + ++p_pos; + m_connections->next (); + } + + return NULL; +} + +int Poll::poll (int timeout) +{ + int nfds; + poll_build (&nfds); + return ::poll (pull, nfds, timeout); +} + +int Poll::count () +{ + return m_connections->count (); +} + +List * Poll::connections () +{ + List * l; + l = new List; + *l = *m_connections; + return l; +} diff --git a/gclib2/modules/Net/INET/Poll.h b/gclib2/modules/Net/INET/Poll.h new file mode 100644 index 0000000..e46fa51 --- /dev/null +++ b/gclib2/modules/Net/INET/Poll.h @@ -0,0 +1,33 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_POLL_H +#define DEFINE_POLL_H + +class Poll +{ + public: + Poll (); + ~Poll (); + + Connection * add (Connection * c); + Connection * unlink (Connection * c); + pollfd * poll_build (int * nfds); + int poll (int timeout); + Connection * scan (); + int count (); + List * connections (); + + private: + Connection * __findConnection (Connection * c); + Connection * __findName (char * str); + + List * m_connections; + pollfd * pull; +}; + +#endif + diff --git a/gclib2/modules/Net/INET/dconnection.cxx b/gclib2/modules/Net/INET/dconnection.cxx new file mode 100755 index 0000000..5bf53f5 --- /dev/null +++ b/gclib2/modules/Net/INET/dconnection.cxx @@ -0,0 +1,563 @@ +/* + * (c) Oleg Puchinin 2006-2008 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include +#include +#include + +void DConnection::prepare () +{ + c_sd = -1; + c_type = 0; + c_name = NULL; + c_group = NULL; + c_mtime = 0; + c_ctime = 0; + c_cname = NULL; // client address + c_pname = NULL; // server address + c_cport = 0; + c_pport = 0; + c_status = NULL; // other data + c_poll_flags = POLLIN; + c_bcast = false; + c_revents = 0; + dirtySocket = false; + c_timeout = 30; +} + +DConnection::DConnection () +{ + prepare (); +} + +DConnection::DConnection (int sd) +{ + prepare (); + c_sd = sd; +} + +DConnection::~DConnection () +{ + if (! dirtySocket && c_sd != -1) + ::close (c_sd); + DROP (c_cname); + DROP (c_group); + DROP (c_pname); +} + +/// Инициализировать объект для работы с IPv4 (AF_INET, SOCK_STREAM). +int DConnection::init () +{ + if (c_sd != -1) + ::close (c_sd); + c_sd = ::socket (AF_INET, SOCK_STREAM, 0); + dirtySocket = false; + return c_sd; +} + +/// Инициализировать объект для работы с IPv4 (AF_INET, SOCK_UDP). +int DConnection::initUdp () +{ + if (c_sd != -1) + return -1; + c_sd = ::socket (AF_INET, SOCK_DGRAM, 0); + dirtySocket = false; + return c_sd; +} + +/*! \brief Привязать сокет к порту. + * \param ip - адрес формата "xxx.xxx.xxx.xxx" + * \param port - порт (не сетевой формат) + */ +int DConnection::bind (char *ip, uint16_t port) +{ + if (! ip) + return -1; + + DROP (c_cname); + c_cname = strdup (ip); + c_cport = port; + return dBind (c_sd, ip, port); +} + +/*! \brief Подключить сокет. + * \param ip - адрес формата "xxx.xxx.xxx.xxx" + * \param port - порт (не сетевой формат) + */ +int DConnection::connect (char *ip, uint16_t port) +{ + sockaddr_in s_addr; + socklen_t len; + int ret; + + ret = dConnect (c_sd, ip, port); + if (ret < 0) + return -1; + + c_pname = strdup (ip); + c_pport = port; + if (! c_cname) { + len = sizeof (struct sockaddr_in); + ::getsockname (c_sd, (sockaddr *) &s_addr, &len); + DROP (c_cname); + c_cname = strdup (inet_ntoa (s_addr.sin_addr)); + c_cport = htons (s_addr.sin_port); + } + c_ctime = time (NULL); + return ret; +} + +/*! \brief Подключить сокет при помощи UDP. + * \param ip - адрес формата "xxx.xxx.xxx.xxx" + * \param port - порт (не сетевой формат) + */ +int DConnection::connectUdp (char *ip, uint16_t port) +{ + if (! ip || c_sd < 0) + return -1; + + DROP (c_pname); + c_pname = strdup (ip); + c_pport = port; + return 0; +} + +/*! \brief Послать пакет (TCP). + * \param ip - адрес формата "xxx.xxx.xxx.xxx" + * \param port - порт (не сетевой формат) + */ +int DConnection::send (char * buf, int len) +{ + return ::send (c_sd, buf, len, 0); +} + +/*! \brief Послать пакет (UDP). + * \param buf - данные пакета. + * \param len - длина пакета. + */ +int DConnection::sendTo (char * buf, int len) +{ + return sendToSocket (c_sd, buf, len, c_pname, c_pport); +} + +/*! \brief Получить пакет (TCP) + * \param buf - данные пакета. + * \param len - максимальная длина пакета. + */ +int DConnection::recv (char * buf, int len) +{ + return ::recv (c_sd, buf, len, 0); +} + +/*! \brief Получить пакет (TCP) + * \param buf - данные пакета. + * \param len - максимальная длина пакета. + * \param IP - адрес отправителя (буфер не менее 16 байт). + * \param PORT - порт отправителя. + */ +int DConnection::recvFrom (char *buf, int len, char * IP, uint16_t * PORT) +{ + return ::recvFrom (c_sd, buf, len, IP, PORT); +} + +/// Количество данных доступных без блокировки. +int DConnection::ioNRead () +{ + int ret; + if (ioctl (c_sd, FIONREAD, &ret) != 0) + return -1; + return ret; +} + +/*! \brief Обновить время создание соединения. + * \param d_time - новое время (или 0 для текущего). + */ +void DConnection::updateCTime (time_t d_time) +{ + if (d_time) + c_ctime = d_time; + else + c_ctime = time (NULL); +} + +/*! \brief Обновить время модификации. + * \param d_time - новое время (или 0 для текущего). + */ +void DConnection::updateMTime (time_t d_time) +{ + if (d_time) + c_mtime = d_time; + else + c_mtime = time (NULL); +} + +/*! \brief Клонировать соединение. + * Копируются все данные по соединению, кроме дескриптора и флага "Broadcast". + */ +DConnection * DConnection::clone () +{ + DConnection *c; + + c = new DConnection; + if (c_name) + c->c_name = strdup (c_name); + if (c_group) + c->c_group = strdup (c_group); + if (c_cname) + c->c_cname = strdup (c_cname); + if (c_pname) + c->c_pname = strdup (c_pname); + + c->c_type = c_type; + c->c_mtime = c_mtime; + c->c_ctime = c_ctime; + c->c_cport = c_cport; + c->c_pport = c_pport; + c->c_status = c_status; + c->c_poll_flags = c_poll_flags; + return c; +} + +/// Включить широковещательную рассылку. +int DConnection::setBroadcast () +{ + c_bcast = true; + return ::setBroadcast (c_sd); +} + +/// Закрыть соединение. +int DConnection::close () +{ + if (! dirtySocket && c_sd != -1) { + ::close (c_sd); + c_sd = -1; + } + + DROP (c_name); + DROP (c_cname); + DROP (c_pname); + return 0; +} + +/// listen(2) +int DConnection::listen (int N) +{ + return ::listen (c_sd, N); +} + +/// Принять подключение. +DConnection * DConnection::accept () +{ + DConnection * m_conn = NULL; + sockaddr_in m_addr; + socklen_t m_len; + int Ret; + + m_len = sizeof (struct sockaddr_in); + Ret = ::accept (c_sd, (sockaddr *) &m_addr, &m_len); + if (Ret < 0) + return NULL; + + m_conn = clone (); + DROP (m_conn->c_pname); + m_conn->c_pname = strdup (inet_ntoa (m_addr.sin_addr)); + m_conn->c_pport = htons (m_addr.sin_port); + m_conn->c_sd = Ret; + + return m_conn; +} + +/// Получить дейтаграмму. +DUdp * DConnection::recvUdp (int bufLen) +{ + DUdp * m_udp; + char * m_buf; + uint16_t port; + char ip[32]; + int len; + + m_udp = new DUdp; + m_buf = CNEW (char, bufLen); + len = recvFrom (m_buf, bufLen, ip, &port); + if (len <= 0) { + delete m_udp; + DROP (m_buf); + return NULL; + } + m_udp->init (m_buf, len, ip, port); + + return m_udp; +} + +/// Ждать поступления данных. +int DConnection::select (int secs, int usecs) +{ + return Dselect (c_sd, secs, usecs); +} + +int DConnection::setSocket (int m_sd, bool dirty) +{ + dirtySocket = dirty; + c_sd = m_sd; + return 0; +} + +void DConnection::setName (char * m_name) +{ + c_name = strdup (m_name); +} + +void DConnection::setGroup (char * m_group) +{ + c_group = strdup (m_group); +} + +int DConnection::open (char *f_name, int openmode, int filemode) +{ + c_sd = ::open (f_name, openmode | O_LARGEFILE, filemode); + return c_sd; +} + +int DConnection::read (char *m_buf, int len) +{ + return ::read (c_sd, m_buf, len); +} + +int DConnection::write (char *m_buf, int len) +{ + return ::write (c_sd, m_buf, len); +} + +void DConnection::setPollFlags (int flags) +{ + c_poll_flags = flags; +} + +int DConnection::pollFlags () +{ + return c_poll_flags; +} + +char * DConnection::getsockname () +{ + sockaddr_in m_addr; + socklen_t namelen = sizeof (sockaddr_in); + + if (c_cname) + return c_cname; + + if (::getsockname (c_sd, (sockaddr *) &m_addr, &namelen) < 0) + return NULL; + c_cname = strdup (inet_ntoa (m_addr.sin_addr)); + + return c_cname; +} + +char * DConnection::getpeername () +{ + sockaddr_in addr; + socklen_t m_len; + + if (c_pname) + return c_pname; + m_len = sizeof (sockaddr_in); + if (::getpeername (c_sd, (sockaddr *) &addr, &m_len) < 0) + return NULL; + c_pname = strdup (inet_ntoa (addr.sin_addr)); + + return c_pname; +} + +uint16_t DConnection::getpeerport () +{ + sockaddr_in addr; + socklen_t m_len; + + if (c_pport) + return c_pport; + m_len = sizeof (sockaddr_in); + if (::getpeername (c_sd, (sockaddr *) &addr, &m_len) < 0) + return 0; + c_pport = htons (addr.sin_port); + + return c_pport; +} + +uint16_t DConnection::getsockport () +{ + sockaddr_in m_addr; + socklen_t namelen = sizeof (sockaddr_in); + + if (c_cport) + return c_cport; + + if (::getsockname (c_sd, (sockaddr *) &m_addr, &namelen) < 0) + return 0; + + c_cport = htons (m_addr.sin_port); + return c_cport; +} + +time_t DConnection::get_ctime () +{ + return c_ctime; +} + +time_t DConnection::get_mtime () { + return c_mtime; +} + +bool DConnection::broadcast () +{ + return c_bcast; +} + +char * DConnection::name () +{ + return c_name; +} + +char * DConnection::group () +{ + return c_group; +} + +int DConnection::socket () +{ + return c_sd; +} + +Buf * DConnection::read () +{ + int count; + Buf * b; + + count = ioNRead (); + if (count <= 0) + return NULL; + + b = new Buf(count); + if (read (b->data (), count) <= 0) { + delete b; + return NULL; + } + + return b; +} + +Buf * DConnection::recv (int opts) +{ + int count; + Buf * b; + + count = ioNRead (); + if (count <= 0) + return NULL; + + b = new Buf(count); + if (::recv (c_sd, b->data (), count, opts) <= 0) { + delete b; + return NULL; + } + + return b; +} + +int DConnection::write (Buf * b) +{ + if (! b) + return 0; + return write (b->data (), b->len ()); +} + +int DConnection::send (Buf * b, int opts) +{ + if (! b) + return 0; + return ::send (c_sd, b->data (), b->len (), opts); +} + +int DConnection::revents () +{ + return c_revents; +} + +void DConnection::setRevents (int m_set) +{ + c_revents = m_set; +} + +int DConnection::setTimeOut (int t) +{ + c_timeout = t; + return t; +} + +int DConnection::timeout () +{ + return c_timeout; +} + +List * DConnection::recvStrings () +{ + char * m_buf; + char * pos; + int count; + int avail; + char * S; + List * Ret; + + m_buf = CNEW (char, 4096); + pos = m_buf; + avail = 4095; + + while (true) { + if (select (timeout (), 0) <= 0) { + DROP (m_buf); + return NULL; + } + + count = recv (pos, avail); + pos += count; + if (pos[-1] == '\n') + break; + + avail -= count; + if (avail <= 0) + break; + } + + pos[0] = '\0'; + Ret = split (m_buf, "\n"); + DROP (m_buf); + return Ret; +} + +int DConnection::shutdown (int how) +{ + return ::shutdown (c_sd, how); +} + +int DConnection::reuseAddr () +{ + return dReuseAddr (c_sd); +} + +char * DConnection::userData () +{ + return c_user_data; +} + +char * DConnection::setUserData (char * ptr) +{ + c_user_data = ptr; + return ptr; +} + diff --git a/gclib2/modules/Net/INET/dconnection.h b/gclib2/modules/Net/INET/dconnection.h new file mode 100755 index 0000000..14d87f7 --- /dev/null +++ b/gclib2/modules/Net/INET/dconnection.h @@ -0,0 +1,105 @@ +/* + * (c) Oleg Puchinin 2006,2007 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DCONNECTION_H +#define DEFINE_DCONNECTION_H + +#include + +#ifndef DEFINE_DUDP_H +#include +#endif + +class DConnection; +/// Класс "соединение". +class DConnection +{ + public: + DConnection (); + DConnection (int sd); + ~DConnection (); + + int init (); + int initUdp (); + int reuseAddr (); + int bind (char *ip, uint16_t port); + int connect (char *ip, uint16_t port = 0); + int connectUdp (char *ip, uint16_t port); + int listen (int N); + Connection * accept (); + int send (char * buf, int len); + int sendTo (char * buf, int len); + int recv (char * buf, int len); + int recvFrom (char *buf, int len, char * IP, uint16_t * PORT); + DUdp * recvUdp (int bufLen = 65535); + void updateCTime (time_t d_time = 0); + void updateMTime (time_t d_time = 0); + int ioNRead (); + int select (int secs, int usecs); + Connection * clone (); + int setBroadcast (); + int setSocket (int m_sd, bool dirty = true); + int socket (); + int setTimeOut (int t); + int timeout (); + int close (); + + void setName (char * m_name); + void setGroup (char * m_group); + void setRevents (int m_set); + void setPollFlags (int m_set); + + int open (char *f_name, int openmode, int filemode = 0644); + int read (char *m_buf, int len); + int write (char *m_buf, int len); + char * getsockname (); + char * getpeername (); + uint16_t getpeerport (); + uint16_t getsockport (); + time_t get_ctime (); + time_t get_mtime (); + bool broadcast (); + + char * name (); + char * group (); + int revents (); + int pollFlags (); + + /* v2.3 */ + Buf * read (); + Buf * recv (int opts = 0); + int write (Buf *); + int send (Buf *, int opts = 0); + List * recvStrings (); + int shutdown (int how); + char * userData (); + char * setUserData (char * ptr); + + /**/ + + private: + char * c_user_data; + int c_sd; + int c_type; + char * c_name; + char * c_group; + time_t c_mtime; + time_t c_ctime; + char * c_cname; // client address + char * c_pname; // server address + uint16_t c_cport; + uint16_t c_pport; + char * c_status; // other data + int c_poll_flags; + int c_revents; + bool c_bcast; + bool dirtySocket; + int c_timeout; + void prepare (); +}; + +#endif + diff --git a/gclib2/modules/Net/INET/dudp.cxx b/gclib2/modules/Net/INET/dudp.cxx new file mode 100644 index 0000000..9cd1739 --- /dev/null +++ b/gclib2/modules/Net/INET/dudp.cxx @@ -0,0 +1,30 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#include + +DUdp::DUdp () +{ + ip = NULL; + port = 0; +} + +DUdp::~DUdp () +{ + delete data (); + DROP (ip); +} + +int DUdp::init (char * data, int len, char * IP, uint16_t PORT) +{ + if (! IP || ! data) + return -1; + DPBuf::init (data, len); + ip = strdup (IP); + port = PORT; + return 0; +} + diff --git a/gclib2/modules/Net/INET/dudp.h b/gclib2/modules/Net/INET/dudp.h new file mode 100644 index 0000000..51af491 --- /dev/null +++ b/gclib2/modules/Net/INET/dudp.h @@ -0,0 +1,26 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DUDP_H +#define DEFINE_DUDP_H + +#ifndef DEFINE_DPBUF_H +#include +#endif + +class DUdp : public DPBuf +{ + public: + DUdp (); + ~DUdp (); + + int init (char * data, int len, char * IP, uint16_t PORT); + char * ip; + uint16_t port; +}; + +#endif + diff --git a/gclib2/modules/Net/INET/gc_network.h b/gclib2/modules/Net/INET/gc_network.h new file mode 100644 index 0000000..b79a252 --- /dev/null +++ b/gclib2/modules/Net/INET/gc_network.h @@ -0,0 +1,36 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_NETWORK_H +#define DEFINE_NETWORK_H + +#include +#include +#include + +__export int sendToPath(void * lp_data,int int_size,char * lpsz_path) ; +__export int sendToSocket (int sock, void * lp_data, int int_size, const char * address, uint16_t port) ; +__export int sendTo (void * lp_data, int int_size, const char * address, uint16_t port); +__export int dBind (int sock, char * addr, int port) ; +__export int dReuseAddr (int sock) ; + +__export int dSocket () ; +__export int dUdpSocket () ; +__export int dConnect (int sock, const char * addr, uint16_t port) ; +__export int getHostByName(const char * hostName,struct in_addr * address) ; +__export char * getNameByHost(struct in_addr * addr) ; +__export int recvFrom (int sd, char * buf, int size, char * peer_ip, uint16_t * peer_port) ; +__export int setBroadcast (int fd) ; +__export int pollScan (struct pollfd *p, int count, int pos) ; + +__export char * url_protocol (char * url) ; +__export char * url_host (char * url) ; +__export char * url_file (char * url) ; + +bool isIP (char * S); + +#endif + diff --git a/gclib2/modules/Net/INET/network.cxx b/gclib2/modules/Net/INET/network.cxx new file mode 100755 index 0000000..159bcbf --- /dev/null +++ b/gclib2/modules/Net/INET/network.cxx @@ -0,0 +1,327 @@ +/* + * (c) Oleg Puchinin 2006,2007 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include +#include + +#ifdef __export +#undef __export +#define __export +#endif + +/// \file network.c Низкоуровневые сетевые функции. + +/*! \page NetworkModule Сетевой модуль. + * \see network.c dns.cxx DConnection DPoll + */ + +/*! \brief Послать UDP в Unix-Socket. + * \param lp_data - буфер пакета. + * \param int_size - размер пакета. + * \param lpsz_path - адрес (путь) сокета. + */ +__export int sendToPath(void * lp_data, int int_size, char * lpsz_path) +{ + int sock; + int Res; + struct sockaddr_un name; + + if (! lp_data) + return -1; + if (! lpsz_path) + return -1; + + memset (&name, 0, sizeof (struct sockaddr_un)); + sock = socket(AF_LOCAL,SOCK_DGRAM, 0); + name.sun_family = AF_LOCAL; + strncpy (name.sun_path, lpsz_path, 108); + Res = sendto (sock, lp_data, int_size, 0, (struct sockaddr *) &name, sizeof (struct sockaddr_un)); + close (sock); + return Res; +} + +/*! \brief Послать UDP (IPv4). + * \param sock - использовать этот сокет. + * \param lp_data - буфер пакета. + * \param int_size - размер пакета. + * \param address - IP адрес ("xxx.xxx.xxx.xxx"); + * \param port - порт (не сетевой формат). + */ +__export int sendToSocket (int sock, void * lp_data, int int_size, const char * address, uint16_t port) +{ + int Res; + struct sockaddr_in inet_address; + + memset (&inet_address, 0, sizeof (struct sockaddr_in)); + inet_address.sin_family = AF_INET; + inet_address.sin_port = htons(port); + inet_aton (address, &inet_address.sin_addr); + + Res = sendto(sock,lp_data,int_size,0, + (struct sockaddr *) &inet_address, sizeof (struct sockaddr_in)); + return Res; +} + +/*! \brief Послать UDP. + * \param lp_data - буфер пакета. + * \param int_size - размер пакета. + * \param address - IP адрес ("xxx.xxx.xxx.xxx"); + * \param port - порт (не сетевой формат). + */ +__export int sendTo (void * lp_data, int int_size, const char * address, uint16_t port) +{ + int sock; + int Res; + struct sockaddr_in inet_address; + + if (! lp_data || ! address) + return -1; + + memset (&inet_address, 0, sizeof (struct sockaddr_in)); + inet_address.sin_family = AF_INET; + inet_address.sin_port = htons(port); + inet_aton (address, &inet_address.sin_addr); + sock = socket(AF_INET,SOCK_DGRAM,0); + Res = sendto(sock,lp_data,int_size,0, + (struct sockaddr *) &inet_address,sizeof (struct sockaddr_in)); + close (sock); + return Res; +} + +/*! \brief Обертка для bind(2). + * \param sock - соответственно сокет. + * \param addr - IP адрес ("xxx.xxx.xxx.xxx"); + * \param port - порт (не сетевой формат). + */ +__export int dBind (int sock, char * addr, int port) +{ + struct sockaddr_in m_addr; + + memset (&m_addr, 0, sizeof (struct sockaddr_in)); + inet_aton (addr, &m_addr.sin_addr); + m_addr.sin_family = AF_INET; + m_addr.sin_port = htons (port); + + return bind (sock, (struct sockaddr *) &m_addr, sizeof (struct sockaddr_in)); +} + +/// Получить сокет (AF_INET, SOCK_STREAM). +__export int dSocket () +{ + return socket (AF_INET, SOCK_STREAM, 0); +} + +/// Получить сокет (AF_INET, SOCK_DGRAM). +__export int dUdpSocket () +{ + return socket (AF_INET, SOCK_DGRAM, 0); +} + +/*! \brief Подключить сокет. + * \param sock - соответственно сокет. + * \param addr - IP адрес ("xxx.xxx.xxx.xxx"); + * \param port - порт (не сетевой формат). + */ +__export int dConnect (int sock, const char * addr, uint16_t port) +{ + struct sockaddr_in m_addr; + + memset (&m_addr, 0, sizeof (struct sockaddr_in)); + inet_aton (addr, &m_addr.sin_addr); + m_addr.sin_family = AF_INET; + m_addr.sin_port = htons (port); + + return connect (sock, (struct sockaddr *) &m_addr, sizeof (struct sockaddr_in)); +} + +/*! \brief Получить адрес хоста по имени. + * \param hostName - имя сервера. + * \param address - результирующий адрес. + */ +__export int getHostByName(const char * hostName,struct in_addr * address) +{ + struct hostent * hostent_hostent; + if((hostName == 0) | (address == 0)) return -1; + + hostent_hostent = gethostbyname(hostName); + if(! hostent_hostent) + return -1; + + *address = *((struct in_addr *) &hostent_hostent->h_addr_list[0][0]); + endhostent(); + return 0; +} + +/*! \brief Получить имя хоста по адресу. + * \param addr - соответственно адрес. + * \note Функция не реентрантная. + */ +__export char * getNameByHost(struct in_addr * addr) +{ + struct sockaddr_in address; + struct hostent * hostent_hostent; + + if(! addr) + return 0; + address.sin_addr = *addr; + hostent_hostent = gethostbyaddr((const char *) &address.sin_addr, 4, PF_INET); + if(! hostent_hostent) + return 0; + + return hostent_hostent->h_name; +} + +/*! \brief Получить UDP. + * \param sd - соответственно дескриптор. + * \param pkt - буфер под пакет. + * \param size - размер буфера под пакет. + * \param peer_ip - адрес (откуда пришло). + * \param peer_port - порт (откуда пришло). + * \note Буфер под peer_ip должен быть не меньше 16 байт. + * \date 2006 +*/ +__export int recvFrom (int sd, char * buf, int size, char * peer_ip, uint16_t * peer_port) +{ + struct sockaddr_in m_addr; + socklen_t al; + char * S; + int len; + + if (buf == NULL) + return -1; + + memset (&m_addr, 0, sizeof (struct sockaddr_in)); + al = sizeof (struct sockaddr_in); + len = recvfrom (sd, buf, size, 0, (struct sockaddr *) &m_addr, &al); + if (len < 0) + return len; + + if (peer_ip) { + peer_ip[0] = '\0'; + S = inet_ntoa (m_addr.sin_addr); + if (! S) + return len; + strcpy (peer_ip, S); + } + + if (peer_port) + *peer_port = ntohs (m_addr.sin_port); + + return len; +} + +/*! \brief Включить BROADCAST на сокет. + * \param fd - соответственно сокет. + */ +__export int setBroadcast (int fd) +{ + int one = 1; + return setsockopt (fd, SOL_SOCKET, SO_BROADCAST, &one, 4); +} + +/*! \brief Найти "готовый" pollfd. + * \param p - указатель на массив pollfd. + * \param count - размер. + * \param pos - начать с этой позиции. + */ +__export int pollScan (struct pollfd *p, int count, int pos) +{ + if (! p) + return -1; + + if (pos >= count) + return 0; + + for (; pos < count; ++pos) { + if (p[pos].revents) + return pos; + } + + return 0; +} + +/*! \brief Добавить дескриптор к пулу. + * \param d_array - инициализированный массив (элементы - pollfd *) + * \param fd - требуемый дескриптор. + * \param events - маска (см. poll(2) ) + */ +__export int Dpoll_add (EArray * d_array, int fd, short events) +{ + struct pollfd *d; + if (d_array == NULL) + return -1; + + d = CNEW (struct pollfd, 1); + memset (d, 0, sizeof (struct pollfd)); + d->fd = fd; + d->events = events; + d->revents = 0; + d_array->add (LPCHAR (d)); + + return 0; +} + +/*! \brief Собрать пул + * \param d - массив элементов pollfd * + * \param p - адрес результирующего пула, готовый для poll (2) + * \note Необходимо освобождать пул (DROP) после использования. + */ +__export int Dpoll_coallesce (EArray * d, struct pollfd ** p) +{ + int size; + int i; + struct pollfd *my; + + if (d == NULL || p == NULL) + return -1; + + size = d->get_size (); + if (size == 0) + return 0; + + *p = CNEW (pollfd, d->get_size ()); + for (i = 0; i < size; i++) { + my = (struct pollfd *) d->get (i); + (*p)[i].fd = my->fd; + (*p)[i].events = my->events; + (*p)[i].revents = 0; + } + + return size; +} + +__export bool isIP (char * S) +{ + int nDots = 0; + + if (! S) + return false; + + while (*S) { + if (*S == '.') + ++nDots; + else if (! isdigit (*S)) + return false; + ++S; + } + + if (nDots != 3) + return false; + + return true; + +} + +__export int dReuseAddr (int sock) +{ + int optval=1; + return setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,&optval,sizeof(optval)); +} + diff --git a/gclib2/modules/Net/INET/url.cxx b/gclib2/modules/Net/INET/url.cxx new file mode 100644 index 0000000..1c65f42 --- /dev/null +++ b/gclib2/modules/Net/INET/url.cxx @@ -0,0 +1,87 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include + +List * __url_split (char * url) +{ + List * m_ret; + char * S; + char * host_ptr; + char m_buf[512]; + + m_ret = new List; + strcpy (m_buf, url); + S = strstr (m_buf, "://"); + + if (! S) { + S = m_buf; + m_ret->add (strdup ("")); + } else { + *S = '\0'; + S += 3; + m_ret->add (strdup (m_buf)); + } + + host_ptr = S; + S = strchr (host_ptr, '/'); + if (S) { + *S = '\0'; + m_ret->add (strdup (host_ptr)); + ++S; + m_ret->add (strdup (S)); + } else { + m_ret->add (strdup (host_ptr)); + m_ret->add (strdup ("")); + } + + return m_ret; +} + +void __url_done (List * m_list) +{ + if (! m_list) + return; + m_list->foreach (free); + delete m_list; +} + +char * url_protocol (char * url) +{ + List * m_list; + char * ret; + + m_list = __url_split (url); + ret = strdup ((*m_list)[0]); + __url_done (m_list); + return ret; +} + +char * url_host (char * url) +{ + List * m_list; + char * ret; + + m_list = __url_split (url); + ret = strdup ((*m_list)[1]); + __url_done (m_list); + return ret; + +} + +char * url_file (char * url) +{ + List * m_list; + char * ret; + + m_list = __url_split (url); + ret = strdup ((*m_list)[2]); + __url_done (m_list); + return ret; + +} + + diff --git a/gclib2/modules/Net/MMP/MMP.h b/gclib2/modules/Net/MMP/MMP.h new file mode 100644 index 0000000..83f3fc8 --- /dev/null +++ b/gclib2/modules/Net/MMP/MMP.h @@ -0,0 +1,50 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_MMP_H +#define DEFINE_MMP_H + +#ifndef DEFINE_MRIM_HDR +struct mrim_hdr; +#endif + +class MMP +{ + public: + MMP (); + ~MMP (); + + int init (); + int login (char * login, char * pass); + int logout (); + int sendMessage (char * to, char * message, bool bulticast = false); + int ping (); + int pingInterval (); + int socket (); + int timeout (); + int setTimeOut (int t); + + private: + mrim_hdr * mk_pkt (u_long msg, char * attach = NULL, uint8_t len = 0); + char * rcv (int * len); + int real_connect (char *addr, int len); + void LPS (char ** pkt, char *str); + void UL (char ** pkt, int N); + int hello (); + + int fd; + char ** cmds_out; + struct sockaddr_in caddr; + struct sockaddr_in saddr; + int last_seq; + int m_ping; + int m_timeout; + +}; + + +#endif + diff --git a/gclib2/modules/Net/MMP/mmp_engine.cxx b/gclib2/modules/Net/MMP/mmp_engine.cxx new file mode 100755 index 0000000..7f2e887 --- /dev/null +++ b/gclib2/modules/Net/MMP/mmp_engine.cxx @@ -0,0 +1,338 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#define DEFINE_MRIM_HDR + +#include +#include +#include "mmp_proto.h" +#include "MMP.h" +#include + +#define CMDS_OUT_SIZE 1024 +// #define DBG(arg) do { printf (arg); fflush (stdout); } while (0) +#define DBG(arg) + +MMP::MMP () +{ + srand (time (NULL)); + fd = -1; + cmds_out = NULL; + last_seq = 0; + m_ping = 0; + m_timeout = rand (); +} + +MMP::~MMP () +{ + logout (); +} + +mrim_hdr * +MMP::mk_pkt (u_long msg, char * attach, uint8_t len) +{ + mrim_hdr *pkt; + + pkt = (mrim_hdr *) CNEW (char, sizeof (mrim_packet_header_t) + len); + + bzero (pkt, sizeof (mrim_packet_header_t)); + pkt->magic = CS_MAGIC; + pkt->proto = PROTO_VERSION; + pkt->msg = msg; + pkt->seq = ++last_seq; + pkt->dlen = len; + pkt->fromport = (u_long) caddr.sin_port; + pkt->from = (u_long) caddr.sin_addr.s_addr; + if (attach) + memcpy (& ((char *) pkt)[sizeof (mrim_packet_header_t)], attach, len); + + return pkt; +} + +int MMP::hello () +{ + mrim_hdr * pkt = mk_pkt (MRIM_CS_HELLO); + if (pkt == NULL) + return -1; + return send (fd, (char *) pkt, sizeof (mrim_hdr), 0); +} + +char * MMP::rcv (int * len) +{ + int count; + char * Ret = NULL; + + count = DIONREAD (fd); + if (count <= 0) + return NULL; + + Ret = CNEW (char, count); + if (recv (fd, Ret, count, 0) != count) { + DROP (Ret); + return NULL; + } + + if (len) + *len = count; + + return Ret; +} + +int MMP::real_connect (char *addr, int len) +{ + char * S; + int port; + socklen_t slen; + + addr[len-1] = 0; + + S = strchr (addr, ':'); + if (S == NULL) + return -1; + + *S = '\0'; + S++; + if (*S == '\0') + return -1; + + port = atoi (S); + + fd = dSocket (); + if (fd < 0) + return -1; + + if (dConnect (fd, addr, port) < 0) { + close (fd); + return -1; + } + + slen = sizeof (struct sockaddr_in); + getpeername (fd, (struct sockaddr *) &saddr, &slen); + slen = sizeof (struct sockaddr_in); + getsockname (fd, (struct sockaddr *) &caddr, &slen); + + return 0; +} + +int MMP::init () +{ + struct sockaddr_in addr; + char * response; + int len; + char * ptr; + mrim_hdr *pkt; + int * i; + + cmds_out = CNEW (char *, CMDS_OUT_SIZE); + if (cmds_out == NULL) + return -1; + + memset (cmds_out, 0, sizeof (char *) * CMDS_OUT_SIZE); + + fd = dSocket (); + if (fd < 0) + return -1; + + memset (&addr, 0, sizeof (sockaddr_in)); + addr.sin_family = AF_INET; + addr.sin_port = htons (2042); + if (getHostByName ("mrim.mail.ru", &addr.sin_addr)) { + fprintf (stderr, "Can't connect to %s\n", "mrim.mail.ru"); + return -1; + } + + DBG ("Connect to main server...\n"); + if (connect (fd, (struct sockaddr *) &addr, sizeof (struct sockaddr_in)) < 0) { + perror ("connect"); + return -1; + } + + if (Dselect (fd, m_timeout, 0) <= 0) + return -1; + + response = rcv (&len); + close (fd); + + if (response == NULL) + return -1; + + DBG ("Connect to real server...\n"); + if (real_connect (response, len) < 0) + return -1; + + DBG ("Send hello...\n"); + DROP (response); + if (hello () < 0) + return -1; + + if (Dselect (fd, m_timeout, 0) <= 0) + return -1; + + response = rcv (&len); + if (response == NULL) + return -1; + + pkt = (mrim_hdr *) response; + ptr = response + sizeof (mrim_hdr); + if (pkt->msg != MRIM_CS_HELLO_ACK) { + DROP (response); + return -1; + } + + i = (int *) ptr; + m_ping = *i; + return 0; +} + +void MMP::LPS (char ** pkt, char *str) +{ + char *S; + int *i; + + i = (int *) *pkt; + *i = strlen (str); + S = *pkt; + S+=4; + strcpy (S, str); + S += *i; + *pkt = S; +} + +void MMP::UL (char ** pkt, int N) +{ + int *i; + + i = (int *) *pkt; + *i = N; + *pkt += 4; +} + +int MMP::login (char * login, char * pass) +{ + mrim_hdr * pkt; + char * attach; + char *ptr; + int len; + char * response; + + attach = CNEW (char, 4096); + ptr = attach; + LPS (&ptr, login); + LPS (&ptr, pass); + UL (&ptr, STATUS_ONLINE); + LPS (&ptr, "Linux MMP client. (c) Oleg Puchinin graycardinalster@gmail.com"); + pkt = mk_pkt (MRIM_CS_LOGIN2, attach, ptr-attach); + len = sizeof (mrim_hdr) + (ptr - attach); + + DROP (attach) + if (send (fd, (char *) pkt, len, 0) < 0) + return -1; + + DROP (pkt); + if (Dselect (fd, m_timeout, 0) <= 0) + return -1; + + response = rcv (&len); + if (response == NULL) + return -1; + + pkt = (mrim_hdr *) response; + if (pkt->msg != MRIM_CS_LOGIN_ACK) { + DROP (response); + return -1; + } + + return 0; +} + +int MMP::sendMessage (char * to, char * message, bool multicast) +{ + mrim_hdr * pkt; + char * attach; + char *ptr; + int len; + char * response; + int * i; + + attach = CNEW (char, 4096); + ptr = attach; + + if (multicast) + UL (&ptr, MESSAGE_FLAG_MULTICAST); + else + UL (&ptr, 0); + LPS (&ptr, to); + LPS (&ptr, message); + LPS (&ptr, " "); + + pkt = mk_pkt (MRIM_CS_MESSAGE, attach, ptr-attach); + len = sizeof (mrim_hdr) + (ptr - attach); + DROP (attach); + + if (send (fd, (char *) pkt, len, 0) < 0) { + DROP (pkt); + return -1; + } + DROP (pkt); + + if (Dselect (fd, m_timeout, 0) <= 0) + return -1; + + response = rcv (&len); + pkt = (mrim_hdr *) response; + if (pkt->msg != MRIM_CS_MESSAGE_STATUS) { + DROP (response); + return -1; + } + + ptr = response + sizeof (mrim_hdr); + i = (int *) ptr; + if (*i != 0) { + DROP (response); + return -1; + } + + DROP (response); + return 0; +} + +int MMP::pingInterval () +{ + return m_ping; +} + +int MMP::ping () +{ + int Ret; + mrim_hdr * pkt; + pkt = mk_pkt (MRIM_CS_PING, NULL, 0); + Ret = send (fd, (char *) pkt, sizeof (mrim_hdr), 0); + DROP (pkt); + return Ret; +} + +int MMP::socket () +{ + return fd; +} + +int MMP::timeout () +{ + return m_timeout; +} + +int MMP::setTimeOut (int n) +{ + m_timeout = n; + return n; +} + +int MMP::logout () +{ + fdclose (&fd); + return 0; +} + diff --git a/gclib2/modules/Net/MMP/mmp_proto.h b/gclib2/modules/Net/MMP/mmp_proto.h new file mode 100755 index 0000000..320d129 --- /dev/null +++ b/gclib2/modules/Net/MMP/mmp_proto.h @@ -0,0 +1,270 @@ +//*************************************************************************** +// $Id: proto.h,v 1.141 2005/10/24 15:32:33 shingrus Exp $ +//*************************************************************************** + +#ifndef MRIM_PROTO_H +#define MRIM_PROTO_H + +#include + +#define PROTO_VERSION_MAJOR 1 +#define PROTO_VERSION_MINOR 7 +#define PROTO_VERSION ((((u_long)(PROTO_VERSION_MAJOR))<<16)|(u_long)(PROTO_VERSION_MINOR)) + + +#define PROTO_MAJOR(p) (((p)&0xFFFF0000)>>16) +#define PROTO_MINOR(p) ((p)&0x0000FFFF) + +typedef struct mrim_packet_header_t +{ + u_long magic; // Magic + u_long proto; // Version + u_long seq; // Sequence + u_long msg; // Packet type + u_long dlen; // Äëèíà äàííûõ + u_long from; // Àäðåñ îòïðàâèòåëÿ + u_long fromport; // Ïîðò îòïðàâèòåëÿ + u_char reserved[16]; // Çàðåçåðâèðîâàíî +} +mrim_packet_header_t; +typedef struct mrim_packet_header_t mrim_hdr; + +#define CS_MAGIC 0xDEADBEEF // Êëèåíòñêèé Magic ( C <-> S ) + + +/*************************************************************************** + + ÏÐÎÒÎÊÎË ÑÂßÇÈ ÊËÈÅÍÒ-ÑÅÐÂÅÐ + + ***************************************************************************/ + +#define MRIM_CS_HELLO 0x1001 // C -> S + // empty + +#define MRIM_CS_HELLO_ACK 0x1002 // S -> C + // mrim_connection_params_t + + +#define MRIM_CS_LOGIN_ACK 0x1004 // S -> C + // empty + +#define MRIM_CS_LOGIN_REJ 0x1005 // S -> C + // LPS reason + +#define MRIM_CS_PING 0x1006 // C -> S + // empty + +#define MRIM_CS_MESSAGE 0x1008 // C -> S + // UL flags + // LPS to + // LPS message + // LPS rtf-formatted message (>=1.1) + #define MESSAGE_FLAG_OFFLINE 0x00000001 + #define MESSAGE_FLAG_NORECV 0x00000004 + #define MESSAGE_FLAG_AUTHORIZE 0x00000008 // X-MRIM-Flags: 00000008 + #define MESSAGE_FLAG_SYSTEM 0x00000040 + #define MESSAGE_FLAG_RTF 0x00000080 + #define MESSAGE_FLAG_CONTACT 0x00000200 + #define MESSAGE_FLAG_NOTIFY 0x00000400 + #define MESSAGE_FLAG_MULTICAST 0x00001000 +#define MAX_MULTICAST_RECIPIENTS 50 + #define MESSAGE_USERFLAGS_MASK 0x000036A8 // Flags that user is allowed to set himself + + +#define MRIM_CS_MESSAGE_ACK 0x1009 // S -> C + // UL msg_id + // UL flags + // LPS from + // LPS message + // LPS rtf-formatted message (>=1.1) + + + + +#define MRIM_CS_MESSAGE_RECV 0x1011 // C -> S + // LPS from + // UL msg_id + +#define MRIM_CS_MESSAGE_STATUS 0x1012 // S -> C + // UL status + #define MESSAGE_DELIVERED 0x0000 // Message delivered directly to user + #define MESSAGE_REJECTED_NOUSER 0x8001 // Message rejected - no such user + #define MESSAGE_REJECTED_INTERR 0x8003 // Internal server error + #define MESSAGE_REJECTED_LIMIT_EXCEEDED 0x8004 // Offline messages limit exceeded + #define MESSAGE_REJECTED_TOO_LARGE 0x8005 // Message is too large + #define MESSAGE_REJECTED_DENY_OFFMSG 0x8006 // User does not accept offline messages + +#define MRIM_CS_USER_STATUS 0x100F // S -> C + // UL status + #define STATUS_OFFLINE 0x00000000 + #define STATUS_ONLINE 0x00000001 + #define STATUS_AWAY 0x00000002 + #define STATUS_UNDETERMINATED 0x00000003 + #define STATUS_FLAG_INVISIBLE 0x80000000 + // LPS user + + +#define MRIM_CS_LOGOUT 0x1013 // S -> C + // UL reason + #define LOGOUT_NO_RELOGIN_FLAG 0x0010 // Logout due to double login + +#define MRIM_CS_CONNECTION_PARAMS 0x1014 // S -> C + // mrim_connection_params_t + +#define MRIM_CS_USER_INFO 0x1015 // S -> C + // (LPS key, LPS value)* X + + +#define MRIM_CS_ADD_CONTACT 0x1019 // C -> S + // UL flags (group(2) or usual(0) + // UL group id (unused if contact is group) + // LPS contact + // LPS name + // LPS unused + #define CONTACT_FLAG_REMOVED 0x00000001 + #define CONTACT_FLAG_GROUP 0x00000002 + #define CONTACT_FLAG_INVISIBLE 0x00000004 + #define CONTACT_FLAG_VISIBLE 0x00000008 + #define CONTACT_FLAG_IGNORE 0x00000010 + #define CONTACT_FLAG_SHADOW 0x00000020 + +#define MRIM_CS_ADD_CONTACT_ACK 0x101A // S -> C + // UL status + // UL contact_id or (u_long)-1 if status is not OK + + #define CONTACT_OPER_SUCCESS 0x0000 + #define CONTACT_OPER_ERROR 0x0001 + #define CONTACT_OPER_INTERR 0x0002 + #define CONTACT_OPER_NO_SUCH_USER 0x0003 + #define CONTACT_OPER_INVALID_INFO 0x0004 + #define CONTACT_OPER_USER_EXISTS 0x0005 + #define CONTACT_OPER_GROUP_LIMIT 0x6 + +#define MRIM_CS_MODIFY_CONTACT 0x101B // C -> S + // UL id + // UL flags - same as for MRIM_CS_ADD_CONTACT + // UL group id (unused if contact is group) + // LPS contact + // LPS name + // LPS unused + +#define MRIM_CS_MODIFY_CONTACT_ACK 0x101C // S -> C + // UL status, same as for MRIM_CS_ADD_CONTACT_ACK + +#define MRIM_CS_OFFLINE_MESSAGE_ACK 0x101D // S -> C + // UIDL + // LPS offline message + +#define MRIM_CS_DELETE_OFFLINE_MESSAGE 0x101E // C -> S + // UIDL + + +#define MRIM_CS_AUTHORIZE 0x1020 // C -> S + // LPS user + +#define MRIM_CS_AUTHORIZE_ACK 0x1021 // S -> C + // LPS user + +#define MRIM_CS_CHANGE_STATUS 0x1022 // C -> S + // UL new status + + +#define MRIM_CS_GET_MPOP_SESSION 0x1024 // C -> S + + +#define MRIM_CS_MPOP_SESSION 0x1025 // S -> C + #define MRIM_GET_SESSION_FAIL 0 + #define MRIM_GET_SESSION_SUCCESS 1 + //UL status + // LPS mpop session + + +//white pages! +#define MRIM_CS_WP_REQUEST 0x1029 //C->S +//DWORD field, LPS value +#define PARAMS_NUMBER_LIMIT 50 +#define PARAM_VALUE_LENGTH_LIMIT 64 + +//if last symbol in value eq '*' it will be replaced by LIKE '%' +// params define +// must be in consecutive order (0..N) to quick check in check_anketa_info_request +enum { + MRIM_CS_WP_REQUEST_PARAM_USER = 0, + MRIM_CS_WP_REQUEST_PARAM_DOMAIN, + MRIM_CS_WP_REQUEST_PARAM_NICKNAME, + MRIM_CS_WP_REQUEST_PARAM_FIRSTNAME, + MRIM_CS_WP_REQUEST_PARAM_LASTNAME, + MRIM_CS_WP_REQUEST_PARAM_SEX , + MRIM_CS_WP_REQUEST_PARAM_BIRTHDAY, + MRIM_CS_WP_REQUEST_PARAM_DATE1 , + MRIM_CS_WP_REQUEST_PARAM_DATE2 , + //!!!!!!!!!!!!!!!!!!!online request param must be at end of request!!!!!!!!!!!!!!! + MRIM_CS_WP_REQUEST_PARAM_ONLINE , + MRIM_CS_WP_REQUEST_PARAM_STATUS , // we do not used it, yet + MRIM_CS_WP_REQUEST_PARAM_CITY_ID, + MRIM_CS_WP_REQUEST_PARAM_ZODIAC, + MRIM_CS_WP_REQUEST_PARAM_BIRTHDAY_MONTH, + MRIM_CS_WP_REQUEST_PARAM_BIRTHDAY_DAY, + MRIM_CS_WP_REQUEST_PARAM_COUNTRY_ID, + MRIM_CS_WP_REQUEST_PARAM_MAX +}; + +#define MRIM_CS_ANKETA_INFO 0x1028 //S->C +//DWORD status + #define MRIM_ANKETA_INFO_STATUS_OK 1 + #define MRIM_ANKETA_INFO_STATUS_NOUSER 0 + #define MRIM_ANKETA_INFO_STATUS_DBERR 2 + #define MRIM_ANKETA_INFO_STATUS_RATELIMERR 3 +//DWORD fields_num +//DWORD max_rows +//DWORD server_time sec since 1970 (unixtime) +// fields set //%fields_num == 0 +//values set //%fields_num == 0 +//LPS value (numbers too) + + +#define MRIM_CS_MAILBOX_STATUS 0x1033 +//DWORD new messages in mailbox + + +#define MRIM_CS_CONTACT_LIST2 0x1037 //S->C +// UL status +#define GET_CONTACTS_OK 0x0000 +#define GET_CONTACTS_ERROR 0x0001 +#define GET_CONTACTS_INTERR 0x0002 +//DWORD status - if ...OK than this staff: +//DWORD groups number +//mask symbols table: +//'s' - lps +//'u' - unsigned long +//'z' - zero terminated string +//LPS groups fields mask +//LPS contacts fields mask +//group fields +//contacts fields +//groups mask 'us' == flags, name +//contact mask 'uussuu' flags, flags, internal flags, status + #define CONTACT_INTFLAG_NOT_AUTHORIZED 0x0001 + + +//old packet cs_login with cs_statistic +#define MRIM_CS_LOGIN2 0x1038 // C -> S +#define MAX_CLIENT_DESCRIPTION 256 +// LPS login +// LPS password +// DWORD status +//+ statistic packet data: +// LPS client description //max 256 + + + + +typedef struct mrim_connection_params_t +{ + unsigned long ping_period; +} +mrim_connection_params_t; + + + +#endif // MRIM_PROTO_H diff --git a/gclib2/modules/Net/MMP/protocol.html b/gclib2/modules/Net/MMP/protocol.html new file mode 100644 index 0000000..6bdb9d8 --- /dev/null +++ b/gclib2/modules/Net/MMP/protocol.html @@ -0,0 +1,544 @@ + + + + Mail.ru Àãåíò + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
Ïîèñê ÏîèñêÇíàêîìñòâà ÇíàêîìñòâàÎòêðûòêè Îòêðûòêè×àòû ×àòûÐàññûëêè ÐàññûëêèÌîëîòîê ÌîëîòîêÏóòåøåñòâèÿ ÏóòåøåñòâèÿÀâòî ÀâòîÂñå ïðîåêòû
+ + + + + + + + + +Rambler's Top100
+ + + + + + + + +
+
+ + + + + + +
Àãåíòmail.ru

çàãðóçèòü

Ïîëüçîâàòåëüñêîå
ñîãëàøåíèå

+
+
+
+ + + + + + + + + + + + + + +
+ + + + + + + +
+ +
+ +
+ +
+ +

Îïèñàíèå ïðîòîêîëà

+

MMP - ïðîòîêîë ñîåäèíåíèÿ Mail.Ru Àãåíòà ñ îáùåé ñåòüþ Mail.Ru. Ðåêîìåíäîâàííûé äëÿ ñîåäèíåíèÿ ñåðâåð â ëþáîé ìîìåíò âðåìåíè ìîæíî ïîëó÷èòü â òåêñòîâîì ôîðìàòå ip:port ïî àäðåñó mrim.mail.ru:2042 è mrim.mail.ru:443. Âçàèìîäåéñòâèå ñ ñåðâåðîì ïðîèñõîäèò ïîâåðõ ïîñòîÿííî óñòàíîâëåííîãî tcp-ñîåäèíåíèÿ ïîñðåäñòâîì àñèíõðîííîãî îáìåíà êîìàíäàìè. Èíèöèàòîðîì óñòàíîâëåíèÿ ñîåäèíåíèÿ ìîæåò áûòü òîëüêî êëèåíò, êîìàíäû ìîãóò ïîñûëàòüñÿ êàê êëèåíòîì, òàê è ñåðâåðîì.

+

MMP áèíàðíûé ïðîòîêîë. Âñå ÷èñëîâûå äàííûå ïåðåäàþòñÿ êàê ÷åòûðåõáàéòíûå öåëûå ÍÅ â ñåòåâîì ôîðìàòå, ò. å. ïåðâûì èäåò ñòàðøèé áàéò, ïîñëåäíèì ìëàäøèé. ×åòûðåõáàéòîâûå áåççíàêîâûå öåëûå îáîçíà÷àþòñÿ UL.

+

Òåêñòîâûå äàííûå ïåðåäàþòñÿ ñ ïðåôåêñèðîâàííîé äëèíîé, ò. å. ñíà÷àëà UL, à ïîòîì ñòðîêà (â êîäèðîâêå windows-1251) äëèíû UL áåç çàâåðøàþùåãî íóëÿ. Îáîçíà÷åíèå â äàëüíåéøåì - LPS.

+

Òèï äàííûõ UIDL èñïîëüçóåòñÿ òîëüêî ïðè ðàáîòå ñ îñòàâëåííûìè íà ñåðâåðå ñîîáùåíèÿìè. UIDL - ïîñëåäîâàòåëüíîñòü èç 8 ñèìâîëîâ èç ìíîæåñòâà [a-z A-Z 0-9 _ - = +].

+

Êàæäàÿ êîìàíäà èëè îòâåò íà íåå íà÷èíàþòñÿ ñ çàãîëîâêà. Ïîëÿ óêàçûâàåìûå â çàãîëîâêå: +

    +
  • âîëøåáíûé êëþ÷, óêàçûâàþùèé íà òî, ÷òî ýòî äåéñòâèòåëüíî ïàêåò MMP - âåðñèÿ MMP, ïîääåðæèâàåìàÿ îòïðàâèòåëåì ïàêåòà (òåêóùàÿ âåðñèÿ - 1.7)
  • +
  • íîìåð îòïðàâëÿåìîé êîìàíäû â òåêóùåì ñîåäèíåíèè. Îòâåò íà êîìàíäó äîëæåí èìåòü òîò æå íîìåð, ÷òî è ñàìà êîìàíäà.
  • +
  • òèï ïàêåòà, íîìåð êîìàíäû è/èëè îòâåòà
  • +
  • äëèííà äàííûõ ïàêåòà (áåç ó÷åòà çàãîëîâêà). Ïðè îáðàáîòêå ïîñûëàåìûõ ñåðâåðîì äàííûõ äëèíà ïàêåòà äîëæíà èìåòü ïðèîðèòåò ïåðåä ñïèñêîì åãî ïàðàìåòðîâ, ò. ê. â ñëåäóþùèõ âåðñèÿõ ïðîòîêîëà ìîãóò ïîÿâëÿòüñÿ íîâûå ïàðàìåòðû è âñå îíè áóäóò äîïèñûâàòüñÿ â êîíåö ïàêåòà.
  • +
  • ïîðò è ip (â inet_aton() ôîðìàòå) ñ êîòîðûõ óñòàíîâëåíî ñîåäèíåíèå
  • +
+


+

 ñèíòàêñèñå ÿçûêà Ñ: +

+Çàãîëîâîê ïàêåòà
+{
+    u_long	magic;	
+    u_long	proto;
+    u_long	seq;
+    u_long	msg;
+    u_long	dlen;
+    u_long	from;
+    u_long	fromport;
+    u_char	reserved[16];
+}
+
+ +

Âàì ïîíàäîáèòñÿ çàãîëîâî÷íûé ôàéë íà ÿçûêå C. Âçÿòü åãî ìîæíî çäåñü.

+

Ñïèñîê êîäîâ ãîðîäîâ, íàñåëåííûõ ïóíêòîâ è ðàéîíîâ ìîæíî âçÿòü çäåñü.

+

 

+

Ïîñëåäîâàòåëüíîñòü êîìàíä

+

Ïîñëå óñòàíîâêè tcp-ñîåäèíåíèÿ êëèåíò îáÿçàí ñðàçó ïîñëàòü MRIM_CS_HELLO, äîæäàòüñÿ MRIM_CS_HELLO_ACK, ïîñëå ÷åãî îòïðàâèòü MRIM_CS_LOGIN2 è íà÷àòü ïîñûëàòü MRIM_CS_PING ñ óñòàíîâëåííûì â MRIM_CS_HELLO_ACK èíòåðâàëîì.  ñëó÷àå óñïåøíîé àâòîðèçàöèè äàëüíåéøèå ïàêåòû (êðîìå MRIM_CS_PING) äîëæíû îòïðàâëÿòüñÿ òîëüêî â ñëó÷àå ïîëüçîâàòåëüñêèõ äåéñòâèé (íàïèñàíèÿ íîâûõ ñîîáùåíèé è ò. ï.) èëè îòâåòà íà ïàêåòû ïîëó÷àåìûå îò ñåðâåðà.

+ +

Òèïû ïàêåòîâ

+

Òèï ïàêåòà: cs - Client -> Server
+ Òèï ïàêåòà: sc - Server -> Client

+ +

Ïàêåòû

+ +
    +
  • Ïàêåò: Óñòàíîâêà ñîåäèíåíèÿ +

    + Èìÿ ïàêåòà: MRIM_CS_HELLO
    + Îòâåò: MRIM_CS_HELLO_ACK
    + Òèï ïàêåòà: cs
    + Îïèñàíèå: Ïåðâûé ïàêåò, îòïðàâëÿåìûé íà ñåðâåð. +

  • +
  • Ïàêåò: Ïîäòâåðæäåíèå óñòàíîâêè ñîåäèíåíèÿ +

    + Èìÿ ïàêåòà: MRIM_CS_HELLO_ACK
    + Òèï ïàêåòà: sc
    + Ïàðàìåòðû:

    +

    UL ## ping_period ## Îæèäàåìàÿ ÷àñòîòà ïîäòâåðæäåíèÿ ñîåäèíåíèÿ (â ñåêóíäàõ)

    +

    + Îïèñàíèå: Ïîäòâåðæäàåò âîçìîæíîñòü ñîåäèíåíèÿ è ñîîáùàåò êëèåíòó èíòåðâàë, ñ êîòîðûì íàäî îòïðàâëÿòü ïàêåòû êîíòðîëÿ ñîåäèíåíèÿ. +

  • +
  • Ïàêåò: Óñïåøíàÿ àâòîðèçàöèÿ +

    + Èìÿ ïàêåòà: MRIM_CS_LOGIN_ACK
    + Òèï ïàêåòà: sc
    + Îïèñàíèå: Ñîîáùàåò, ÷òî ïàðà ëîãèí-ïàðîëü áûëà âåðíà è êëèåíò óñïåøíî àâòîðèçîâàëñÿ â ñåòè àãåíòà. +

  • +
  • Ïàêåò: Íåâåðíàÿ àâòîðèçàöèÿ +

    + Èìÿ ïàêåòà: MRIM_CS_LOGIN_REJ
    + Òèï ïàêåòà: sc
    + Ïàðàìåòðû:

    +

    LPS ## reason ## ïðè÷èíà îòêàçà

    +

    + Îïèñàíèå: Ñîîáùàåò, ÷òî ïàðà ëîãèí-ïàðîëü áûëà íåâåðíà, è ñîåäèíåíèå áóäåò çàâåðøåíî. +

  • +
  • Ïàêåò: Êîíòðîëü ñîåäèíåíèÿ +

    + Èìÿ ïàêåòà: MRIM_CS_PING
    + Òèï ïàêåòà: cs
    + Îïèñàíèå: Îòïðàâêà ýòîãî ïàêåòà ïîäòâåðæäàåò äëÿ ñåðâåðà, ÷òî êëèåíò àêòèâåí. Ïàêåò äîëæåí îòïðàâëÿòüñÿ ñ èíòåðâàëîì, îïðåäåëåííûì â MRIM_CS_HELLO_ACK. +

  • +
  • Ïàêåò: Ñîîáùåíèå +

    + Èìÿ ïàêåòà: MRIM_CS_MESSAGE
    + Òèï ïàêåòà: cs
    + ïîëå seq äîëæíî ñîäåðæàòü íîìåð, êîòîðûé â ïîñëåäñòâèè áóäåò ñîäåðæàòüñÿ â çàãîëîâêå ïàêåòà MRIM_CS_MESSAGE_STATUS, îïîâåùàþùåì êëèåíòà î ñòàòóñå äîñòàâêè äàííîãî ñîîáùåíèÿ.
    + Ïàðàìåòðû:

    +

    UL ## flags ## ôëàãè ##

    +

    MESSAGE_FLAG_OFFLINE ## Ñîîáùåíèå ïðèøëî, ïîêà êëèåíò áûë îòêëþ÷åí
    + MESSAGE_FLAG_NORECV ## Îòïðàâèòåëþ ñîîáùåíèÿ íå òðåáóåòñÿ ïîäòâåðæäåíèÿ äîñòàâêè
    + MESSAGE_FLAG_AUTHORIZE ## Ñîîáùåíèå ÿâëÿåòñÿ çàïðîñîì íà àâòîðèçàöèþ
    + MESSAGE_FLAG_SYSTEM ## Ñîîáùåíèå ÿâëÿåòñÿ ñèñòåìíûì óâåäîìëåíèåì àäìèíèñòðàöèè
    + MESSAGE_FLAG_RTF ##  ñîîáùåíèè ñîäåðæèòñÿ ôîðìàòèðîâàííàÿ ÷àñòü
    + MESSAGE_FLAG_CONTACT ## Ñîîáùåíèå ïðåäñòàâëÿåò èç ñåáÿ ïåðåñëàííûé ñïèñîê êîíòàêòîâ. Òåêñò ñîîáùåíèÿ â ýòîì ñëó÷àå äîëæåí ïðåäñòàâëÿòü èç ñåáÿ ñïèñîê àäðåñîâ è íèêîâ ïåðåñûëàåìûõ êîíòàêòîâ, ïåðå÷èñëåííûõ ÷åðåç òî÷êó ñ çàïÿòîé. <àäðåñ1>;<íèê1>;<àäðåñ2>;<íèê2>;<àäðåñ3>;<íèê3>;...
    + MESSAGE_FLAG_NOTIFY ## Ýòî ñîîáùåíèå-óâåäîìëåíèå "Âàì ïèøóò". Äîëæíî ïîñûëàòüñÿ êàæäûå 10 ñåêóíä, ïðè áîëåå äëèííîé ïàóçå êëèåíò-ïîëó÷àòåëü äîëæåí ñ÷èòàòü, ÷òî îòïðàâèòåëü ïðåêðàòèë íàïèñàíèå. Òåêñò òàêîãî ñîîáùåíèÿ äîëæåí ñîñòîÿòü èç îäíîãî ïðîáåëà.
    + MESSAGE_FLAG_MULTICAST ## Ñîîáùåíèå íàïðàâëåíî ñïèñêó ïîëó÷àòåëåé, à íå îäíîìó. Ïîëå to â òàêîì ñëó÷àå ñîñòîèò èç ñïèñêà ïîëó÷àòåëåé, ïåðå÷èñëåííûõ ÷åðåç çàïÿòóþ. Ìàêñèìàëüíàÿ äëèíà ñïèñêà - 50 àäðåñîâ.

    +

    + LPS ## to ## email ïîëó÷àòåëÿ
    + LPS ## message ## òåêñòîâàÿ âåðñèÿ îòïðàâëÿåìîãî ñîîáùåíèÿ
    + LPS ## rtf-message ## îòôîðìàòèðîâàííàÿ âåðñèÿ îòïðàâëÿåìîãî ñîîáùåíèÿ, â ñëó÷àå íàëè÷èÿ îáîèõ âåðñèé ñîîáùåíèÿ ïðèîðèòåò èìååò rtf-âåðñèÿ. Îíà äîëæíà ñîäåðæàòü rtf-òåêñò óïàêîâàííûé gzip â base64 ïðåäñòàâëåíèè. Òî åñòü: +

    +BASE64(
    +  		GZIP(
    +  			UL êîëè÷åñòâî LPS (äîëæíî áûòü íå ìåíåå 2)
    +  			LPS rtf_text_with_all_rtf_headers_and_tags
    +  			LPS öâåò ôîíà â âèäå UL
    + 			 )
    + 		 ) 
    +					

    +

    Îïèñàíèå: Îñíîâíîé ïàêåò âçàèìîäåéñòâèÿ ìåæäó äâóìÿ êëèåíòàìè. Ìîæåò áûòü îòïðàâëåíî â ëþáîé ìîìåíò ïî èíèöèàòèâå êëèåíòà. Íè òåêñòîâàÿ, íè rtf ÷àñòè ñîîáùåíèé íå ìîãóò áûòü ïóñòûìè, ïðè íåîáõîäèìîñòè ñëåäóåò èñïîëüçîâàòü ñòðîêó èç îäíîãî ïðîáåëà.

    +
  • +
  • Ïàêåò: Äîñòàâêà ñîîáùåíèÿ +

    + Èìÿ ïàêåòà: MRIM_CS_MESSAGE_ACK
    + Òèï ïàêåòà: sc
    + Ïàðàìåòðû:

    +

    UL ## msg_id ## Íîìåð ïàêåòà (Sequence) ýòîãî ñîîáùåíèÿ äëÿ îòïðàâèòåëÿ
    + UL ## flags ## Âîçìîæíûå çíà÷åíèÿ îïèñàíû â MRIM_CS_MESSAGE
    + LPS ## from ## Àäðåñ îòïðàâèòåëÿ
    + LPS ## message ## òåêñòîâàÿ âåðñèÿ ñîîáùåíèÿ
    + LPS ## rtf-message ## ôîðìàòèðîâàííàÿ âåðñèÿ ñîîáùåíèÿ

    +

    + Îïèñàíèå: +

  • +
  • Ïàêåò: Ïîäòâåðæäåíèå ïîëó÷åíèÿ ñîîáùåíèÿ +

    + Èìÿ ïàêåòà: MRIM_CS_MESSAGE_RECV
    + Òèï ïàêåòà: cs
    + Ïàðàìåòðû:

    +

    LPS ## from ##
    + UL ## msg_id ##

    +

    + Îïèñàíèå: Îòïðàâëÿåòñÿ ïîëó÷àòåëåì ñîîáùåíèÿ ñðàçó ïîñëå ïðèõîäà MRIM_CS_MESSAGE_ACK, åñëè ôëàãè MRIM_CS_MESSAGE_ACK íå ñîäåðæàëè MESSAGE_FLAG_NORECV. from è msg_id äîëæíû áûòü ñêîïèðîâàíû èç MRIM_CS_MESSAGE_ACK è èìåþò òî æå çíà÷åíèå. +

  • +
  • Ïàêåò: Ïîäòâåðæäåíèå äîñòàâêè ñîîáùåíèÿ +

    + Èìÿ ïàêåòà: MRIM_CS_MESSAGE_STATUS
    + Òèï ïàêåòà: sc
    + Ïîëå seq ÷èñëåííî ðàâíî ïîëþ seq ïàêåòà MRIM_CS_MESSAGE
    + Ïàðàìåòðû:

    +

    UL ## status ## ñòàòóñ äîñòàâêè ##

    +

    MESSAGE_DELIVERED ## Ñîîáùåíèå óñïåøíî äîñòàâëåíî
    + MESSAGE_REJECTED_INTERR ## Ïðîèçîøëà âíóòðåííÿÿ îøèáêà
    + MESSAGE_REJECTED_NOUSER ## Íå ñóùåñòâóåò ïîëüçîâàòåëÿ-ïîëó÷àòåëÿ ñîîáùåíèÿ
    + MESSAGE_REJECTED_LIMIT_EXCEEDED ## Ïîëüçîâàòåëü-ïîëó÷àòåëü â äàííûé ìîìåíò îòêëþ÷åí îò ñåòè, è ñîîáùåíèå íå ïîìåùàåòñÿ â åãî ïî÷òîâûé ÿùèê
    + MESSAGE_REJECTED_TOO_LARGE ## Ðàçìåð ñîîáùåíèÿ ïðåâûøàåò ìàêñèìàëüíî äîïóñòèìûé
    + MESSAGE_REJECTED_DENY_OFFMSG ## Ïîëüçîâàòåëü-ïîëó÷àòåëü â äàííûé ìîìåíò îòêëþ÷åí îò ñåòè, à íàñòðîéêè åãî ïî÷òîâîãî ÿùèêà íå äîïóñêàþò íàëè÷èå îôôëàéíîâûõ ñîîáùåíèé àãåíòà

    +

    + Îïèñàíèå: Îòïðàâëåííîå ñîîáùåíèå ñ÷èòàåòñÿ äîñòàâëåííûì òîëüêî ïîñëå ïîëó÷åíèÿ ýòîãî îòâåòà ñåðâåðà. Ñåðâåð ÍÅ ÃÀÐÀÍÒÈÐÓÅÒ äîñòàâêó ñîîáùåíèÿ.  ñëó÷àå îòñòóòñòâèÿ MRIM_CS_MESSAGE_STATUS áîëåå èíòåðâàëà ïîäòâåðæäåíèÿ ñîåäèíåíèÿ, ïðîãðàììà êëèåíò äîëæíà ïîñëàòü ñîîáùåíèå ïîâòîðíî èëè ïðîèíôîðìèðîâàòü ïîëüçîâàòåëÿ î íåâîçìîæíîñòè äîñòàâêè èç-çà ïðîáëåì ñâÿçè ïîëó÷àòåëÿ. +

  • +
  • Ïàêåò: Ñìåíà ñòàòóñà äðóãîãî ïîëüçîâàòåëÿ +

    + Èìÿ ïàêåòà: MRIM_CS_USER_STATUS
    + Òèï ïàêåòà: sc
    + Ïàðàìåòðû:

    +

    UL ## status ## íîâûé ñòàòóñ ïîëüçîâàòåëÿ ##

    +

    STATUS_OFFLINE ## Ïîëüçîâàòåëü îòêëþ÷åí îò ñåòè Àãåíòà
    + STATUS_ONLINE ## Ïîëüçîâàòåëü íàõîäèòñÿ â ñåòè
    + STATUS_AWAY ## Ïîëüçîâàòåëü â ñåòè, íî îòîøåë îò êîìïüþòåðà
    + STATUS_UNDETERMINATED ## Íàñòðîéêè ïîëüçîâàòåëÿ çàïðåùàþò ïîêàçûâàòü åãî ñòàòóñ
    + STATUS_FLAG_INVISIBLE ## Ïîëüçîâàòåëü íàõîäèòñÿ â ñåòè, íî íåâèäèì äëÿ âñåõ, êðîìå ïðèâèëåãèðîâàííûõ ïîëüçîâàòåëåé èç åãî ñïèñêà âèäèìîñòè.

    + LPS ## user ## email ñìåíèâøåãî ñâîé ñòàòóñ ïîëüçîâàòåëÿ

    +

    + Îïèñàíèå: Ýòî ñîîáùåíèå îòïðàâëÿåòñÿ ñåðâåðîì ïðè ñìåíå ñòàòóñà ïîëüçîâàòåëÿì âñåì òåì, ó êîãî îí íàõîäèòñÿ â êîíòàêò-ëèñòå (çà èñêëþ÷åíèåì ãðóïïû "Æäó Àâòîðèçàöèè" è òåõ, êîãî îí âêëþ÷èë â ñïèñîê èãíîðèðóåìûõ èëè íåâèäÿùèõ). Äàííîå ñîîáùåíèå ìîæåò áûòü äîñòàâëåíî êëèåíòó ÄÎ ïîëó÷åíèÿ èì êîíòàêò-ëèñòà.  òàêîé ñèòóàöèè îíî äîëæíî èãíîðèðîâàòüñÿ. +

  • +
  • Ïàêåò: Çàêðûòèå ñîåäèíåíèÿ +

    + Èìÿ ïàêåòà: MRIM_CS_LOGOUT
    + Òèï ïàêåòà: sc
    + Ïàðàìåòðû:

    +

    UL ## reason ## ïðè÷èíà îòêëþ÷åíèÿ ##

    +

    LOGOUT_NO_RELOGIN_FLAG ## Ïîëüçîâàòåëü îòêëþ÷åí èç-çà ïàðàëëåëüíîãî âõîäà ñ åãî ëîãèíîì. Êëèåíò íå äîëæåí îñóùåñòâëÿòü àâòîìàòè÷åñêèé ïåðåçàõîä â ýòîì ñëó÷àå.

    +
  • +
  • Ïàêåò: Èçìåíåíèå ïàðàìåòðîâ ñîåäèíåíèÿ +

    + Èìÿ ïàêåòà: MRIM_CS_CONNECTION_PARAM
    + Òèï ïàêåòà: sc
    + Ïàðàìåòðû:

    +

    UL ## ping_period ## íîâàÿ îæèäàåìàÿ ÷àñòîòà ïîäòâåðæäåíèÿ ñîåäèíåíèÿ

    +

    + Îïèñàíèå: Áëèæàéøèé MRIM_CS_PING ñëåäóåò îòïðàâëÿòü óæå èñõîäÿ èç íîâîé ÷àñòîòû. +

  • +
  • Ïàêåò: Äîáàâëåíèå íîâîãî êîíòàêòà +

    + Èìÿ ïàêåòà: MRIM_CS_ADD_CONTACT
    + Òèï ïàêåòà: cs
    + Ïàðàìåòðû:

    +

    UL ## flags ## ôëàãè ##

    +

    CONTACT_FLAG_GROUP ## Äîáàâëÿåòñÿ íîâàÿ ãðóïïà, à íå êîíòàêò (íåñîâìåñòèì ñ îñòàëüíûìè). Âåðõíèé áàéò ñîäåðæèò êîëè÷åñòâî óæå èìåþùèõñÿ ãðóïï â êîíòàêò-ëèñòå
    + CONTACT_FLAG_INVISIBLE ## Êîíòàêò äîëæåí ïîïàñòü â ñïèñîê "ß âñåãäà íåâèäèì äëÿ"
    + CONTACT_FLAG_VISIBLE ## Êîíòàêò äîëæåí ïîïàñòü â ñïèñîê "ß âñåãäà âèäèì äëÿ"
    + CONTACT_FLAG_IGNORE ## Êîíòàêò äîëæåí ïîïàñòü â ñïèñîê èãíîðèðóåìûõ
    + CONTACT_FLAG_SHADOW ## Êîíòàêò íå äîëæåí ïîïàñòü â îñíîâíîé êîíòàêò-ëèñò (ïðèìåíÿåòñÿ â ïàðå ñ îäíèì èç òðåõ ïðåäûäóùèõ)
    + CONTACT_FLAG_REMOVED ## Êîíòàêò óäàëåí

    +

    + UL ## group_id ## ãðóïïà, â êîòîðóþ äîëæåí áûòü äîáàâëåí êîíòàêò (äëÿ CONTACT_FLAG_GROUP ðàâíî 0)
    + LPS ## email ## äîáàâëÿåìûé àäðåñ (èìÿ ãðóïïû äëÿ CONTACT_FLAG_GROUP)
    + LPS ## name ## íèê äîáàâëÿåìîãî ïîëüçîâàòåëÿ (äëÿ îòîáðàæåíèÿ â êîíòàêò-ëèñòå, íå ïîñûëàåòñÿ äëÿ CONTACT_FLAG_GROUP) + LPS ## unused ## íåèñïîëüçóåìûé ïàðàìåòð +

    +
  • +
  • Ïàêåò: Ïîäòâåðæäåíèå äîáàâëåíèÿ êîíòàêòà +

    + Èìÿ ïàêåòà: MRIM_CS_ADD_CONTACT_ACK
    + Òèï ïàêåòà: sc
    + Ïàðàìåòðû:

    +

    UL ## status ## ðåçóëüòàò îïåðàöèè ##

    +

    CONTACT_OPER_SUCCESS ## äîáàâëåíèå ïðîèçâåäåíî óñïåøíî
    + CONTACT_OPER_ERROR ## ïåðåäàííûå äàííûå áûëè íåêîððåêòíû
    + CONTACT_OPER_INTERR ## ïðè îáðàáîòêå çàïðîñà ïðîèçîøëà âíóòðåííÿÿ îøèáêà
    + CONTACT_OPER_NO_SUCH_USER ## äîáàâëÿåìîãî ïîëüçîâàòåëÿ íå ñóùåñòâóåò â ñèñòåìå
    + CONTACT_OPER_INVALID_INFO ## íåêîððåêòíîå èìÿ ïîëüçîâàòåëÿ
    + CONTACT_OPER_USER_EXISTS ## ïîëüçîâàòåëü óæå åñòü â êîíòàêò-ëèñòå
    + CONTACT_OPER_GROUP_LIMIT ## ïðåâûøåíî ìàêñèìàëüíî äîïóñòèìîå êîëè÷åñòâî ãðóïï (20)

    +

    + ## UL ## contact_id ## ïðèñâîåííûé íîâîìó êîíòàêòó íîìåð

    +

    + Îïèñàíèå: Ïðèõîäèò â îòâåò íà MRIM_CS_ADD_CONTACT. -1 åñëè status íå ðàâåí CONTACT_OPER_SUCCESS. +

  • +
  • Ïàêåò: Èçìåíåíèå êîíòàêòà +

    + Èìÿ ïàêåòà: MRIM_CS_MODIFY_CONTACT
    + Òèï ïàêåòà: cs
    + Ïàðàìåòðû:

    +

    UL ## id ## íîìåð ìîäèôèöèðóåìîãî êîíòàêòà
    + UL ## flags ##
    + UL ## group_id ## Ðàâíî 0 äëÿ ãðóïïû
    + LPS ## contact ## Åñëè ãðóïïà, òî èìÿ ãðóïïû
    + LPS ## name ## Åñëè ãðóïïà, òî èìÿ ãðóïïû

    +

    + Îïèñàíèå: Ïàðàìåòðû òå æå, ÷òî è ó MRIM_CS_ADD_CONTACT. contact äî è ïîñëå èçìåíåíèÿ îáÿçàíû ñîâïàäàòü. +

  • +
  • Ïàêåò: Ïîäòâåðæäåíèå èçìåíåíèÿ êîíòàêòà +

    + Èìÿ ïàêåòà: MRIM_CS_MODIFY_CONTACT_ACK
    + Òèï ïàêåòà: sc
    + Ïàðàìåòðû:

    +

    UL ## status ## Ðåçóëüòàò îïåðàöèè. Çíà÷åíèÿ èìåþò òîò æå ñìûñë, ÷òî è â MRIM_CS_ADD_CONTACT_ACK

    +
  • +
  • Ïàêåò: Ñîîáùåíèå äîñòàâëåííîå, ïîêà ïîëüçîâàòåëü íå áûë ïîäêëþ÷åí ê ñåòè +

    + Èìÿ ïàêåòà: MRIM_CS_OFFLINE_MESSAGE_ACK
    + Òèï ïàêåòà: sc
    + Ïàðàìåòðû:

    +

    UIDL ## uidl ## id ñîîáùåíèÿ
    + LPS ## message ## ñîîáùåíèå. Ñîîáùåíèå ïðèõîäèò â ôîðìàòå RFC/822 ïèñüìà. Îòïðàâèòåëü ñîîáùåíèÿ õðàíèòñÿ â çàãîëîâêå From, äàòà â çàãîëîâêå Date, ôëàãè ñîîáùåíèÿ â X-MRIM-FLAGS, òåêñòîâàÿ è ôîðìàòèðîâàííàÿ âåðñèè ñîîáùåíèÿ ñîñòàâëÿþò òåêñò ïèñüìà è ðàçäåëÿþòñÿ ìåæäó ñîáîé ðàçäåëèòåëåì èç çàãîëîâêà Boundary.

    +

    + Îïèñàíèå: Êàæäîå ïîëó÷åííîå çà âðåìÿ îòñóòñòâèÿ ñîîáùåíèå ïðèõîäèò îòäåëüíûì ïàêåòîì â òîì ïîðÿäêå, â êàêîì îíè ïîñòóïàëè íà ñåðâåð. +

  • +
  • Ïàêåò: Óäàëåíèå ñîõðàíåííîãî ñîîáùåíèÿ +

    + Èìÿ ïàêåòà: MRIM_CS_OFFLINE_MESSAGE_DEL
    + Òèï ïàêåòà: cs
    + Ïàðàìåòðû:

    +

    UIDL ## uidl

    +

    + Îïèñàíèå: Íà êàæäûé ïîëó÷åííûé MRIM_CS_OFFLINE_MESSAGE_ACK êëèåíò îáÿçàí îòïðàâèòü MRIM_CS_OFFLINE_MESSAGE_DEL ñ òåì æå uidl, ïîäòâåðæäàþùèé ïîëó÷åíèå äàííîãî ñîîáùåíèÿ. Ñîîáùåíèå ñòèðàåòñÿ íà ñåðâåðå òîëüêî ïðè ïîëó÷åíèè ýòîé êîìàíäû.

  • +
  • Ïàêåò: Àâòîðèçàöèÿ ïîëüçîâàòåëÿ íà äîáàâëåíèå â êîíòàêò-ëèñò +

    + Èìÿ ïàêåòà: MRIM_CS_AUTHORIZE
    + Òèï ïàêåòà: cs
    + Ïàðàìåòðû:

    +

    LPS ## user ## email ïîëüçîâàòåëÿ

    +

    + Îïèñàíèå: Îòïðàâëÿåòñÿ, ÷òîáû ðàçðåøèòü user äîáàâëåíèå ïîëüçîâàòåëÿ â êîíòàêò-ëèñò è íàáëþäåíèå çà åãî ñòàòóñîì. +

  • +
  • Ïàêåò: Èíôîðìàöèÿ îá àâòîðèçàöèè +

    + Èìÿ ïàêåòà: MRIM_CS_AUTHORIZE_ACK
    + Òèï ïàêåòà: sc
    + Ïàðàìåòðû:

    +

    LPS ## user ## email àâòîðèçîâàâøåãî ïîëüçîâàòåëÿ

    +

    + Îïèñàíèå: Îòñûëàåòñÿ ñåðâåðîì ïîñëå ïîëó÷åíèåì èì MRIM_CS_AUTHORIZE îò user òîìó, êîãî user àâòîðèçîâàë. +

  • +
  • Ïàêåò: Èçìåíåíèå ñòàòóñà +

    + Èìÿ ïàêåòà: MRIM_CS_CHANGE_STATUS
    + Òèï ïàêåòà: cs
    + Ïàðàìåòðû:

    +

    UL ## status ## âîçìîæíûå çíà÷åíèÿ ñîâïàäàþò ñ MRIM_CS_USER_STATUS, íî íå ìîãóò ïîñûëàòüñÿ ñòàòóñû STATUS_UNDETERMINATED è STATUS_OFFLINE

    +
  • +
  • Ïàêåò: Òðåáîâàíèå êëþ÷à äëÿ web-àâòîðèçàöèè +

    + Èìÿ ïàêåòà: MRIM_CS_GET_MPOP_SESSION
    + Òèï ïàêåòà: cs
    + Îïèñàíèå: Ïîëüçîâàòåëü àãåíòà ìîæåò çàõîäèòü â ïî÷òîâûé ÿùèê Mail.Ru áåç äîïîëíèòåëüíîé àâòîðèçàöèè è íå ïåðåäàâàÿ ñâîé ïàðîëü â GET-çàïðîñå, äëÿ ýòîãî èñïîëüçóåòñÿ ìåõàíèçì êëþ÷åé. +

  • +
  • Ïàêåò: Êëþ÷ äëÿ web-àâòîðèçàöèè +

    + Èìÿ ïàêåòà: MRIM_CS_GET_MPOP_SESSION_ACK
    + Òèï ïàêåòà: sc
    + Ïàðàìåòðû:

    +

    UL ## status ## óñïåøíîñòü îïåðàöèè (1 - êëþ÷ ïîëó÷åí, 0 - ïðîèçîøëà îøèáêà)
    + LPS ## session ## ñàì êëþ÷

    +

    + Îïèñàíèå: Äëÿ âõîäà â ÿùèê ìîæíî èñïîëüçîâàòü URL win.mail.ru/cgi-bin/auth?Login=email&agent=êëþ÷. +

  • +
  • Ïàêåò: Ïîèñê êîíòàêòà +

    + Èìÿ ïàêåòà: MRIM_CS_WP_REQUEST
    + Òèï ïàêåòà: cs
    + Ïàðàìåòðû:

    +

    UL ## field ## ïàðàìåòð ïîèñêà ##

    +

    MRIM_CS_WP_REQUEST_PARAM_USER ## ëîãèí (áåç äîìåíà), îáÿçàí êîìáèíèðîâàòüñÿ ñ äîìåíîì
    + MRIM_CS_WP_REQUEST_PARAM_DOMAIN ## ïî÷òîâûé äîìåí
    + MRIM_CS_WP_REQUEST_PARAM_NICKNAME ## íèê
    + MRIM_CS_WP_REQUEST_PARAM_FIRSTNAME ## èìÿ
    + MRIM_CS_WP_REQUEST_PARAM_LASTNAME ## ôàìèëèÿ, * â êîíöå íèêà/èìåíè/ôàìèëèè óêàçûâàåò íà âîçìîæíîñòü ëþáîãî ïðîäîëæåíèÿ èìåíè
    + MRIM_CS_WP_REQUEST_PARAM_SEX ## ïîë. 1 - ìóæñêîé, 2 - æåíñêèé
    + MRIM_CS_WP_REQUEST_PARAM_DATE1 ## ìèíèìàëüíûé âîçðàñò (â ãîäàõ)
    + MRIM_CS_WP_REQUEST_PARAM_DATE2 ## ìàêñèìàëüíûé âîçðàñò (â ãîäàõ)
    + MRIM_CS_WP_REQUEST_PARAM_CITY_ID ## ID ðåãèîíà ïðîæèâàíèÿ
    + MRIM_CS_WP_REQUEST_PARAM_ZODIAC ## Çíàê çîäèàêà (Îâåí - 1, ..., Ðûáû - 12)
    + MRIM_CS_WP_REQUEST_PARAM_BIRTHDAY_MONTH ## Ìåñÿö ðîæäåíèÿ (ßíâàðü - 1, ..., Äåêàáðü - 12)
    + MRIM_CS_WP_REQUEST_PARAM_BIRTHDAY_DAY ## Äåíü ðîæäåíèÿ (îáÿçàí êîìáèíèðîâàòüñÿ ñ ìåñÿöåì ðîæäåíèÿ)
    + MRIM_CS_WP_REQUEST_PARAM_COUNTRY_ID ## ID ñòðàíû ïðîæèâàíèÿ
    + MRIM_CS_WP_REQUEST_PARAM_ONLINE ## èùåì ëè ìû òîëüêî ïîäêëþ÷åííûõ â äàííûé ìîìåíò ïîëüçîâàòåëåé (1)

    +

    + LPS ## value âñå ïàðàìåòðû â ñòðîêîâîì ôîðìàòå, âêëþ÷àÿ ÷èñëà

    +

    + Îïèñàíèå: Ïîèñê êîíòàêòîâ â áàçå àãåíòà. Ïàðàìåòðû ïîèñêà ïåðåäàþòñÿ ïàðàìè ïàðàìåòð-çíà÷åíèå. Ïåðåäà÷à íåñêîëüêèõ ïàðàìåòðîâ èìååò ñåìàíòèêó "è", ò. å. âñå íàéäåííûå ðåçóëüòàòû äîëæíû ñîîòâåòñòâîâàòü âñåì ïåðåäàííûì ïàðàìåòðàì. Êîìáèíèðîâàòüñÿ ìîãóò âñå ïàðàìåòðû çà èñêëþ÷åíèåì ëîãèíà è äîìåíà (îíè îáÿçàíû èäòè ïàðîé è íå ìîãóò êîìáèíèðîâàòüñÿ ñ äðóãèìè ïàðàìåòðàìè) â ïîðÿäêå ñîîòâåòñòâóþùåì ïîðÿäêó îïèñàíèÿ (çà èñêëþ÷åíèåì òðåáîâàíèÿ äëÿ MRIM_CS_WP_REQUEST_PARAM_ONLINE áûòü ïîñëåäíèì â ñïèñêå). +

  • +
  • Ïàêåò: Íàéäåííûå ïîëüçîâàòåëè +

    + Èìÿ ïàêåòà: MRIM_CS_ANKETA_INFO
    + Òèï ïàêåòà: cs
    + Ïàðàìåòðû:

    +

    UL ## status ## óñïåøíîñòü çàïðîñà ##

    +

    MRIM_ANKETA_INFO_STATUS_OK ## ïîèñê óñïåøíî çàâåðøåí
    + MRIM_ANKETA_INFO_STATUS_NOUSER ## íå íàéäåíî íè îäíîé ïîäõîäÿùåé çàïèñè
    + MRIM_ANKETA_INFO_STATUS_RATELIMERR ## ñëèøêîì ìíîãî çàïðîñîâ, ïîèñê âðåìåííî çàïðåùåí

    +

    + UL ## fields_num ## êîëè÷åñòâî ïîëåé â àíêåòå êàæäîãî ïîëüçîâàòåëÿ
    + UL ## max_rows ## òåêóùåå îãðàíè÷åíèå íà êîëè÷åñòâî ðåçóëüòàòîâ ïîèñêà (ìîæåò áûòü áîëüøå, ÷åì êîëè÷åñòâî ñòðîê â äàííîì îòâåòå)
    + UL ## server_time ## òåêóùåå âðåìÿ íà ñåðâåðå (äîëæíî èñïîëüçîâàòüñÿ äëÿ âû÷èñëåíèÿ âîçðàñòà). Ôîðìàò âðåìåíè: Êîëè÷åñòâî ñåêóíä ñ 00:00:00 1 ÿíâàðÿ 1970 ãîäà.
    + LPS, LPS, ... ## fields ## íàçâàíèÿ ïîëåé òåêóùåé àíêåòû (âñåãî fields_num øòóê)
    + LPS, LPS, ... ## values ## çíà÷åíèÿ ïîëåé àíêåòû äëÿ êàæäîãî íàéäåííîãî ïî çàïðîñó ïîëüçîâàòåëÿ â òîì æå ïîðÿäêå, ÷òî â ñïèñêå ïîëåé, ïî fields_num øòóê íà êàæäîãî

    +

    + Îïèñàíèå: Ðåçóëüòàò ïîèñêà êîíòàêòîâ. Âîçâðàùàåò àíêåòû íàéäåííûõ ïîëüçîâàòåëåé (èõ àäðåñà ÿâëÿþòñÿ ïîëÿìè àíêåòû). +

  • +
  • Ïàêåò: Êîëè÷åñòâî ïèñåì â ïî÷òîâîì ÿùèêå +

    + Èìÿ ïàêåòà: MRIM_CS_MAILBOX_STATUS
    + Òèï ïàêåòà: sc
    + Ïàðàìåòðû:

    +

    UL ## status ## êîëè÷åñòâî íåïðî÷èòàííûõ ïèñåì

    +

    + Îïèñàíèå: Ïðèõîäèò ïðè ïîëó÷åíèè íîâîé ïî÷òû èëè ëþáîì äðóãîì èçìåíåíèè ÷èñëà íåïðî÷èòàííûõ ïèñåì â ÿùèêå. +

  • +
  • Ïàêåò: Êîíòàêò-ëèñò +

    + Èìÿ ïàêåòà: MRIM_CS_CONTACT_LIST2
    + Òèï ïàêåòà: sc
    + Ïàðàìåòðû:

    +

    UL ## status ## ðåçóëüòàò çàïðîñà êîíòàêò-ëèñòà

    +

    GET_CONTACTS_OK ## ïîèñê âûïîëíåí óñïåøíî
    + GET_CONTACTS_ERROR ## íàéäåííûé êîíòàêò-ëèñò íåêîððåêòåí
    + GET_CONTACTS_INTERR ## ïðîèçîøëà âíóòðåííÿÿ îøèáêà

    +

    + UL ## groups_number ## êîëè÷åñòâî ãðóïï â êîíòàêò-ëèñòå
    + LPS ## group_mask ## ìàñêà-îïèñàíèå ãðóïïû, ñîñòîèò èç ñèìâîëîâ 's' (LPS),'u' (UL),'z' (ñòðîêà îêàí÷èâàþùàÿñÿ áèíàðíûì íóëåì, â äàííûé ìîìåíò íå èñïîëüçóåòñÿ), ñåé÷àñ "us" - ôëàãè è íàçâàíèå, ïðè ðàñøèðåíèè îïèñàíèÿ ñòàðûå ïîëÿ ñîõðàíÿò ñâîå ðàñïîëîæåíèå
    + LPS ## contacts_mask ## ìàñêà-îïèñàíèå ïîëüçîâàòåëÿ (ñèíòàêñèñ òàêîé æå êàê è ó group_mask), ñåé÷àñ uussuu (ôëàãè, ãðóïïà, àäðåñ, íèê, ñåðâåðíûå ôëàãè, òåêóùèé ñòàòóñ â ñåòè)
    + ## groups ## ãðóïïû (âñåãî groups_number øòóê)
    + ## contacts ## êîíòàêòû

    +

    + Îïèñàíèå: Êîíòàêò-ëèñò ïîëüçîâàòåëÿ õðàíèòñÿ íà ñåðâåðå. Êëèåíò ìîæåò õðàíèòü ëîêàëüíóþ êîïèþ êîíòàêò-ëèñòà, íî ñåðâåðíàÿ äîëæíà èìåòü ïðèîðèòåò. Ôëàãè êîíòàêòà èìåþò òîò æå ñìûñë, ÷òî â MRIM_CS_ADD_CONTACT, ñòàòóñ - òîò æå ñìûñë, ÷òî â MRIM_CS_USER_STATUS. Ñåðâåðíûé ôëàã â äàííûé ìîìåíò îïðåäåë¸í îäèí - CONTACT_INTFLAG_NOT_AUTHORIZED îçíà÷àåò, ÷òî êîíòàêò åùå íå àâòîðèçîâàë ïîëüçîâàòåëÿ è íàõîäèòñÿ â ãðóïïå "Æäó àâòîðèçàöèè". Åñëè ìàñêà êîíòàêòà èëè ãðóïïû ñîäåðæèò áîëüøå ñèìâîëîâ, ÷åì íåîáõîäèìî, êëèåíò äîëæåí ïðî÷èòàòü çíà÷åíèÿ ýòèõ ïîëåé è ïðîèãíîðèðîâàòü èõ. +

  • +
  • Ïàêåò: Èíôîðìàöèÿ î ïîëüçîâàòåëå +

    + Èìÿ ïàêåòà: MRIM_CS_USER_INFO
    + Òèï ïàêåòà: sc
    + Ïàðàìåòðû:

    +

    LPS, LPS, ... ##name1, value1, name2, value2, ... ## äîïîëíèòåëüíàÿ èíôîðìàöèÿ î ïîëüçîâàòåëå, èìÿ ïàðàìåòðà, çíà÷åíèå ïàðàìåòðà, èìÿ ïàðàìåòðà, çíà÷åíèå ïàðàìåòðà, ... Íà äàííûé ìîìåíò îïðåäåëåíû MESSAGES.TOTAL - êîëè÷åñòâî ïèñåì â ÿùèêå, MESSAGES.UNREAD - êîëè÷åñòâî íåïðî÷èòàííûõ ïèñåì â ÿùèêå, MRIM.NICKNAME - íèê ïîëüçîâàòåëÿ +

  • +
  • Ïàêåò: Àâòîðèçàöèÿ +

    + Èìÿ ïàêåòà: MRIM_CS_LOGIN2
    + Òèï ïàêåòà: cs
    + Ïàðàìåòðû:

    +

    LPS ## login ## email àâòîðèçóþùåãîñÿ ïîëüçîâàòåëÿ
    + LPS ## password ## ïàðîëü
    + UL ## status ## ñòàòóñ (ñì. MRIM_CS_CHANGE_STATUS)
    + LPS ## user_agent ## òåêñòîâîå îïèñàíèå êëèåíòà ïîëüçîâàòåëÿ, íàïðèìåð "Mail.Ru Miranda Plugin v 1.0"

    +
  • +
+ +
+
+ + + + + +
+ +
+
+
+ + diff --git a/gclib2/unit_tests/1.html b/gclib2/unit_tests/1.html new file mode 100644 index 0000000..290264b --- /dev/null +++ b/gclib2/unit_tests/1.html @@ -0,0 +1,8 @@ +ßíäåêñ

Íîâîñòè 22:04

  1. 1. Âåñíèíà è Êóçíåöîâà ñûãðàþò â ïàðíîé âñòðå÷å â Êóáêå Ôåäåðàöèè
  2. 2. «Ñïàðòàê» è «Ìîñêâà» ñûãðàëè âíè÷üþ íîâîñòü ÷àñà
  3. 3. Â Êàáóëå áîåâèêè äâèæåíèÿ «Òàëèáàí» â óïîð ðàññòðåëÿëè âîåííûé ïàðàä
  4. 4. Äëÿ õðèñòèàí íàñòóïèë ñàìûé ãëàâíûé öåðêîâíûé ïðàçäíèê â ãîäó — Ïàñõà
  5. 5. «×åëñè» ïîáåäèë «Ìàí÷åñòåð Þíàéòåä» — 2:1
  1. 1.  Îìñêå áóäåò óñòàíîâëåí ïàìÿòíèê àäìèðàëó Êîë÷àêó
  2. 2. Æèòåëü Îìñêà, èçîáðàæàÿ ãåðîÿ ôèëüìà, íàñìåðòü çàêîëîë ÷åëîâåêà øàìïóðîì
  3. 3. Áîëåå 450 æèëûõ äîìîâ â Îìñêîé îáëàñòè ïîëó÷àò êàïðåìîíò äî êîíöà ãîäà
  4. 4. Ôåñòèâàëü ìîëîäåæíûõ ýñòðàäíûõ òåàòðîâ è êîìàíä ÊÂÍ ïðîõîäèò â Îìñêå
  5. 5. Àâàðèéíàÿ ñòðîéêà â èñòîðè÷åñêîì öåíòðå Îìñêà ïðèîñòàíîâëåíà ñóäîì

Àíòèâèðóñ Êàñïåðñêîãî

äëÿ ïîëüçîâàòåëåé ß.Îíëàéíà

ßndex

 
ÂåçäåÍîâîñòèÌàðêåòÊàðòûÑëîâàðèÁëîãèÊàðòèíêèÂñå ñëóæáû…

Ïî÷òà

Çàâåñòè ïî÷òîâûé ÿùèê

\ No newline at end of file diff --git a/gclib2/unit_tests/CMakeLists.txt b/gclib2/unit_tests/CMakeLists.txt new file mode 100644 index 0000000..8ced1ff --- /dev/null +++ b/gclib2/unit_tests/CMakeLists.txt @@ -0,0 +1,19 @@ +include_directories ("/usr/include/gclib2") +link_libraries ("gclib2") + +add_executable ( http http.cxx ) +add_executable ( url url.cxx ) +add_executable ( ipc ipc.cxx ) +add_executable ( clone clone.cxx ) +add_executable ( strreplace strreplace.cxx ) +add_executable ( pack pack.cxx ) +add_executable ( dns dns.cxx ) +add_executable ( dns2 dns2.cxx ) +add_executable ( base64 base64.cxx ) +add_executable ( buf buf.cxx ) +add_executable ( split_join split_join.cxx ) +add_executable ( connection connection.cxx ) +add_executable ( connection2 connection2.cxx ) +add_executable ( mmp mmp.cxx ) +add_executable ( ftp ftp.cxx ) + diff --git a/gclib2/unit_tests/base64.cxx b/gclib2/unit_tests/base64.cxx new file mode 100644 index 0000000..c04baf4 --- /dev/null +++ b/gclib2/unit_tests/base64.cxx @@ -0,0 +1,19 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include + +int main (int argc, char ** argv) +{ + char * ptr; + int size; + + ptr = DFILE ("./base64.cxx", &size); + printf ("%s\n", base64_code ((uchar_t *) ptr, size)); + + return EXIT_SUCCESS; +} + diff --git a/gclib2/unit_tests/buf.cxx b/gclib2/unit_tests/buf.cxx new file mode 100644 index 0000000..5d08b76 --- /dev/null +++ b/gclib2/unit_tests/buf.cxx @@ -0,0 +1,34 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include + +int main (int argc, char ** argv) +{ + Buf * m_buf; + Buf * b; + List * list; + char * ptr; + int len; + + if (argc != 2) { + printf ("use: buf \n"); + return EXIT_SUCCESS; + } + + ptr = DFILE (argv[1], &len); + m_buf = new Buf (ptr, len); + + list = bsplit (m_buf, 1024); + b = bjoin (list, NULL); + if (*m_buf != b) { + printf ("Тест провален !\n"); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} + diff --git a/gclib2/unit_tests/clone.cxx b/gclib2/unit_tests/clone.cxx new file mode 100644 index 0000000..b682c66 --- /dev/null +++ b/gclib2/unit_tests/clone.cxx @@ -0,0 +1,29 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include + +int i = 0; + +int thread (void * param) +{ + while (true) { + printf ("%i\n", i); + fflush (stdout); + } +} + +int main (int argc, char ** argv) +{ + Dclone (thread, NULL); + while (true) { + ++i; + sleep (1); + } + + return EXIT_SUCCESS; +} + diff --git a/gclib2/unit_tests/connection.cxx b/gclib2/unit_tests/connection.cxx new file mode 100644 index 0000000..6399b75 --- /dev/null +++ b/gclib2/unit_tests/connection.cxx @@ -0,0 +1,61 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include + +int thread_in (void * param) +{ + DConnection * c; + Buf * b; + c = (DConnection *) param; + + while (true) { + c->select (30, 0); + b = c->recv (); + if (b) { + write (1, b->data (), b->len ()); + delete b; + } + } + + return 0; +} + +int main (int argc, char ** argv) +{ + Connection * c; + char * server; + char m_buf[4096]; + + if (argc != 3) { + printf ("usage: connection \n"); + return EXIT_SUCCESS; + } + + c = new Connection; + c->init (); + + server = argv[1]; + if (! isIP (server)) + server = dns_A (server); + if (c->connect (server, atoi (argv[2])) < 0) { + perror ("connect"); + return EXIT_FAILURE; + } + + Dclone (thread_in, (void *) c); + + while (fgets( m_buf, 256, stdin)) { + chomp (m_buf); + strcat (m_buf, "\n"); + c->send (m_buf, strlen (m_buf)); + } + + return EXIT_SUCCESS; +} + diff --git a/gclib2/unit_tests/connection2.cxx b/gclib2/unit_tests/connection2.cxx new file mode 100644 index 0000000..5d1b92f --- /dev/null +++ b/gclib2/unit_tests/connection2.cxx @@ -0,0 +1,74 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include + +int main (int argc, char ** argv) +{ + Connection * c; + Connection * m_remote; + Connection * m_stdin; + + Buf * b; + Poll * m_pull; + char m_buf[4096]; + int count; + + + if (argc != 3) { + printf ("usage: connection \n"); + return EXIT_SUCCESS; + } + + c = new Connection; + c->init (); + c->setName ("remote"); + m_remote = c; + + m_stdin = new Connection; + m_stdin->setSocket (fileno (stdin)); + m_stdin->setName ("local"); + + if (c->connect (argv[1], atoi (argv[2])) < 0) { + perror ("connect"); + return EXIT_FAILURE; + } + + m_pull = new Poll; + m_pull->add (c); + m_pull->add (m_stdin); + + while (true) { + count = m_pull->poll (1000); + if (count < 0) { + perror ("poll"); + break; + } + if (count == 0) + continue; + + while ((c = m_pull->scan ()) && c) { + if (c->ioNRead () == 0) + return EXIT_SUCCESS; + + memset (m_buf, 0, 4096); + if (EQ (c->name (), "remote")) { + b = c->recv (); + if (b) + write (1, b->data (), b->len ()); + } else if (EQ (c->name (), "local")) { + c->read (m_buf, c->ioNRead ()); + chomp (m_buf); + strcat (m_buf, "\n"); + m_remote->send (m_buf, strlen (m_buf)); + } + } + + } + + return EXIT_SUCCESS; +} + diff --git a/gclib2/unit_tests/dns.cxx b/gclib2/unit_tests/dns.cxx new file mode 100644 index 0000000..d488b9b --- /dev/null +++ b/gclib2/unit_tests/dns.cxx @@ -0,0 +1,36 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include +#include + +int main (int argc, char ** argv) +{ + char * str; + + dns_init (); + dns_async_A ("mail.ru"); + dns_async_A ("yandex.ru"); + dns_async_A ("google.ru"); + + sleep (3); + while (dns_loop ()); + + str = dns_async_A ("mail.ru"); + printf ("%s\n", str); + delete str; + + str = dns_async_A ("yandex.ru"); + printf ("%s\n", str); + delete str; + + str = dns_async_A ("google.ru"); + printf ("%s\n", str); + delete str; + + return EXIT_SUCCESS; +} + diff --git a/gclib2/unit_tests/dns2.cxx b/gclib2/unit_tests/dns2.cxx new file mode 100644 index 0000000..7ef747b --- /dev/null +++ b/gclib2/unit_tests/dns2.cxx @@ -0,0 +1,31 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include +#include + +int main (int argc, char ** argv) +{ + DNS * m_dns; + + m_dns = new DNS; + m_dns->async_A ("mail.ru"); + m_dns->async_A ("yandex.ru"); + m_dns->async_A ("google.ru"); + + sleep (3); + while (m_dns->loop ()); + + + printf ("%s\n", m_dns->async_A ("mail.ru")); + printf ("%s\n", m_dns->async_A ("yandex.ru")); + printf ("%s\n", m_dns->async_A ("google.ru")); + + delete m_dns; + + return EXIT_SUCCESS; +} + diff --git a/gclib2/unit_tests/ftp.cxx b/gclib2/unit_tests/ftp.cxx new file mode 100644 index 0000000..0a16c89 --- /dev/null +++ b/gclib2/unit_tests/ftp.cxx @@ -0,0 +1,22 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ +#include +#include + +int main (int argc, char ** argv) +{ + FTP * f; + + f = new FTP; + if (f->connect ("ontk93.thehost.ru", 21) < 0) { + perror ("connect"); + return EXIT_FAILURE; + } + + delete f; + return EXIT_SUCCESS; +} + diff --git a/gclib2/unit_tests/http.cxx b/gclib2/unit_tests/http.cxx new file mode 100644 index 0000000..e312564 --- /dev/null +++ b/gclib2/unit_tests/http.cxx @@ -0,0 +1,18 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include +#include + +int main (int argc, char ** argv) +{ + int size; + char * m_data; + + m_data = http_get (argv[1], &size); + fwrite (m_data, 1, size, stdout); +} + diff --git a/gclib2/unit_tests/ipc.cxx b/gclib2/unit_tests/ipc.cxx new file mode 100644 index 0000000..b2ce070 --- /dev/null +++ b/gclib2/unit_tests/ipc.cxx @@ -0,0 +1,37 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include + +int m_sem; + +int main (int argc, char ** argv) +{ + m_sem = sem_init (NULL); + + if (m_sem <= 0) { + perror ("sem_init"); + return EXIT_FAILURE; + } + + if (fork () == 0) { + while (true) { + down (m_sem); + printf ("1\n"); fflush (stdout); + up (m_sem); + } + } else { + while (true) { + down (m_sem); + printf ("2\n", fflush (stdout)); + up (m_sem); + } + } + + + return EXIT_SUCCESS; +} + diff --git a/gclib2/unit_tests/mmp.cxx b/gclib2/unit_tests/mmp.cxx new file mode 100644 index 0000000..d08cc91 --- /dev/null +++ b/gclib2/unit_tests/mmp.cxx @@ -0,0 +1,30 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include +#include + +#define LOGIN "login" +#define PASS "pass" +#define MAILTO "mailto" + +int main (int argc, char ** argv) +{ + MMP * m_mmp; + + m_mmp = new MMP; + m_mmp->init (); + + if (m_mmp->login (LOGIN, PASS) < 0) { + printf ("FAIL\n"); + return -1; + } + + m_mmp->sendMessage (MAILTO, "OCHUMELIE RUCHKI !\n"); + + delete m_mmp; +} + diff --git a/gclib2/unit_tests/pack.cxx b/gclib2/unit_tests/pack.cxx new file mode 100644 index 0000000..a01318c --- /dev/null +++ b/gclib2/unit_tests/pack.cxx @@ -0,0 +1,58 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include + +List * __init_list () +{ + List * l; + + l = new List; + *l << "GOP" << "SUP" << "VOBLA" << "KUKISH"; + return l; +} + +Hash * __init_hash () +{ + Hash * h; + + h = new Hash; + h->set ("Date", "yesterday"); + h->set ("From", "Oleg"); + h->set ("To", "Papka"); + h->set ("Nyu", "Fu"); + + return h; +} + +int main (int argc, char ** argv) +{ + Buf * m_buf; + List * m_list; + Hash * m_hash; + char * str; + + int i = 0; + + m_list = __init_list (); + m_hash = __init_hash (); + + str = "HELLO"; + m_buf = pack ("clhs", 2, m_list, m_hash, str); + + m_list = NULL; + m_hash = NULL; + str = NULL; + + unpack (m_buf, "clhs", &i, &m_list, &m_hash, &str); + printf ("i = %i\n", i); + printf ("string = %s\n", str); + printf ("LIST:\n"); + m_list->dump (); + printf ("Hash:\n"); + m_hash->dump (); +} + diff --git a/gclib2/unit_tests/split_join.cxx b/gclib2/unit_tests/split_join.cxx new file mode 100644 index 0000000..5c4b5ba --- /dev/null +++ b/gclib2/unit_tests/split_join.cxx @@ -0,0 +1,58 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include + +char * double_zero = "CHUKA\0"; + +void __buf_add_str (List * m_list, char * string) +{ + Buf * b; + if (string) + b = new Buf (strdup (string), strlen (string)); + else + b = new Buf; + m_list->add (LPCHAR (b)); +} + +int main (int argc, char ** argv) +{ + List * m_list; + List * m_list2; + Buf * bdz; + Buf * b; + + m_list = new List; + + __buf_add_str (m_list, "11111"); + __buf_add_str (m_list, "11111"); + __buf_add_str (m_list, NULL); + __buf_add_str (m_list, "HULI"); + __buf_add_str (m_list, "GOP"); + __buf_add_str (m_list, NULL); + __buf_add_str (m_list, NULL); + __buf_add_str (m_list, NULL); + + bdz = new Buf (strdup (double_zero), 6); + b = bjoin (m_list, bdz); + m_list2 = csplit (b, bdz); + + delete b; + delete bdz; + + if ((*m_list) != (*m_list2)) { + printf ("Тест провален.\n"); + return EXIT_FAILURE; + } + + m_list->foreach (buf_free); + m_list2->foreach (buf_free); + delete m_list; + delete m_list2; + + return EXIT_SUCCESS; +} + diff --git a/gclib2/unit_tests/strreplace.cxx b/gclib2/unit_tests/strreplace.cxx new file mode 100644 index 0000000..d5bb6aa --- /dev/null +++ b/gclib2/unit_tests/strreplace.cxx @@ -0,0 +1,25 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include + +char * datastr = "GOP STOP STOP STOP URA"; + +int main (int argc, char ** argv) +{ + char * m_buf; + char * S; + + m_buf = CNEW (char, 128); + strcpy (m_buf, datastr); + S = strreplace (m_buf, "STOP", "SUP"); + printf ("%s\n", S); + fflush (stdout); + DROP (S); + + return EXIT_SUCCESS; +} + diff --git a/gclib2/unit_tests/url.cxx b/gclib2/unit_tests/url.cxx new file mode 100644 index 0000000..0d171df --- /dev/null +++ b/gclib2/unit_tests/url.cxx @@ -0,0 +1,19 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include +#include + +int main (int argc, char ** argv) +{ + int size; + char * m_data; + + printf ("protocol: %s; host: %s; file: %s\n", url_protocol (argv[1]), + url_host (argv[1]), + url_file (argv[1])); +} + diff --git a/silentbob/AAP/main.aap b/silentbob/AAP/main.aap new file mode 100644 index 0000000..8271c5c --- /dev/null +++ b/silentbob/AAP/main.aap @@ -0,0 +1,100 @@ +CC=gcc +CXX=g++ +CFLAGS=-O3 -Wall -pipe +CXXFLAGS=$CFLAGS +OPTS= +INCLUDE=-I..//include -I..//gclib/include +LIBS=-L./ +OPTIMIZE=0 +LDFLAGS= +:dll gclib : ..//gclib/src/darray.cxx + ..//gclib/src/deprecated_dsplit.cxx ..//gclib/src/dhash.cxx + ..//gclib/src/dheapsort.cxx ..//gclib/src/djobs.cxx + ..//gclib/src/dlist.cxx ..//gclib/src/dsplit.cxx + ..//gclib/src/earray.cxx ..//gclib/src/ehash.cxx + ..//gclib/src/elist.cxx ..//gclib/src/fs.cxx + ..//gclib/src/gclib.cxx ..//gclib/src/gclib_c.c + + +CC=gcc +CXX=g++ +CFLAGS=-O3 -Wall -pipe +CXXFLAGS=$CFLAGS +OPTS= +INCLUDE=-I..//include -I..//gclib/include +LIBS=-L./ -lsblib -lgclib -ldl +OPTIMIZE=0 +LDFLAGS= +:dll sblib : ..//sblib/py_tt.cxx + ..//sblib/Sblib.cxx ..//sblib/the_fly.cxx + ..//sblib/the_tt.cxx ..//sblib/t_op2.cxx + ..//sblib/t_op.cxx ..//sblib/TT.cxx + ..//sblib/wit.cxx + + + +CC=gcc +CXX=g++ +CFLAGS=-O3 -Wall -pipe +CXXFLAGS=$CFLAGS +OPTS= +INCLUDE=-I..//include -I..//gclib/include +LIBS=-L./ -lsblib -lgclib -ldl +OPTIMIZE=0 +LDFLAGS= +:program silent_bob : ..//src/callTags.cxx + ..//src/cFiles.cxx ..//src/cgrep.cxx + ..//src/ctags.cxx ..//src/file.cxx + ..//src/indent.cxx ..//src/init.cxx + ..//src/interactive.cxx ..//src/kinds.cxx + ..//src/main.cxx ..//src/modding.cxx + ..//src/opts_funcs.cxx ..//src/opts_kinds.cxx + ..//src/opts_list.cxx ..//src/opts_settings.cxx + ..//src/structs.cxx ..//src/tree.cxx + ..//src/usage.cxx + +CC=gcc +CXX=g++ +CFLAGS=-O3 -Wall -pipe +CXXFLAGS=$CFLAGS +OPTS= +INCLUDE=-I..//include -I..//gclib/include +LIBS=-L./ -lsblib -lgclib -ldl +OPTIMIZE=0 +LDFLAGS= +:dll plugin_perl : ..//plugins/plugin_perl.cxx + + +:dll plugin_perlpackages : ..//plugins/plugin_perlpackages.cxx + + +:dll plugin_cache : ..//plugins/plugin_cache.cxx + + +:dll plugin_editor : ..//plugins/plugin_editor.cxx + + +:dll plugin_grep : ..//plugins/plugin_grep.cxx + + +:dll plugin_compile : ..//plugins/plugin_compile.cxx + + +:dll plugin_aap : ..//plugins/plugin_aap.cxx + + +:dll plugin_python : ..//plugins/plugin_python.cxx + + +:dll plugin_scons : ..//plugins/plugin_scons.cxx + + +:dll plugin_foreach : ..//plugins/plugin_foreach.cxx + + +:dll plugin_make : ..//plugins/plugin_make.cxx + + +:dll plugin_xml_project : ..//plugins/plugin_xml_project.cxx + + diff --git a/silentbob/AUTHORS b/silentbob/AUTHORS new file mode 100644 index 0000000..20d9a05 --- /dev/null +++ b/silentbob/AUTHORS @@ -0,0 +1,5 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ diff --git a/silentbob/COPYING b/silentbob/COPYING new file mode 100644 index 0000000..623b625 --- /dev/null +++ b/silentbob/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/silentbob/ChangeLog b/silentbob/ChangeLog new file mode 100644 index 0000000..ab45784 --- /dev/null +++ b/silentbob/ChangeLog @@ -0,0 +1,11 @@ +Version 1.5 + - added -j N for --cgrep --grep --make-ctags --call-tags. Tags creation code (--make-ctags) is rewritten for new + engine (sblib/TT.cxx). gclib library was minimized to size needed only for SilentBob. Of course, you are able to download + gclib2 separately. + +Version 1.4 + - Bug fixes. Bugs are caught, fryed and worn out + - Removed support for ./tags file from exuberant-ctags. Now the project is autonomous and doesn't need it. + - Added heapsort and [working] variant with paralleling. + - All libs are in the one heap now + diff --git a/silentbob/INSTALL b/silentbob/INSTALL new file mode 100644 index 0000000..4b6a3a6 --- /dev/null +++ b/silentbob/INSTALL @@ -0,0 +1,14 @@ +$ mkdir debug +$ cd debug +$ ../configure --disable-static +$ make +$ make install +$ make install_plugins + +or + +cd scripts +$ scons +$ ./install.sh + + diff --git a/silentbob/INSTALL_generic b/silentbob/INSTALL_generic new file mode 100644 index 0000000..02a4a07 --- /dev/null +++ b/silentbob/INSTALL_generic @@ -0,0 +1,167 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes a while. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Type `make install' to install the programs and any data files and + documentation. + + 4. You can remove the program binaries and object files from the + source code directory by typing `make clean'. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. + diff --git a/silentbob/Makefile.am b/silentbob/Makefile.am new file mode 100644 index 0000000..65bb5da --- /dev/null +++ b/silentbob/Makefile.am @@ -0,0 +1,9 @@ +SUBDIRS=gclib sblib src plugins +man_MANS=$(top_srcdir)/silent_bob.1 +EXTRA_DIST = $(man_MANS) + +install_plugins: + mkdir -p /usr/lib/silent_bob/plugins/ + cp $(top_builddir)/plugins/.libs/*.so.0.0.0 /usr/lib/silent_bob/ + echo + echo "Plugins was successfully installed to /usr/lib/silent_bob/" diff --git a/silentbob/Makefile.cvs b/silentbob/Makefile.cvs new file mode 100644 index 0000000..d160702 --- /dev/null +++ b/silentbob/Makefile.cvs @@ -0,0 +1,8 @@ +default: all + +all: + aclocal + autoheader + automake + autoconf + diff --git a/silentbob/Makefile.in b/silentbob/Makefile.in new file mode 100644 index 0000000..7eecf07 --- /dev/null +++ b/silentbob/Makefile.in @@ -0,0 +1,688 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ + config.guess config.sub depcomp install-sh ltmain.sh missing \ + mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +man1dir = $(mandir)/man1 +am__installdirs = "$(DESTDIR)$(man1dir)" +NROFF = nroff +MANS = $(man_MANS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = gclib sblib src plugins +man_MANS = $(top_srcdir)/silent_bob.1 +EXTRA_DIST = $(man_MANS) +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +install-man1: $(man1_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ + done +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d $(distdir) || mkdir $(distdir) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile $(MANS) config.h +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: install-man1 + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ + dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-man1 \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-man uninstall-man1 + + +install_plugins: + mkdir -p /usr/lib/silent_bob/plugins/ + cp $(top_builddir)/plugins/.libs/*.so.0.0.0 /usr/lib/silent_bob/ + echo + echo "Plugins was successfully installed to /usr/lib/silent_bob/" +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/silentbob/NEWS b/silentbob/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/silentbob/README b/silentbob/README new file mode 100644 index 0000000..ae6ebe8 --- /dev/null +++ b/silentbob/README @@ -0,0 +1,200 @@ + + + + SILENT BOB +"Silent Bob", actually, it can be drawn an analogy with three programs, which +leaded to its creation, ctags, cscope, ctree( first I'll describe them, and +their problems, and then - their differences from "Bob"). + +Description of some programs ( on which motives SilentBob was written) + +Let's take, for example, such well-known program as ctags, probably you've +used it and you know it's main point of work. It simply creates special file, +which stores information about some source files. Usually it's OS kernels and +other big programs, like sendmail or apache. This file contains: +1. "Addresses" of all functions, structures, macroses, etc. "Address" means +file name + string number (or regular expression, using which an appropriate +string can be found). That file, for example, in Vim, can be used to evaluate +":tag " to make a quick switch. Also ctags allows to extract "goodies" +from files - simply to find out its contents. + +csope - very useful program, it doesn't create file, described above, but can +do search and has some additional features: +1. Interface for "comfortable" search. +2. It can trace which functions called and what does they call (one layer +"lower") +3. It also can trace who calls certain functions (one layer "upper") +And some other feature, which I have never used... + +And at last - ctree. Theoreticaly, it can show all above described information +several layers "lower". Practically I couldn't turn it on. + +Problems of existing software + +ctags problems: +For "tags" file creation regular expressions are used, which allows to add +other languages, but places a substantial limits: +1. Quality of received information is quite low. +2. Information, which we receive, in "interactive" mode is not full enough. +3. Support for C++ is present, but not quite good. + +cscope problems: +Actually, all ctags problems, plus: +1. Base, which actually doesn't needed anybody, but "weights" 150 Mbytes (for +Linux 2.6.14 for example) +2. Quality of "interactivity" is not good enough +3. Support for C++ is absent. This is not good, because problems, which this +kind of software is called to solve, lies down to different libraries, +including Qt3/GTK. + +In SilentBob this problems are absent. Program uses preprocessor (written by +me) either than regular expressions. + +Main ideas of SilentBob + +Preprocessor, which is described above, is called "THE_TT" and placed in +appropriate file... +Actually it's quite simple: it removes all "extras" from C/C++ source. It +removes/minimizes all variants of C code notations, removes all extra space +symbols and comments, adds additional spaces where it's necessary (for +example, before brackets). THE_TT allows to take some part of code and +exactly (about 99%) tell you what is it, using minimum of checks. +All it works quite fast (for example, 1.6 GHz processor, 256 Mb of RAM - works +excellent), which allows to do some interesting things. As far as I know, +such kind of code usually is written only to compilers and isn't used for +other things, what, as for my view, isn't good enough. + +Next SilentBob's level - "t_op", "what_is_this" and alike functions. First of +them simply allows to enumerate all "operators" of source code, second - +checks, what kind of operator do we met. Actually, "what_is_this" isn't +quite enough for all, so some additional functions exists... Now, THE_TT and +t_op are two separate parts of program. In future I plan to unite them... + +It took from me for about one month to develop current version (1.0-rc1) and +two months for testing, finding out bugs, etc. + +LYRICS +("life story", "blog" ) + +SilentBob was written one dark night, when one Siberian fellow tried to +understand how sys_poll system call works. After some time of digging the +sources and several tanks of drinked beer, this fellow understood, that +abilities of Gvim only isn't quite enough. Some tricks was made - they helped +a little, but this wasn't the solution. +Then, some other popular programs was used. After several tries fellow +understood, that he received the access to function he needs. But only one +function. If you take into account, that such calls, let's say, not only one +in program - you can imaging fellows indignation. + + + Version 1.5 + - added -j N for --cgrep --grep --make-ctags --call-tags. Tags creation code (--make-ctags) is rewritten for new +engine (sblib/TT.cxx). gclib library was minimized to size needed only for SilentBob. Of course, you are able to +download gclib2 separately. + + Version 1.4 + - Bug fixes. Bugs are caught, fryed and worn out + - Removed support for ./tags file from exuberant-ctags. Now the project is autonomous and doesn't need it. + - Added heapsort and [working] variant with paralleling. + - All libs are in the one heap now + + + + +To build project you may use Scons (go to ./Scons), AAP (./AAP directory) or with plain ./configure + + -- Scripts: + build_bob.bob - used to create SConsturct, main.aap, build_bob.sh + if you have bob and all plugins installed run as a + ordinary script. + build_bob.sh - build all parts... with bash script. Very fast. + install.sh - alternative script for installing. It installs everything to /usr. + make.sed - SED script, which is used to automatize automake :-) + package.sh - alternative method for building SilentBob. It installs everything to ../package, + removing all files in the current dir before. + + +To install plugins you must execute +$ make install_plugins +Plugins are installed to invariable directory +/usr/lib/silent_bob/ +BUT you may manually copy files libplugin_* to the ~/.silent_bob/plugins/ directory. + + -- Building with alternative methods (non ./configure): +install.sh,package.sh,install.sh scripts are executed from build directory. +i.e. Executing from directories Scons or APP, you are to add "../scripts/". +Also it may be a bug (?) of changing the order in Scons. If you have such problem you may build needed targets in series (see the commands below). + +scons ligclib.so +scons libsblib.so +scons silent_bob + +Bug of incorrect compilation something non -O2 in CFLAGS was found in AAP 1.088. +Using scons, AAP or bash-script you must be in the first-level sub-directory, like: +./AAP ./SCons ./debug, or change top_srcdir= in build_bob.bob and recreate build files. +Of course, the second variant will work only if you have installed working version of Bob. + + HOW to USE: +Files for SilentBob are given as parameters or as file with filelist (every file is in the new line) +and option -L, i.e. -L . + + -- Creating filelist: +$ bob --cfiles +or +$ bob -f + + -- Creating file ./tags +$ bob --make-ctags +or +$ bob -c +You may specify -j N --make-ctags, where N is the num of CPUs +* templates are not indexed +** There is test option "--lang cpp" for C++. This option make Bob to use "C++" mode. + In this mode global variables are not indexed. To search global vars in C++ code it's recommended + to use --cgrep option. + +If you have plugins installed (not from deb package), you may add for these options (--cfiles и --make-ctags) --perl or --python accordingly for Perl and Python, but this fitch is testing... +$ bob [--perl | --python] --files +$ bob [--perl | --python] --make-ctags +Created tag file is supported only by Vim, but you may use directly SilentBob to work with it. + + -- Creating ./call_tags file +$ bob --call-tags +It creates tags file. But instead of start points of function it will be written where they are called. +You may rename it to ./tags, run Vi and go throw _functions_call_points with a plain usual command + :tag + + -- Call-trees +./call_tags needed. + + -- Simple +$ bob [--depth N] +Where N is the maximum level (for huge projects). + + -- The reverse +$ bob -u [--depth N] +Сorrectness for C++ code functions is not guaranteed. + + -- Search in operators : +$ bob --cgrep op1,op2... +Where op1 and op2 are required parts of _one operator_. I.e. to search the place of checking T variable +you may use, for example: +$ bob -L ./cfiles --cgrep if,T +Using -ts option (it may be used at once c>./tags) you may get tags-formatted output. + + -- Access to tags +$ bob --tags ... +Where function1..functionN are needed symbol from ./tags file +The code if all listed functions will be reflected after this call + +And also there are many another tasty things, not listed here. + + Other information +We need responses about working with Bob on another platforms. +Any thoughts on: + Oleg Puchinin + +Thanks for your attention. +Oleg. + +Translation to English: Evgeniy Ivanov diff --git a/silentbob/Scons/SConstruct b/silentbob/Scons/SConstruct new file mode 100644 index 0000000..b33f274 --- /dev/null +++ b/silentbob/Scons/SConstruct @@ -0,0 +1,36 @@ +env = Environment (CC='gcc', CXX='g++', CCFLAGS='-g3 -Wall -pipe', CXXFLAGS='-g3 -Wall -pipe', OPTS='', CPPPATH=['..//include', '..//gclib/include'], LINKFLAGS='-L./ ') +env.SharedLibrary ("gclib", ['..//gclib/src/darray.cxx', + '..//gclib/src/deprecated_dsplit.cxx', '..//gclib/src/dhash.cxx', '..//gclib/src/dheapsort.cxx', '..//gclib/src/djobs.cxx', '..//gclib/src/dlist.cxx', '..//gclib/src/dsplit.cxx', '..//gclib/src/earray.cxx', '..//gclib/src/ehash.cxx', '..//gclib/src/elist.cxx', '..//gclib/src/fs.cxx', '..//gclib/src/gclib.cxx', '..//gclib/src/gclib_c.c']) +env = Environment (CC='gcc', CXX='g++', CCFLAGS='-g3 -Wall -pipe', CXXFLAGS='-g3 -Wall -pipe', OPTS='', CPPPATH=['..//include', '..//gclib/include'], LINKFLAGS='-L./ -lsblib -lgclib -ldl ') +env.SharedLibrary ("sblib", ['..//sblib/py_tt.cxx', + '..//sblib/Sblib.cxx', '..//sblib/the_fly.cxx', '..//sblib/the_tt.cxx', '..//sblib/t_op2.cxx', '..//sblib/t_op.cxx', '..//sblib/TT.cxx', '..//sblib/wit.cxx']) + + +env = Environment (CC='gcc', CXX='g++', CCFLAGS='-g3 -Wall -pipe', CXXFLAGS='-g3 -Wall -pipe', OPTS='', CPPPATH=['..//include', '..//gclib/include'], LINKFLAGS='-L./ -lsblib -lgclib -ldl ') +env.Program ("silent_bob", ['..//src/callTags.cxx', + '..//src/cFiles.cxx', '..//src/cgrep.cxx', '..//src/ctags.cxx', '..//src/file.cxx', '..//src/indent.cxx', '..//src/init.cxx', '..//src/interactive.cxx', '..//src/kinds.cxx', '..//src/main.cxx', '..//src/modding.cxx', '..//src/opts_funcs.cxx', '..//src/opts_kinds.cxx', '..//src/opts_list.cxx', '..//src/opts_settings.cxx', '..//src/structs.cxx', '..//src/tree.cxx', '..//src/usage.cxx']) +env = Environment (CC='gcc', CXX='g++', CCFLAGS='-g3 -Wall -pipe', CXXFLAGS='-g3 -Wall -pipe', OPTS='', CPPPATH=['..//include', '..//gclib/include'], LINKFLAGS='-L./ -lsblib -lgclib -ldl ') +env.SharedLibrary ("plugin_perl", ['..//plugins/plugin_perl.cxx', + ]) +env.SharedLibrary ("plugin_perlpackages", ['..//plugins/plugin_perlpackages.cxx', + ]) +env.SharedLibrary ("plugin_cache", ['..//plugins/plugin_cache.cxx', + ]) +env.SharedLibrary ("plugin_editor", ['..//plugins/plugin_editor.cxx', + ]) +env.SharedLibrary ("plugin_grep", ['..//plugins/plugin_grep.cxx', + ]) +env.SharedLibrary ("plugin_compile", ['..//plugins/plugin_compile.cxx', + ]) +env.SharedLibrary ("plugin_aap", ['..//plugins/plugin_aap.cxx', + ]) +env.SharedLibrary ("plugin_python", ['..//plugins/plugin_python.cxx', + ]) +env.SharedLibrary ("plugin_scons", ['..//plugins/plugin_scons.cxx', + ]) +env.SharedLibrary ("plugin_foreach", ['..//plugins/plugin_foreach.cxx', + ]) +env.SharedLibrary ("plugin_make", ['..//plugins/plugin_make.cxx', + ]) +env.SharedLibrary ("plugin_xml_project", ['..//plugins/plugin_xml_project.cxx', + ]) diff --git a/silentbob/SilentBobDoc.html b/silentbob/SilentBobDoc.html new file mode 100644 index 0000000..11c4a88 --- /dev/null +++ b/silentbob/SilentBobDoc.html @@ -0,0 +1,121 @@ + + + +Silent Bob + + +

SilentBob

+Brief description
+Code indexing
+Calls indexing
+Direct trees of calls
+Inversed trees of calls
+Files searching
+Searching in the source code
+Quick access
+Plugins development
+Code indexing (Perl/Python)
+Files searching (Perl/Python)
+Links
+Download
+Author and Contacts
+ +

Brief description

+SilentBob is an instrument for working with source code of programms. The main functionality is handling C/C++:
+ +
+ +SilentBob supports Perl/Python via plugins:
+ + +

Code indexing.

+Code indexing is creating the index file. The sources for Silent Bob are peace of big database, which should be indexed for quick access to any part of it. In C/C++ Silent Bob indexes
+
    +
  • Functions
  • +
  • Structures
  • +
  • Classes
  • +
  • Defines (macroses)
  • +
  • Global variables
  • +
+Format of index file looks like:
+<index>\t<file's name>\t<line number>\t<[; additional information]>
+ +The information of athor of the programm you're indexing and some parametrs are added to the beginning of the file. +Index file is sorted out +by ascending for better serching, so that you may use the index file for really big sources. The index file's format is supported by some popular text editors like Vi. Furthermore the index file is used +in many SilentBob's functions. The good idea is to create index file before working, for example: +

+$ sb --make-ctags

+"ctags" is a type of index file (other formats are not supported) + +

Calls indexing

+Calls indexing is the indexing functions calls in the code. it is used to build direct and reversed calls trees. Moreover you may use it in prigramms which support "ctags". To create such type of index file you may use command:

+$ sb <Files list> --call-tags

+ may be replaced with "-L ". It is convenient to create files list using Silent Bob. (see "File searching".). + +

Direct trees of calls.

+You may use to see the part of index file (with indexing functions calls). All calls look like tree, where the top is the given function.

+$ sb <function>

+Tree of calls is the main part of programm so you scholdn't type any options. The main and only option is the indexing "depth" of tree

+$ sb --depth <N> <function>

+ +

Inversed trees of calls.

+Similarly to direct, but representation begins from another end. + +

Files searching.

+Practically it is creation list of the files, which you work with. Use this "--cfiles" option to create the list(C/C++):

+$ sb --cfiles

+Now you have file "cfiles", which includes all necessary information. +

Searching in the source code.

+Use it to find any parts of C/C++ code. All comments and strings (" ") are ignored. +For searching Silent Bob uses fragments of text, parted with comma. It is important that Bob searchs not in the hole code, but in _operators_. See the command format below:

+$ sb -L

+ +

Quick access.

+It gives an possibility to find in the code thengs you are interasted in. The programm searchs in the index files and makes output with code fragments. It supports only C/C++. Example:

+$ tags ...

+Index - name of function, structure, global variable, macros. +

Plugins development.

+There is no constant plugin format. To develop your plugins you schould look through the source code. After ending of development plugin support you will be able to find API documentation here. +

Code indexing (Perl/Python)

+There are some standart plugins for Silent Bob, the functionality of one of them is indexing Perl and Python code.
+In Perl indexing : + +
    +
  • Functions
  • +
  • Modules
  • +
+In Python functiona and packages are indexed. For indexing use:

+$ sb <--perl | --python> --make-ctags

+ +

Files searching (Perl/Python).

+To create filelist for Perl/Python sources ypu must specify language + "--files", example:

+$ sb <--perl | --python> --files

+As result ypu will get filelist: perl_files and python_files. +

Links

+Forum, Here you may learn about lost development (my nick is GrayCardinal). +

Download

+You may download SilentBob from sourceforge.net
Here, + +

Author and Contacts

+Silent Bob(c) Oleg Puchinin 2006
+graycardinalster at gmail dot com

+ +English translation: Evgeniy Ivanov
+green-lord at mail dot ru + + + + + diff --git a/silentbob/SilentBobDoc_ru.html b/silentbob/SilentBobDoc_ru.html new file mode 100644 index 0000000..ca8e484 --- /dev/null +++ b/silentbob/SilentBobDoc_ru.html @@ -0,0 +1,126 @@ + + + +íÏÌÞÁÌÉ×ÙÊ âÏ + + +

íÏÌÞÁÌÉ×ÙÊâÏÂ

+

SilentBob

+
ëÒÁÔËÏÅ ÏÐÉÓÁÎÉÅ.
+éÎÄÅËÓÁÃÉÑ ËÏÄÁ.
+éÎÄÅËÓÁÃÉÑ ×ÙÚÏ×Ï×.
+ðÒÑÍÙÅ ÄÅÒÅ×ØÑ ×ÙÚÏ×Ï×.
+ïÂÒÁÔÎÙÅ ÄÅÒÅ×ØÑ ×ÙÚÏ×Ï×.
+ðÏÉÓË ÆÁÊÌÏ×.
+ðÏÉÓË ÐÏ ËÏÄÕ.
+âÙÓÔÒÙÊ ÄÏÓÔÕÐ.
+ðÌÁÇÉÎÙ (ÒÁÚÒÁÂÏÔËÁ).
+éÎÄÅËÓÁÃÉÑ ËÏÄÁ (Perl/Python)
+ðÏÉÓË ÆÁÊÌÏ× (Perl/Python)
+ìÉÎËÉ.
+óËÁÞÁÔØ.
+á×ÔÏÒ É ËÏÎÔÁËÔÙ.
+ +

ëÒÁÔËÏÅ ÏÐÉÓÁÎÉÅ.

+SilentBob (íÏÌÞÁÌÉ×ÙÊâÏÂ) - ÉÎÓÔÒÕÍÅÎÔ ÄÌÑ ÒÁÂÏÔÙ Ó ÉÓÈÏÄÎÙÍ ËÏÄÏÍ ÐÒÏÇÒÁÍÍ. ïÓÎÏ×ÎÁÑ ÆÕÎËÃÉÏÎÁÌØÎÏÓÔØ ÐÒÉÈÏÄÉÔÓÑ ÎÁ óÉ/óÉ++ :
+
+ðÏÄÄÅÒÖËÁ Perl/Python, ÄÏÓÔÕÐÎÁ ÞÅÒÅÚ ÐÌÁÇÉÎÙ :
+ + +

éÎÄÅËÓÁÃÉÑ ËÏÄÁ.

+éÎÄÅËÓÁÃÉÑ ËÏÄÁ ÅÓÔØ ÎÉ ÞÔÏ ÉÎÏÅ ËÁË ÓÏÚÄÁÎÉÅ ÆÁÊÌÁ-ÉÎÄÅËÓÁ. éÓÈÏÄÎÙÊ ËÏÄ ÒÁÓÓÍÁÔÒÉ×ÁÅÔÓÑ ËÁË âä, ËÏÔÏÒÏÊ ÎÅÏÂÈÏÄÉÍ "ÉÎÄÅËÓ" ÄÌÑ +ÂÙÓÔÒÏÇÏ ÄÏÓÔÕÐÁ Ë ËÁËÏÊ-ÌÉÂÏ ÅÅ ÞÁÓÔÉ. ÷ ËÏÄÅ óÉ/óÉ++ ÉÎÄÅËÓÁÃÉÉ ÐÏÄÌÅÖÁÔ :
+
    +
  • æÕÎËÃÉÉ.
  • +
  • óÔÒÕËÔÕÒÙ.
  • +
  • ëÌÁÓÓÙ.
  • +
  • íÁËÒÏÓÙ.
  • +
  • çÌÏÂÁÌØÙÎÅ ÐÅÒÅÍÅÎÎÙÅ.
  • +
+æÏÒÍÁÔ ÆÁÊÌÁ-ÉÎÄÅËÓÁ ÓÌÅÄÕÀÝÉÊ :
+<ÉÎÄÅËÓ>\t<ÉÍÑ ÆÁÊÌÁ>\t<ÎÏÍÅÒ ÓÔÒÏËÉ>\t<[; ÄÏÐÏÌÎÉÔÅÌØÎÁÑ ÉÎÆÏÒÍÁÃÉÑ]>
+÷ ÎÁÞÁÌÏ ÆÁÊÌÁ ÄÏÂÁ×ÌÑÅÔÓÑ ÚÁÇÌÏ×ÏË Ó ÉÎÆÏÒÍÁÃÉÅÊ Ï Á×ÔÏÒÅ ÉÎÄÅËÓÉÒÕÀÝÅÊ ÐÒÏÇÒÁÍÍÙ É ÎÅËÏÔÏÒÙÅ ÐÁÒÁÍÅÔÒÙ. éÎÄÅËÓÎÙÊ ÆÁÊÌ ÏÔÓÏÒÔÉÒÏ×ÁÎ +ÐÏ ×ÏÚÒÁÓÔÁÎÉÀ É ÐÏÉÓË × ÉÎÄÅËÓÅ ÐÒÏÉÓÈÏÄÉÔ ÏÞÅÎØ ÂÙÓÔÒÏ, ÐÏÜÔÏÍÕ ÉÎÄÅËÓÎÙÊ ÆÁÊÌ ÍÏÖÅÔ ÉÓÐÏÌØÚÏ×ÁÔØÓÑ ÄÌÑ ÄÅÊÓÔ×ÉÔÅÌØÎÏ ÂÏÌØÛÉÈ +ÉÓÈÏÄÎÙÈ ËÏÄÏ×. äÁÎÎÙÊ ÆÏÒÍÁÔ ÉÎÄÅËÓÎÏÇÏ ÆÁÊÌÁ ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ ÎÅËÏÔÏÒÙÍÉ ÐÏÐÕÌÑÒÎÙÍÉ ÒÅÄÁËÔÏÒÁÍÉ, Ë ÐÒÉÍÅÒÕ Vi. ôÁË ÖÅ ÜÔÏÔ ÉÎÄÅËÓ +ÉÓÐÏÌØÚÕÅÔÓÑ × ÂÏÌØÛÉÎÓÔ×Å ÏÓÔÁÌØÎÙÈ ÆÕÎËÃÉÊ íÏÌÞÁÌÉ×ÏÇÏâÏÂÁ. èÏÒÏÛÁÑ ÉÄÅÑ ÐÅÒÅÄ ÎÁÞÁÌÏÍ ÒÁÂÏÔÙ - ÓÏÚÄÁÔØ ÉÎÄÅËÓÎÙÊ ÆÁÊÌ, Ë ÐÒÉÍÅÒÕ +ÔÁË :

+$ sb --make-ctags

+úÄÅÓØ "ctags" - ÎÁÚ×ÁÎÉÅ ÆÏÒÍÁÔÁ ÉÎÄÅËÓÎÏÇÏ ÆÁÊÌÁ (ÄÒÕÇÉÅ ÆÏÒÍÁÔÙ ÎÅ ÐÏÄÄÅÒÖÉ×ÁÀÔÓÑ). + + +

éÎÄÅËÓÁÃÉÑ ×ÙÚÏ×Ï×.

+éÎÄÅËÓÁÃÉÑ ×ÙÚÏ×Ï× ÜÔÏ ÉÎÄÅËÓÁÃÉÑ ËÏÄÁ ÐÏ ×ÙÚÏ×ÁÍ ÆÕÎËÃÉÊ. éÓÐÏÌØÚÕÅÔÓÑ ÄÌÑ ÐÏÓÔÒÏÅÎÉÑ ÐÒÑÍÙÈ É ÏÂÒÁÔÎÙÈ ÄÅÒÅ×ØÅ× ×ÙÚÏ×Ï×. ôÁË ÖÅ +ÍÏÖÅÔ ÉÓÐÏÌØÚÏ×ÁÔØÓÑ × ÐÒÏÇÒÁÍÍÁÈ ÐÏÄÄÅÒÖÉ×ÁÀÝÉÈ "ctags" ÆÏÒÍÁÔ. äÌÑ ÓÏÚÄÁÎÉÑ ÉÎÄÅËÓÁ ÄÁÎÎÏÇÏ ÔÉÐÁ ÍÏÖÎÏ ÉÓÐÏÌØÚÏ×ÁÔØ ËÏÍÁÎÄÕ :

+$ sb <ÓÐÉÓÏË ÆÁÊÌÏ×> --call-tags

+<ÓÐÉÓÏË ÆÁÊÌÏ×> ÍÏÖÎÏ ÚÁÍÅÎÉÔØ ÎÁ "-L <ÆÁÊÌ ÓÏ ÓÐÉÓËÏÍ ÆÁÊÌÏ×>". óÐÉÓÏË ÆÁÊÌÏ× ÕÄÏÂÎÅÊ ×ÓÅÇÏ ÓÏÚÄÁ×ÁÔØ ÐÒÉ ÐÏÍÏÝÉ +íÏÌÞÁÌÉ×ÏÇÏâÏÂÁ (ÓÍ. "ÐÏÉÓË ÆÁÊÌÏ×".). + +

ðÒÑÍÙÅ ÄÅÒÅ×ØÑ ×ÙÚÏ×Ï×.

+éÓÐÏÌØÚÕÀÔÓÑ ÄÌÑ ÎÁÇÌÑÄÎÏÇÏ ÏÔÏÂÒÁÖÅÎÉÑ ÞÁÓÔÉ ÉÎÄÅËÓÎÏÇÏ ÆÁÊÌÁ (Ó ÉÎÄÅËÓÁÃÉÅÊ ÐÏ ×ÙÚÏ×ÁÍ ÆÕÎËÃÉÊ). ïÔÏÂÒÁÖÅÎÉÅ ÐÒÏÉÚ×ÏÄÉÔÓÑ +× ×ÉÄÅ ÄÅÒÅ×Á, × ËÏÔÏÒÏÍ ×ÅÒÈÕÛËÕ ÚÁÎÉÍÁÅÔ ÚÁÄÁÎÎÁÑ ÆÕÎËÃÉÑ.

+$ sb <ÆÕÎËÃÉÑ>

+äÅÒÅ×Ï ×ÙÚÏ×Ï× - ÏÓÎÏ×ÎÁÑ ÆÕÎËÃÉÑ ÐÒÏÇÒÁÍÍÙ, ÐÏÜÔÏÍÕ ÓÐÅÃÉÁÌØÎÙÈ ÏÐÃÉÊ ÚÁÄÁ×ÁÔØ ÎÅ ÎÕÖÎÏ. ðÒÁ×ÄÁ ÍÏÖÎÏ ÚÁÄÁÔØ ÎÅÏÂÈÏÄÉÍÕÀ "ÇÌÕÂÉÎÕ" +ÄÅÒÅ×Á (N) :

+$ sb --depth <N> <ÆÕÎËÃÉÑ>

+ +

ïÂÒÁÔÎÙÅ ÄÅÒÅ×ØÑ ×ÙÚÏ×Ï×.

+áÎÁÌÏÇÉÞÎÏ ÐÒÑÍÙÍ, ÔÏÌØËÏ ÏÔÏÂÒÁÖÅÎÉÅ ÐÒÏÉÓÈÏÄÉÔ "Ó ÄÒÕÇÏÇÏ ËÏÎÃÁ". + +

ðÏÉÓË ÆÁÊÌÏ×.

+æÁËÔÉÞÅÓËÉ ÜÔÏ ÓÏÚÄÁÎÉÅ ÓÐÉÓËÁ ÆÁÊÌÏ×, Ó ËÏÔÏÒÙÍÉ × ÄÁÌØÎÅÊÛÅÍ ÐÒÉÄÅÔÓÑ ÒÁÂÏÔÁÔØ. óÏÚÄÁÎÉÅ ÓÐÉÓËÁ (óÉ/óÉ++) ×ÏÐÌÎÑÅÔÓÑ ÐÒÉ +ÐÏÍÏÝÉ ÏÐÃÉÉ "--cfiles" :

+$ sb --cfiles

+÷Ù ÐÏÌÕÞÉÔÅ ÆÁÊÌ "cfiles", × ËÏÔÏÒÏÍ ÂÕÄÅÔ ÓÏÄÅÒÖÁÔØÓÑ ÎÅÏÂÈÏÄÉÍÁÑ ÉÎÆÏÒÍÁÃÉÑ. + +

ðÏÉÓË ÐÏ ËÏÄÕ.

+éÓÐÏÌØÚÕÅÔÓÑ ÄÌÑ ÎÁÈÏÖÄÅÎÉÑ ËÁËÏÇÏ(ÉÈ)-ÌÉÂÏ ËÕÓËÁ(Ï×) ËÏÄÁ (óÉ/óÉ++). ðÒÉ ÐÏÉÓËÅ ÉÇÎÏÒÉÒÕÀÔÓÑ ÓÔÒÏËÉ, ÚÁËÌÀÞÅÎÎÙÅ × ËÁ×ÙÞËÉ É ËÏÍÍÅÎÔÁÒÉÉ. +äÌÑ ÐÏÉÓËÁ ÉÓÐÏÌØÚÕÀÔÓÑ ÎÅÏÂÈÏÄÉÍÙÅ ÆÒÁÇÍÅÎÔÙ ÔÅËÓÔÁ, ÒÁÚÄÅÌÅÎÎÙÅ ÚÁÐÑÔÏÊ. ÷ÁÖÎÏÊ ÏÓÏÂÅÎÎÏÓÔØÀ Ñ×ÌÑÅÔÓÑ ÔÏ, ÞÔÏ ÐÏÉÓË ÐÒÏÉÚ×ÏÄÉÔÓÑ ÎÅ +ÐÏ ×ÓÅÍÕ ÔÅËÓÔÕ/ÓÔÒÏËÁÍ, Á ÐÏ _ÏÐÅÒÁÔÏÒÁÍ_. æÏÒÍÁÔ ËÏÍÁÎÄÙ ÐÏÉÓËÁ ÐÏ ËÏÄÕ :

+$ sb -L <ÓÐÉÓÏË ÆÁÊÌÏ×> <ËÕÓËÉ ÔÅËÓÔÁ ÞÅÒÅÚ ÚÁÐÑÔÕÀ>

+ +

âÙÓÔÒÙÊ ÄÏÓÔÕÐ.

+äÁÅÔ ×ÏÚÍÏÖÎÏÓÔØ ÂÙÓÔÒÏ ÐÏÓÍÏÔÒÅÔØ ÔÏ, ÞÔÏ ÷ÁÓ ÉÎÔÅÒÅÓÕÅÔ. ðÒÏÇÒÁÍÍÁ ÐÒÏÉÚ×ÏÄÉÔ ÐÏÉÓË ÐÏ ÉÎÄÅËÓÎÏÍÕ ÆÁÊÌÕ É ×Ù×ÏÄÉÔ ÎÁ ËÏÎÓÏÌØ +ÉÎÔÅÒÅÓÕÀÝÉÊ(Å) ÆÒÁÇÍÅÎÔ(Ù). ðÏÄÄÅÒÖÉ×ÁÅÔÓÑ ÔÏÌØËÏ óÉ/óÉ++. æÏÒÍÁÔ :

+$ tags <ÉÎÄÅËÓ> <ÉÎÄÅËÓ2> ... <ÉÎÄÅËÓN>

+éÎÄÅËÓ - ÉÍÑ ÆÕÎËÃÉÉ, ÓÔÒÕËÔÕÒÙ, ËÌÁÓÓÁ, ÇÌÏÂÁÌØÎÏÊ ÐÅÒÅÍÅÎÎÏÊ, ÍÁËÒÏÓÁ. + +

ðÌÁÇÉÎÙ (ÒÁÚÒÁÂÏÔËÁ).

+æÏÒÍÁÔ ÐÌÁÇÉÎÏ× ÐÏËÁ ×ÁÒØÉÒÕÅÔÓÑ. äÌÑ ÒÁÚÒÁÂÏÔËÉ Ó×ÏÉÈ ÐÌÁÇÉÎÏ×Á ÷ÁÍ ÓÔÏÉÔ ÏÚÎÁËÏÍÉÔØÓÑ Ó ÉÓÈÏÄÎÙÍ ËÏÄÏÍ ÐÒÏÇÒÁÍÍÙ. ðÏÓÌÅ ÏËÏÎÞÁÎÉÑ +ÒÁÚÒÁÂÏÔËÉ ÐÌÁÇÉÎ-ÓÉÓÔÅÍÙ ÄÏËÕÍÅÎÔÁÃÉÑ ÐÏ API ÂÕÄÅÔ ×ÙÌÏÖÅÎÁ ÚÄÅÓØ. + +

éÎÄÅËÓÁÃÉÑ ËÏÄÁ (Perl/Python).

+äÌÑ íÏÌÞÁÌÉ×ÏÇÏâÏÂÁ ÓÕÝÅÓÔ×ÕÅÔ ÎÅÓËÏÌØËÏ ÓÔÁÎÄÁÒÔÎÙÈ ÐÌÁÇÉÎÏ×, ÏÄÉÎ ÉÚ ËÏÔÏÒÙÈ - ÜÔÏ ÉÎÄÅËÓÁÃÉÑ ËÏÄÁ Perl É Python.
+÷ Perl ÉÎÄÅËÓÉÒÕÀÔÓÑ : +
    +
  • æÕÎËÃÉÉ.
  • +
  • íÏÄÕÌÉ.
  • +
+÷ Python ÉÎÄÅËÓÉÒÕÀÔÓÑ ÆÕÎËÃÉÉ É ÐÁËÅÔÙ. äÌÑ ÉÎÄÅËÓÁÃÉÉ ÉÓÐÏÌØÚÕÊÔÅ :

+$ sb <--perl | --python> --make-ctags

+ +

ðÏÉÓË ÆÁÊÌÏ× (Perl/Python).

+óÏÚÄÁÎÉÅ ÓÐÉÓËÁ ÆÁÊÌÏ× ÄÌÑ Perl/Python ×ÙÐÏÌÎÑÅÔÓÑ ÏÐÃÉÅÊ ÕËÁÚÁÎÉÑ ÑÚÙËÁ + "--files", ÆÏÒÍÁÔ :

+$ sb <--perl | --python> --files

+òÅÚÕÌØÔÁÔ - ÆÁÊÌÙ perl_files É python_files ÓÏÏÔ×ÅÔÓÔ×ÅÎÎÏ. +

ìÉÎËÉ.

+æÏÒÕÍ, ÎÁ ËÏÔÏÒÏÍ ÍÏÖÎÏ ÕÚÎÁÔØ Ï ÐÏÓÌÅÄÎÉÈ ÒÁÚÒÁÂÏÔËÁÈ (ÍÏÊ ÎÉË - GrayCardinal). +

óËÁÞÁÔØ.

+óËÁÞÁÔØ ÐÒÏÇÒÁÍÍÕ ÍÏÖÎÏ Ó ÐÒÏÅËÔÁ ÎÁ sourceforge.net
ÔÕÔ, + +

á×ÔÏÒ É ËÏÎÔÁËÔÙ.

+(c) ïÌÅÇ ðÕÞÉÎÉÎ 2006
+graycardinalster psina gmail.com + + + diff --git a/silentbob/bootstrap.sh b/silentbob/bootstrap.sh new file mode 100755 index 0000000..1134fa7 --- /dev/null +++ b/silentbob/bootstrap.sh @@ -0,0 +1,2 @@ +#!/bin/bash +make -f Makefile.cvs diff --git a/silentbob/config.guess b/silentbob/config.guess new file mode 100755 index 0000000..396482d --- /dev/null +++ b/silentbob/config.guess @@ -0,0 +1,1500 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. + +timestamp='2006-07-02' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + x86:Interix*:[3456]*) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T:Interix*:[3456]*) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/silentbob/config.h.in b/silentbob/config.h.in new file mode 100644 index 0000000..5a1898a --- /dev/null +++ b/silentbob/config.h.in @@ -0,0 +1,55 @@ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION diff --git a/silentbob/config.sub b/silentbob/config.sub new file mode 100755 index 0000000..387c18d --- /dev/null +++ b/silentbob/config.sub @@ -0,0 +1,1608 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. + +timestamp='2006-07-02' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/silentbob/configure.in b/silentbob/configure.in new file mode 100644 index 0000000..770e63f --- /dev/null +++ b/silentbob/configure.in @@ -0,0 +1,14 @@ +AC_INIT(configure.in) + +AM_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE(SilentBob, 1.6) + +AC_LANG_CPLUSPLUS +AC_PROG_CXX +AM_PROG_LIBTOOL + +AC_OUTPUT(Makefile sblib/Makefile \ + src/Makefile \ + gclib/Makefile \ + gclib/src/Makefile \ + plugins/Makefile) diff --git a/silentbob/data/silent_bob_immune b/silentbob/data/silent_bob_immune new file mode 100644 index 0000000..d7543c0 --- /dev/null +++ b/silentbob/data/silent_bob_immune @@ -0,0 +1,58 @@ +assert +atomic_add +atomic_dec +atomic_inc +atomic_set +BUG +BUG_ON +down +dump_stack +free +free +get_cpu +is_digit +kmalloc +local_irq_disable +local_irq_enable +local_irq_restore +local_irq_save +malloc +malloc +max +memchr +memcpy +memcpy +memset +might_sleep +min +ntohl +per_cpu +printf +printk +put_cpu +read_lock +seq_printf +show_regs +snprintf +spin_lock +spin_lock_irq +spin_lock_irqsave +spin_unlock_irq +strchr +strchr +strcmp +strcpy +strdup +strlen +strncpy +strncpy_from_user +strstr +udelay +up +vsprintf +copy_from_user +copy_to_user +put_user +get_user +__put_user +__get_user diff --git a/silentbob/debian/README.Debian b/silentbob/debian/README.Debian new file mode 100644 index 0000000..541f2e4 --- /dev/null +++ b/silentbob/debian/README.Debian @@ -0,0 +1,6 @@ +silentbob for Debian +-------------------- + + + + -- root , Sun, 4 Feb 2007 19:54:30 +0600 diff --git a/silentbob/debian/changelog b/silentbob/debian/changelog new file mode 100644 index 0000000..41c3fb3 --- /dev/null +++ b/silentbob/debian/changelog @@ -0,0 +1,6 @@ +silentbob (1.6-1) unstable; urgency=low + + * Initial release (Closes: #nnnn) + + -- root Sun, 4 Feb 2007 19:54:30 +0600 + diff --git a/silentbob/debian/compat b/silentbob/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/silentbob/debian/compat @@ -0,0 +1 @@ +5 diff --git a/silentbob/debian/control b/silentbob/debian/control new file mode 100644 index 0000000..6d93387 --- /dev/null +++ b/silentbob/debian/control @@ -0,0 +1,19 @@ +Source: silentbob +Section: devel +Priority: optional +Maintainer: Oleg Puchinin +Build-Depends: debhelper (>= 5), autotools-dev +Standards-Version: 3.7.2 + +Package: silentbob +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: The SilentBob is yet another indexing tool. + The SilentBob is yet another indexing tool helping you to find your way through the software source code. + Although SilentBob is also able to index sources in many popular programming languages, currently C/C++ is the + most functional back-end. Main features are: + - Code indexing + - Function call traverse + - Call backtrace + - File searching + - Fast searching in the source code diff --git a/silentbob/debian/copyright b/silentbob/debian/copyright new file mode 100644 index 0000000..6eb547e --- /dev/null +++ b/silentbob/debian/copyright @@ -0,0 +1,22 @@ +This package was debianized by root on +Sun, 4 Feb 2007 19:54:30 +0600. + +It was downloaded from + +Upstream Author: + +Copyright: + +License: + + + + +The Debian packaging is (C) 2007, root and +is licensed under the GPL, see `/usr/share/common-licenses/GPL'. + + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. + diff --git a/silentbob/debian/cron.d.ex b/silentbob/debian/cron.d.ex new file mode 100644 index 0000000..e5437c9 --- /dev/null +++ b/silentbob/debian/cron.d.ex @@ -0,0 +1,4 @@ +# +# Regular cron jobs for the silentbob package +# +0 4 * * * root silentbob_maintenance diff --git a/silentbob/debian/dirs b/silentbob/debian/dirs new file mode 100644 index 0000000..ca882bb --- /dev/null +++ b/silentbob/debian/dirs @@ -0,0 +1,2 @@ +usr/bin +usr/sbin diff --git a/silentbob/debian/docs b/silentbob/debian/docs new file mode 100644 index 0000000..50bd824 --- /dev/null +++ b/silentbob/debian/docs @@ -0,0 +1,2 @@ +NEWS +README diff --git a/silentbob/debian/emacsen-install.ex b/silentbob/debian/emacsen-install.ex new file mode 100644 index 0000000..c398177 --- /dev/null +++ b/silentbob/debian/emacsen-install.ex @@ -0,0 +1,45 @@ +#! /bin/sh -e +# /usr/lib/emacsen-common/packages/install/silentbob + +# Written by Jim Van Zandt , borrowing heavily +# from the install scripts for gettext by Santiago Vila +# and octave by Dirk Eddelbuettel . + +FLAVOR=$1 +PACKAGE=silentbob + +if [ ${FLAVOR} = emacs ]; then exit 0; fi + +echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR} + +#FLAVORTEST=`echo $FLAVOR | cut -c-6` +#if [ ${FLAVORTEST} = xemacs ] ; then +# SITEFLAG="-no-site-file" +#else +# SITEFLAG="--no-site-file" +#fi +FLAGS="${SITEFLAG} -q -batch -l path.el -f batch-byte-compile" + +ELDIR=/usr/share/emacs/site-lisp/${PACKAGE} +ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE} + +# Install-info-altdir does not actually exist. +# Maybe somebody will write it. +if test -x /usr/sbin/install-info-altdir; then + echo install/${PACKAGE}: install Info links for ${FLAVOR} + install-info-altdir --quiet --section "" "" --dirname=${FLAVOR} /usr/info/${PACKAGE}.info.gz +fi + +install -m 755 -d ${ELCDIR} +cd ${ELDIR} +FILES=`echo *.el` +cp ${FILES} ${ELCDIR} +cd ${ELCDIR} + +cat << EOF > path.el +(setq load-path (cons "." load-path) byte-compile-warnings nil) +EOF +${FLAVOR} ${FLAGS} ${FILES} +rm -f *.el path.el + +exit 0 diff --git a/silentbob/debian/emacsen-remove.ex b/silentbob/debian/emacsen-remove.ex new file mode 100644 index 0000000..788a9e0 --- /dev/null +++ b/silentbob/debian/emacsen-remove.ex @@ -0,0 +1,15 @@ +#!/bin/sh -e +# /usr/lib/emacsen-common/packages/remove/silentbob + +FLAVOR=$1 +PACKAGE=silentbob + +if [ ${FLAVOR} != emacs ]; then + if test -x /usr/sbin/install-info-altdir; then + echo remove/${PACKAGE}: removing Info links for ${FLAVOR} + install-info-altdir --quiet --remove --dirname=${FLAVOR} /usr/info/silentbob.info.gz + fi + + echo remove/${PACKAGE}: purging byte-compiled files for ${FLAVOR} + rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE} +fi diff --git a/silentbob/debian/emacsen-startup.ex b/silentbob/debian/emacsen-startup.ex new file mode 100644 index 0000000..72ca54c --- /dev/null +++ b/silentbob/debian/emacsen-startup.ex @@ -0,0 +1,25 @@ +;; -*-emacs-lisp-*- +;; +;; Emacs startup file, e.g. /etc/emacs/site-start.d/50silentbob.el +;; for the Debian silentbob package +;; +;; Originally contributed by Nils Naumann +;; Modified by Dirk Eddelbuettel +;; Adapted for dh-make by Jim Van Zandt + +;; The silentbob package follows the Debian/GNU Linux 'emacsen' policy and +;; byte-compiles its elisp files for each 'emacs flavor' (emacs19, +;; xemacs19, emacs20, xemacs20...). The compiled code is then +;; installed in a subdirectory of the respective site-lisp directory. +;; We have to add this to the load-path: +(let ((package-dir (concat "/usr/share/" + (symbol-name flavor) + "/site-lisp/silentbob"))) +;; If package-dir does not exist, the silentbob package must have +;; removed but not purged, and we should skip the setup. + (when (file-directory-p package-dir) + (setq load-path (cons package-dir load-path)) + (autoload 'silentbob-mode "silentbob-mode" + "Major mode for editing silentbob files." t) + (add-to-list 'auto-mode-alist '("\\.silentbob$" . silentbob-mode)))) + diff --git a/silentbob/debian/init.d.ex b/silentbob/debian/init.d.ex new file mode 100644 index 0000000..d20aa11 --- /dev/null +++ b/silentbob/debian/init.d.ex @@ -0,0 +1,74 @@ +#! /bin/sh +# +# skeleton example file to build /etc/init.d/ scripts. +# This file should be used to construct scripts for /etc/init.d. +# +# Written by Miquel van Smoorenburg . +# Modified for Debian +# by Ian Murdock . +# +# Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl +# + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/sbin/silentbob +NAME=silentbob +DESC=silentbob + +test -x $DAEMON || exit 0 + +# Include silentbob defaults if available +if [ -f /etc/default/silentbob ] ; then + . /etc/default/silentbob +fi + +set -e + +case "$1" in + start) + echo -n "Starting $DESC: " + start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ + --exec $DAEMON -- $DAEMON_OPTS + echo "$NAME." + ;; + stop) + echo -n "Stopping $DESC: " + start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \ + --exec $DAEMON + echo "$NAME." + ;; + #reload) + # + # If the daemon can reload its config files on the fly + # for example by sending it SIGHUP, do it here. + # + # If the daemon responds to changes in its config file + # directly anyway, make this a do-nothing entry. + # + # echo "Reloading $DESC configuration files." + # start-stop-daemon --stop --signal 1 --quiet --pidfile \ + # /var/run/$NAME.pid --exec $DAEMON + #;; + restart|force-reload) + # + # If the "reload" option is implemented, move the "force-reload" + # option to the "reload" entry above. If not, "force-reload" is + # just the same as "restart". + # + echo -n "Restarting $DESC: " + start-stop-daemon --stop --quiet --pidfile \ + /var/run/$NAME.pid --exec $DAEMON + sleep 1 + start-stop-daemon --start --quiet --pidfile \ + /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS + echo "$NAME." + ;; + *) + N=/etc/init.d/$NAME + # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $N {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/silentbob/debian/manpage.1.ex b/silentbob/debian/manpage.1.ex new file mode 100644 index 0000000..dddbe34 --- /dev/null +++ b/silentbob/debian/manpage.1.ex @@ -0,0 +1,59 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH SILENTBOB SECTION "Февраль 4, 2007" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +silentbob \- program to do something +.SH SYNOPSIS +.B silentbob +.RI [ options ] " files" ... +.br +.B bar +.RI [ options ] " files" ... +.SH DESCRIPTION +This manual page documents briefly the +.B silentbob +and +.B bar +commands. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBsilentbob\fP is a program that... +.SH OPTIONS +These programs follow the usual GNU command line syntax, with long +options starting with two dashes (`-'). +A summary of options is included below. +For a complete description, see the Info files. +.TP +.B \-h, \-\-help +Show summary of options. +.TP +.B \-v, \-\-version +Show version of program. +.SH SEE ALSO +.BR bar (1), +.BR baz (1). +.br +The programs are documented fully by +.IR "The Rise and Fall of a Fooish Bar" , +available via the Info system. +.SH AUTHOR +silentbob was written by . +.PP +This manual page was written by root , +for the Debian project (but may be used by others). diff --git a/silentbob/debian/manpage.sgml.ex b/silentbob/debian/manpage.sgml.ex new file mode 100644 index 0000000..f76e009 --- /dev/null +++ b/silentbob/debian/manpage.sgml.ex @@ -0,0 +1,156 @@ + manpage.1'. You may view + the manual page with: `docbook-to-man manpage.sgml | nroff -man | + less'. A typical entry in a Makefile or Makefile.am is: + +manpage.1: manpage.sgml + docbook-to-man $< > $@ + + + The docbook-to-man binary is found in the docbook-to-man package. + Please remember that if you create the nroff version in one of the + debian/rules file targets (such as build), you will need to include + docbook-to-man in your Build-Depends control field. + + --> + + + FIRSTNAME"> + SURNAME"> + + Февраль 4, 2007"> + + SECTION"> + root@pc2.lab.com"> + + SILENTBOB"> + + + Debian"> + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2003 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + &dhpackage; + + program to do something + + + + &dhpackage; + + + + + + + + DESCRIPTION + + This manual page documents briefly the + &dhpackage; and bar + commands. + + This manual page was written for the &debian; distribution + because the original program does not have a manual page. + Instead, it has documentation in the &gnu; + Info format; see below. + + &dhpackage; is a program that... + + + + OPTIONS + + These programs follow the usual &gnu; command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. For a complete description, see the + Info files. + + + + + + + + Show summary of options. + + + + + + + + Show version of program. + + + + + + SEE ALSO + + bar (1), baz (1). + + The programs are documented fully by The Rise and + Fall of a Fooish Bar available via the + Info system. + + + AUTHOR + + This manual page was written by &dhusername; &dhemail; for + the &debian; system (but may be used by others). Permission is + granted to copy, distribute and/or modify this document under + the terms of the &gnu; General Public License, Version 2 any + later version published by the Free Software Foundation. + + + On Debian systems, the complete text of the GNU General Public + License can be found in /usr/share/common-licenses/GPL. + + + +
+ + + + diff --git a/silentbob/debian/manpage.xml.ex b/silentbob/debian/manpage.xml.ex new file mode 100644 index 0000000..d972d7b --- /dev/null +++ b/silentbob/debian/manpage.xml.ex @@ -0,0 +1,148 @@ + +.
will be generated. You may view the +manual page with: nroff -man .
| less'. A +typical entry in a Makefile or Makefile.am is: + +DB2MAN=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/\ +manpages/docbook.xsl +XP=xsltproc -''-nonet + +manpage.1: manpage.dbk + $(XP) $(DB2MAN) $< + +The xsltproc binary is found in the xsltproc package. The +XSL files are in docbook-xsl. Please remember that if you +create the nroff version in one of the debian/rules file +targets (such as build), you will need to include xsltproc +and docbook-xsl in your Build-Depends control field. + +--> + + + FIRSTNAME"> + SURNAME"> + + Февраль 4, 2007"> + + SECTION"> + root@pc2.lab.com"> + + SILENTBOB"> + + + Debian"> + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2003 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + &dhpackage; + + program to do something + + + + &dhpackage; + + + + + + + + DESCRIPTION + + This manual page documents briefly the + &dhpackage; and bar + commands. + + This manual page was written for the &debian; distribution + because the original program does not have a manual page. + Instead, it has documentation in the &gnu; + Info format; see below. + + &dhpackage; is a program that... + + + + OPTIONS + + These programs follow the usual &gnu; command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. For a complete description, see the + Info files. + + + + + + + + Show summary of options. + + + + + + + + Show version of program. + + + + + + SEE ALSO + + bar (1), baz (1). + + The programs are documented fully by The Rise and + Fall of a Fooish Bar available via the + Info system. + + + AUTHOR + + This manual page was written by &dhusername; &dhemail; for + the &debian; system (but may be used by others). Permission is + granted to copy, distribute and/or modify this document under + the terms of the &gnu; General Public License, Version 2 any + later version published by the Free Software Foundation. + + + On Debian systems, the complete text of the GNU General Public + License can be found in /usr/share/common-licenses/GPL. + + + +
+ diff --git a/silentbob/debian/menu.ex b/silentbob/debian/menu.ex new file mode 100644 index 0000000..94178a4 --- /dev/null +++ b/silentbob/debian/menu.ex @@ -0,0 +1,2 @@ +?package(silentbob):needs="X11|text|vc|wm" section="Apps/see-menu-manual"\ + title="silentbob" command="/usr/bin/silentbob" diff --git a/silentbob/debian/package.links b/silentbob/debian/package.links new file mode 100644 index 0000000..28d3e38 --- /dev/null +++ b/silentbob/debian/package.links @@ -0,0 +1,9 @@ +usr/bin/silent_bob usr/bin/bob +usr/bin/silent_bob usr/bin/tags +usr/bin/silent_bob usr/bin/the_tt +usr/bin/silent_bob usr/bin/structs +usr/share/man1/silent_bob.1.gz usr/share/man1/bob.1.gz +usr/share/man1/silent_bob.1.gz usr/share/man1/tags.1.gz +usr/share/man1/silent_bob.1.gz usr/share/man1/the_tt.1.gz +usr/share/man1/silent_bob.1.gz usr/share/man1/structs.1.gz + diff --git a/silentbob/debian/postinst.ex b/silentbob/debian/postinst.ex new file mode 100644 index 0000000..b7b3fef --- /dev/null +++ b/silentbob/debian/postinst.ex @@ -0,0 +1,42 @@ +#!/bin/sh +# postinst script for silentbob +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package +# + +case "$1" in + configure) + + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/silentbob/debian/postrm.ex b/silentbob/debian/postrm.ex new file mode 100644 index 0000000..2aa4dde --- /dev/null +++ b/silentbob/debian/postrm.ex @@ -0,0 +1,38 @@ +#!/bin/sh +# postrm script for silentbob +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' overwrit>r> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + + + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/silentbob/debian/preinst.ex b/silentbob/debian/preinst.ex new file mode 100644 index 0000000..2acd254 --- /dev/null +++ b/silentbob/debian/preinst.ex @@ -0,0 +1,38 @@ +#!/bin/sh +# preinst script for silentbob +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `install' +# * `install' +# * `upgrade' +# * `abort-upgrade' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + install|upgrade) + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/silentbob/debian/prerm.ex b/silentbob/debian/prerm.ex new file mode 100644 index 0000000..8779610 --- /dev/null +++ b/silentbob/debian/prerm.ex @@ -0,0 +1,38 @@ +#!/bin/sh +# prerm script for silentbob +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|upgrade|deconfigure) + ;; + failed-upgrade) + ;; + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/silentbob/debian/rules b/silentbob/debian/rules new file mode 100755 index 0000000..0004d86 --- /dev/null +++ b/silentbob/debian/rules @@ -0,0 +1,109 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + + +CFLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif + +config.status: configure + dh_testdir + # Add here commands to configure the package. + ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs" + + +build: build-stamp + +build-stamp: config.status + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + #docbook-to-man debian/silentbob.sgml > silentbob.1 + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + + # Add here commands to clean up after the build process. + -$(MAKE) distclean +ifneq "$(wildcard /usr/share/misc/config.sub)" "" + cp -f /usr/share/misc/config.sub config.sub +endif +ifneq "$(wildcard /usr/share/misc/config.guess)" "" + cp -f /usr/share/misc/config.guess config.guess +endif + + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/silentbob. + $(MAKE) install DESTDIR=$(CURDIR)/debian/silentbob + rm -f plugins/.lib/*.so.* + mkdir -p $(CURDIR)/debian/silentbob/usr/lib/silent_bob/ + cp $(CURDIR)/plugins/.libs/*.so.0.0.0 $(CURDIR)/debian/silentbob/usr/lib/silent_bob/ + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs ChangeLog + dh_installdocs + dh_installexamples +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link `cat debian/package.links` + dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install diff --git a/silentbob/debian/silentbob-default.ex b/silentbob/debian/silentbob-default.ex new file mode 100644 index 0000000..59ed137 --- /dev/null +++ b/silentbob/debian/silentbob-default.ex @@ -0,0 +1,10 @@ +# Defaults for silentbob initscript +# sourced by /etc/init.d/silentbob +# installed at /etc/default/silentbob by the maintainer scripts + +# +# This is a POSIX shell fragment +# + +# Additional options that are passed to the Daemon. +DAEMON_OPTS="" diff --git a/silentbob/debian/silentbob.doc-base.EX b/silentbob/debian/silentbob.doc-base.EX new file mode 100644 index 0000000..dee096d --- /dev/null +++ b/silentbob/debian/silentbob.doc-base.EX @@ -0,0 +1,22 @@ +Document: silentbob +Title: Debian silentbob Manual +Author: +Abstract: This manual describes what silentbob is + and how it can be used to + manage online manuals on Debian systems. +Section: unknown + +Format: debiandoc-sgml +Files: /usr/share/doc/silentbob/silentbob.sgml.gz + +Format: postscript +Files: /usr/share/doc/silentbob/silentbob.ps.gz + +Format: text +Files: /usr/share/doc/silentbob/silentbob.text.gz + +Format: HTML +Index: /usr/share/doc/silentbob/html/index.html +Files: /usr/share/doc/silentbob/html/*.html + + diff --git a/silentbob/debian/watch.ex b/silentbob/debian/watch.ex new file mode 100644 index 0000000..7091bdb --- /dev/null +++ b/silentbob/debian/watch.ex @@ -0,0 +1,22 @@ +# Example watch control file for uscan +# Rename this file to "watch" and then you can run the "uscan" command +# to check for upstream updates and more. +# See uscan(1) for format + +# Compulsory line, this is a version 3 file +version=3 + +# Uncomment to examine a Webpage +# +#http://www.example.com/downloads.php silentbob-(.*)\.tar\.gz + +# Uncomment to examine a Webserver directory +#http://www.example.com/pub/silentbob-(.*)\.tar\.gz + +# Uncommment to examine a FTP server +#ftp://ftp.example.com/pub/silentbob-(.*)\.tar\.gz debian uupdate + +# Uncomment to find new files on sourceforge, for debscripts >= 2.9 +# http://sf.net/silentbob/silentbob-(.*)\.tar\.gz + + diff --git a/silentbob/depcomp b/silentbob/depcomp new file mode 100755 index 0000000..04701da --- /dev/null +++ b/silentbob/depcomp @@ -0,0 +1,530 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2005-07-09.11 + +# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + stat=$? + + if test -f "$tmpdepfile"; then : + else + stripped=`echo "$stripped" | sed 's,^.*/,,'` + tmpdepfile="$stripped.u" + fi + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + outname="$stripped.o" + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mecanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/silentbob/doc/FAQ_koi8r b/silentbob/doc/FAQ_koi8r new file mode 100644 index 0000000..87d1577 --- /dev/null +++ b/silentbob/doc/FAQ_koi8r @@ -0,0 +1,36 @@ +UTF8 + +Q. þÔÏ Ó ÐÌÁÔÆÏÒÍÁÍÉ ? +A. ðÏËÁ ÔÏÌØËÏ Linux/ix86. SilentBob × ÐÒÉÎÃÉÐÅ ÎÅ ÂÕÄÅÔ ÒÁÂÏÔÁÔØ ÎÁ Win É Mac OS. + âÁÇÉ ËÏÍÐÉÌÑÃÉÉ ÎÁ ÄÒÕÇÉÈ ÐÌÁÔÆÏÒÍÁÈ, ÐÏ-×ÏÚÍÏÖÎÏÓÔÉ, ÂÕÄÕ ÆÉËÓÉÔØ (ÖÄÕ ÂÁÇ-ÒÅÐÏÒÔÏ×). + +Q. ðÏÞÅÍÕ SilentBob ÎÁÐÉÓÁÎ ÎÁ óÉ++ ? +A. ÷ SilentBob ÔÒÅÂÕÀÔÓÑ ËÏÎËÒÅÔÎÙÅ ÍÏÄÕÌÉ, ×ÙÐÏÌÎÑÀÝÉÅ ËÏÎËÒÅÔÎÙÅ ×ÅÝÉ. íÎÅ ÉÚÎÁÞÁÌØÎÏ ÎÅ ÍÏÇ + ÐÏÔÒÅÂÏ×ÁÔØÓÑ ËÏÄ, Ë ÐÒÉÍÅÒÕ, ÄÌÑ ÏÔÐÒÁ×ËÉ ÐÉÓØÍÁ ÐÒÅÚÉÄÅÎÔÕ. á ÎÕÖÎÙÅ ÍÏÄÕÌÉ ÕÖÅ ÎÁÐÉÓÁÎÙ, + É ÒÅÁÌÉÚÁÃÉÑ ÉÈ ÎÁ óÉ++ ÐÒÅÄÓÔÁ×ÌÑÅÔÓÑ ÓÁÍÏÊ ÒÁÃÉÏÎÁÌØÎÏÊ. + +Q. éÓÐÏÌØÚÕÅÔ ÌÉ SilentBob Yacc/Bison etc. ? +A. îåô. ôÁ ÉÎÆÏÒÍÁÃÉÑ, ËÏÔÏÒÕÀ ×ÙÄÁÀÔ ÏÚÎÁÞÅÎÎÙÅ ÐÒÏÇÒÁÍÍÙ, ÏÞÅÎØ ÉÚÂÙÔÏÞÎÁ, É SilentBob ×ÓÅ ÒÁ×ÎÏ ÎÅ ÓÍÏÖÅÔ + ÅÅ ÏÂÒÁÂÏÔÁÔØ, ÉÂÏ ÜÔÏ ×ÓÅ-ÔÁËÉ ÎÅ ËÏÍÐÉÌÑÔÏÒ. ÷ÓÅ ÐÒÏÂÌÅÍÙ, ËÏÔÏÒÙÅ Ñ ÒÅÛÁÀ SilentBob'ÏÍ, ÏÂÒÁÂÁÔÙ×ÁÀÔÓÑ + 2-ÍÑ, 3-ÍÑ if'ÁÍÉ ÄÌÑ ËÁÖÄÏÇÏ ÏÐÅÒÁÔÏÒÁ ËÏÄÁ É ÏÔÓÌÅÖÉ×ÁÎÉÅÍ ËÏÎÔÅËÓÔÁ. + +Q. þÔÏ Ó óÉ++ ? +A. ÷Ù ÍÏÖÅÔÅ ×ÙÐÏÌÎÑÔØ ×ÓÅ ÔÅ ÖÅ ÏÐÅÒÁÃÉÉ ÞÔÏ É Ó óÉ, ÎÏ ÎÅËÏÔÏÒÙÅ ÐÒÏÂÌÅÍÙ ÚÄÅÓØ ×ÓÅ-ÔÁËÉ ÐÒÉÓÕÔÓÔ×ÕÀÔ. + éÚ ÓÅÒØÅÚÎÙÈ - ÏÔÓÕÔÓÔ×ÉÅ ÐÏÄÄÅÒÖËÉ template'Ï×. + +Q. ëÁËÉÅ ÐÒÏÂÌÅÍÙ ÓÕÝÅÓÔ×ÕÀÔ Ó ÄÏÂÁ×ÌÅÎÉÅÍ ÆÕÎËÃÉÏÎÁÌØÎÏÓÔÉ/ÑÚÙËÏ× × SilentBob ? +A. óÒÁÚÕ ÈÏÞÕ ÏÔÍÅÔÉÔØ, ÞÔÏ ÐÒÏÂÌÅÍÙ ÜÔÉ _ÎÅ Ó×ÑÚÁÎÙ_ Ó ÔÅÍ, ÞÔÏ Ñ ÎÅ ÉÓÐÏÌØÚÕÀ Bison. + ðÒÏÇÒÁÍÍÁ SilentBob ÉÚÎÁÞÁÌØÎÏ ÐÉÓÁÌÁÓØ ÄÌÑ ÒÁÂÏÔÙ Ó ËÏÄÏÍ, Á ÜÔÏ ÐÏÎÑÔÉÅ ÄÏ×ÏÌØÎÏ ÏÂÛÉÒÎÏÅ. ïÄÎÁËÏ Ñ ÎÅ + ×ÉÖÕ ÓÍÙÓÌÁ ÒÅÁÌÉÚÏ×Ù×ÁÔØ ÔÏÌØËÏ ÆÕÎËÃÉÏÎÁÌ ÐÏ ÓÏÚÄÁÎÉÀ ÆÁÊÌÁ ./tags ÄÌÑ ÄÒÕÇÉÈ ÑÚÙËÏ×, ÉÂÏ, Ë ÐÒÉÍÅÒÕ, + ÐÒÏÇÒÁÍÍÉÓÔÕ ÎÁ Java ÓËÏÒÅÅ ÐÒÉÇÏÄÉÔÓÑ ÐÏÉÓË ÎÕÖÎÏÇÏ ËÏÍÍÅÎÔÁÒÉÑ. + +Q. îÁ ÓËÏÌØËÏ ÓÌÏÖÎÏ ÄÏÂÁ×ÉÔØ ÎÏ×ÕÀ ×ÏÚÍÏÖÎÏÓÔØ × SilentBob ? +A. åÓÌÉ ÜÔÏ ÑÚÙË, ÄÌÑ ËÏÔÏÒÏÇÏ × SilentBob ÕÖÅ ÎÁÐÉÓÁÎ ÐÒÅÐÒÏÃÅÓÓÏÒ, ÄÏÂÁ×ÌÅÎÉÅ ÆÕÎËÃÉÏÎÁÌØÎÏÓÔÉ Ó×ÏÄÉÔÓÑ + Ë ËÏÐÉÒÏ×ÁÎÉÀ ÛÁÂÌÏÎÎÏÇÏ ÐÌÁÇÉÎÁ, ×ÓÔÁ×ËÉ ËÏÄÁ ÚÁÐÕÓËÁ ÎÕÖÎÏÇÏ ÐÒÅÐÒÏÃÅÓÓÏÒÁ (ÐÁÒÁ ÓÔÒÏÞÅË) É ËÏÄÁ + ÄÌÑ ÉÔÅÒÁÃÉÉ (ÐÁÒÁ if'Ï×). üÔÏ ÎÁÇÌÑÄÎÏ ×ÉÄÎÏ, Ë ÐÒÉÍÅÒÕ, × plugins/plugin_perl.cxx (ÆÕÎËÃÉÑ perl_make_ctags). + åÓÌÉ ÜÔÏ ÑÚÙË, ÄÌÑ ËÏÔÏÒÏÇÏ ÎÉ ÏÄÉÎ ÉÚ ÐÒÅÄÌÏÖÅÎÎÙÈ ÐÒÅÐÒÏÃÅÓÓÏÒÏ× ÎÅ ÐÏÄÈÏÄÉÔ, ×Ù ÍÏÖÅÔÅ ÎÁÐÉÓÁÔØ ÜÔÏÔ + ÐÒÅÐÒÏÃÅÓÓÏÒ, ÌÉÂÏ ÏÔÐÒÁ×É× ÍÎÅ "ÔÏÎËÉÊ ÎÁÍÅË" × ×ÉÄÅ ÓÐÅÃÉÆÉËÁÃÉÉ ÑÚÙËÁ É ÐÏÍÅÔËÏÊ SilentBob × ÔÅÍÅ. + +Q. þÔÏ c deb-ÐÁËÅÔÏÍ ? +A. ñ ÄÅÌÁÀ deb ÐÁËÅÔÙ SilentBob'Á, ÏÄÎÁËÏ ÎÅ ÍÏÇÕ ÐÏÄÄÅÒÖÉ×ÁÔØ ÉÈ × ×ÅÔËÅ ÄÉÓÔÒÉÂÕÔÉ×Á Debian. éÚ×ÉÎÉÔÅ. + diff --git a/silentbob/doc/FAQ_utf8 b/silentbob/doc/FAQ_utf8 new file mode 100644 index 0000000..8f7aa11 --- /dev/null +++ b/silentbob/doc/FAQ_utf8 @@ -0,0 +1,36 @@ +UTF8 + +Q. Что с платформами ? +A. Пока только Linux/ix86. SilentBob в принципе не будет работать на Win и Mac OS. + Баги компиляции на других платформах, по-возможности, буду фиксить (жду баг-репортов). + +Q. Почему SilentBob написан на Си++ ? +A. В SilentBob требуются конкретные модули, выполняющие конкретные вещи. Мне изначально не мог + потребоваться код, к примеру, для отправки письма президенту. А нужные модули уже написаны, + и реализация их на Си++ представляется самой рациональной. + +Q. Использует ли SilentBob Yacc/Bison etc. ? +A. НЕТ. Та информация, которую выдают означенные программы, очень избыточна, и SilentBob все равно не сможет + ее обработать, ибо это все-таки не компилятор. Все проблемы, которые я решаю SilentBob'ом, обрабатываются + 2-мя, 3-мя if'ами для каждого оператора кода и отслеживанием контекста. + +Q. Что с Си++ ? +A. Вы можете выполнять все те же операции что и с Си, но некоторые проблемы здесь все-таки присутствуют. + Из серьезных - отсутствие поддержки template'ов. + +Q. Какие проблемы существуют с добавлением функциональности/языков в SilentBob ? +A. Сразу хочу отметить, что проблемы эти _не связаны_ с тем, что я не использую Bison. + Программа SilentBob изначально писалась для работы с кодом, а это понятие довольно обширное. Однако я не + вижу смысла реализовывать только функционал по созданию файла ./tags для других языков, ибо, к примеру, + программисту на Java скорее пригодится поиск нужного комментария. + +Q. На сколько сложно добавить новую возможность в SilentBob ? +A. Если это язык, для которого в SilentBob уже написан препроцессор, добавление функциональности сводится + к копированию шаблонного плагина, вставки кода запуска нужного препроцессора (пара строчек) и кода + для итерации (пара if'ов). Это наглядно видно, к примеру, в plugins/plugin_perl.cxx (функция perl_make_ctags). + Если это язык, для которого ни один из предложенных препроцессоров не подходит, вы можете написать этот + препроцессор, либо отправив мне "тонкий намек" в виде спецификации языка и пометкой SilentBob в теме. + +Q. Что c deb-пакетом ? +A. Я делаю deb пакеты SilentBob'а, однако не могу поддерживать их в ветке дистрибутива Debian. Извините. + diff --git a/silentbob/gclib/AUTHORS b/silentbob/gclib/AUTHORS new file mode 100644 index 0000000..b407ab8 --- /dev/null +++ b/silentbob/gclib/AUTHORS @@ -0,0 +1 @@ +Oleg Puchinin diff --git a/silentbob/gclib/Makefile.am b/silentbob/gclib/Makefile.am new file mode 100644 index 0000000..1bfdcf4 --- /dev/null +++ b/silentbob/gclib/Makefile.am @@ -0,0 +1 @@ +SUBDIRS=src diff --git a/silentbob/gclib/Makefile.in b/silentbob/gclib/Makefile.in new file mode 100644 index 0000000..589d754 --- /dev/null +++ b/silentbob/gclib/Makefile.in @@ -0,0 +1,479 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = gclib +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in AUTHORS +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = src +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu gclib/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu gclib/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/silentbob/gclib/include/gclib/best_names.h b/silentbob/gclib/include/gclib/best_names.h new file mode 100644 index 0000000..fcc7fed --- /dev/null +++ b/silentbob/gclib/include/gclib/best_names.h @@ -0,0 +1,18 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_BEST_NAMES_H +#define DEFINE_BEST_NAMES_H + +typedef EHash Hash; +typedef EList List; +typedef EList AV; +typedef EArray Array; +typedef DJobs Jobs; +typedef DHeapSort HeapSort; + +#endif + diff --git a/silentbob/gclib/include/gclib/darray.h b/silentbob/gclib/include/gclib/darray.h new file mode 100644 index 0000000..e01e77e --- /dev/null +++ b/silentbob/gclib/include/gclib/darray.h @@ -0,0 +1,40 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DARRAY_H +#define DEFINE_DARRAy_H + +class DArray +{ +public: + DArray (int asize = 0); + ~DArray (); + + bool add (char * VALUE); + void drop (); + char * get (int NUM); + int get_size (); + int set_size (int); + inline char ** get_skeleton () + { + return values; + } + void foreach (Dfunc_t); + void set (long, char *); + void init (int asize); + bool from_file (char * __from); + inline int get_real_size () { + return size; + } + +private: + char ** values; + int size; + int used; + +}; + +#endif diff --git a/silentbob/gclib/include/gclib/dexec.h b/silentbob/gclib/include/gclib/dexec.h new file mode 100644 index 0000000..4d1416e --- /dev/null +++ b/silentbob/gclib/include/gclib/dexec.h @@ -0,0 +1,14 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DEXEC_H +#define DEFINE_DEXEC_H + +gclib_c__export void Djob_init (struct __djob_t * ctx); +gclib_c__export int Dexec_done (struct __djob_t *ctx); + +#endif + diff --git a/silentbob/gclib/include/gclib/dhash.h b/silentbob/gclib/include/gclib/dhash.h new file mode 100644 index 0000000..0e17852 --- /dev/null +++ b/silentbob/gclib/include/gclib/dhash.h @@ -0,0 +1,33 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DHASH_H +#define DEFINE_DHASH_H +class DHash +{ +public: + DHash (int asize = 256); + ~DHash (); + bool set (char * KEY, char * DATA, int TYPE = DHASH_LPCHAR); + bool set (char * KEY, long DATA, int TYPE = DHASH_INT); + char * get (char * KEY); + char * del (char * KEY); + inline char ** get_keys () { return keys; } + inline char ** get_values () { return values; } + inline int * get_types () { return types; } + inline int get_size () { return size; } + void foreach (Dhash_f func); + int from_file (char *f_name); + +private: + char ** keys; + char ** values; + int * types; + int size; +}; + +#endif + diff --git a/silentbob/gclib/include/gclib/dheapsort.h b/silentbob/gclib/include/gclib/dheapsort.h new file mode 100644 index 0000000..a960d64 --- /dev/null +++ b/silentbob/gclib/include/gclib/dheapsort.h @@ -0,0 +1,29 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DHEAP_SORT_H +#define DHEAP_SORT_H + +class DHeapSort +{ + public: + char ** h; + int size; + + DHeapSort (int); + ~DHeapSort (); + + char * add (char *x); + char * extract_min (); + + private: + void checkup (int c); + void checkdown (int c); + +}; + +#endif + diff --git a/silentbob/gclib/include/gclib/djob_t.h b/silentbob/gclib/include/gclib/djob_t.h new file mode 100644 index 0000000..80a5d19 --- /dev/null +++ b/silentbob/gclib/include/gclib/djob_t.h @@ -0,0 +1,30 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DJOB_T_H +#define DEFINE_DJOB_T_H + +struct __djob_t +{ + __pid_t pid; + int exit_status; + char status_ready; + char * user_data; + int stdIn; + int stdOut; + int stdErr; + int pipe_in[2]; + int pipe_out[2]; + int pipe_err[2]; + char * shared_mem; + int shm_size; + char child; + char *otmp_name; + char *etmp_name; +}; + +#endif + diff --git a/silentbob/gclib/include/gclib/djobs.h b/silentbob/gclib/include/gclib/djobs.h new file mode 100644 index 0000000..2cfe507 --- /dev/null +++ b/silentbob/gclib/include/gclib/djobs.h @@ -0,0 +1,32 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DJOBS_H +#define DEFINE_DJOBS_H +#include "djob_t.h" + +class DJobs : public EList +{ + public: + DJobs (); + ~DJobs (); + + __djob_t * add (int pid, char * user_data = NULL); + __djob_t * attach (__djob_t * j); + __djob_t * zombie (); + __djob_t * by_pid (pid_t pid); + __djob_t * fork (); + __djob_t * wait_all (); + + private: + __djob_t * alloc_job (); + void __close_job_fds (__djob_t * j); + __djob_t * __do_zombie (pid_t pid, int status); +}; + +#endif + + diff --git a/silentbob/gclib/include/gclib/dlist.h b/silentbob/gclib/include/gclib/dlist.h new file mode 100644 index 0000000..97e3406 --- /dev/null +++ b/silentbob/gclib/include/gclib/dlist.h @@ -0,0 +1,88 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_DLIST_H +#define DEFINE_DLIST_H + +struct __dlist_entry_t; +struct __dlist_entry_t { + char * data; + __dlist_entry_t * next; + __dlist_entry_t * prev; +}; + +class DList { + public: + inline DList () { + head = NULL; + tail = NULL; + dont_free = false; + ecount = 0; + } + + ~DList (); + + inline char * init (char * one) { + head = new_one (one); + tail = head; + return one; + } + + char * init (__dlist_entry_t * one); + char * add_head (char *); + char * add_tail (char *); + void rm (__dlist_entry_t *); + + inline void del (__dlist_entry_t *entry) { + rm (entry); + } + + inline void remove (__dlist_entry_t *entry) { + rm (entry); + } + + void detach (__dlist_entry_t * one); + char * add_after (__dlist_entry_t *, char *); + char * add_before (__dlist_entry_t *, char *); + char * add_entry_head (__dlist_entry_t * one); + char * add_entry_tail (__dlist_entry_t * one); + char * add_entry_after (__dlist_entry_t *, __dlist_entry_t *); + char * add_entry_before (__dlist_entry_t *, __dlist_entry_t *); + void foreach (Dfunc_t); + + inline __dlist_entry_t * new_one (char * one) { + __dlist_entry_t *entry; + entry = new __dlist_entry_t; + memset (entry, 0, sizeof (__dlist_entry_t)); + entry->data = one; + ++ecount; + return entry; + } + + inline int count () { + return ecount; + } + + inline __dlist_entry_t * get_head () { + return head; + } + + inline __dlist_entry_t * get_tail () { + return tail; + } + + __dlist_entry_t * get_entry_at (int N); + char * get_at (int N); + + bool dont_free; + + private: + __dlist_entry_t * head; + __dlist_entry_t * tail; + int ecount; +}; +#endif + diff --git a/silentbob/gclib/include/gclib/earray.h b/silentbob/gclib/include/gclib/earray.h new file mode 100644 index 0000000..adbc9d4 --- /dev/null +++ b/silentbob/gclib/include/gclib/earray.h @@ -0,0 +1,47 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_EARRAY_H +#define DEFINE_EARRAY_H + +class EArray : public DArray +{ + public: + EArray (int asize = 0); + + int sfind (char * d_find); + int snfind (char * d_find); + int add (long d_one); + + int find (long d_one); + int del (long d_one); + + int inline add (char * d_one) { + return add ((long) d_one); + } + +/// \note "find (char *)" search a pointer, not a string. Use sfind (or snfind) instead. + + inline char * operator [] (int n) { + return get (n); + } + + void push (char ** d_push); + int snfind_fast (char *str, int n); + char * join (char * mid = NULL, int *len_out = NULL); + + int from_pipe (int fd); + int strings_to_file (char *f_name); + int expand (EArray * e); + int expand (char *S, char * split); + int dump (char * d_join); + + EArray & operator <<(char *); + +}; + +#endif + diff --git a/silentbob/gclib/include/gclib/ehash.h b/silentbob/gclib/include/gclib/ehash.h new file mode 100644 index 0000000..9253c15 --- /dev/null +++ b/silentbob/gclib/include/gclib/ehash.h @@ -0,0 +1,29 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_EHASH_H +#define DEFINE_EHASH_H + +class EHash : public EList +{ + public: + EHash (); + ~EHash (); + + char * set (char *KEY, char *SET); + char * get (char *KEY); + char * del (char *KEY); + int from_file (char *f_name); + void foreach (Dhash_f f); + char * operator [] (char *S); + + inline char * get () { + return EList::get (); + } +}; + +#endif + diff --git a/silentbob/gclib/include/gclib/elist.h b/silentbob/gclib/include/gclib/elist.h new file mode 100644 index 0000000..6d6fb4b --- /dev/null +++ b/silentbob/gclib/include/gclib/elist.h @@ -0,0 +1,36 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_ELIST_H +#define DEFINE_ELIST_H + +class EList : public DList +{ + public: + EList (); + ~EList (); + + char * get (); + char * first (); + char * last (); + char * next (); + char * prev (); + char * rm (); + bool eol (); + inline char * del () { + return rm (); + } + inline char * add (char *S) { + return add_tail (S); + } + EList & operator << (char *); + + private: + __dlist_entry_t * pos; +}; + +#endif + diff --git a/silentbob/gclib/include/gclib/gclib.h b/silentbob/gclib/include/gclib/gclib.h new file mode 100644 index 0000000..ab37138 --- /dev/null +++ b/silentbob/gclib/include/gclib/gclib.h @@ -0,0 +1,93 @@ +/* + * (c) Oleg Puchinin 2005,2006,2007 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_GCLIB_H +#define DEFINE_GCLIB_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +typedef unsigned int uint32_t; +#define __export extern "C" +#else +#define __export extern +#endif +typedef unsigned char uchar_t; + +#define PUT(arga) DROP(arga) +#define Dmemused mallinfo().uordblks +#define LPCHAR(arga) (char *) arga +#define DARRAY(arga) ((DArray *) arga) +#define container_of(var, type) ((type) var) +#define OBJECT(object,type) ((type) object) +#define DRET(type) ((type) cur_ret) +#define DSRET(ret) cur_ret = (long) ret; + +#ifndef min +#define min(arga,argb) (arga < argb ? arga : argb) +#define max(arga,argb) (arga > argb ? arga : argb) +#endif + +#define MAXSTRSIZE 256 + +typedef void (*Dfunc_t)(void *); +typedef void (*Dhash_f)(char *, char *); + +enum DHASH_TYPES +{ + DHASH_LPCHAR, + DHASH_INT, + DHASH_OTHER +}; + +#include "dhash.h" +#include "darray.h" +#include "earray.h" +#include "dlist.h" +#include "elist.h" +#include "ehash.h" +#include "dheapsort.h" +#include "djobs.h" + +struct dkey_t { + char *KEY; + char *VALUE; +}; + +#ifdef I_IN_DLIB_CODE +struct dirent * cur_dir_ent = NULL; +int cur_dir_fd = 0; +int cur_ret = 0; +#else +__export struct dirent * cur_dirent; +__export int cur_dir_fd; +__export int cur_ret; +#endif + +__export DArray * Dfiles (char * path); +DArray * Dsplit (char * STR, char *ch); // 2005. +int Dsplit (char * STR, char *ch, DList * to_list); +__export int Dposix_fadvise (int fd, int offset, int len, int advice); + +#undef __export +#define __export + +#endif + diff --git a/silentbob/gclib/include/gclib/gclib_c.h b/silentbob/gclib/include/gclib/gclib_c.h new file mode 100644 index 0000000..e8cc88f --- /dev/null +++ b/silentbob/gclib/include/gclib/gclib_c.h @@ -0,0 +1,106 @@ +/* + * (c); Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_GCLIBC_H +#define DEFINE_GCLIBC_H + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef gclib_c__export +#undef gclib_c__export +#endif + +#ifdef __cplusplus +#define gclib_c__export extern "C" +#else +#define gclib_c__export extern +typedef char bool; +#endif + +#include "djob_t.h" +#include "dexec.h" + +gclib_c__export void print_the_time (FILE * file_my); +gclib_c__export int close_pipe (int *fds); +gclib_c__export void Dfastsort_s(char ** a, long N); +gclib_c__export void Dtimer (); +gclib_c__export struct timeval *the_time (); +gclib_c__export int Dterm_one_kick (int fd); +gclib_c__export char *Dversion (); +gclib_c__export int Dfnwrite (char * p_lpsz_filename, void * p_lp_buffer,int int_size); +gclib_c__export int Dfnread (char * f_name, void * p_lp_buffer, int int_size); +gclib_c__export int Dselect (int FILENO, int SEC, int USEC); +gclib_c__export char * DFILE (const char * m_filename, int *rsize); +gclib_c__export struct stat * DSTAT (const char * S); +gclib_c__export struct stat * DLSTAT (const char * S); +gclib_c__export int DIONREAD (int fd); +gclib_c__export int fsize (const char * S); +gclib_c__export int fdsize (int fd); +gclib_c__export char * DFDMAP (int fd); +gclib_c__export char * DFMAP (const char *d_file, int *out_fd, int *d_out_size); +gclib_c__export char * Dread_to_eof (int fd, int *d_out_size); +gclib_c__export int move_stream (int fd_in, int fd_out); +gclib_c__export int Dnonblock(int fd); +gclib_c__export char * gc_realloc (char * PTR, int old_size, int new_size); +gclib_c__export void * memdup (void * PTR, int size); +//gclib_c__export int Dsplit(char * lpsz_String, char *ch, char ** outbuffer, int int_buffersize); +gclib_c__export char * Dstrmid(char * lpsz_string,char * param1, char * param2); +gclib_c__export char * chomp (char * S); +gclib_c__export char * DSTR (FILE * m_file); +gclib_c__export char * strchr_r (char * S, char ch, int d_len); +gclib_c__export char * strchrs (char *S, char ch, char ch2, char ch3, char ch4); +gclib_c__export char * Dstrstr_r (char *where, char * str); +gclib_c__export char * Dstrndup (char *ptr, int n); +gclib_c__export char * Dtimestr (char * buf, int max); +gclib_c__export int Dsyms (char * from, char * to, char sym); +gclib_c__export char * Dmemchr (char *from, int n, char ch); +gclib_c__export char * Dmid_strchr (char *ptr, char *end, char ch); +gclib_c__export char * Dmid_getstr (char *buf, char *end); +gclib_c__export char * Drand_str (char * buf, int count); +gclib_c__export char * int2str (int i); +gclib_c__export char * Dprogram_read (char *EXEC, int * len_out); +gclib_c__export char * stail (char *S); +gclib_c__export char * strmov (char *buf, char * S); +gclib_c__export char * strip (char *str) ; +gclib_c__export char * strip2 (char *str) ; +gclib_c__export char * Dmemmem (char *haystack, size_t haystacklen, char *needle, size_t needlelen) ; +gclib_c__export char * Dmid_memmem (char * begin, char * last, char * needle, size_t needlelen) ; +gclib_c__export int Dtmpfd (char *name) ; +gclib_c__export int fdclose (int * fd) ; +gclib_c__export char * fext (char *name) ; +gclib_c__export char * Dsprintf (char * fmt, ...) ; +gclib_c__export int logToFile (char * fileName, char * fmt, ...) ; +gclib_c__export int copyFile (char * sourceName, char * destName) ; + +#define if_digit(S) ((*S >= '0') && (*S <= '9')) +#define if_abc(S) ((*S >= 'a' && *S <= 'z') || (*S >= 'A' && *S <= 'Z')) +#define OR(var,val1,val2) ((var == val1) || (var == val2)) + +#ifndef EQ +#define EQ(arga, argb) (!strcmp (arga, argb)) +#endif + +#ifndef NE +#define NE(arga, argb) (strcmp (arga, argb)) +#endif + +#ifndef chop +#define chop(arg1) arg1[strlen(arg1) - 1] = 0 +#endif + +#define DROP(arga) if (arga) { free (arga); arga = NULL; } +#define CNEW(arga,argb) (arga *)malloc (sizeof (arga)*(argb)) + +#undef gclib_c__export +#endif + diff --git a/silentbob/gclib/src/Makefile.am b/silentbob/gclib/src/Makefile.am new file mode 100644 index 0000000..b058411 --- /dev/null +++ b/silentbob/gclib/src/Makefile.am @@ -0,0 +1,16 @@ +INCLUDES=-I$(top_srcdir)/include -I$(top_srcdir)/gclib/include +lib_LTLIBRARIES=libgclib.la +libgclib_la_SOURCES= darray.cxx \ + deprecated_dsplit.cxx \ + dhash.cxx \ + dheapsort.cxx \ + djobs.cxx \ + dlist.cxx \ + dsplit.cxx \ + earray.cxx \ + ehash.cxx \ + elist.cxx \ + fs.cxx \ + gclib.cxx \ + gclib_c.c + diff --git a/silentbob/gclib/src/Makefile.in b/silentbob/gclib/src/Makefile.in new file mode 100644 index 0000000..626f460 --- /dev/null +++ b/silentbob/gclib/src/Makefile.in @@ -0,0 +1,518 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = gclib/src +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +libgclib_la_LIBADD = +am_libgclib_la_OBJECTS = darray.lo deprecated_dsplit.lo dhash.lo \ + dheapsort.lo djobs.lo dlist.lo dsplit.lo earray.lo ehash.lo \ + elist.lo fs.lo gclib.lo gclib_c.lo +libgclib_la_OBJECTS = $(am_libgclib_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libgclib_la_SOURCES) +DIST_SOURCES = $(libgclib_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/gclib/include +lib_LTLIBRARIES = libgclib.la +libgclib_la_SOURCES = darray.cxx \ + deprecated_dsplit.cxx \ + dhash.cxx \ + dheapsort.cxx \ + djobs.cxx \ + dlist.cxx \ + dsplit.cxx \ + earray.cxx \ + ehash.cxx \ + elist.cxx \ + fs.cxx \ + gclib.cxx \ + gclib_c.c + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .cxx .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu gclib/src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu gclib/src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libgclib.la: $(libgclib_la_OBJECTS) $(libgclib_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libgclib_la_OBJECTS) $(libgclib_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/darray.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deprecated_dsplit.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dhash.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dheapsort.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/djobs.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dlist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dsplit.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earray.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ehash.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gclib.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gclib_c.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +.cxx.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cxx.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cxx.lo: +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(libdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-libLTLIBRARIES + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/silentbob/gclib/src/darray.cxx b/silentbob/gclib/src/darray.cxx new file mode 100644 index 0000000..6e9a4cd --- /dev/null +++ b/silentbob/gclib/src/darray.cxx @@ -0,0 +1,126 @@ +/* + * (c) Oleg Puchinin 2005,2006 + * graycardinalster@gmail.com + * + */ + +#include +#include + +DArray::DArray (int asize) +{ + init (asize); +} + +DArray::~DArray () +{ + drop (); +} + +char * DArray::get (int NUM) +{ + if (NUM >= size) + return NULL; + + if (NUM < 0) + return NULL; + + return values[NUM]; +} + +bool DArray::add (char * VALUE) +{ + if (values == NULL) { + used = 0; + size = 16; + values = CNEW(char *,size); + memset (values, 0, sizeof (char *) * size); + } + + if (used < size) { + values[used] = VALUE; + used++; + return true; + } else { + values = (char **) gc_realloc ((char *)values, + (sizeof (char *)*size), + (sizeof (char *) * (size << 1))); + if (values == NULL) + return false; + size <<= 1; + values[used] = VALUE; + used++; + return true; + } +} + +void DArray::drop () +{ + if (values) { + delete [] values; + values = NULL; + } + used = 0; + size = 0; +} + +int DArray::get_size () +{ + return used; +} + +int DArray::set_size (int a_used) +{ + int old = used; + used = a_used; + return old; +} + +void DArray::foreach (Dfunc_t FUNC) +{ + for (int i = 0; i < used; i++) + FUNC(values[i]); +} + +void DArray::set (long ARGA, char * S) +{ + values[ARGA] = S; +} + +void DArray::init (int asize) +{ + values = NULL; + used = 0; + if (asize > 0) { + size = asize; + } else { + size = 16; + asize = 16; + } + + values = CNEW(char *, asize); + memset (values, 0, asize * sizeof (char *)); +} + +bool DArray::from_file (char * __from) +{ + char * buf; + FILE * m_file; + + m_file = fopen (__from, "r"); + if (m_file == NULL) + return false; + + buf = CNEW (char, 256); + while (true) { + if (fgets (buf, 256, m_file) == NULL) + break; + + add (strdup (buf)); + } + + fclose (m_file); + DROP (buf); + return true; +} + diff --git a/silentbob/gclib/src/deprecated_dsplit.cxx b/silentbob/gclib/src/deprecated_dsplit.cxx new file mode 100644 index 0000000..e4501dd --- /dev/null +++ b/silentbob/gclib/src/deprecated_dsplit.cxx @@ -0,0 +1,41 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include + +/* 2005 */ +__export DArray * Dsplit (char * STR, char *ch) +{ + DArray * ret = new DArray(128); + char * S; + char * buf = strdup (STR); + char * ptr = buf; + int ch_len; + + if (buf == NULL) + return NULL; + + if (!STR || !ch) { + delete ret; + return NULL; + } + + ch_len = strlen (ch); + while((S = strstr (ptr, ch)) && S) { + *S = 0; + S += ch_len; + ret->add (strdup (ptr)); + ptr = S; + } + + if (strlen (ptr)) + ret->add (strdup (ptr)); + + free (buf); + return ret; +} + diff --git a/silentbob/gclib/src/dhash.cxx b/silentbob/gclib/src/dhash.cxx new file mode 100644 index 0000000..5bedd7d --- /dev/null +++ b/silentbob/gclib/src/dhash.cxx @@ -0,0 +1,141 @@ +/* + * (c) Oleg Puchinin 2005,2006 + * graycardinalster@gmail.com + * + * June 2006 - [DEPRECATED] Use EHash instead. + */ + +#include +#include + +DHash::DHash (int asize) +{ + if (asize) + size = asize; + else + size = 256; + + keys = CNEW(char *, size); + values = CNEW(char *, size); + types = CNEW(int, size); + memset (keys, 0, sizeof (char *) * size); + memset (values, 0, sizeof (char *) * size); + memset (types, 0, (sizeof (int)) * size); +} + +DHash::~DHash () +{ + int i; + + for (i = 0; i < size; i++) { + if (keys[i] != NULL) + free (keys[i]); + } + DROP (keys); + DROP (values); + DROP (types); +} + +bool DHash::set (char * KEY, char * VALUE, int TYPE) +{ + int i; + + for (i = 0; i < size; i++) { + if (keys[i] && EQ (keys[i], KEY)) { + values[i] = VALUE; + types[i] = TYPE; + return true; + } + } + + for (i = 0; i < size; i++) { + if (keys[i] == NULL) { + keys[i] = strdup (KEY); + values[i] = VALUE; + types[i] = TYPE; + return true; + } + } + + return false; +} + +bool DHash::set (char * KEY, long VALUE, int TYPE) +{ + return set (KEY, LPCHAR (VALUE), DHASH_INT); +} + +char * DHash::get (char * KEY) +{ + int i; + + for (i = 0; i < size; i++) { + if (keys[i] && EQ (keys[i], KEY)) { + return values[i]; + } + } + + return NULL; +} + +char * DHash::del (char * KEY) +{ + int i; + + for (i = 0; i < size; i++) { + if (keys[i] && EQ (keys[i], KEY)) { + keys[i] = NULL; + return values[i]; + } + } + + return NULL; +} + +void DHash::foreach (Dhash_f func) +{ + int i; + + for (i = 0; i < size; i++) + func (keys[i], values[i]); +} + +int DHash::from_file (char *f_name) +{ + FILE * f; + char * m_buf; + char * d_key; + char * d_set; + + m_buf = CNEW (char, 4096); + f = fopen (f_name, "r"); + if (! f) + return -1; + + while (true) { + if (fgets (m_buf, 256, f) == NULL) + break; + + if (m_buf[0] == '#') + continue; + + chomp (m_buf); + d_key = strchr (m_buf, '='); + if (! d_key) + continue; + + d_set = d_key; + *d_set = '\0'; + while ((*(--d_key) == ' ' || *d_key == '\t') + && d_key != m_buf) + *d_key = '\0'; + + while (*(++d_set) && (*d_set == ' ' || *d_set == '\t')); + + set (m_buf, strdup (d_set)); + } + + fclose (f); + DROP (m_buf); + return 0; +} diff --git a/silentbob/gclib/src/dheapsort.cxx b/silentbob/gclib/src/dheapsort.cxx new file mode 100644 index 0000000..3754f88 --- /dev/null +++ b/silentbob/gclib/src/dheapsort.cxx @@ -0,0 +1,71 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include + +DHeapSort::DHeapSort (int n) +{ + size = 0; + h = (char **) malloc (sizeof (char *) * n+10); +} + +DHeapSort::~DHeapSort() +{ + if (h) + free (h); +} + +char * DHeapSort::add(char * x) +{ + h[++size]=x; + checkup(size); + return x; +} + +char * DHeapSort::extract_min() +{ + char *x; + if(size <= 0) + return NULL; + x = h[1]; + h[1] = h[size--]; + checkdown (1); + return x; +} + +void DHeapSort::checkup(int c) { + int p; + char * tmp; + p = c>>1; + if (! p) + return; + if (strcmp (h[p], h[c]) > 0) { + tmp = h[p]; h[p] = h[c]; h[c] = tmp; + checkup(p); + } +} + +void DHeapSort::checkdown(int p) +{ + int c; + char * tmp; + c = p<<1; + if (c > size) + return; + if ( ((c+1) <= size) && strcmp (h[c + 1], h[c]) < 0) + ++c; + if (strcmp (h[c], h[p]) < 0) { + tmp = h[c]; + h[c] = h[p]; + h[p] = tmp; + checkdown (c); + } +} + diff --git a/silentbob/gclib/src/djobs.cxx b/silentbob/gclib/src/djobs.cxx new file mode 100644 index 0000000..68e1d40 --- /dev/null +++ b/silentbob/gclib/src/djobs.cxx @@ -0,0 +1,126 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include + +DJobs::DJobs () +{ + +} + +DJobs::~DJobs () +{ + +} + +__djob_t * DJobs::add (int pid, char * user_data) +{ + __djob_t * j; + j = alloc_job (); + j->pid = pid; + j->user_data = user_data; + add_tail (LPCHAR(j)); + return j; +} + +__djob_t * DJobs::attach (__djob_t * j) +{ + if (! j) + return NULL; + + return (__djob_t *) add_tail (LPCHAR(j)); +} + +__djob_t * DJobs::zombie () +{ + pid_t pid; + int status; + + if (! first ()) + return NULL; + + pid = waitpid (-1, &status, WNOHANG); + if (pid <= 0) + return NULL; + + return __do_zombie (pid, status); +} + +__djob_t * DJobs::__do_zombie (pid_t pid, int exit_status) +{ + __djob_t * j = by_pid (pid); + if (j) { + rm (); + j->exit_status = exit_status; + } + return j; +} + +__djob_t * DJobs::wait_all () +{ + __djob_t * j; + int status; + pid_t pid; + + while (first ()) { + pid = waitpid (-1, &status, 0); + if (pid <= 0) + break; + j = __do_zombie (pid, status); + return j; + } + + return NULL; +} + +__djob_t * DJobs::alloc_job () +{ + __djob_t * j; + j = CNEW (__djob_t, 1); + Djob_init (j); + return j; +} + +__djob_t * DJobs::by_pid (pid_t pid) +{ + __djob_t * j; + first (); + while ((j = (__djob_t *) get ()) && j) { + if (j->pid == pid) + return j; + next (); + } + return NULL; +} + +__djob_t * DJobs::fork () +{ + pid_t pid; + __djob_t *j; + + pid = ::fork (); + if (pid < 0) + return NULL; + + j = alloc_job (); + Djob_init (j); + if (pid > 0) + j->pid = pid; + else { + j->pid = getpid (); + j->child = 1; + } + + attach (j); + return j; +} + + + diff --git a/silentbob/gclib/src/dlist.cxx b/silentbob/gclib/src/dlist.cxx new file mode 100644 index 0000000..a622356 --- /dev/null +++ b/silentbob/gclib/src/dlist.cxx @@ -0,0 +1,222 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +/* 2006-05-25 */ + +#include +#include +#include +#include + +DList::~DList () +{ + __dlist_entry_t * one; + __dlist_entry_t * d_del; + if (! head || dont_free) + return; + + one = head; + while (one) { + d_del = one; + one = one->next; + free (d_del); + } + head = NULL; + tail = NULL; +} + +char * DList::init (__dlist_entry_t * one) +{ + head = one; + tail = one; + return one->data; +} + +char * DList::add_head (char * one) +{ + __dlist_entry_t *entry; + + if (head == NULL) + return init (one); + + entry = new_one (one); + head->prev = entry; + entry->next = head; + head = entry; + + return one; +} + +char * DList::add_tail (char * one) +{ + __dlist_entry_t * entry; + if (tail == NULL) + return init (one); + + entry = new_one (one); + tail->next = entry; + entry->prev = tail; + tail = entry; + + return one; +} + +void DList::rm (__dlist_entry_t * one) +{ + if (! one) + return; + + --ecount; + if (one == tail && one == head) { + free (one); + head = NULL; + tail = NULL; + return; + } + + if (one == head) { + head = one->next; + head->prev = NULL; + free (one); + return; + } + + if (one == tail) { + tail = one->prev; + tail->next = NULL; + free (one); + return; + } + + one->prev->next = one->next; + one->next->prev = one->prev; + free (one); +} + +void DList::detach (__dlist_entry_t * one) +{ + if (! one) + return; + + if (one == tail && one == head) { + head = NULL; + tail = NULL; + return; + } + + if (one == head) { + head = one->next; + head->prev = NULL; + return; + } + + if (one == tail) { + tail = one->prev; + tail->next = NULL; + return; + } + + one->prev->next = one->next; + one->next->prev = one->prev; +} + + +char * DList::add_after (__dlist_entry_t *two, char * one) +{ + __dlist_entry_t * entry; + + if (! two || ! one) + return NULL; + + if (two == tail) + return add_tail (one); + + entry = new_one (one); + if (two->next) { + entry->prev = two; + entry->next = two->next; + two->next->prev = entry; + two->next = entry; + } else + return NULL; + + return one; +} + +char * DList::add_before (__dlist_entry_t *two, char * one) +{ + __dlist_entry_t * entry; + + if (! two || ! one) + return NULL; + + if (two == head) + return add_head (one); + + entry = new_one (one); + if (two->prev) { + entry->next = two; + entry->prev = two->prev; + two->prev->next = entry; + two->prev = entry; + } else + return NULL; + + return one; +} + +void DList::foreach (Dfunc_t f) +{ + __dlist_entry_t * entry; + entry = head; + while (entry) { + f((void *) entry->data); + entry = entry->next; + } +} + +char * DList::add_entry_head (__dlist_entry_t * one) +{ + if (head == NULL) + return init (one); + head->prev = one; + one->next = head; + one->prev = NULL; + head = one; + return one->data; +} + +char * DList::add_entry_tail (__dlist_entry_t * one) +{ + if (tail == NULL) + return init (one); + tail->next = one; + one->prev = tail; + one->next = NULL; + tail = one; + return one->data; +} + +__dlist_entry_t * DList::get_entry_at (int N) +{ + __dlist_entry_t * one; + one = get_head (); + if (! one || ! N) + return NULL; + while ((one = one->next) && one && --N); + return NULL; +} + +char * DList::get_at (int N) +{ + __dlist_entry_t * one; + one = get_entry_at (N); + if (! one) + return NULL; + else + return one->data; +} + diff --git a/silentbob/gclib/src/dsplit.cxx b/silentbob/gclib/src/dsplit.cxx new file mode 100644 index 0000000..9b58fed --- /dev/null +++ b/silentbob/gclib/src/dsplit.cxx @@ -0,0 +1,66 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#undef __export +#define __export + +/* 2006-06-07 */ +__export int Dsplit (char * STR, char *ch, DList * to_list) +{ + DList * ret = to_list; + char * S; + char * ptr = STR; + int ch_len; + int count = 0; + + if (!STR || !ch || !ret) + return -1; + + ch_len = strlen (ch); + while((S = strstr (ptr, ch)) && S) { + ret->add_tail (Dstrndup (ptr, S - ptr)); + S += ch_len; + ptr = S; + ++count; + } + + if (strlen (ptr)) { + ret->add_tail (strdup (ptr)); + ++count; + } + + return count; +} + +__export int Dsplit (char * buf, size_t buflen, char *str, EList * to_list) +{ + char * S; + char * ptr = buf; + int str_len; + int count = 0; + char * last; + + if (!buf || !str || !to_list) + return -1; + + last = &buf[buflen-1]; + str_len = strlen (str); + while((S = Dmid_memmem (ptr, last, str, str_len)) && S) { + *to_list << Dstrndup (ptr, S - ptr); + S += str_len; + ptr = S; + ++count; + } + + if (ptr <= last) { + *to_list << Dstrndup (ptr, last-ptr+1); + ++count; + } + + return count; +} + diff --git a/silentbob/gclib/src/earray.cxx b/silentbob/gclib/src/earray.cxx new file mode 100644 index 0000000..d1618b3 --- /dev/null +++ b/silentbob/gclib/src/earray.cxx @@ -0,0 +1,244 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include + +/* Extendent array */ +EArray::EArray (int asize) +{ +} + +int EArray::add (long one) +{ + return DArray::add (LPCHAR (one)); +} + +int EArray::sfind (char * d_find) +{ + int i; + int d_size = get_size (); + char ** d_array = get_skeleton (); + + for (i = 0; i < d_size; i++) { + if (EQ (d_find, d_array[i])) + return i; + } + + return -1; +} + +int EArray::snfind (char * d_find) +{ + int i; + int d_size = get_size (); + char ** d_array = get_skeleton (); + + for (i = 0; i < d_size; i++) { + if (!strncmp (d_find, d_array[i], strlen (d_array[i]))) + return i; + } + + return -1; +} + +void EArray::push (char ** d_push) +{ + int i = 0; + if (d_push == NULL) + return; + + while (d_push[i]) { + add ((long) d_push[i]); + ++i; + } +} + +int EArray::snfind_fast (char *str, int n) +{ + int first; + int last; + int fact; + int check; + int move; + + first = 0; + last = get_size (); + --last; + if (last < 0) + return -1; + + if (strcmp (get (0), str) > 0) + return -1; + + while (true) { + move = (last - first) >> 1; + if (! move) { + if (EQ (get (first), str)) + return first; + if (EQ (get (last), str)) + return last; + return -1; + } + + check = first + move; + if (n) + fact = strncmp (get (check), str, n); + else + fact = strcmp (get (check), str); + + if (fact < 0) { // [check] < str + first = check; + } else if (! fact) { // [check] == str + return check; + } else if (fact > 0) { // [chec] > str + last = check; + } + } + + if (EQ (get (first), str)) + return first; + + return -1; +} + +int EArray::from_pipe (int fd) +{ + char * buf; + FILE * m_file; + + m_file = fdopen (fd, "r"); + if (m_file == NULL) + return false; + + buf = CNEW (char, 256); + while (true) { + if (fgets (buf, 256, m_file) == NULL) + break; + + add (strdup (buf)); + } + + fclose (m_file); + DROP (buf); + return get_size (); +} + +char * EArray::join (char * mid, int *len_out) +{ + char *Ret; + char *ptr; + int count; + int len = 0; + int mid_len; + int i; + + if (! mid) { + mid_len = 0; + mid = ""; + } else + mid_len = strlen (mid); + + count = get_size (); + for (i = 0; i < count; i++) + len += strlen (get (i)); + + if (mid) + len += count * mid_len; + + len++; + Ret = CNEW (char, len); + ptr = Ret; + for (i = 0; i < count; i++) { + strcpy (ptr, (char *) get (i)); + ptr += strlen (get (i)); + strcpy (ptr, mid); + ptr += mid_len; + } + + if (len_out) + *len_out = len; + + return Ret; +} + +int EArray::strings_to_file (char * f_name) +{ + FILE * d_file; + int d_len; + int i; + + d_file = fopen (f_name, "w"); + if (! d_file) + return -1; + + d_len = get_size (); + for (i = 0; i < d_len; ++i) + fprintf (d_file, "%s\n", get (i)); + + fclose (d_file); + return d_len; +} + +EArray & EArray::operator << (char *S) +{ + add (S); + return *this; +} + +int EArray::expand (EArray * e) +{ + int count; + int i; + + if (! e) + return get_size (); + + count = e->get_size (); + if (! count) + return get_size (); + + for (i = 0; i < count; ++i) + add (e->get (i)); + + return get_size (); +} + +int EArray::expand (char *buf, char * split) +{ + char * S; + char * ptr = buf; + int split_len; + char * last; + + if (!buf || !split || !(*buf)) + return -1; + + last = &buf[strlen (buf)-1]; + split_len = strlen (split); + while((S = Dmid_memmem (ptr, last, split, split_len)) && S) { + add (Dstrndup (ptr, S - ptr)); + S += split_len; + ptr = S; + } + + if (ptr <= last) + add (Dstrndup (ptr, last-ptr+1)); + + return get_size (); +} + +int EArray::dump (char * d_join) +{ + int i; + int count; + + count = get_size (); + for (i = 0; i < count; ++i) + printf ("%s%s", get (i), d_join); + + return count; +} diff --git a/silentbob/gclib/src/ehash.cxx b/silentbob/gclib/src/ehash.cxx new file mode 100644 index 0000000..1ddaeef --- /dev/null +++ b/silentbob/gclib/src/ehash.cxx @@ -0,0 +1,142 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +/* 2006-06-07 */ + +#include +#include +#include +#include +#include + +EHash::EHash () +{ + +} + +EHash::~EHash () +{ + +} + +char * EHash::set (char *KEY, char *VALUE) +{ + __dlist_entry_t *entry; + dkey_t * one; + + entry = get_head (); + while (entry) { + one = (dkey_t *) entry->data; + if (EQ (KEY, one->KEY)) { + one->VALUE = VALUE; + break; + } + entry = entry->next; + } + + if (! entry) { + one = CNEW (dkey_t, 1); + one->KEY = strdup (KEY); + one->VALUE = VALUE; + add_tail (LPCHAR (one)); + } + + return KEY; +} + +char * EHash::get (char *KEY) +{ + char * ret = NULL; + __dlist_entry_t * one; + one = get_head (); + + if (! one) + return NULL; + + while (true) { + if (EQ (KEY, ((dkey_t *) one->data)->KEY)) { + ret = ((dkey_t *) one->data)->VALUE; + break; + } + if (! one->next) + break; + one = one->next; + } + return ret; +} + +char * EHash::del (char *KEY) +{ + char * ret = NULL; + __dlist_entry_t * one; + + one = get_head (); + while (one) { + if (EQ (KEY, ((dkey_t *) one->data)->KEY)) { + ret = ((dkey_t *) one->data)->VALUE; + DList::del (one); + break; + } + one = one->next; + } + + return ret; +} + +int EHash::from_file (char *f_name) +{ + FILE * f; + char * m_buf; + char * d_set; + + m_buf = CNEW (char, 4096); + f = fopen (f_name, "r"); + if (! f) + return -1; + + while (true) { + if (fgets (m_buf, 256, f) == NULL) + break; + + if (m_buf[0] == '#') + continue; + + chomp (m_buf); + d_set = strchr (m_buf, '='); + if (! d_set) + continue; + + *d_set = '\0'; + ++d_set; + strip (d_set); + strip2 (m_buf); + printf ("%s = %s\n", m_buf, d_set); + set (m_buf, strdup (d_set)); + } + + fclose (f); + DROP (m_buf); + return 0; +} + +void EHash::foreach (Dhash_f f) +{ + __dlist_entry_t * one; + dkey_t * key; + + one = get_head (); + while (one) { + key = (dkey_t *) one->data; + f (key->KEY, key->VALUE); + one = one->next; + } +} + +char * EHash::operator [] (char *S) +{ + return get (S); +} + diff --git a/silentbob/gclib/src/elist.cxx b/silentbob/gclib/src/elist.cxx new file mode 100644 index 0000000..3c6853a --- /dev/null +++ b/silentbob/gclib/src/elist.cxx @@ -0,0 +1,88 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include + +EList::EList () +{ + pos = NULL; +} + +EList::~EList () +{ +} + +char * EList::get () +{ + if (! pos) + return NULL; + else + return pos->data; +} + +char * EList::first () +{ + pos = get_head (); + return get (); +} + +char * EList::last () +{ + pos = get_tail (); + return get (); +} + +char * EList::next () +{ + if (! pos->next) + pos = NULL; + else + pos = pos->next; + return get (); +} + +char * EList::prev () +{ + if (! pos->prev) + pos = NULL; + else + pos = pos->prev; + return get (); +} + +char * EList::rm () +{ + __dlist_entry_t *ptr; + char * Ret; + + if (! pos) + return NULL; + + ptr = pos; + Ret = ptr->data; + + if (ptr->next) + pos = ptr->next; + else if (ptr->prev) + pos = ptr->prev; + else + pos = NULL; + + DList::rm (ptr); + return Ret; +} + +EList & EList::operator << (char * S) +{ + add_tail (S); + return *this; +} + +bool EList::eol () +{ + return pos ? false : true; +} + diff --git a/silentbob/gclib/src/fs.cxx b/silentbob/gclib/src/fs.cxx new file mode 100644 index 0000000..513855a --- /dev/null +++ b/silentbob/gclib/src/fs.cxx @@ -0,0 +1,126 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include + +__export int Dfnread (char * f_name, void * p_lp_buffer, int int_size) +{ + int n_bytes = int_size > fsize (f_name) ? fsize (f_name) : int_size; + int fd; + + fd = open (f_name, O_RDONLY); + if (fd < 0) + return fd; + + if (read (fd, p_lp_buffer, n_bytes) < 0) + n_bytes = -1; + + close (fd); + return n_bytes; +} + +__export char * Dread_to_eof (int fd, int *d_out_size) +{ + char * d_buf = (char *) malloc (4096); + int d_size = 4096; + int d_pos = 0; + int d_ret = 0; + + if (fd < 0) + return NULL; + + if (d_out_size) + *d_out_size = 0; + + while (-1) { + d_ret = read (fd, &d_buf[d_pos], d_size - d_pos - 1); + if (d_ret == -1) + return NULL; + + if (d_ret == 0) //EOF + break; + + d_pos += d_ret; + if ((d_size - d_pos) < 4096) { + d_buf = gc_realloc (d_buf, d_size, d_size << 1); + d_size<<=1; + if (d_buf == NULL) { + if (d_out_size) + *d_out_size = 0; + return NULL; + } + } + } + + if (d_out_size) + *d_out_size = d_pos; + + d_buf[d_pos] = 0; + return d_buf; +} + +// 24/06/06 +__export DArray * Dfiles (char * path) +{ + DIR * m_dir; + DArray * Ret; + struct dirent * m_dirent; + + if (! path) + return NULL; + + m_dir = opendir (path); + if (! m_dir) + return NULL; + + Ret = new DArray; + while (true) { + m_dirent = readdir (m_dir); + if (! m_dirent) + break; + m_dirent = (struct dirent *) memdup (m_dirent, sizeof (struct dirent)); + Ret->add (LPCHAR (strdup (m_dirent->d_name))); + DROP (m_dirent); + } + + closedir (m_dir); + return Ret; +} + +__export int logToFile (char * fileName, char * fmt, ...) +{ + va_list alist; + FILE * myfile; + myfile = fopen (fileName, "a"); + if (! myfile) { + myfile = fopen (fileName, "w"); + if (! myfile) + return -1; + } + va_start (alist, fmt); + vfprintf (myfile, fmt, alist); + va_end (alist); + fclose (myfile); + return 0; +} + +#ifdef __NR_fadvise64 +int Dposix_fadvise (int fd, int offset, int len, int advice) +{ + return posix_fadvise (fd, offset, len, advice); +// return syscall (__NR_fadvise64, fd, 0, offset, len, advice); +} +#else +int Dposix_fadvise (int fd, int offset, int len, int advice) +{ +#warning "Dposix_fadvise is broken.\n" + return 0; +} +#endif + diff --git a/silentbob/gclib/src/gclib.cxx b/silentbob/gclib/src/gclib.cxx new file mode 100644 index 0000000..bff14aa --- /dev/null +++ b/silentbob/gclib/src/gclib.cxx @@ -0,0 +1,11 @@ +/* + * (c) Oleg Puchinin 2005,2006 + * graycardinalster@gmail.com + * + */ + +#define I_IN_DLIB_CODE +#include + +/* Moved to gclib_c */ + diff --git a/silentbob/gclib/src/gclib_c.c b/silentbob/gclib/src/gclib_c.c new file mode 100644 index 0000000..b7c822e --- /dev/null +++ b/silentbob/gclib/src/gclib_c.c @@ -0,0 +1,676 @@ +/* + * (c) Oleg Puchinin 2006,2007 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define __export +struct timeval *cur_tv = NULL; +struct stat *cur_stat = NULL; + +__export void Djob_init (struct __djob_t * ctx) +{ + memset (ctx, 0, sizeof (struct __djob_t)); + ctx->stdIn = -1; + ctx->stdOut = -1; + ctx->stdErr = -1; + ctx->pipe_in[0] = -1; + ctx->pipe_in[1] = -1; + ctx->pipe_out[0] = -1; + ctx->pipe_out[1] = -1; + ctx->pipe_err[0] = -1; + ctx->pipe_err[1] = -1; + ctx->otmp_name = (char *) malloc (128); + ctx->etmp_name = (char *) malloc (128); + ctx->otmp_name[0] = '\0'; + ctx->etmp_name[0] = '\0'; + ctx->shared_mem = NULL; +} + +__export int Dexec_done (struct __djob_t *ctx) +{ + if (! ctx) + return 0; + + if (ctx->otmp_name) + free (ctx->otmp_name); + + if (ctx->etmp_name) + free (ctx->etmp_name); + + if (ctx->shared_mem) + munmap (ctx->shared_mem, ctx->shm_size); + + fdclose (&ctx->stdIn); + fdclose (&ctx->stdOut); + fdclose (&ctx->stdErr); + free (ctx); + return 0; +} + +__export int Dfnwrite (char * p_lpsz_filename, void * p_lp_buffer,int int_size) +{ + int result; + FILE * myfile; + myfile = fopen(p_lpsz_filename,"w"); + if(!myfile) + return 0; + result = fwrite(p_lp_buffer,1,int_size,myfile); + fclose(myfile); + return result; +} + +__export char * DFILE (const char * m_filename, int *rsize) +{ + char * m_file; + struct stat m_stat; + char * ptr; + int count; + int len; + int fd; + + if (m_filename == NULL) + return NULL; + + fd = open (m_filename, O_RDONLY); + if (fd < 0) + return NULL; + + if (lstat (m_filename, &m_stat) < 0) + return NULL; + + m_file = malloc (m_stat.st_size); + if (m_file == NULL) + return NULL; + + ptr = m_file; + len = m_stat.st_size; + while (-1) { + count = read (fd, ptr, len); + if (count <= 0) + break; + ptr+=count; + len-=count; + } + + if (rsize) + *rsize = m_stat.st_size; + + close (fd); + return m_file; +} + +__export struct stat * DSTAT (const char * S) +{ + if (!cur_stat) + cur_stat = malloc (sizeof (struct stat)); + stat (S, cur_stat); + return cur_stat; +} + +__export struct stat * DLSTAT (const char * S) +{ + if (! cur_stat) + cur_stat = malloc (sizeof (struct stat)); + lstat (S, cur_stat); + return cur_stat; +} + +__export int DIONREAD (int fd) +{ + int ret = -1; + + if (ioctl (fd, FIONREAD, &ret) != 0) + return -1; + + return ret; +} + +__export int fsize (const char * S) +{ + struct stat m_stat; + + if (lstat (S, &m_stat) < 0) + return -1; + + return m_stat.st_size; +} + +__export int fdsize (int fd) +{ + struct stat m_stat; + + if (fstat (fd, &m_stat) < 0) + return -1; + + return m_stat.st_size; +} + +__export char * DFDMAP (int fd) +{ + return (char *) mmap (NULL, fdsize (fd), PROT_READ, MAP_SHARED, fd, 0); +} + +__export char * DFMAP (const char *d_file, int *out_fd, int *d_out_size) +{ + char *S = NULL; + int d_size; + int fd; + + fd = open (d_file, O_RDONLY); + if (fd < 0) + return NULL; + + d_size = fdsize (fd); + + if (d_out_size) + *d_out_size = d_size; + + if (out_fd) + *out_fd = fd; + + S = (char *) mmap (NULL, d_size, PROT_READ, MAP_SHARED, fd, 0); + + if ((long) S == -1) { + close (fd); + return NULL; + } + + return S; +} + +__export int close_pipe (int *fds) +{ + int Ret1 = 0; + int Ret2 = 0; + + if (fds[0] != -1) { + Ret1 = close (fds[0]); + fds[0] = -1; + } + + if (fds[1] != -1) { + Ret2 = close (fds[1]); + fds[1] = -1; + } + + return Ret1 ? Ret1 : Ret2; +} + +__export int Dtmpfd (char *name) +{ + char m_buf[128]; + char tmpstr[64]; + int fd; + + Drand_str (tmpstr, 63); + sprintf (m_buf, "/tmp/%s", tmpstr); + fd = open (m_buf, O_CREAT | O_RDWR); + if (name) { + if (fd >= 0) + strcpy (name, m_buf); + else + name[0] = '\0'; + } + + return fd; +} + +__export int fdclose (int * fd) +{ + if (! fd) + return 0; + + if (*fd != -1) { + close (*fd); + *fd = -1; + } + return 0; +} + +__export char * fext (char *name) +{ + if (! name) + return NULL; + return rindex (name, '.'); +} + +__export void Dtimer () +{ + if (! cur_tv) + cur_tv = malloc (sizeof (struct timeval)); + gettimeofday(cur_tv, NULL); +} + +__export struct timeval *the_time () +{ + struct timeval new_tv; + + if (cur_tv == NULL) + return NULL; + + gettimeofday (&new_tv, NULL); + cur_tv->tv_sec = new_tv.tv_sec - cur_tv->tv_sec; + if (new_tv.tv_usec >= cur_tv->tv_usec) + cur_tv->tv_usec = new_tv.tv_usec - cur_tv->tv_usec; + else { + cur_tv->tv_sec--; + cur_tv->tv_usec = cur_tv->tv_usec - new_tv.tv_usec; + } + + return cur_tv; +} + +__export void print_the_time (FILE * file_my) +{ + if (! the_time ()) + return; + + if (file_my) + fprintf (file_my, "The time : %i.%06i\n", + (int) cur_tv->tv_sec, + (int) cur_tv->tv_usec); + else + printf ("The time : %i.%06i\n", + (int) cur_tv->tv_sec, (int) cur_tv->tv_usec); + +} + +__export int Dterm_one_kick (int fd) +{ + struct termios ttystate; + tcgetattr (fd, &ttystate); + ttystate.c_lflag &= -ICANON; + ttystate.c_cc[VMIN] = 1; + return tcsetattr (fd, TCSANOW, &ttystate); +} + +__export char *Dversion () +{ + return "1.6"; +} + +__export char * Dtimestr (char * buf, int max) +{ + time_t t; + time (&t); + if (! buf) + return NULL; + strftime (buf, max, "%H:%M:%S %d.%m.%Y", localtime (&t)); + return buf; +} + +__export char * gc_realloc (char * PTR, int old_size, int new_size) +{ + int i; + char * S = malloc (new_size); + if (S == NULL) + return NULL; + + i = (new_size >= old_size) ? old_size : new_size; + memcpy (S, PTR, i); + free (PTR); + return S; +} + +__export void * memdup (void * PTR, int size) +{ + char * Ret; + Ret = malloc (size); + memcpy (Ret, PTR, size); + return (void *) Ret; +} + +/* 2005 */ +__export int Dsplit(char * lpsz_String, char *ch, + char ** outbuffer, int int_buffersize) +{ + char * S; + int i; + + i = 1; + --int_buffersize; + + if(!lpsz_String) + return 0; + + if(int_buffersize > 0) { + S = lpsz_String; + outbuffer[0] = S; + } else + return 0; + + S = strstr(S,ch); + while(S && (int_buffersize--)) { + S[0] = 0; + ++S; + outbuffer[i] = S; + S = strstr(S,ch); + ++i; + } + return i; +} + +/// lpsz_string =~ m/param1(.*)param2/ +__export char * Dstrmid(char * lpsz_string,char * param1, char * param2) +{ + char * Result; + char *S; + char *S2; + int int_strsize; + + if(! strlen (param1)) + return 0; + + S = strstr (lpsz_string,param1); + if(! S) + return 0; + S += strlen (param1); + S2 = strstr (S,param2); + if(! S2) + return 0; + + int_strsize = S2 - S; + if(! int_strsize) + return 0; + + Result = malloc (int_strsize + 1); + memcpy (Result, S, int_strsize); + Result [int_strsize] = 0; + return Result; +} + +__export char * chomp (char * S) +{ + char * str; + if (S == NULL) + return NULL; + + str = strstr (S, "\n"); + if (str) + *str = 0; + + return S; +} + +__export char * DSTR (FILE * m_file) +{ + char *S; + if (m_file == NULL) + return NULL; + + S = malloc (256); + if (fgets (S, 256, m_file) != S) + return NULL; + + return S; +} + +__export char * strchr_r (char * S, char ch, int d_len) +{ + if (! d_len) + d_len = strlen (S); + + S += d_len - 1; + while (d_len > 0) { + if (*S == ch) + break; + --S; + --d_len; + } + + return S; +} + +__export char * strchrs (char *S, char ch, char ch2, char ch3, char ch4) +{ + while (*S) { + if (*S == ch) + break; + + if (*S == ch2) + break; + + if (*S == ch3) + break; + + if (*S == ch4) + break; + + S++; + } + + if (*S == ch || *S == ch2 || *S == ch3 || *S == ch4) + return S; + + return NULL; +} + +/* 2006-05-25 */ +__export char * Dstrstr_r (char *where, char * str) +{ + char * S; + int len; + + if (! where || ! str || strlen (where) == 0) + return NULL; + + S = &where[strlen (where)]; + len = strlen (str); + + while (--S != where) { + if (! strncmp (S, str, len)) + return S; + } + + return NULL; +} + +__export int Dsyms (char * from, char * to, char sym) +{ + int count = 0; + do { + if (*from == sym) + ++count; + } while (++from != to); + return count; +} + +__export char * Dmemchr (char * from, int n, char ch) +{ + while (n--) { + if (*from == ch) + return from; + ++from; + } + return NULL; +} + +__export char * Dstrndup (char *ptr, int n) +{ + char *S; + char *buf; + + if (ptr == NULL || n <= 0) + return NULL; + + buf = (char *) malloc (n+1); + S = buf; + while (*ptr && n--) { + *S = *ptr; + ++S; ++ptr; + } + *S = '\0'; + + return buf; +} + +__export char * Dmid_strchr (char *ptr, char *end, char ch) +{ + while (ptr <= end) { + if (*ptr == ch) + return ptr; + ++ptr; + } + return NULL; +} + +__export char * Dmid_getstr (char *buf, char *end) +{ + char *S; + char *out; + int s_len; + + if (! buf || ! end) + return NULL; + + S = Dmid_strchr (buf, end, '\n'); + if (! S) + S = end; + + s_len = S-buf+1; + out = malloc (s_len+1); + memcpy (out, buf, s_len); + out[s_len] = '\0'; + + return out; +} + +__export char * Drand_str (char * buf, int count) +{ + int i; + unsigned char ch; + + if (! buf) + return NULL; + + --count; + for (i = 0; i < count; ++i) { + ch = rand () % ('z' - 'a' - 1); + buf[i] = ch + 'a'; + } + + buf[i] = 0; + return buf; +} + +__export char * int2str (int i) +{ + char buf[64]; + sprintf (buf, "%i", i); + return strdup (buf); +} + +__export char * stail (char *S) +{ + if (! S) + return NULL; + return &S[strlen (S)]; +} + +__export char * strmov (char *buf, char * S) +{ + if (! buf || ! S) + return NULL; + strcpy (buf, S); + return buf+strlen (S); +} + +__export char * strip (char *str) +{ + char *S; + if (! str) + return NULL; + S = str; + while (*S && (*S == '\t' || *S == ' ')) + ++S; + if (S != str) + strcpy (str, S); + return str; +} + +__export char * strip2 (char *str) +{ + char *S; + if (! str) + return NULL; + S = stail (str); + --S; + while (S != str && (*S == ' ' || *S == '\t')) + --S; + ++S; + *S = '\0'; + return str; +} + +__export char * Dmemmem (char *haystack, size_t haystacklen, + char *needle, size_t needlelen) +{ + char * ptr; + char * end; + + if (! haystack || ! needle) + return NULL; + + if (haystacklen < needlelen) + return NULL; + ptr = haystack; + end = &haystack[haystacklen] - needlelen; + while (ptr != end && memcmp (ptr, needle, needlelen)) + ++ptr; + if (ptr == end) + return NULL; + + return ptr; +} + +__export char * Dmid_memmem (char * begin, char * last, + char * needle, size_t needlelen) +{ + char * ptr; + + if (! begin || ! needle) + return NULL; + + if ((last - begin - 1) < needlelen) + return NULL; + + last -= needlelen; + ++last; + ptr = begin; + while (ptr <= last && memcmp (ptr, needle, needlelen)) + ++ptr; + + if (ptr > last) + return NULL; + + return ptr; +} + +__export char * Dsprintf (char * fmt, ...) +{ + char m_buf[512]; + va_list ap; + m_buf[511] = '\0'; + va_start (ap, fmt); + vsnprintf (m_buf, 511, fmt, ap); + va_end (ap); + return strdup (m_buf); +} + diff --git a/silentbob/ideas/Sardar_Java.txt b/silentbob/ideas/Sardar_Java.txt new file mode 100644 index 0000000..d2b89d8 --- /dev/null +++ b/silentbob/ideas/Sardar_Java.txt @@ -0,0 +1,7 @@ +bob MyClass.class - все MyClass во всех пакетах, доступных по classpath, только исходники, на .class говорить что он просто есть +bob herschel.hifi.tools.MyClass - собственно говорит что класс есть, удобно для скриптов +bob MyClass/isEnabled* - все методы с префиксом (реги) isEnabled во всех MyClass. вообще всё может искаться по регам +bob @my_annotation [MyClass] - все аннотации my_annotation из класса MyClass (если не указано, то вообще по проекту) +bob herschel.hifi.tools.MyClass.isEnabled()/@my_* - все аннотатции с префиксом my_ из конкретного метода +bob "This is a big thing!" ищет сию строку во всех коментах ко всем классам +bob MyCass/"The main purpose is to convert" - ищет только в класах MyClass diff --git a/silentbob/ideas/Sardar_Java_koi8r.txt b/silentbob/ideas/Sardar_Java_koi8r.txt new file mode 100644 index 0000000..01b0902 --- /dev/null +++ b/silentbob/ideas/Sardar_Java_koi8r.txt @@ -0,0 +1,7 @@ +bob MyClass.class - ×ÓÅ MyClass ×Ï ×ÓÅÈ ÐÁËÅÔÁÈ, ÄÏÓÔÕÐÎÙÈ ÐÏ classpath, ÔÏÌØËÏ ÉÓÈÏÄÎÉËÉ, ÎÁ .class ÇÏ×ÏÒÉÔØ ÞÔÏ ÏÎ ÐÒÏÓÔÏ ÅÓÔØ +bob herschel.hifi.tools.MyClass - ÓÏÂÓÔ×ÅÎÎÏ ÇÏ×ÏÒÉÔ ÞÔÏ ËÌÁÓÓ ÅÓÔØ, ÕÄÏÂÎÏ ÄÌÑ ÓËÒÉÐÔÏ× +bob MyClass/isEnabled* - ×ÓÅ ÍÅÔÏÄÙ Ó ÐÒÅÆÉËÓÏÍ (ÒÅÇÉ) isEnabled ×Ï ×ÓÅÈ MyClass. ×ÏÏÂÝÅ ×Ó£ ÍÏÖÅÔ ÉÓËÁÔØÓÑ ÐÏ ÒÅÇÁÍ +bob @my_annotation [MyClass] - ×ÓÅ ÁÎÎÏÔÁÃÉÉ my_annotation ÉÚ ËÌÁÓÓÁ MyClass (ÅÓÌÉ ÎÅ ÕËÁÚÁÎÏ, ÔÏ ×ÏÏÂÝÅ ÐÏ ÐÒÏÅËÔÕ) +bob herschel.hifi.tools.MyClass.isEnabled()/@my_* - ×ÓÅ ÁÎÎÏÔÁÔÃÉÉ Ó ÐÒÅÆÉËÓÏÍ my_ ÉÚ ËÏÎËÒÅÔÎÏÇÏ ÍÅÔÏÄÁ +bob "This is a big thing!" ÉÝÅÔ ÓÉÀ ÓÔÒÏËÕ ×Ï ×ÓÅÈ ËÏÍÅÎÔÁÈ ËÏ ×ÓÅÍ ËÌÁÓÓÁÍ +bob MyCass/"The main purpose is to convert" - ÉÝÅÔ ÔÏÌØËÏ × ËÌÁÓÁÈ MyClass diff --git a/silentbob/include/TT.h b/silentbob/include/TT.h new file mode 100644 index 0000000..bcb8327 --- /dev/null +++ b/silentbob/include/TT.h @@ -0,0 +1,38 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_TT_H +#define DEFINE_TT_H +class TT +{ + public: + TT (); + ~TT (); + + int loadFile (char * fileName); + int init (); + int drop (); + char * op (); + char * nextOperator (); + int wit (); + + inline int line () { + if (! tt) + return -1; + return tt->attachment[ENV->t_op_no].pair_line + 1; + } + + char ch; + tt_state_t * tt; + int bracketDepth; + + private: + char *d_out, *d_ptr; + int depthModif; +}; + +#endif + diff --git a/silentbob/include/bob_flags.h b/silentbob/include/bob_flags.h new file mode 100644 index 0000000..e20d92b --- /dev/null +++ b/silentbob/include/bob_flags.h @@ -0,0 +1,43 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef BOB_FLAGS_H +#define BOB_FLAGS_H + +enum { + SB_FLVERBOSE = 0, + SB_FLLINEAR, + SB_FLNOLINKS, + SB_FLSIMULATE, + SB_FLTAGSTYLE, + SB_FLFNAMES, + SB_FLALL, + SB_FLPERL, + SB_FLTEST, + SB_FLRTREE, + SB_FLCPP, + SB_FLCTAGSAPPEND, + SB_FLTHREAD, + SB_FLDEBUG +}; + +enum { + cmd_give_structs = 1, + cmd_file, + cmd_kinds, + cmd_indent, + cmd_tags, + cmd_the_tt, + cmd_call_tags, + cmd_cgrep, + cmd_makectags +}; + +#define SB_FLSET(arg) (ENV->sb_flags |= (1<sb_flags & (1<d_stream_dbg); fflush (ENV->d_stream_dbg); } +#define dbg_if { fputc ('>', ENV->d_stream_dbg); fflush (ENV->d_stream_dbg); } +#define dbg_else { fputc ('<', ENV->d_stream_dbg); fflush (ENV->d_stream_dbg); } +#define dbg_s(ptr,str) { if (strstr (ptr,str)) { fprintf (ENV->d_stream_dbg, "//SDBG %s %i %s\n", __FUNCTION__, __LINE__, ptr); \ + d_dbg_SDBG_active = true; } else { d_dbg_SDBG_active = false; } } +#define dbg_s2 { if (d_dbg_SDBG_active) { fputc ('*', ENV->d_stream_dbg); fflush (ENV->d_stream_dbg); } } +#define dbg_sif { if (d_dbg_SDBG_active) { fputc ('>', ENV->d_stream_dbg); fflush (ENV->d_stream_dbg); } } +#define dbg_selse { if (d_dbg_SDBG_active) { fputc ('<', ENV->d_stream_dbg); fflush (ENV->d_stream_dbg); } } + +#define LN { fputc ('\n', ENV->d_stream_dbg); fflush (ENV->d_stream_dbg); } + +#define THE_TT_DBG { fputc (T, ENV->d_stream_dbg); fflush (ENV->d_stream_dbg); } +#define THE_TT_DBG_SPEC { fputc ('!', ENV->d_stream_dbg); fputc (T, ENV->d_stream_dbg); fflush (ENV->d_stream_dbg); } +#define FDBG(arg) { fprintf (ENV->d_stream_dbg, "%s", arg); fflush (ENV->d_stream_dbg); } + +#define assert(arga,argb) if(arga) { fprintf (ENV->d_stream_dbg, "\tBUG at file %s line %i \"%s\"\n", \ + __FILE__, __LINE__, argb); fflush (ENV->d_stream_dbg); } + +#define fault(arga) if(arga) { fprintf (ENV->d_stream_dbg, "\tBUG at file %s line %i\n", __FILE__, __LINE__); exit (2); } + +#define dbg_in { fprintf (ENV->d_stream_dbg, "%s in\n", __FUNCTION__); fflush (ENV->d_stream_dbg); } +#define dbg_out { fprintf (ENV->d_stream_dbg, "%s out\n", __FUNCTION__); fflush (ENV->d_stream_dbg); } + +#endif diff --git a/silentbob/include/env.h b/silentbob/include/env.h new file mode 100644 index 0000000..a2cbd15 --- /dev/null +++ b/silentbob/include/env.h @@ -0,0 +1,48 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_ENV_H +#define DEFINE_ENV_H + +struct env_t +{ + EArray * d_tags_file; + EArray * immune_list; + EArray * full_list; + EArray * modding; + EArray * d_cops; + DArray * d_opts; + EArray * d_files; + DJobs * proc_list; + EHash * settings; + EList * listOptions; + + FILE *d_stream_dbg; + + char * home_dir; + char * tmp_files; + char * tmp_tags; + char * debug_file; + char * home_plugins; + char * shared_plugins; + char * language; + char * cgrep_exp; + + bool d_dbg_SDBG_active; + int t_op_no; + int d_depth; + int cgrep_A; + int cgrep_B; + int sb_cmd; + int max_proc; + int nproc; + int d_kinds; + uint32_t sb_flags; +}; + +extern "C" struct env_t *ENV; +extern "C" struct env_t *get_env (); +#endif diff --git a/silentbob/include/head.h b/silentbob/include/head.h new file mode 100644 index 0000000..1d5884b --- /dev/null +++ b/silentbob/include/head.h @@ -0,0 +1,29 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_HEAD_H +#define DEFINE_HEAD_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_CONFIG_H +# include +#else +# define PACKAGE "silent_bob" +#endif + +#endif + diff --git a/silentbob/include/inline.h b/silentbob/include/inline.h new file mode 100644 index 0000000..776f24c --- /dev/null +++ b/silentbob/include/inline.h @@ -0,0 +1,115 @@ +#ifndef DEFINE_INLINE_H +#define DEFINE_INLINE_H + +inline bool ww_call_cmp (char * d_op, char * d_cmp, int d_len) +{ + if (!strncmp (d_op, d_cmp, d_len) + && (d_op[d_len] == '(' || d_op[d_len+1] == '(')) + return true; + + return false; +} + +inline bool ww_case_cmp (char * d_op, char * d_cmp, int d_len) +{ + if (!strncmp (d_op, d_cmp, d_len) + && (d_op[d_len] == ':' || d_op[d_len+1] == ':')) + return true; + + return false; +} + +inline bool local_ftest (char *S) // test for pair "()" +{ + int d_count1 = 0; + int d_count2 = 0; + + while (*S) { + if (*S == '(') + d_count1++; + + if (*S == ')') + d_count2++; + + if (!d_count1 || (d_count1 == d_count2)) { + if (*S == '[') + return false; + if (*S == ']') + return false; + if (*S == '=') + return false; + } + S++; + } + + return d_count1 && d_count2; +} + +inline char last_ch (char *S) +{ + S = &S[strlen (S)] - 1; + while (if_digit (S) || if_abc(S) || *S == '_') + S--; + if (*S == ' ') + S--; + return *S; +} + +inline char ww_after_word (char *S) +{ + while (true) { + if (! (if_abc (S) || *S =='_' || if_digit (S))) + break; + S++; + } + if (*S == ' ') + S++; + + return *S; +} + +inline void free_cword (c_word * word) +{ + free (word->S); + free (word); +} + +inline struct c_word * new_cword (char *word, char sym) +{ + c_word * Ret = CNEW (c_word, 1); + Ret->S = strdup (word); + Ret->ch = sym; + return Ret; +} + +inline char * ww_first_word (char * word) +{ + char *S = word; + + while (true) { + if (!if_abc (S) && + !if_digit (S) && + *S != '_') + break; + S++; + } + + return Dstrndup (word, S-word); +} + +inline int ww_nsyms_r (char * begin, char * end, char sym) +{ + char * S; + int count = 0; + S = end; + while (S != begin && *S == sym) { + ++count; + --S; + } + return count; +} + +#define find_one_ext(ext) sblib_find ("./", ext, ENV->tmp_files) + +#endif + diff --git a/silentbob/include/log.h b/silentbob/include/log.h new file mode 100644 index 0000000..91336dc --- /dev/null +++ b/silentbob/include/log.h @@ -0,0 +1,23 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_LOG_H +#define DEFINE_LOG_H + +#ifndef DEFINE_THE_TT_H +struct tt_state_t; +#endif + +namespace Log { + int init (); + int globals (char *file, int type, int size); + int tt (tt_state_t * tt); + int write (char *logName, char *logStr); + int done (char *logName); +} + +#endif + diff --git a/silentbob/include/mod.h b/silentbob/include/mod.h new file mode 100644 index 0000000..2fa1773 --- /dev/null +++ b/silentbob/include/mod.h @@ -0,0 +1,50 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_MOD_H +#define DEFINE_MOD_H + +enum plug_type_t { + TYPE_LANGUAGE = 0, + TYPE_OUTPUT, + TYPE_INPUT, + TYPE_GUI, + TYPE_INDENT, + TYPE_FEATURE +}; + +struct mod_t { + int Type; + int ID; + char * Version; + char * Name; + char Enabled; + char * mod_file; + void (*short_info) (); + void (*usage) (); +}; + +struct mod_feature { + struct mod_t mod; + char (*opt) (DArray * d_opts, int * pos); + char (*opt2) (DArray * d_opts, int * pos); +}; + +/* Language plugin. */ +struct mod_language { + struct mod_t mod; + char *language; + char *(*the) (struct tt_state_t *d_tt_state); // --the-tt + int (*make_ctags) (char *f_name, FILE *ofile); // SilentBob --make-ctags code body. + int (*call_tags) (char *f_name); // SilentBob --call-tags code body. + int (*print_tags) (char * f_name); // tags + void (*file) (DArray * d_files); // sb --file +}; + +int modding_init (); +int modding_start (int i_cmd); +int modding_load_plugin (char * name, char * path); +#endif diff --git a/silentbob/include/proto.h b/silentbob/include/proto.h new file mode 100644 index 0000000..668f3e6 --- /dev/null +++ b/silentbob/include/proto.h @@ -0,0 +1,126 @@ +/* + * (c) Oleg Puchinin 2006,2007 + * graycardinalster@gmail.com + * + */ + +void nogui_tagsdump (char * f_name, int n_trip) ; +void opMacro (char ** d_ptr, char ** d_out, char ch) ; +int ww_begin_line (struct tt_state_t * d_tt_state, char *d_out, int d_offset) ; +char * ww_begin_offset (struct tt_state_t * d_tt_state, char *d_out, int d_offset) ; + +#include + +/* sblib */ +bool def_test (char * d_op) ; +int what_is_this (char * d_op, char ch) ; +char * sstrend (char * d_ptr) ; +void free_cword (c_word * S) ; +inline struct c_word * new_cword (char *word, char sym) ; +DArray * split_to_words (char * d_op) ; +char * cts (struct c_word * d_word) ; +char * ww_last_word (char *d_op) ; +int words_count (char *S) ; +struct tt_state_t * get_onett_tag (char * f_name, char ** d_tt_buf) ; +int sblib_find (char * path, char * name, char * f_outname) ; +int find_cfiles () ; +int split_tmp_files () ; +int remove_tmp_files () ; +EHash * bob_init_compile_env () ; +void setParam (char *opt) ; +char * name2obj (char * name) ; +void globalsPrint (tt_state_t * tt, char * d_out, int d_found_type) ; +bool validOption (char *Name) ; +/**/ + +/*** ./call_tags.cxx ***/ +void call_tags_main (tt_state_t * d_tt_state, DArray * dout) ; +int call_tags (EArray * d_files) ; +int callTagsFile (char * fileName) ; + +/*** ./cgrep.cxx ***/ +namespace cgrep { + int file (tt_state_t * d_tt_state) ; + int cgrep (EArray * d_files) ; +} + +/*** ./flist.cxx ***/ +char * flist_iter (char * d_ptr, char * d_name, bool b_repair) ; +void flist_main (char * d_file) ; + +/*** ./globals.cxx ***/ +void globals_main (struct tt_state_t * d_tt_state, int d_type) ; +void bob_globals (char * d_file, int d_type) ; + +/*** ./kinds.cxx ***/ +int kindsFile (char * fileName, int type) ; + +/*** ./got_structs.cxx ***/ +void got_structs (char * d_file) ; + +/*** ./got_tag.cxx ***/ +int parse_regexp (char * d_file, char * S) ; +bool bob_tag (char *d_str, char * d_name, d_tag_t * d_tag) ; +EArray * got_tag (char * d_tag) ; + +/*** ./init.cxx ***/ +int sb_init () ; + +/*** ./main.cxx ***/ +int sb_prname (char *arg) ; +int main (int argc, char ** argv) ; + +/*** ./make_tags.cxx ***/ +void mk_tags (char *f_name, DArray *d_in) ; +void make_ctags (EArray * d_files) ; + +/*** ./mk_tag.cxx ***/ +char * macro_name (char * d_op, char * d_macro_name) ; +void mk_tag_macro (char * d_op, char * d_file, int t_line) ; +void mk_tag (char * d_op, char * d_file, int line, int d_found_type) ; +DArray * mk_tag_structtail_split (char *S) ; +void mk_tag_structtail (char * S, char * d_file, int t_line) ; + +/*** ./modding.cxx ***/ +env_t * sb_getenv (void) ; +char modding_optparse (int * i, int step) ; +int linux_modding_init () ; +void mods_info (); + +/*** ./nogui_fdump.cxx ***/ +bool brace_count (char * d_str, int * d_count, bool b_force_block) ; +void nogui_fdump (struct fdump_param_t * d_param) ; + +/*** ./nogui_indent.cxx ***/ +void nogui_indent () ; + +/*** ./tags.cxx ***/ +void tags (DArray * d_names, char * d_file_output) ; + +/*** ./interactive.cxx ***/ +void tags_interactive () ; + +/*** ./t_op.cxx ***/ +char t_op (char ** d_in, char ** d_prev, bool b_no_operators = true) ; + +/*** ./tree.cxx ***/ +inline bool tree_immune (char * m_fname) ; +void rctree_iter (char * f_name, int n_trip) ; +void reverse_calltree (char * f_name) ; +void tree_echo (int n_trip, char *S) ; +inline void tree_mkpos (int N) ; +void call_tree (char * f_name, int n_trip) ; + +/*** ./usage.cxx ***/ +void usage () ; + +int opts_kinds (DArray * d_opts, int & i) ; +int opts_settings (DArray * d_opts, int & i) ; +int opts_funcs (DArray * d_opts, int & i) ; + +/*** ./sb_prnmame.cxx **/ +int sb_prname (char *arg) ; + +int bob_cfiles (); +int logToFile (char * fileName, char * fmt, ...); + diff --git a/silentbob/include/structs.h b/silentbob/include/structs.h new file mode 100644 index 0000000..f77c732 --- /dev/null +++ b/silentbob/include/structs.h @@ -0,0 +1,72 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_STRUCTS_H +#define DEFINE_STRUCTS_H +struct d_tag_t +{ + char d_name[256]; + char d_file[256]; + int d_op; + int d_line; + int d_type; // Minimal support. +}; + +struct pair_t +{ + int pair_op; + int pair_line; + int offset; +}; + +struct tt_state_t +{ + char *fileName; + int fd; + char * fileData; + int fileDataSize; + bool mmaped; + char * result; + int resultSize; + pair_t * attachment; +}; + +struct fdump_param_t +{ + int n_trip; + int d_line; + bool linear; + bool b_force_block; + char * d_file_name; + char *d_file_output; +}; + +struct c_word +{ + char * S; + char ch; +}; + +void free_cword (c_word *); + +struct __block_t { + int op_no; + int type; +}; + +/* + * "struct {" -- BB_BEGIN + * ... + * } - BB_END + * ; - BB_TAIL + */ + +enum { + BB_BEGIN = 1, + BB_END = 2, + BB_TAIL = 3 +}; +#endif diff --git a/silentbob/include/temp_names.h b/silentbob/include/temp_names.h new file mode 100644 index 0000000..e235b3d --- /dev/null +++ b/silentbob/include/temp_names.h @@ -0,0 +1,14 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_TEMP_NAMES +#define DEFINE_TEMP_NAMES + +#define TMPNAME_FILES ".sb_files.tmp" +#define TMPNAME_TAGS ".sb_tags.tmp" + +#endif + diff --git a/silentbob/include/the_fly.hpp b/silentbob/include/the_fly.hpp new file mode 100644 index 0000000..1de7fff --- /dev/null +++ b/silentbob/include/the_fly.hpp @@ -0,0 +1,9 @@ +#ifndef _THE_FLY_HPP +# define _THE_FLY_HPP +# include + +namespace THE_FLY { + char * fly_for_file (struct tt_state_t * tt); +} + +#endif diff --git a/silentbob/include/the_tt.h b/silentbob/include/the_tt.h new file mode 100644 index 0000000..e662e19 --- /dev/null +++ b/silentbob/include/the_tt.h @@ -0,0 +1,21 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_THE_TT_H +#define DEFINE_THE_TT_H + +/*** ./the_tt.cpp ***/ +namespace THE_TT { + void tt_skip () ; + void tt_comment () ; + int the_tt_main (char * f_name) ; + char * do_tt_file (tt_state_t * d_tt_state); +} +#define do_tt THE_TT::do_tt_file +void free_tt_state (struct tt_state_t * S); +int tt_map (tt_state_t *tt); + +#endif diff --git a/silentbob/include/wit.h b/silentbob/include/wit.h new file mode 100644 index 0000000..35a4b6c --- /dev/null +++ b/silentbob/include/wit.h @@ -0,0 +1,28 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#ifndef DEFINE_WIT_H +#define DEFINE_WIT_H + +namespace OT { + enum { + Variable = 1<<0, + Typedef = 1<<1, + Extern = 1<<2, + Function = 1<<3, + Struct = 1<<4, + Operator = 1<<5, + Macro = 1<<6, + Call = 1<<7, + Define = 1<<8, + Class = 1<<9, + Namespace = 1<<10, + Enum = 1<<11, + Other = 1<<30 + }; +}; + +#endif diff --git a/silentbob/install-sh b/silentbob/install-sh new file mode 100755 index 0000000..4d4a951 --- /dev/null +++ b/silentbob/install-sh @@ -0,0 +1,323 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2005-05-14.22 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +chmodcmd="$chmodprog 0755" +chowncmd= +chgrpcmd= +stripcmd= +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src= +dst= +dir_arg= +dstarg= +no_target_directory= + +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" + +while test -n "$1"; do + case $1 in + -c) shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit $?;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; + + --version) echo "$0 $scriptversion"; exit $?;; + + *) # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + test -n "$dir_arg$dstarg" && break + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done + break;; + esac +done + +if test -z "$1"; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + src= + + if test -d "$dst"; then + mkdircmd=: + chmodcmd= + else + mkdircmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dst=$dst/`basename "$src"` + fi + fi + + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" + + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + shift + IFS=$oIFS + + pathcomp= + + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test -d "$pathcomp" || exit + fi + pathcomp=$pathcomp/ + done + fi + + if test -n "$dir_arg"; then + $doit $mkdircmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } + + else + dstfile=`basename "$dst"` + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap '(exit $?); exit' 1 2 13 15 + + # Copy the file name to the temp name. + $doit $cpprog "$src" "$dsttmp" && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit 1 + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } + fi || { (exit 1); exit 1; } +done + +# The final little trick to "correctly" pass the exit status to the exit trap. +{ + (exit 0); exit 0 +} + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/silentbob/ltmain.sh b/silentbob/ltmain.sh new file mode 100644 index 0000000..c715b59 --- /dev/null +++ b/silentbob/ltmain.sh @@ -0,0 +1,6871 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun configure. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +basename="s,^.*/,,g" + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + +# The name of this program: +progname=`echo "$progpath" | $SED $basename` +modename="$progname" + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION="1.5.22 Debian 1.5.22-4" +TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes. +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$progpath" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +duplicate_deps=no +preserve_args= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +##################################### +# Shell function definitions: +# This seems to be the best place for them + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $mkdir "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || { + $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 + exit $EXIT_FAILURE + } + fi + + $echo "X$my_tmpdir" | $Xsed +} + + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +func_win32_libid () +{ + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ + $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | \ + $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $echo $win32_libid_type +} + + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case "$@ " in + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit $EXIT_FAILURE +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 + exit $EXIT_FAILURE + fi +} + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + my_status="" + + $show "${rm}r $my_gentop" + $run ${rm}r "$my_gentop" + $show "$mkdir $my_gentop" + $run $mkdir "$my_gentop" + my_status=$? + if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then + exit $my_status + fi + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` + my_xdir="$my_gentop/$my_xlib" + + $show "${rm}r $my_xdir" + $run ${rm}r "$my_xdir" + $show "$mkdir $my_xdir" + $run $mkdir "$my_xdir" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then + exit $exit_status + fi + case $host in + *-darwin*) + $show "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + if test -z "$run"; then + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` + darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` + if test -n "$darwin_arches"; then + darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + $show "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we have a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + lipo -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + ${rm}r unfat-$$ + cd "$darwin_orig_dir" + else + cd "$darwin_orig_dir" + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + fi # $run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + func_extract_archives_result="$my_oldobjs" +} +# End of Shell function definitions +##################################### + +# Darwin sucks +eval std_shrext=\"$shrext_cmds\" + +disable_libs=no + +# Parse our command line options once, thoroughly. +while test "$#" -gt 0 +do + arg="$1" + shift + + case $arg in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + execute_dlfiles) + execute_dlfiles="$execute_dlfiles $arg" + ;; + tag) + tagname="$arg" + preserve_args="${preserve_args}=$arg" + + # Check whether tagname contains only valid characters + case $tagname in + *[!-_A-Za-z0-9,/]*) + $echo "$progname: invalid tag name: $tagname" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $tagname in + CC) + # Don't test for the "default" C tag, as we know, it's there, but + # not specially marked. + ;; + *) + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then + taglist="$taglist $tagname" + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" + else + $echo "$progname: ignoring unknown tag $tagname" 1>&2 + fi + ;; + esac + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case $arg in + --help) + show_help=yes + ;; + + --version) + $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + $echo + $echo "Copyright (C) 2005 Free Software Foundation, Inc." + $echo "This is free software; see the source for copying conditions. There is NO" + $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + exit $? + ;; + + --config) + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath + # Now print the configurations for the tags. + for tagname in $taglist; do + ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" + done + exit $? + ;; + + --debug) + $echo "$progname: enabling shell trace mode" + set -x + preserve_args="$preserve_args $arg" + ;; + + --dry-run | -n) + run=: + ;; + + --features) + $echo "host: $host" + if test "$build_libtool_libs" = yes; then + $echo "enable shared libraries" + else + $echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + $echo "enable static libraries" + else + $echo "disable static libraries" + fi + exit $? + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --preserve-dup-deps) duplicate_deps="yes" ;; + + --quiet | --silent) + show=: + preserve_args="$preserve_args $arg" + ;; + + --tag) + prevopt="--tag" + prev=tag + preserve_args="$preserve_args --tag" + ;; + --tag=*) + set tag "$optarg" ${1+"$@"} + shift + prev=tag + preserve_args="$preserve_args --tag" + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE +fi + +case $disable_libs in +no) + ;; +shared) + build_libtool_libs=no + build_old_libs=yes + ;; +static) + build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` + ;; +esac + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 + $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 + case $nonopt in + *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) + mode=link + for arg + do + case $arg in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case $mode in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + if test -n "$libobj" ; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit $EXIT_FAILURE + fi + arg_mode=target + continue + ;; + + -static | -prefer-pic | -prefer-non-pic) + later="$later $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + base_compile="$base_compile $lastarg" + continue + ;; + + * ) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + case $lastarg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, and some SunOS ksh mistreat backslash-escaping + # in scan sets (worked around with variable expansion), + # and furthermore cannot handle '|' '&' '(' ')' in scan sets + # at all, so we specify them separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + base_compile="$base_compile $lastarg" + done # for arg + + case $arg_mode in + arg) + $echo "$modename: you must specify an argument for -Xcompile" + exit $EXIT_FAILURE + ;; + target) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit $EXIT_FAILURE + ;; + *) + # Get the name of the library object. + [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSifmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.ii) xform=ii ;; + *.class) xform=class ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + *.java) xform=java ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` + case $qlibobj in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qlibobj="\"$qlibobj\"" ;; + esac + test "X$libobj" != "X$qlibobj" \ + && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." + objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir= + else + xdir=$xdir/ + fi + lobj=${xdir}$objdir/$objname + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $run ln "$progpath" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + $echo "$srcfile" > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` + case $qsrcfile in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qsrcfile="\"$qsrcfile\"" ;; + esac + + $run $rm "$libobj" "${libobj}T" + + # Create a libtool object file (analogous to a ".la" file), + # but don't create it if we're doing a dry run. + test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + $show "$mv $output_obj $lobj" + if $run $mv $output_obj $lobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the PIC object to the libtool object file. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the non-PIC object the libtool object file. + # Only append if the libtool object file exists. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + fi + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test + ;; + *) qarg=$arg ;; + esac + libtool_args="$libtool_args $qarg" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit $EXIT_FAILURE + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat $save_arg` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + done + else + $echo "$modename: link input file \`$save_arg' does not exist" + exit $EXIT_FAILURE + fi + arg=$save_arg + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit $EXIT_FAILURE + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + compile_command="$compile_command $wl$qarg" + finalize_command="$finalize_command $wl$qarg" + continue + ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + darwin_framework|darwin_framework_skip) + test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + prev= + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: more than one -exported-symbols argument is not allowed" + exit $EXIT_FAILURE + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework|-arch|-isysroot) + case " $CC " in + *" ${arg} ${1} "* | *" ${arg} ${1} "*) + prev=darwin_framework_skip ;; + *) compiler_flags="$compiler_flags $arg" + prev=darwin_framework ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + notinst_path="$notinst_path $dir" + fi + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs -framework System" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + -model) + compile_command="$compile_command $arg" + compiler_flags="$compiler_flags $arg" + finalize_command="$finalize_command $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m* pass through architecture-specific compiler args for GCC + # -m*, -t[45]*, -txscale* pass through architecture-specific + # compiler args for GCC + # -pg pass through profiling flag for GCC + # @file GCC response files + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ + -t[45]*|-txscale*|@*) + + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + compiler_flags="$compiler_flags $arg" + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # The PATH hackery in wrapper scripts is required on Windows + # in order for the loader to find any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit $EXIT_FAILURE + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $wl$flag" + linker_flags="$linker_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + + *.$objext) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done # argument parsing loop + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + # Create the object directory. + if test ! -d "$output_objdir"; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then + exit $exit_status + fi + fi + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + case $host in + *cygwin* | *mingw* | *pw32*) + # don't eliminate duplications in $postdeps and $predeps + duplicate_compiler_generated_deps=yes + ;; + *) + duplicate_compiler_generated_deps=$duplicate_deps + ;; + esac + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if test "X$duplicate_deps" = "Xyes" ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit $EXIT_FAILURE + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + for pass in $passes; do + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) + libs="$deplibs %DEPLIBS%" + test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" + ;; + esac + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + compiler_flags="$compiler_flags $deplib" + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if (${SED} -e '2q' $lib | + grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + library_names= + old_library= + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + if eval $echo \"$deplib\" 2>/dev/null \ + | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + $echo + $echo "*** Warning: Trying to link with static lib archive $deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because the file extensions .$libext of this argument makes me believe" + $echo "*** that it is just a static archive that I should not used here." + else + $echo + $echo "*** Warning: Linking the shared library $output against the" + $echo "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test "$found" = yes || test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 + exit $EXIT_FAILURE + fi + + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit $EXIT_FAILURE + fi + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi + fi # $installed = yes + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $absdir" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes ; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + # This is a shared library + + # Warn about portability, can't link against -module's on + # some systems (darwin) + if test "$shouldnotlink" = yes && test "$pass" = link ; then + $echo + if test "$linkmode" = prog; then + $echo "*** Warning: Linking the executable $output against the loadable module" + else + $echo "*** Warning: Linking the shared library $output against the loadable module" + fi + $echo "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw*) + major=`expr $current - $age` + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`$echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + save_ifs="$IFS"; IFS='~' + cmds=$extract_expsyms_cmds + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + save_ifs="$IFS"; IFS='~' + cmds=$old_archive_from_expsyms_cmds + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a module then we can not link against + # it, someone is ignoring the new warnings I added + if /usr/bin/file -L $add 2> /dev/null | + $EGREP ": [^:]* bundle" >/dev/null ; then + $echo "** Warning, lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $echo + $echo "** And there doesn't seem to be a static archive available" + $echo "** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit $EXIT_FAILURE + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + $echo + $echo "*** Warning: This system can not link to static lib archive $lib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + $echo "*** But as you try to build a module library, libtool will still create " + $echo "*** a static module, that should work as long as the dlopening application" + $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="$absdir/$objdir" + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="$absdir" + fi + depdepl= + case $host in + *-*-darwin*) + # we do not want to link against static libs, + # but need to link against shared + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$path/$depdepl" ; then + depdepl="$path/$depdepl" + fi + # do not add paths which are already there + case " $newlib_search_path " in + *" $path "*) ;; + *) newlib_search_path="$newlib_search_path $path";; + esac + fi + path="" + ;; + *) + path="-L$path" + ;; + esac + ;; + -l*) + case $host in + *-*-darwin*) + # Again, we only want to link against shared libraries + eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` + for tmp in $newlib_search_path ; do + if test -f "$tmp/lib$tmp_libs.dylib" ; then + eval depdepl="$tmp/lib$tmp_libs.dylib" + break + fi + done + path="" + ;; + *) continue ;; + esac + ;; + *) continue ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + case " $deplibs " in + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit $EXIT_FAILURE + else + $echo + $echo "*** Warning: Linking the shared library $output against the non-libtool" + $echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + if test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test "$#" -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$2" + number_minor="$3" + number_revision="$4" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + current=`expr $number_major + $number_minor - 1` + age="$number_minor" + revision="$number_minor" + ;; + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE + ;; + esac + ;; + no) + current="$2" + revision="$3" + age="$4" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + if test "$age" -gt "$current"; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + minor_current=`expr $current + 1` + verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + irix | nonstopux) + major=`expr $current - $age + 1` + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=.`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + major=`expr $current - $age` + versuffix="-$major" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + fi + + if test "$mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$echo "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + removelist="$removelist $p" + ;; + *) ;; + esac + done + if test -n "$removelist"; then + $show "${rm}r $removelist" + $run ${rm}r $removelist + fi + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + for path in $notinst_path; do + lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` + deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` + dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` + done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs -framework System" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for file magic test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a file magic. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name=`expr $a_deplib : '-l\(.*\)'` + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval $echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a regex pattern. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` + done + fi + if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ + | grep . >/dev/null; then + $echo + if test "X$deplibs_check_method" = "Xnone"; then + $echo "*** Warning: inter-library dependencies are not supported in this platform." + else + $echo "*** Warning: inter-library dependencies are not known to be supported." + fi + $echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + $echo + $echo "*** Warning: libtool could not satisfy all declared inter-library" + $echo "*** dependencies of module $libname. Therefore, libtool will create" + $echo "*** a static module, that should work as long as the dlopening" + $echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + $echo "*** The inter-library dependencies that have been dropped here will be" + $echo "*** automatically added whenever a program is linked with this library" + $echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + $echo + $echo "*** Since this library must not contain undefined symbols," + $echo "*** because either the platform does not support them or" + $echo "*** it was explicitly requested with -no-undefined," + $echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + deplibs="$new_libs" + + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + linknames="$linknames $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + if len=`expr "X$cmd" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + $show "$cmd" + $run eval "$cmd" || exit $? + skipped_export=false + else + # The command line is too long to execute in one step. + $show "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise. + $echo "creating reloadable object files..." + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + output_la=`$echo "X$output" | $Xsed -e "$basename"` + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + delfiles= + last_robj= + k=1 + output=$output_objdir/$output_la-${k}.$objext + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + eval test_cmds=\"$reload_cmds $objlist $last_robj\" + if test "X$objlist" = X || + { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len"; }; then + objlist="$objlist $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + k=`expr $k + 1` + output=$output_objdir/$output_la-${k}.$objext + objlist=$obj + len=1 + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + + if ${skipped_export-false}; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + libobjs=$output + # Append the command to create the export file. + eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" + fi + + # Set up a command to remove the reloadable object files + # after they are used. + i=0 + while test "$i" -lt "$k" + do + i=`expr $i + 1` + delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" + done + + $echo "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + + # Append the command to remove the reloadable object files + # to the just-reset $cmds. + eval cmds=\"\$cmds~\$rm $delfiles\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case $output in + *.lo) + if test -n "$objs$old_deplibs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit $EXIT_FAILURE + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + cmds=$reload_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $run eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + cmds=$reload_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + esac + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + if test "$tagname" = CXX ; then + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + fi + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case $dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $run $rm $export_symbols + $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + else + $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval '$echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + $echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +" + + case $host in + *cygwin* | *mingw* ) + $echo >> "$output_objdir/$dlsyms" "\ +/* DATA imports from DLLs on WIN32 can't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs */ +struct { +" + ;; + * ) + $echo >> "$output_objdir/$dlsyms" "\ +const struct { +" + ;; + esac + + + $echo >> "$output_objdir/$dlsyms" "\ + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{\ +" + + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + case $host in + *cygwin* | *mingw* ) + if test -f "$output_objdir/${outputname}.def" ; then + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + else + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + fi + ;; + * ) + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + esac + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + exit_status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $exit_status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + output_name=`basename $output` + output_path=`dirname $output` + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $rm $cwrappersource $cwrapper + trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + cat > $cwrappersource <> $cwrappersource<<"EOF" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +/* -DDEBUG is fairly common in CFLAGS. */ +#undef DEBUG +#if defined DEBUGWRAPPER +# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) +#else +# define DEBUG(format, ...) +#endif + +const char *program_name = NULL; + +void * xmalloc (size_t num); +char * xstrdup (const char *string); +const char * base_name (const char *name); +char * find_executable(const char *wrapper); +int check_executable(const char *path); +char * strendzap(char *str, const char *pat); +void lt_fatal (const char *message, ...); + +int +main (int argc, char *argv[]) +{ + char **newargz; + int i; + + program_name = (char *) xstrdup (base_name (argv[0])); + DEBUG("(main) argv[0] : %s\n",argv[0]); + DEBUG("(main) program_name : %s\n",program_name); + newargz = XMALLOC(char *, argc+2); +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" + newargz[1] = find_executable(argv[0]); + if (newargz[1] == NULL) + lt_fatal("Couldn't find %s", argv[0]); + DEBUG("(main) found exe at : %s\n",newargz[1]); + /* we know the script has the same name, without the .exe */ + /* so make sure newargz[1] doesn't end in .exe */ + strendzap(newargz[1],".exe"); + for (i = 1; i < argc; i++) + newargz[i+1] = xstrdup(argv[i]); + newargz[argc+1] = NULL; + + for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" + return 127; +} + +void * +xmalloc (size_t num) +{ + void * p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL +; +} + +const char * +base_name (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha ((unsigned char)name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return base; +} + +int +check_executable(const char * path) +{ + struct stat st; + + DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); + if ((!path) || (!*path)) + return 0; + + if ((stat (path, &st) >= 0) && + ( + /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ +#if defined (S_IXOTH) + ((st.st_mode & S_IXOTH) == S_IXOTH) || +#endif +#if defined (S_IXGRP) + ((st.st_mode & S_IXGRP) == S_IXGRP) || +#endif + ((st.st_mode & S_IXUSR) == S_IXUSR)) + ) + return 1; + else + return 0; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise */ +char * +find_executable (const char* wrapper) +{ + int has_slash = 0; + const char* p; + const char* p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char* concat_name; + + DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char* path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char* q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR(*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + return NULL; +} + +char * +strendzap(char *str, const char *pat) +{ + size_t len, patlen; + + assert(str != NULL); + assert(pat != NULL); + + len = strlen(str); + patlen = strlen(pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp(str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char * mode, + const char * message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} +EOF + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource + ;; + esac + $rm $output + trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='${SED} -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $echo >> $output "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + $echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $echo \"\$relink_command_output\" >&2 + $rm \"\$progdir/\$file\" + exit $EXIT_FAILURE + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + $echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit $EXIT_FAILURE + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + $echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit $EXIT_FAILURE + fi +fi\ +" + chmod +x $output + fi + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "copying selected object files to avoid basename conflicts..." + + if test -z "$gentop"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$gentop"; then + exit $exit_status + fi + fi + + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + counter=`expr $counter + 1` + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + $run ln "$obj" "$gentop/$newobj" || + $run cp "$obj" "$gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + + eval cmds=\"$old_archive_cmds\" + + if len=`expr "X$cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + $echo "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + for obj in $save_oldobjs + do + oldobjs="$objlist $obj" + objlist="$objlist $obj" + eval test_cmds=\"$old_archive_cmds\" + if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + eval cmd=\"$cmd\" + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdlfiles="$newdlfiles $libdir/$name" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdlprefiles="$newdlprefiles $libdir/$name" + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" + fi + $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $echo >> $output "\ +relink_command=\"$relink_command\"" + fi + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? + ;; + esac + exit $EXIT_SUCCESS + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $echo "X$nonopt" | grep shtool > /dev/null; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + case " $install_prog " in + *[\\\ /]cp\ *) ;; + *) prev=$arg ;; + esac + ;; + -g | -m | -o) prev=$arg ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test "$#" -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + library_names= + old_library= + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + if test "$inst_prefix_dir" = "$destdir"; then + $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 + exit $EXIT_FAILURE + fi + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + exit $EXIT_FAILURE + fi + fi + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run eval "$striplib $destdir/$realname" || exit $? + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" + $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + cmds=$postinstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + file=`$echo $file|${SED} 's,.exe$,,'` + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin*|*mingw*) + wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` + ;; + *) + wrapper=$file + ;; + esac + if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # + # If there is no directory component, then add one. + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; + esac + + # Check the variables that should have been set. + if test -z "$notinst_deplibs"; then + $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 + exit $EXIT_FAILURE + fi + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + relink_command= + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # + # If there is no directory component, then add one. + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; + esac + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir=`func_mktempdir` + file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` + ;; + esac + ;; + esac + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + if test -n "$stripme" && test -n "$old_striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + + # Do each command in the postinstall commands. + cmds=$old_postinstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + cmds=$finish_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit $EXIT_SUCCESS + + $echo "X----------------------------------------------------------------------" | $Xsed + $echo "Libraries have been installed in:" + for libdir in $libdirs; do + $echo " $libdir" + done + $echo + $echo "If you ever happen to want to link against installed libraries" + $echo "in a given directory, LIBDIR, you must either use libtool, and" + $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + $echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + $echo " during execution" + fi + if test -n "$runpath_var"; then + $echo " - add LIBDIR to the \`$runpath_var' environment variable" + $echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + $echo + $echo "See any operating system documentation about shared libraries for" + $echo "more information, such as the ld(1) and ld.so(8) manual pages." + $echo "X----------------------------------------------------------------------" | $Xsed + exit $EXIT_SUCCESS + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit $EXIT_FAILURE + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit $EXIT_FAILURE + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit $EXIT_SUCCESS + fi + ;; + + # libtool clean and uninstall mode + clean | uninstall) + modename="$modename: $mode" + rm="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) rm="$rm $arg"; rmforce=yes ;; + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + rmdirs= + + origobjdir="$objdir" + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$origobjdir" + else + objdir="$dir/$origobjdir" + fi + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + + case "$mode" in + clean) + case " $library_names " in + # " " in the beginning catches empty $dlname + *" $dlname "*) ;; + *) rmfiles="$rmfiles $objdir/$dlname" ;; + esac + test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + cmds=$postuninstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + cmds=$old_postuninstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + + # Read the .lo file + . $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" \ + && test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" \ + && test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + file=`$echo $file|${SED} 's,.exe$,,'` + noexename=`$echo $name|${SED} 's,.exe$,,'` + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$noexename + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + objdir="$origobjdir" + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit $EXIT_FAILURE + fi +fi # test -z "$show_help" + +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit $EXIT_FAILURE +fi + +# We need to display help for each of the modes. +case $mode in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + --version print version information + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE. + +Report bugs to ." + exit $EXIT_SUCCESS + ;; + +clean) + $echo \ +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; +esac + +$echo +$echo "Try \`$modename --help' for more information about other modes." + +exit $? + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +disable_libs=shared +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +disable_libs=static +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/silentbob/missing b/silentbob/missing new file mode 100755 index 0000000..894e786 --- /dev/null +++ b/silentbob/missing @@ -0,0 +1,360 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2005-06-08.21 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case "$1" in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/silentbob/mkinstalldirs b/silentbob/mkinstalldirs new file mode 100755 index 0000000..d2d5f21 --- /dev/null +++ b/silentbob/mkinstalldirs @@ -0,0 +1,111 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +errstatus=0 +dirmode="" + +usage="\ +Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." + +# process command line arguments +while test $# -gt 0 ; do + case $1 in + -h | --help | --h*) # -h for help + echo "$usage" 1>&2 + exit 0 + ;; + -m) # -m PERM arg + shift + test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } + dirmode=$1 + shift + ;; + --) # stop option processing + shift + break + ;; + -*) # unknown option + echo "$usage" 1>&2 + exit 1 + ;; + *) # first non-opt arg + break + ;; + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in + 0) exit 0 ;; +esac + +case $dirmode in + '') + if mkdir -p -- . 2>/dev/null; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + fi + ;; + *) + if mkdir -m "$dirmode" -p -- . 2>/dev/null; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + fi + ;; +esac + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case $pathcomp in + -*) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# End: +# mkinstalldirs ends here diff --git a/silentbob/plugins/Makefile.am b/silentbob/plugins/Makefile.am new file mode 100644 index 0000000..a2ff9d9 --- /dev/null +++ b/silentbob/plugins/Makefile.am @@ -0,0 +1,39 @@ +PLUGINSLDADD=-L$(top_builddir)/gclib/src/.libs \ + -L$(top_builddir)/sblib/.libs -lgclib -ldl -lsblib + +INCLUDES=-I$(top_srcdir)/include -I$(top_srcdir)/gclib/include +lib_LTLIBRARIES=libplugin_perl.la libplugin_perlpackages.la libplugin_cache.la \ + libplugin_editor.la libplugin_grep.la libplugin_compile.la \ + libplugin_aap.la libplugin_python.la libplugin_scons.la \ + libplugin_foreach.la libplugin_make.la libplugin_xml_project.la libplugin_test.la \ + libplugin_csharp.la + +libplugin_perl_la_SOURCES = plugin_perl.cxx +libplugin_perlpackages_la_SOURCES = plugin_perlpackages.cxx +libplugin_cache_la_SOURCES = plugin_cache.cxx +libplugin_editor_la_SOURCES = plugin_editor.cxx +libplugin_grep_la_SOURCES = plugin_grep.cxx +libplugin_compile_la_SOURCES = plugin_compile.cxx +libplugin_aap_la_SOURCES = plugin_aap.cxx +libplugin_python_la_SOURCES = plugin_python.cxx +libplugin_scons_la_SOURCES = plugin_scons.cxx +libplugin_foreach_la_SOURCES = plugin_foreach.cxx +libplugin_make_la_SOURCES = plugin_make.cxx +libplugin_xml_project_la_SOURCES = plugin_xml_project.cxx +libplugin_test_la_SOURCES = plugin_test.cxx +libplugin_csharp_la_SOURCES = plugin_csharp.cxx + +libplugin_perl_la_LIBADD=$(PLUGINSLDADD) +libplugin_perlpackages_la_LIBADD=$(PLUGINSLDADD) +libplugin_cache_la_LIBADD=$(PLUGINSLDADD) +libplugin_editor_la_LIBADD=$(PLUGINSLDADD) +libplugin_grep_la_LIBADD=$(PLUGINSLDADD) +libplugin_compile_la_LIBADD=$(PLUGINSLDADD) +libplugin_aap_la_LIBADD=$(PLUGINSLDADD) +libplugin_python_la_LIBADD=$(PLUGINSLDADD) +libplugin_scons_la_LIBADD=$(PLUGINSLDADD) +libplugin_foreach_la_LIBADD=$(PLUGINSLDADD) +libplugin_make_la_LIBADD=$(PLUGINSLDADD) +libplugin_xml_project_la_LIBADD=$(PLUGINSLDADD) +libplugin_test_la_LIBADD=$(PLUGINSLDADD) +libplugin_csharp_la_LIBADD=$(PLUGINSLDADD) diff --git a/silentbob/plugins/Makefile.in b/silentbob/plugins/Makefile.in new file mode 100644 index 0000000..4b11f46 --- /dev/null +++ b/silentbob/plugins/Makefile.in @@ -0,0 +1,593 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = plugins +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libplugin_aap_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libplugin_aap_la_OBJECTS = plugin_aap.lo +libplugin_aap_la_OBJECTS = $(am_libplugin_aap_la_OBJECTS) +libplugin_cache_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libplugin_cache_la_OBJECTS = plugin_cache.lo +libplugin_cache_la_OBJECTS = $(am_libplugin_cache_la_OBJECTS) +libplugin_compile_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libplugin_compile_la_OBJECTS = plugin_compile.lo +libplugin_compile_la_OBJECTS = $(am_libplugin_compile_la_OBJECTS) +libplugin_csharp_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libplugin_csharp_la_OBJECTS = plugin_csharp.lo +libplugin_csharp_la_OBJECTS = $(am_libplugin_csharp_la_OBJECTS) +libplugin_editor_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libplugin_editor_la_OBJECTS = plugin_editor.lo +libplugin_editor_la_OBJECTS = $(am_libplugin_editor_la_OBJECTS) +libplugin_foreach_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libplugin_foreach_la_OBJECTS = plugin_foreach.lo +libplugin_foreach_la_OBJECTS = $(am_libplugin_foreach_la_OBJECTS) +libplugin_grep_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libplugin_grep_la_OBJECTS = plugin_grep.lo +libplugin_grep_la_OBJECTS = $(am_libplugin_grep_la_OBJECTS) +libplugin_make_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libplugin_make_la_OBJECTS = plugin_make.lo +libplugin_make_la_OBJECTS = $(am_libplugin_make_la_OBJECTS) +libplugin_perl_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libplugin_perl_la_OBJECTS = plugin_perl.lo +libplugin_perl_la_OBJECTS = $(am_libplugin_perl_la_OBJECTS) +libplugin_perlpackages_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libplugin_perlpackages_la_OBJECTS = plugin_perlpackages.lo +libplugin_perlpackages_la_OBJECTS = \ + $(am_libplugin_perlpackages_la_OBJECTS) +libplugin_python_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libplugin_python_la_OBJECTS = plugin_python.lo +libplugin_python_la_OBJECTS = $(am_libplugin_python_la_OBJECTS) +libplugin_scons_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libplugin_scons_la_OBJECTS = plugin_scons.lo +libplugin_scons_la_OBJECTS = $(am_libplugin_scons_la_OBJECTS) +libplugin_test_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libplugin_test_la_OBJECTS = plugin_test.lo +libplugin_test_la_OBJECTS = $(am_libplugin_test_la_OBJECTS) +libplugin_xml_project_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libplugin_xml_project_la_OBJECTS = plugin_xml_project.lo +libplugin_xml_project_la_OBJECTS = \ + $(am_libplugin_xml_project_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libplugin_aap_la_SOURCES) $(libplugin_cache_la_SOURCES) \ + $(libplugin_compile_la_SOURCES) $(libplugin_csharp_la_SOURCES) \ + $(libplugin_editor_la_SOURCES) $(libplugin_foreach_la_SOURCES) \ + $(libplugin_grep_la_SOURCES) $(libplugin_make_la_SOURCES) \ + $(libplugin_perl_la_SOURCES) \ + $(libplugin_perlpackages_la_SOURCES) \ + $(libplugin_python_la_SOURCES) $(libplugin_scons_la_SOURCES) \ + $(libplugin_test_la_SOURCES) \ + $(libplugin_xml_project_la_SOURCES) +DIST_SOURCES = $(libplugin_aap_la_SOURCES) \ + $(libplugin_cache_la_SOURCES) $(libplugin_compile_la_SOURCES) \ + $(libplugin_csharp_la_SOURCES) $(libplugin_editor_la_SOURCES) \ + $(libplugin_foreach_la_SOURCES) $(libplugin_grep_la_SOURCES) \ + $(libplugin_make_la_SOURCES) $(libplugin_perl_la_SOURCES) \ + $(libplugin_perlpackages_la_SOURCES) \ + $(libplugin_python_la_SOURCES) $(libplugin_scons_la_SOURCES) \ + $(libplugin_test_la_SOURCES) \ + $(libplugin_xml_project_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +PLUGINSLDADD = -L$(top_builddir)/gclib/src/.libs \ + -L$(top_builddir)/sblib/.libs -lgclib -ldl -lsblib + +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/gclib/include +lib_LTLIBRARIES = libplugin_perl.la libplugin_perlpackages.la libplugin_cache.la \ + libplugin_editor.la libplugin_grep.la libplugin_compile.la \ + libplugin_aap.la libplugin_python.la libplugin_scons.la \ + libplugin_foreach.la libplugin_make.la libplugin_xml_project.la libplugin_test.la \ + libplugin_csharp.la + +libplugin_perl_la_SOURCES = plugin_perl.cxx +libplugin_perlpackages_la_SOURCES = plugin_perlpackages.cxx +libplugin_cache_la_SOURCES = plugin_cache.cxx +libplugin_editor_la_SOURCES = plugin_editor.cxx +libplugin_grep_la_SOURCES = plugin_grep.cxx +libplugin_compile_la_SOURCES = plugin_compile.cxx +libplugin_aap_la_SOURCES = plugin_aap.cxx +libplugin_python_la_SOURCES = plugin_python.cxx +libplugin_scons_la_SOURCES = plugin_scons.cxx +libplugin_foreach_la_SOURCES = plugin_foreach.cxx +libplugin_make_la_SOURCES = plugin_make.cxx +libplugin_xml_project_la_SOURCES = plugin_xml_project.cxx +libplugin_test_la_SOURCES = plugin_test.cxx +libplugin_csharp_la_SOURCES = plugin_csharp.cxx +libplugin_perl_la_LIBADD = $(PLUGINSLDADD) +libplugin_perlpackages_la_LIBADD = $(PLUGINSLDADD) +libplugin_cache_la_LIBADD = $(PLUGINSLDADD) +libplugin_editor_la_LIBADD = $(PLUGINSLDADD) +libplugin_grep_la_LIBADD = $(PLUGINSLDADD) +libplugin_compile_la_LIBADD = $(PLUGINSLDADD) +libplugin_aap_la_LIBADD = $(PLUGINSLDADD) +libplugin_python_la_LIBADD = $(PLUGINSLDADD) +libplugin_scons_la_LIBADD = $(PLUGINSLDADD) +libplugin_foreach_la_LIBADD = $(PLUGINSLDADD) +libplugin_make_la_LIBADD = $(PLUGINSLDADD) +libplugin_xml_project_la_LIBADD = $(PLUGINSLDADD) +libplugin_test_la_LIBADD = $(PLUGINSLDADD) +libplugin_csharp_la_LIBADD = $(PLUGINSLDADD) +all: all-am + +.SUFFIXES: +.SUFFIXES: .cxx .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libplugin_aap.la: $(libplugin_aap_la_OBJECTS) $(libplugin_aap_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libplugin_aap_la_OBJECTS) $(libplugin_aap_la_LIBADD) $(LIBS) +libplugin_cache.la: $(libplugin_cache_la_OBJECTS) $(libplugin_cache_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libplugin_cache_la_OBJECTS) $(libplugin_cache_la_LIBADD) $(LIBS) +libplugin_compile.la: $(libplugin_compile_la_OBJECTS) $(libplugin_compile_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libplugin_compile_la_OBJECTS) $(libplugin_compile_la_LIBADD) $(LIBS) +libplugin_csharp.la: $(libplugin_csharp_la_OBJECTS) $(libplugin_csharp_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libplugin_csharp_la_OBJECTS) $(libplugin_csharp_la_LIBADD) $(LIBS) +libplugin_editor.la: $(libplugin_editor_la_OBJECTS) $(libplugin_editor_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libplugin_editor_la_OBJECTS) $(libplugin_editor_la_LIBADD) $(LIBS) +libplugin_foreach.la: $(libplugin_foreach_la_OBJECTS) $(libplugin_foreach_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libplugin_foreach_la_OBJECTS) $(libplugin_foreach_la_LIBADD) $(LIBS) +libplugin_grep.la: $(libplugin_grep_la_OBJECTS) $(libplugin_grep_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libplugin_grep_la_OBJECTS) $(libplugin_grep_la_LIBADD) $(LIBS) +libplugin_make.la: $(libplugin_make_la_OBJECTS) $(libplugin_make_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libplugin_make_la_OBJECTS) $(libplugin_make_la_LIBADD) $(LIBS) +libplugin_perl.la: $(libplugin_perl_la_OBJECTS) $(libplugin_perl_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libplugin_perl_la_OBJECTS) $(libplugin_perl_la_LIBADD) $(LIBS) +libplugin_perlpackages.la: $(libplugin_perlpackages_la_OBJECTS) $(libplugin_perlpackages_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libplugin_perlpackages_la_OBJECTS) $(libplugin_perlpackages_la_LIBADD) $(LIBS) +libplugin_python.la: $(libplugin_python_la_OBJECTS) $(libplugin_python_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libplugin_python_la_OBJECTS) $(libplugin_python_la_LIBADD) $(LIBS) +libplugin_scons.la: $(libplugin_scons_la_OBJECTS) $(libplugin_scons_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libplugin_scons_la_OBJECTS) $(libplugin_scons_la_LIBADD) $(LIBS) +libplugin_test.la: $(libplugin_test_la_OBJECTS) $(libplugin_test_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libplugin_test_la_OBJECTS) $(libplugin_test_la_LIBADD) $(LIBS) +libplugin_xml_project.la: $(libplugin_xml_project_la_OBJECTS) $(libplugin_xml_project_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libplugin_xml_project_la_OBJECTS) $(libplugin_xml_project_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_aap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_cache.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_compile.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_csharp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_editor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_foreach.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_grep.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_make.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_perl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_perlpackages.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_python.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_scons.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_test.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_xml_project.Plo@am__quote@ + +.cxx.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cxx.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cxx.lo: +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(libdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-libLTLIBRARIES + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/silentbob/plugins/plugin_aap.cxx b/silentbob/plugins/plugin_aap.cxx new file mode 100644 index 0000000..830df7b --- /dev/null +++ b/silentbob/plugins/plugin_aap.cxx @@ -0,0 +1,187 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include + +extern "C" DArray * plugin_init (struct env_t *env); +EHash * __compile_env; +bool __aap_env; + +void __aap_files_join (DArray * d_files) +{ + char *S; + int count; + int i; + + if (! d_files) + return; + + i = 0; + S = d_files->get (i); + if (S) + printf ("%s\n", S); + else { + printf ("\n"); + return; + } + count = d_files->get_size (); + while (true) { + ++i; + S = d_files->get (i); + if (S) + printf ("\t\t%s ", S); + else + break; + + ++i; + S = d_files->get (i); + if (S) + printf ("%s\n", S); + else + break; + } + printf ("\n"); +} + +void __do_aap (char * pr_name, char * type) +{ + DArray * d_files; + + if (! pr_name || ! type) + return; + + d_files = ENV->d_files; + if (! d_files || d_files->get_size () <= 0) + return; + + __compile_env = bob_init_compile_env (); + if (! __compile_env) + return; + + if (__aap_env) { + printf ("CC=%s\n", __compile_env->get ("CC")); + printf ("CXX=%s\n", __compile_env->get ("CXX")); + printf ("CFLAGS=%s\n", __compile_env->get ("CFLAGS")); + printf ("CXXFLAGS=$CFLAGS\n"); + printf ("OPTS=%s\n", __compile_env->get ("OPTS")); + printf ("INCLUDE=%s\n", __compile_env->get ("INCLUDE")); + printf ("LIBS=%s\n", __compile_env->get ("LIBS")); + printf ("OPTIMIZE=0\n"); + printf ("LDFLAGS=%s\n", __compile_env->get ("LDFLAGS")); + } + + printf (":%s %s : ", type, pr_name); + __aap_files_join (d_files); + printf ("\n"); +} + +char aap_program_opt2 (DArray * d_opts, int * pos) +{ + int count; + char * S; + char * type; + + if (! d_opts || ! pos) + return 0; + + count = d_opts->get_size (); + S = d_opts->get (*pos); + + if (EQ (S, "--aap-program")) { + if (++(*pos) >= count) + return 0; + type = "program"; + goto letsdoit; + } + + if (EQ (S, "--aap-dll") || + EQ (S, "--aap-shared")) { + if (++(*pos) >= count) + return 0; + type = "dll"; + goto letsdoit; + } + + if (EQ (S, "--aap-lib") || + EQ (S, "--aap-static")) { + if (++(*pos) >= count) + return 0; + type = "lib"; + goto letsdoit; + } + + return 0; + +letsdoit: + S = d_opts->get (*pos); + __do_aap (S, type); + exit (0); + return 1; +} + +char aap_program_opt (DArray * d_opts, int * pos) +{ + int count; + char *S; + + if (! d_opts || ! pos) + return 0; + + count = d_opts->get_size (); + S = d_opts->get (*pos); + if (EQ (S, "--aap-program") || + EQ (S, "--aap-lib") || + EQ (S, "--aap-dll") || + EQ (S, "--aap-shared")) { + if (++(*pos) >= count) + return 0; + return 1; + } + + if (EQ (S, "--aap-env")) { + __aap_env = true; + return 1; + } + + return 0; +} + +void aap_program_info () +{ + printf ("AAP file.\n"); + printf ("Version: 1.0\n"); + printf ("options: --aap-[program | shared | static] --aap-env\n"); +} + +DArray * plugin_init (struct env_t *env) +{ + struct mod_feature * pm; + DArray * Ret; + + __aap_env = false; + ENV = env; + Ret = new DArray (1); + pm = CNEW (mod_feature, 1); + memset (pm, 0, sizeof (mod_feature)); + pm->mod.Type = TYPE_FEATURE; + pm->mod.Version = strdup ("0.1"); + pm->mod.short_info = aap_program_info; + pm->opt = aap_program_opt; + pm->opt2 = aap_program_opt2; + + ENV->listOptions->add ("--aap-program"); + ENV->listOptions->add ("--aap-shared"); + ENV->listOptions->add ("--aap-static"); + ENV->listOptions->add ("--aap-env"); + + Ret->add (LPCHAR (pm)); + return Ret; +} + diff --git a/silentbob/plugins/plugin_cache.cxx b/silentbob/plugins/plugin_cache.cxx new file mode 100644 index 0000000..54ce16c --- /dev/null +++ b/silentbob/plugins/plugin_cache.cxx @@ -0,0 +1,104 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef POSIX_FADV_WILLNEED +#define cache_opt __cache_opt +#else +#define POSIX_FADV_WILLNEED 0 +#define POSIX_FADV_DONTNEED 0 +#define cache_opt __nofadvise +#endif + +extern "C" DArray * plugin_init (struct env_t *env); + +void cache_file (char * file, int adv) +{ + int fd; + + fd = open (file, O_RDONLY); + if (fd < 0) + return; + + Dposix_fadvise (fd, 0, fdsize (fd), adv); + close (fd); + return; +} + +char __no_fadvise (DArray * d_opts, int * pos) +{ + char * S = d_opts->get (*pos); + if (EQ (S, "--cache-load") || EQ (S, "--cache-free")) { + fprintf (stderr, "Sorry, your system do not support %s option.\n", S); + return 1; + } + return 0; +} + +char __cache_opt (DArray * d_opts, int * pos) +{ + DArray * files = ENV->d_files; + char * S; + int i; + + if (! d_opts || ! pos) + return 0; + + S = d_opts->get (*pos); + if (EQ (S, "--cache-load")) { + for (i = 0; i < files->get_size (); i++) + cache_file (files->get (i), POSIX_FADV_WILLNEED); + exit (0); + return 1; + } + + if (EQ (S, "--cache-free")) { + for (i = 0; i < files->get_size (); i++) + cache_file (files->get (i), POSIX_FADV_DONTNEED); + exit (0); + } + + return 0; +} + +void cache_info () +{ + printf ("System cache.\n"); + printf ("Version: 1.0\n"); + printf ("Load files to system cache.\n"); + printf ("options: [--cache-load | --cache-free]\n"); +} + +DArray * plugin_init (struct env_t *env) +{ + DArray * Ret; + struct mod_feature * pm; + + ENV = env; + Ret = new DArray (1); + pm = CNEW (mod_feature, 1); + memset (pm, 0, sizeof (mod_feature)); + pm->mod.Type = TYPE_FEATURE; + pm->mod.Version = strdup ("1.0"); + pm->mod.Name = strdup ("Cache"); + pm->opt2 = cache_opt; + pm->mod.short_info = cache_info; + + ENV->listOptions->add ("--cache-load"); + ENV->listOptions->add ("--cache-free"); + + Ret->add (LPCHAR (pm)); + return Ret; +} diff --git a/silentbob/plugins/plugin_compile.cxx b/silentbob/plugins/plugin_compile.cxx new file mode 100644 index 0000000..bf23437 --- /dev/null +++ b/silentbob/plugins/plugin_compile.cxx @@ -0,0 +1,342 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include + +extern "C" DArray * plugin_init (struct env_t *env); +struct env_t *ENV; +EHash * __hv_compile_env; +bool __cc_script; +bool __compile_env; +char * __cc_shared; +char * __cc_program; + +void __aa (EArray * a, DArray * b) +{ + int count; + int i; + + if (! a || ! b) + return; + + count = b->get_size (); + for (i = 0; i < count; ++i) + a->add (strdup (LPCHAR (b->get (i)))); +} + +void __astr (EArray * a, char *str) +{ + DArray * d_split; + + if (! a || ! str) + return; + + d_split = Dsplit (str, " "); + if (! d_split) + return; + + __aa (a, d_split); + d_split->foreach (free); + delete d_split; +} + +void __array_log (EArray * a) +{ + int i; + if (! a) + return; + for (i = 0; i < a->get_size (); ++i) { + if (a->get (i)) + printf ("%s ", a->get (i)); + } + printf ("\n"); +} + +int compile_cppfile (char * name) +{ + int pid; + int status; + char * oname = name2obj (name); + EArray * d_param; + + if (! oname) + return -1; + + if (__cc_script) { + printf ("$CXX $CXXFLAGS $OPTS $INCLUDE -c -o %s %s\n", oname, name); + return 0; + } + + d_param = new EArray(32); + d_param->add ( (*__hv_compile_env)["CXX"] ); + __astr (d_param, (*__hv_compile_env)["CXXFLAGS"]); + if (strlen ((*__hv_compile_env)["OPTS"])) + __astr (d_param, (*__hv_compile_env)["OPTS"]); + if (strlen ((*__hv_compile_env)["INCLUDE"])) + __astr (d_param, (*__hv_compile_env)["INCLUDE"]); + + *d_param << "-c" << "-o" << oname << name << NULL; + + if (SB_FLGET (SB_FLVERBOSE)) + __array_log (d_param); + else + printf ("\tCXX\t%s\n", oname); + + pid = fork (); + if (pid == 0) + execvp ((*__hv_compile_env)["CXX"], d_param->get_skeleton ()); + else + waitpid (pid, &status, 0); + + free (oname); + return 0; +} + +int compile_cfile (char * name) +{ + char * oname = name2obj (name); + EArray * d_param; + int status; + int pid; + + if (! oname) + return -1; + + if (__cc_script) { + printf ("$CC $CFLAGS $OPTS $INCLUDE -c -o %s %s\n", oname, name); + return 0; + } + + d_param = new EArray(32); + *d_param << (*__hv_compile_env)["CC"]; + __astr (d_param, (*__hv_compile_env)["CFLAGS"]); + if (strlen ((*__hv_compile_env)["OPTS"])) + __astr (d_param, (*__hv_compile_env)["OPTS"]); + if (strlen ( (*__hv_compile_env)["INCLUDE"] )) + __astr (d_param, (*__hv_compile_env)["INCLUDE"]); + + *d_param << "-c" << "-o" << oname << name << NULL; + + if (SB_FLGET (SB_FLVERBOSE)) + __array_log (d_param); + else + printf ("\tCC\t%s\n", oname); + + pid = fork (); + if (pid == 0) + execvp ((*__hv_compile_env)["CC"], d_param->get_skeleton ()); + else + waitpid (pid, &status, 0); + + free (oname); + return 0; +} + +int __cc_build_target () +{ + EArray * cmd; + int status; + char * oname; + int count; + pid_t pid; + int i; + + count = ENV->d_files->get_size (); + cmd = new EArray (ENV->d_files->get_size ()+32); + *cmd << (*__hv_compile_env)["CC"]; + + if (! __cc_script) { + __astr (cmd, (*__hv_compile_env)["LDFLAGS"]); + __astr (cmd, (*__hv_compile_env)["LIBS"]); + } else { + *cmd << "$LDFLAGS"; + *cmd << "$LIBS"; + } + + if (__cc_shared) + *cmd << "-shared"; + + for (i = 0; i < count; ++i) + cmd->add (name2obj (ENV->d_files->get (i))); + + if (__cc_shared && __cc_program) { + fprintf (stderr, "only one --program or --shared option can be used,\n"); + exit (1); + } + + *cmd << "-o"; + if (__cc_shared) + oname = __cc_shared; + else + oname = __cc_program; + + *cmd << oname; + *cmd << LPCHAR(NULL); + + if (__cc_script || SB_FLGET (SB_FLVERBOSE)) { + __array_log (cmd); + return 0; + } else + printf ("\tLD\t%s\n", oname); + + pid = fork (); + if (pid < 0) + return -1; + + if (pid == 0) + execvp ((*cmd)[0], cmd->get_skeleton ()); + else + waitpid (pid, &status, 0); + + return 0; +} + +int compile_files () +{ + char *S; + char opts_buf[256]; + int count; + int i; + + opts_buf[0] = '\0'; + if (__cc_shared && ! strstr ((*__hv_compile_env)["OPTS"], "-fPIC")) { + strcpy (opts_buf, "-fPIC -DPIC"); + strcat (opts_buf, (*__hv_compile_env)["OPTS"]); + free ((*__hv_compile_env)["OPTS"]); + __hv_compile_env->set ("OPTS", opts_buf); + } + + if (__compile_env) { + printf ("export CC=\"%s\"\n", (*__hv_compile_env)["CC"]); + printf ("export CXX=\"%s\"\n", (*__hv_compile_env)["CXX"]); + printf ("export CFLAGS=\"%s\"\n", (*__hv_compile_env)["CFLAGS"]); + printf ("export CXXFLAGS=\"%s\"\n", (*__hv_compile_env)["CXXFLAGS"]); + printf ("export INCLUDE=\"%s\"\n", (*__hv_compile_env)["INCLUDE"]); + printf ("export OPTS=\"%s\"\n", (*__hv_compile_env)["OPTS"]); + printf ("export LDFLAGS=\"%s\"\n", (*__hv_compile_env)["LDFLAGS"]); + printf ("export LIBS=\"%s\"\n\n", (*__hv_compile_env)["LIBS"]); + } + + count = ENV->d_files->get_size (); + for (i = 0; i < count; ++i) { + S = rindex (ENV->d_files->get (i), '.'); + if (! S) + continue; + if (EQ (S, ".cpp") || EQ (S, ".cxx")) + compile_cppfile (ENV->d_files->get (i)); + if (EQ (S, ".c")) + compile_cfile (ENV->d_files->get (i)); + } + + if (__cc_shared || __cc_program) + __cc_build_target (); + + return 0; +} + +char compile_opt (DArray * d_opts, int * pos) +{ + int count; + char *opt; + if (! d_opts || ! pos) + return 0; + + opt = d_opts->get (*pos); + count = d_opts->get_size (); + if (EQ (opt, "--cc-script")) { + __cc_script = true; + return 1; + } + + if (EQ (opt, "--cc-shared") || + EQ (opt, "--compile-shared")) { + ++(*pos); + if (*pos >= count) + return 0; + __cc_shared = d_opts->get (*pos); + return 1; + } + + if (EQ (opt, "--cc-program") || + EQ (opt, "--compile-program")) { + ++(*pos); + if (*pos >= count) + return 0; + __cc_program = d_opts->get (*pos); + return 1; + } + + if (EQ (opt, "--cc-env") || + EQ (opt, "--compile-env")) { + __compile_env = true; + return 1; + } + + return 0; +} + +char compile_opt2 (DArray * d_opts, int * pos) +{ + char * S; + + if (! d_opts || ! pos) + return 0; + + S = d_opts->get (*pos); + if (EQ (S, "--compile") || + EQ (S, "-cc")) { + __hv_compile_env = bob_init_compile_env (); + compile_files (); + exit (0); + } + + return 0; +} + +void compile_info () +{ + printf ("C/C++ compilation plugin.\n"); + printf ("Version: 0.3\n"); + printf ("options: -cc --cc-script --cc-shared --cc-program) \n"); +} + +DArray * plugin_init (struct env_t *env) +{ + DArray * Ret; + struct mod_feature * pm; + + __compile_env = false; + ENV = env; + Ret = new DArray (1); + pm = CNEW (mod_feature, 1); + memset (pm, 0, sizeof (mod_feature)); + pm->mod.Type = TYPE_FEATURE; + pm->mod.Version = strdup ("1.0"); + pm->mod.short_info = compile_info; + pm->opt = compile_opt; + pm->opt2 = compile_opt2; + + __cc_script = false; + __cc_shared = NULL; + + ENV->listOptions->add ("--cc-script"); + ENV->listOptions->add ("-compile"); + ENV->listOptions->add ("-cc"); + ENV->listOptions->add ("--cc-shared"); + ENV->listOptions->add ("--compile-shared"); + ENV->listOptions->add ("--cc-program"); + ENV->listOptions->add ("--compile-program"); + ENV->listOptions->add ("--cc-env"); + ENV->listOptions->add ("--compile-env"); + + Ret->add (LPCHAR (pm)); + return Ret; +} + diff --git a/silentbob/plugins/plugin_csharp.cxx b/silentbob/plugins/plugin_csharp.cxx new file mode 100644 index 0000000..c200100 --- /dev/null +++ b/silentbob/plugins/plugin_csharp.cxx @@ -0,0 +1,159 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + * (??? :) ) + * + * --cgrep and --grep for C should work correctly with C# + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" DArray * plugin_init (struct env_t *env); +struct env_t *ENV; + +// At the first operation cycle of options. +char csharp_opt (DArray * d_opts, int * pos) +{ + int count; + char * S; + + if (! d_opts || ! pos) + return 0; + + count = d_opts->get_size (); + S = d_opts->get (*pos); + if (EQ (S, "--csharp")) { + ENV->language = "csharp"; + return 1; + } + +/* if (EQ (S, "--other-option")) { +// if (++(*pos) >= count) // For an option the parameter is necessary. +// return 0; + + return 1; + } */ + + return 0; +} + +// At the second operation cycle of options. +char csharp_opt2 (DArray * d_opts, int * pos) +{ + if (! d_opts || ! pos) + return 0; + + if (NE (ENV->language, "charp")) + return 0; + + if (EQ (d_opts->get (*pos), "--files")) { + /* unlink ("./csharp_files"); + sblib_find ("./", "*.cs", "./csharp_files"); + */ + fprintf (stderr, "Option not supported currently\n"); + exit (0); + } + + return 0; +} + + +/// It is carried out for each file +/// $ bob --csharp --make-ctags +int csharp_make_ctags (char * f_name, FILE * of) +{ + TT * tt; + char * op; + int m_type; + + if (! f_name) { + // To find all C# files. (see sblib_find sblib/Sblib.cpp) + + return 0; + } + + tt = new TT; + tt->loadFile (f_name); + tt->init (); + + // Cycle of pass on operators + while (true) { + op = tt->nextOperator (); + if (tt->ch == 0) + break; +/* + tt->line (); // Current line + tt->ch; // Closing symbol of the operator ( {,},;,\n) + tt->bracketDepth; // Degree of an enclosure {/} + + // See also (sblib/sblib.cxx) : + // DArray * split_to_words (char * d_op); + // int words_count (char *S); + // char * ww_last_word (char *d_op); */ + + // To deduce a line in "of" for each found tag. + // line format : \t\t\n" + printf ("OP: %s\n", op); + } + + delete tt; + return 0; +} + +// It is carried out at start $ bob - plugins-info +void csharp_plugin_info () +{ + printf ("C# plugin.\n"); + printf ("Version: 0.1\n"); + printf ("options: --csharp\n"); +} + +DArray * plugin_init (struct env_t *env) +{ + DArray * Ret; + struct mod_language * ml; + struct mod_feature * mf; + + ml = new mod_language; + mf = new mod_feature; + Ret = new DArray (2); + + memset (ml, 0, sizeof (mod_language)); + memset (mf, 0, sizeof (mod_feature)); + ENV = env; + + ml->mod.Type = TYPE_LANGUAGE; + ml->mod.Version = strdup ("0.1"); + ml->mod.short_info = csharp_plugin_info; + ml->language = strdup ("csharp"); + ml->the = THE_TT::do_tt_file; + ml->make_ctags = csharp_make_ctags; +// ml->call_tags = + + mf->mod.Type = TYPE_FEATURE; + mf->mod.Version = strdup ("0.1"); + mf->opt = csharp_opt; + mf->opt2 = csharp_opt2; + + Ret->add (LPCHAR (ml)); + Ret->add (LPCHAR (mf)); + + ENV->listOptions->add ("--csharp"); +// ENV->listOptions->add ("--other-option"); + ENV->listOptions->add ("--files"); + + + return Ret; +} + diff --git a/silentbob/plugins/plugin_editor.cxx b/silentbob/plugins/plugin_editor.cxx new file mode 100644 index 0000000..548a20a --- /dev/null +++ b/silentbob/plugins/plugin_editor.cxx @@ -0,0 +1,114 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define TMP_FILE "/tmp/.silent_bob.tmp.cpp" +extern "C" DArray * plugin_init (struct env_t *env); +struct env_t *ENV; +char * editor; + +void try_editor () +{ + int pid; + int fd; + int status; + char m_buf[1024]; + + pid = fork (); + if (pid < 0) + return; + + if (pid == 0) { + unlink (TMP_FILE); + fd = open (TMP_FILE, O_WRONLY | O_CREAT); + fchmod (fd, S_IREAD | S_IWRITE); + if (fd == -1) { + perror ("open"); + exit (1); + } + dup2 (fd, fileno (stdout)); + return; + } else { + if ((waitpid (pid, &status, 0) < 0) || + status != 0) + exit (status); + + sprintf (m_buf, "%s %s", editor, TMP_FILE); + system (m_buf); + exit (0); + } +} + +char editor_opt (DArray * d_opts, int * i) +{ + char * S; + if (! d_opts || ! i) + return 0; + + if (editor != NULL) + return 1; + + S = d_opts->get (*i); + if (EQ(S, "-g") || EQ(S, "--gvim")) + editor = "gvim"; + + if (EQ(S, "--emacs")) + editor = "emacs"; + + if (EQ(S, "--nano")) + editor = "nano"; + + if (editor != NULL) { + try_editor (); + return 1; + } + + return 0; +} + +void info () +{ + printf ("Editors.\n"); + printf ("Version: 1.0\n"); + printf ("Few editors for SilentBob:\n" + "\t-g --gvim\t-\tGVim\n" + "\t--emacs\t\t-\tEmacs\n" + "\t--nano\t\t-\tnano\n"); +} + +DArray * plugin_init (struct env_t *env) +{ + DArray * Ret; + struct mod_feature * pm; + + ENV = env; + Ret = new DArray (1); + pm = CNEW (mod_feature, 1); + memset (pm, 0, sizeof (mod_feature)); + pm->mod.Type = TYPE_FEATURE; + pm->mod.Version = strdup ("1.0"); + pm->opt = editor_opt; + pm->mod.Name = strdup ("Editors"); + pm->mod.short_info = info; + + ENV->listOptions->add ( "-g"); + ENV->listOptions->add ( "--gvim"); + ENV->listOptions->add ( "--emacs"); + ENV->listOptions->add ( "--nano"); + + editor = NULL; + Ret->add (LPCHAR (pm)); + return Ret; +} diff --git a/silentbob/plugins/plugin_foreach.cxx b/silentbob/plugins/plugin_foreach.cxx new file mode 100644 index 0000000..f92d3b6 --- /dev/null +++ b/silentbob/plugins/plugin_foreach.cxx @@ -0,0 +1,94 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" DArray * plugin_init (struct env_t *env); + +void __do_foreach (DArray * d_opts, int i) +{ + int count; + char * cmd; + char * m_buf; + int pid; + int status; + + if (! d_opts) + return; + + count = d_opts->get_size (); + if (i >= count) + return; + cmd = d_opts->get (i); + + m_buf = CNEW (char, 256); + while (fgets (m_buf, 255, stdin)) { + chomp (m_buf); + setenv ("FILE", m_buf, 1); + pid = fork (); + if (pid == 0) { + execlp ("sh", "sh", "-c", cmd, NULL); + exit (1); + } else + waitpid (pid, &status, 0); + } + free (m_buf); +} + +char foreach_opt (DArray * d_opts, int * pos) +{ + char * opt; + int i; + + if (! d_opts || ! pos) + return 0; + + i = *pos; + opt = d_opts->get (i); + if (EQ (opt, "--foreach")) { + __do_foreach (d_opts, ++i); + exit (0); + } + + return 0; +} + +void foreach_info () +{ + printf ("For each file.\n"); + printf ("Version: 1.0\n"); + printf ("options: --foreach\n"); +} + +DArray * plugin_init (struct env_t *env) +{ + DArray * Ret; + struct mod_feature * pm; + + ENV = env; + Ret = new DArray (1); + pm = CNEW (mod_feature, 1); + memset (pm, 0, sizeof (mod_feature)); + pm->mod.Type = TYPE_FEATURE; + pm->mod.Version = strdup ("1.0"); + pm->mod.short_info = foreach_info; + pm->opt = foreach_opt; + + ENV->listOptions->add ("--foreach"); + + Ret->add (LPCHAR (pm)); + return Ret; +} + diff --git a/silentbob/plugins/plugin_grep.cxx b/silentbob/plugins/plugin_grep.cxx new file mode 100644 index 0000000..9ff84d8 --- /dev/null +++ b/silentbob/plugins/plugin_grep.cxx @@ -0,0 +1,203 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" DArray * plugin_init (struct env_t *env); + +struct grep_env_t { + bool ignore_case; + char * f_name; +}; +struct grep_env_t ENV_grep; + +void grepBuf (char * buf, int size, char * search, int s_len) +{ + int nlines; + char *s_line; + char *ptr; + char *end; + char *end2; + char * line_ptr; + + if (size < s_len) + return; + + nlines = 1; + ptr = buf; + end = &buf[size - s_len - 1]; + end2 = &buf[size - 1]; + line_ptr = ptr; + + while (ptr <= end) { + if (*ptr == '\n') { + line_ptr = ptr+1; + ++nlines; + } + + if (! memcmp (ptr, search, s_len)) { + s_line = Dmid_getstr (line_ptr, end2); + if (! s_line) + break; + chomp (s_line); + if (SB_FLGET (SB_FLTAGSTYLE)) + printf ("%s\t%s\t%i\n", search, ENV_grep.f_name, nlines); + else + printf ("%s:%i: %s\n", ENV_grep.f_name, nlines, s_line); + fflush (stdout); + free (s_line); + ptr += s_len; + continue; + } + ++ptr; + } +} + +int grepFile (char * fileName, char * search) +{ + char * ptr; + int size; + + ptr = DFILE (fileName, &size); + if (! ptr) { + perror ("DFILE"); + return -1; + } + ENV_grep.f_name = fileName; + grepBuf (ptr, size, search, strlen (search)); + DROP (ptr); + return 0; +} + +void grep_loop (DArray * files, char * search) +{ + int s_len; + int nfiles; + int i; + + if (! files || ! search) + return; + + s_len = strlen (search); + nfiles = files->get_size (); + for (i = 0; i < nfiles; ++i) + grepFile (files->get (i), search); +} + +void grep_thread (int N, char * search) +{ + FILE * m_file; + char m_buf[512]; + + sprintf (m_buf, "%s%i", ENV->tmp_files, N); + m_file = fopen (m_buf, "r"); + if (! m_file) + return; + while (fgets (m_buf, 512, m_file)) { + chomp (m_buf); + grepFile (m_buf, search); + } + + fclose (m_file); +} + +char grep_opt (DArray * d_opts, int * pos) +{ + int count; + char * S; + + if (! d_opts || ! pos) + return 0; + + count = d_opts->get_size (); + S = d_opts->get (*pos); + if (EQ (S, "--grep")) { + ++(*pos); + return 1; + } + + return 0; +} + +char grep_opt2 (DArray * d_opts, int * pos) +{ + char * S; + __djob_t * j; + int i; + + if (! d_opts || ! pos) + return 0; + + S = d_opts->get (*pos); + if (NE (S, "--grep")) + return 0; + + ++(*pos); + S = d_opts->get (*pos); + if (! S) { + printf ("SilentBob grep require parameter.\n"); + exit (1); + } + + if (ENV->max_proc == 1) { + grep_loop (ENV->d_files, S); + exit (0); + } + + ENV->d_files->strings_to_file (ENV->tmp_files); + split_tmp_files (); + for (i = 0; i < ENV->max_proc; ++i) { + j = ENV->proc_list->fork (); + if (j->child) { + grep_thread (i, S); + exit (0); + } + } + + while ((j = ENV->proc_list->wait_all ()) && j) + Dexec_done (j); + + remove_tmp_files (); + exit (0); + return 0; +} + +void grep_info () +{ + printf ("Search of text.\n"); + printf ("Version: 1.1\n"); + printf ("options: --grep\n"); +} + +DArray * plugin_init (struct env_t *env) +{ + DArray * Ret; + struct mod_feature * pm; + + ENV = env; + Ret = new DArray (1); + pm = CNEW (mod_feature, 1); + memset (pm, 0, sizeof (mod_feature)); + pm->mod.Type = TYPE_FEATURE; + pm->mod.Version = strdup ("1.0"); + pm->mod.short_info = grep_info; + pm->opt = grep_opt; + pm->opt2 = grep_opt2; + + ENV->listOptions->add ("--grep"); + + Ret->add (LPCHAR (pm)); + return Ret; +} + diff --git a/silentbob/plugins/plugin_make.cxx b/silentbob/plugins/plugin_make.cxx new file mode 100644 index 0000000..3b917c1 --- /dev/null +++ b/silentbob/plugins/plugin_make.cxx @@ -0,0 +1,204 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" DArray * plugin_init (struct env_t *env); +struct env_t *ENV; + +char *__make; +char *__make_cc; +bool __compile_env; +EHash * __hv_compile_env; + +char plugin_make_opt (DArray * d_opts, int * pos) +{ + int count; + char * S; + + if (! d_opts || ! pos) + return 0; + + count = d_opts->get_size (); + S = d_opts->get (*pos); + + if (EQ (S, "--make")) { + if (++(*pos) >= count) + return 0; + + __make = d_opts->get (*pos); + return 1; + } + + if (EQ (S, "--make-env")) { + __compile_env = true; + return 1; + } + + return 0; +} + +void __make_dump_files () +{ + EArray * d_files = ENV->d_files; + char * S; + int count; + int i; + int k = 0; + + count = d_files->get_size (); + for (i = 0; i < count; ++i) { + S = d_files->get (i); + printf ("%s ", name2obj (d_files->get (i))); + if (++k == 3) { + printf ("\\\n\t"); + k = 0; + } + } + fputc ('\n', stdout); +} + +void __make_log (Array * ar) +{ + ar->dump (" "); + printf ("\n"); +} + +void __do_make_program () +{ + Array * ar; + char *S; + char * name; + int status; + int pid; + int count; + int i; + + printf ("PROJECT_OBJECTS="); + __make_dump_files (); + printf ("\n"); + printf ("%s : ${PROJECT_OBJECTS}\n", __make); + printf ("\t${CC} ${LIBS} ${LDFLAGS} -o %s ${PROJECT_OBJECTS}\n", __make); + printf ("\n"); + fflush (stdout); + + count = ENV->d_files->get_size (); + for (i = 0; i < count; ++i) { + name = ENV->d_files->get (i); + ar = new Array(32); + (*ar) << __make_cc; + (*ar) << "-MM"; + ar->expand ((*__hv_compile_env)["INCLUDE"], " "); + (*ar) << name; + (*ar) << NULL; + pid = fork (); + if (pid == 0) + execvp (ar->get (0), ar->get_skeleton ()); + else + waitpid (pid, &status, 0); + + delete ar; + S = fext (name); + if (S && EQ (S, ".c")) + printf ("\t${CC} ${CFLAGS} ${OPTS} ${INCLUDE} -c -o %s %s\n", name2obj (name), name); + else + printf ("\t${CXX} ${CXXFLAGS} ${OPTS} ${INCLUDE} -c -o %s %s\n", + name2obj (name), name); + + printf ("\n"); + fflush (stdout); + } + printf ("clean:\n\trm -f ${PROJECT_OBJECTS}\n\trm -f %s\n", __make); +} + +void __do_make_shared () +{ + __make_dump_files (); +} + +char plugin_make_opt2 (DArray * d_opts, int * pos) +{ + char * S; + + if (! d_opts || ! pos) + return 0; + + S = d_opts->get (*pos); + if (NE (S, "--make")) + return 0; + + if (! __make) + exit (1); + + __hv_compile_env = bob_init_compile_env (); + S = ENV->d_files->get (0); + S = rindex (S, '.'); + if (! S) + return 1; + + if (__compile_env) { + printf ("CC=%s\n", (*__hv_compile_env)["CC"]); + printf ("CXX=%s\n", (*__hv_compile_env)["CXX"]); + printf ("CFLAGS=%s\n", (*__hv_compile_env)["CFLAGS"]); + printf ("CXXFLAGS=%s\n", (*__hv_compile_env)["CXXFLAGS"]); + printf ("INCLUDE=%s\n", (*__hv_compile_env)["INCLUDE"]); + printf ("OPTS=%s\n", (*__hv_compile_env)["OPTS"]); + printf ("LDFLAGS=%s\n", (*__hv_compile_env)["LDFLAGS"]); + printf ("LIBS=%s\n\n", (*__hv_compile_env)["LIBS"]); + } + + if (EQ (S, ".c")) + __make_cc = (*__hv_compile_env)["CC"]; + else + __make_cc = (*__hv_compile_env)["CXX"]; + + if (__make) + __do_make_program (); + + exit (0); +} + +void plugin_make_info () +{ + printf ("Makefile plugin.\n"); + printf ("Version: 1.0\n"); + printf ("options: --make --make-env\n"); +} + +DArray * plugin_init (struct env_t *env) +{ + DArray * Ret; + struct mod_feature * pm; + + __compile_env = false; + ENV = env; + Ret = new DArray (1); + pm = CNEW (mod_feature, 1); + memset (pm, 0, sizeof (mod_feature)); + pm->mod.Type = TYPE_FEATURE; + pm->mod.Version = strdup ("1.0"); + pm->mod.short_info = plugin_make_info; + pm->opt = plugin_make_opt; + pm->opt2 = plugin_make_opt2; + + ENV->listOptions->add ( "--make"); + ENV->listOptions->add ( "--make-env"); + + Ret->add (LPCHAR (pm)); + return Ret; +} + diff --git a/silentbob/plugins/plugin_perl.cxx b/silentbob/plugins/plugin_perl.cxx new file mode 100644 index 0000000..ba40bf3 --- /dev/null +++ b/silentbob/plugins/plugin_perl.cxx @@ -0,0 +1,282 @@ +/* + * (c) Oleg Puchinin 2006. + * graycardinalster@gmail.com + * + * 25/06/06 - Perl plugin for SilentBob. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" DArray * plugin_init (struct env_t *env); +void __perl_files (char * f_name); +int perl_make_ctags (char * f_name, FILE * of); +char t_op2 (char ** d_in, char ** d_prev); + +struct env_t *ENV; +FILE * ofile; +char * PerlPackage; + +int perl_print_tags (char * f_name) +{ + + return 0; +} + +void perl_file (DArray * d_array) +{ + +} + +void pl_sub (struct tt_state_t *tt, int line, char * d_out, char ch) +{ + char *S; + char *part1, *part2; + + S = strchr (d_out, '('); + if (S) + *S = '\0'; + + part1 = strchr (d_out, ' '); + ++part1; + part2 = strchr (part1, ':'); + + if (part2) { + *part2 = '\0'; + ++part2; + part2 = strip (part2); + strip2 (part2); + } + + strip2 (part1); + if (part2) + fprintf (ofile, "%s:%s\t%s\t%i\n", part1, part2, tt->fileName, line); + else + fprintf (ofile, "%s\t%s\t%i\n", part1, tt->fileName, line); +} + +void pl_package (struct tt_state_t *tt, int line, char * d_out, char ch) +{ + char * S; + char * ptr; + + S = strchr (d_out, ' '); + if (! S) + return; + + strip2 (S); + + ptr = rindex (S, ':'); + if (ptr) { + ++ptr; + fprintf (ofile, "%s\t%s\t%i\n", ptr, tt->fileName, line); + } + fprintf (ofile, "%s\t%s\t%i\n", S, tt->fileName, line); +} + +void perl_make_tag (struct tt_state_t *tt, char * d_out, char ch) +{ + int line; + + line = tt->attachment[ENV->t_op_no].pair_line+1; + if (*d_out == ' ') + ++d_out; + + if (ch == '{' && (! strncmp (d_out, "sub ", 4))) { + pl_sub (tt, line, d_out, ch); + return; + } + + if (ch == ';' && (! strncmp (d_out, "package ", 8))) { + pl_package (tt, line, d_out, ch); + return; + } +} + +void pl_lookup () +{ + int i; + DArray * d_array; + + __perl_files (ENV->tmp_files); + d_array = new DArray (32); + d_array->from_file (ENV->tmp_files); + d_array->foreach ((Dfunc_t)chomp); + + for (i = 0; i < d_array->get_size (); ++i) { + if (! d_array->get (i)) + continue; + + perl_make_ctags (d_array->get (i), ofile); + } + + unlink (ENV->tmp_files); + d_array->foreach (free); + delete d_array; +} + +int perl_make_ctags (char * f_name, FILE * of) +{ + char ch; + char *d_ptr,*d_out; // for t_op2 + int block_depth = 0; + struct tt_state_t *tt; + + ofile = of; + if (f_name == NULL) { + pl_lookup (); + return 0; + } + + ENV->t_op_no = 0; + PerlPackage = NULL; + + tt = CNEW (tt_state_t, 1); + memset (tt, 0, sizeof (struct tt_state_t)); + tt->fileName = strdup (f_name); + THE_FLY::fly_for_file (tt); + //write (1, tt->d_output, tt->d_output_size); + + d_out = tt->result; + d_ptr = d_out; + while (true) { + ch = t_op2 (&d_ptr, &d_out); + ENV->t_op_no++; + + if (ch == '\0') + break; + + if (! block_depth) + perl_make_tag (tt, d_out, ch); + + if (ch == '{') + ++block_depth; + + if (ch == '}') + --block_depth; + + if (block_depth < 0) + block_depth = 0; + } + + free_tt_state (tt); + return 0; +} + +int perl_call_tags (char * f_name) +{ + printf ("Under construction.\n"); + return 0; +} + +char perl_opt (DArray * d_opts, int * i) +{ + if (! d_opts || ! i) + return 0; + + if (EQ (d_opts->get (*i), "--perl")) { + ENV->language = "Perl"; + return 1; + } + return 0; +} + +void __perl_files (char * f_name) +{ + unlink (f_name); + sblib_find ("./", "*.pm", f_name); + sblib_find ("./", "*.pl", f_name); + sblib_find ("./", "*.ph", f_name); +} + +char perl_files_opt (DArray * d_opts, int * i) +{ + if (! d_opts || ! i) + return 0; + + if (EQ (d_opts->get (*i), "--files") && EQ (ENV->language, "Perl")) { + __perl_files ("./perl_files"); + return 1; + } + + return 0; +} + +void perl_plugin_info () +{ + printf ("Perl support.\n"); + printf ("Version: 1.0-rc1\n"); + printf ("options: --perl --make-ctags\n"); +} + +void perl_files_info () +{ + printf ("Perl files.\n"); + printf ("Version: 1.0\n"); + printf ("options: --perl --files\n"); +} + +DArray * perl_init () +{ + DArray * Ret; + struct mod_feature * pm; + struct mod_feature * mod_perlfiles; + struct mod_language * pm_lang; + + Ret = new DArray (2); + pm = CNEW (mod_feature, 1); + pm_lang = CNEW (mod_language, 1); + mod_perlfiles = CNEW (mod_feature, 1); + + memset (pm, 0, sizeof (mod_feature)); + memset (pm_lang, 0, sizeof (mod_language)); + memset (mod_perlfiles, 0, sizeof (mod_feature)); + + pm->mod.Type = TYPE_FEATURE; + pm->mod.Version = strdup ("0.1"); + pm->opt = perl_opt; + + mod_perlfiles->mod.Type = TYPE_FEATURE; + mod_perlfiles->mod.Version = strdup ("1.0"); + mod_perlfiles->mod.short_info = perl_files_info; + mod_perlfiles->opt = perl_files_opt; + + pm_lang->mod.Type = TYPE_LANGUAGE; + pm_lang->mod.Version = strdup ("1.0-rc1"); + pm_lang->mod.short_info = perl_plugin_info; + pm_lang->language = strdup ("Perl"); + pm_lang->the = THE_FLY::fly_for_file; + pm_lang->print_tags = perl_print_tags; + pm_lang->file = perl_file; + pm_lang->make_ctags = perl_make_ctags; + + ENV->listOptions->add ("--perl"); + ENV->listOptions->add ("--files"); + + Ret->add (LPCHAR (pm)); + Ret->add (LPCHAR (pm_lang)); + Ret->add (LPCHAR (mod_perlfiles)); + + return Ret; +} + +DArray * plugin_init (struct env_t *env) +{ + ENV = env; +#if 1 + return perl_init (); +#else +// printf ("Perl module under construction.\n"); + return NULL; +#endif +} + diff --git a/silentbob/plugins/plugin_perlpackages.cxx b/silentbob/plugins/plugin_perlpackages.cxx new file mode 100644 index 0000000..ba29269 --- /dev/null +++ b/silentbob/plugins/plugin_perlpackages.cxx @@ -0,0 +1,132 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" DArray * plugin_init (struct env_t *env); +char t_op2 (char ** d_in, char ** d_prev); + +void __perl_files (char * f_name) +{ + unlink (f_name); + sblib_find ("./", "*.pm", f_name); + sblib_find ("./", "*.pl", f_name); + sblib_find ("./", "*.ph", f_name); +} + +void plpkg_one (struct tt_state_t * tt) +{ + char * d_out, *d_ptr; // for t_op2 + int block_depth = 0; + char ch; + char * S; + + d_out = tt->result; + d_ptr = d_out; + + while (true) { + ch = t_op2 (&d_ptr, &d_out); + if (ch == '\0') + break; + + S = d_out; + if (*S == ' ') + ++S; + + if (! block_depth && !strncmp (S, "package ", 8)) + printf ("%s\n", S); + + if (ch == '{') + ++block_depth; + + if (ch == '}') + --block_depth; + + if (block_depth < 0) + block_depth = 0; + + } +} + +void try_packages () +{ + int i; + struct tt_state_t * tt; + DArray * d_files; + + d_files = ENV->d_files; + if (d_files->get_size () == 0) { + __perl_files (ENV->tmp_files); + d_files->from_file (ENV->tmp_files); + d_files->foreach ((Dfunc_t)chomp); + unlink (ENV->tmp_files); + } + + for (i = 0; i < d_files->get_size (); i++) { + tt = CNEW (tt_state_t, 1); + + memset (tt, 0, sizeof (struct tt_state_t)); + if (! d_files->get (i)) + continue; + + tt->fileName = strdup (d_files->get (i)); + THE_FLY::fly_for_file (tt); + plpkg_one (tt); + free_tt_state (tt); + } +} + +char pl_opt (DArray * d_opts, int * i) +{ + if (! d_opts || ! i) + return 0; + + if (EQ (d_opts->get (*i), "--packages")) { + if (EQ (ENV->language, "Perl")) { + try_packages (); + exit (1); + } + } + + return 0; +} + +void plug_info () +{ + printf ("Perl packages.\n"); + printf ("Version: 1.0\n"); + printf ("options: --perl --packages\n"); +} + +DArray * plugin_init (struct env_t * env) +{ + DArray * Ret; + struct mod_feature * pm; + + ENV = env; + Ret = new DArray (32); + pm = CNEW (mod_feature, 1); + memset (pm, 0, sizeof (mod_feature)); + pm->mod.Type = TYPE_FEATURE; + pm->mod.Version = strdup ("1.0"); + pm->mod.short_info = plug_info; + pm->opt2 = pl_opt; + + ENV->listOptions->add ("--packages"); + + Ret->add (LPCHAR (pm)); + return Ret; +} + diff --git a/silentbob/plugins/plugin_python.cxx b/silentbob/plugins/plugin_python.cxx new file mode 100644 index 0000000..e60940a --- /dev/null +++ b/silentbob/plugins/plugin_python.cxx @@ -0,0 +1,233 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include +#include + +extern "C" DArray * plugin_init (struct env_t *env); +int python_ctags (char * f_name, FILE * of); + +namespace PYTHON { + char * py_tt_file (struct tt_state_t * tt); + char t_op (char ** d_in, char ** d_prev); +} + +char * py_prepare (char *ptr) +{ + char *S; + + S = strchr (ptr, '('); + if (S) + *S = '\0'; + + strip2 (ptr); + S = strchr (ptr, ' '); + return ++S; +} + +void python_tag (tt_state_t * tt, char *ptr, char ch, int type, FILE *of) +{ + int line = tt->attachment[ENV->t_op_no].pair_line+1; + + while (*ptr == ' ' || *ptr == '\t') + ++ptr; + + if (type & OT::Class) { + if (! strncmp (ptr, "def ", 4)) { + ptr = py_prepare (ptr); + goto ttry; + } + } + + if (type & OT::Function) { + if (! strncmp (ptr, "class ", 6)) { + ptr = py_prepare (ptr); + goto ttry; + } + } + + return; +ttry: + fprintf (of, "%s\t%s\t%i\n", ptr, tt->fileName, line); +} + +void python_lookup () +{ + DArray * d_array; + + unlink (ENV->tmp_files); + sblib_find ("./", "*.py", ENV->tmp_files); + d_array = ENV->d_files; + d_array->from_file (ENV->tmp_files); + unlink (ENV->tmp_files); + d_array->foreach ((Dfunc_t)chomp); +} + +void python_ctags_foreach (FILE * of) +{ + int i; + DArray * d_array = ENV->d_files; + for (i = 0; i < d_array->get_size (); ++i) { + if (! d_array->get (i)) + continue; + + python_ctags (d_array->get (i), of); + free (d_array->get (i)); + } +} + +int python_ctags (char * f_name, FILE * of) +{ + char ch; + char *d_ptr,*d_out; // for t_op2 + struct tt_state_t *tt; + + if (! f_name) { + python_lookup (); + python_ctags_foreach (of); + return 0; + } + + ENV->t_op_no = 0; + + tt = CNEW (tt_state_t, 1); + memset (tt, 0, sizeof (struct tt_state_t)); + tt->fileName = strdup (f_name); + PYTHON::py_tt_file (tt); + + d_out = tt->result; + d_ptr = d_out; + while (true) { + ch = PYTHON::t_op (&d_ptr, &d_out); + ++ENV->t_op_no; + + if (ch == '\0') + break; + + python_tag (tt, d_out, ch, OT::Function | OT::Class, of); + } + + free_tt_state (tt); + return 0; +} + +void pyc_one (char * f_name) +{ + char *S; + char ch; + char *d_ptr,*d_out; // for t_op2 + struct tt_state_t *tt; + + tt = CNEW (tt_state_t, 1); + memset (tt, 0, sizeof (struct tt_state_t)); + tt->fileName = strdup (f_name); + PYTHON::py_tt_file (tt); + + d_out = tt->result; + d_ptr = d_out; + while (true) { + ch = PYTHON::t_op (&d_ptr, &d_out); + + if (ch == '\0') + break; + + S = d_out; + while (*S == ' ' || *S == '\t') + ++S; + + if (! strncmp (S, "class ", 6)) + printf ("%s\n", py_prepare (S)); + } + + free_tt_state (tt); +} + +void py_class () +{ + int i; + + if (! ENV->d_files->get_size ()) + python_lookup (); + + for (i = 0; i < ENV->d_files->get_size (); ++i) + pyc_one (ENV->d_files->get (i)); + + exit (0); +} + +char py_opt (DArray * d_opts, int * i) +{ + if (! d_opts || ! i) + return 0; + + if (EQ (d_opts->get (*i), "--python")) { + ENV->language = strdup ("Python"); + return 1; + } + + if (EQ (d_opts->get (*i), "--files") && EQ (ENV->language, "Python")) { + unlink ("./python_files"); + sblib_find ("./", "*.py", "./python_files"); + exit (0); + } + + return 0; +} + +char py_opt2 (DArray * d_opts, int * i) +{ + if (EQ (ENV->language, "Python") && EQ (d_opts->get (*i), "--class")) { + py_class (); + return 1; + } + return 0; +} + +void py_info () +{ + printf ("Python plugin.\n"); + printf ("Version: 1.0\n"); + printf ("options: --python [--files | --make-ctags | --class ]\n"); +} + +DArray * plugin_init (struct env_t *env) +{ + struct mod_feature * pm; + struct mod_language * pm_lang; + DArray * Ret; + + pm = CNEW (mod_feature, 1); + pm_lang = CNEW (mod_language, 1); + + memset (pm, 0, sizeof (struct mod_feature)); + memset (pm_lang, 0, sizeof (struct mod_language)); + pm_lang->mod.Version = strdup ("1.0"); + pm_lang->mod.Type = TYPE_LANGUAGE; + pm_lang->the = PYTHON::py_tt_file; + pm_lang->make_ctags = python_ctags; + pm_lang->language = strdup ("Python"); + + pm->mod.Version = strdup ("1.0"); + pm->opt = py_opt; + pm->opt2 = py_opt2; + pm->mod.Type = TYPE_FEATURE; + pm->mod.short_info = py_info; + + ENV->listOptions->add ( "--python"); + ENV->listOptions->add ( "--files"); + ENV->listOptions->add ( "--class"); + + Ret = new DArray (2); + Ret->add (LPCHAR (pm)); + Ret->add (LPCHAR (pm_lang)); + + return Ret; +} + diff --git a/silentbob/plugins/plugin_scons.cxx b/silentbob/plugins/plugin_scons.cxx new file mode 100644 index 0000000..3a34674 --- /dev/null +++ b/silentbob/plugins/plugin_scons.cxx @@ -0,0 +1,200 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include + +extern "C" DArray * plugin_init (struct env_t *env); +EHash * __compile_env; +bool __scons_env; + +void __scons_files_join (DArray * d_files) +{ + char *S; + int count; + int i; + + if (! d_files) + return; + + i = 0; + S = d_files->get (i); + if (S) + printf ("\'%s\',\n\t", S); + else { + printf ("\n"); + return; + } + + count = d_files->get_size (); + for (i = 1; i < count; ++i) { + S = d_files->get (i); + if (! S) + break; + + printf ("\'%s\'", S); + if ((i+1) < count) + printf (", "); + + } +} + +void __print_cpppath () +{ + EList * list; + char *S; + list = new EList; + + printf ("CPPPATH=["); + Dsplit ( ((*__compile_env) ["INCLUDE"]), " ", list); + list->first (); + while ((S = list->get ()) && S) { + if (strlen (S) > 2) { + S+=2; + printf ("'%s'", S); + } + + if (list->next ()) + printf (", "); + } + + printf ("], "); + list->foreach ((Dfunc_t)free); + delete list; +} + +void __do_scons (char * pr_name, char * type) +{ + DArray * d_files; + + if (! pr_name || ! type) + return; + + d_files = ENV->d_files; + if (! d_files || d_files->get_size () <= 0) + return; + + __compile_env = bob_init_compile_env (); + if (! __compile_env) + return; + + if (__scons_env) { + printf ("env = Environment ("); + printf ("CC=\'%s\', ", (*__compile_env) ["CC"]); + printf ("CXX=\'%s\', ", (*__compile_env) ["CXX"]); + printf ("CCFLAGS=\'%s\', ", (*__compile_env) ["CFLAGS"]); + printf ("CXXFLAGS=\'%s\', ", (*__compile_env) ["CXXFLAGS"]); + printf ("OPTS=\'%s\', ", (*__compile_env) ["OPTS"]); + __print_cpppath (); + printf ("LINKFLAGS=\'%s %s\'", (*__compile_env) ["LIBS"], (*__compile_env) ["LDFLAGS"]); + printf (")\n"); + } + printf ("env.%s (\"%s\", [", type, pr_name); + __scons_files_join (d_files); + printf ("])\n"); +} + +char scons_program_opt2 (DArray * d_opts, int * pos) +{ + int count; + char * S; + char * type; + + if (! d_opts || ! pos) + return 0; + + count = d_opts->get_size (); + S = d_opts->get (*pos); + + if (EQ (S, "--scons-program")) { + if (++(*pos) >= count) + return 0; + type = "Program"; + goto letsdoit; + } + + if (EQ (S, "--scons-shared")) { + if (++(*pos) >= count) + return 0; + type = "SharedLibrary"; + goto letsdoit; + } + + if (EQ (S, "--scons-static")) { + if (++(*pos) >= count) + return 0; + type = "Library"; + goto letsdoit; + } + + return 0; + +letsdoit: + S = d_opts->get (*pos); + __do_scons (S, type); + exit (0); + return 1; +} + +char scons_program_opt (DArray * d_opts, int * pos) +{ + int count; + char *S; + + if (! d_opts || ! pos) + return 0; + + count = d_opts->get_size (); + S = d_opts->get (*pos); + if (EQ (S, "--scons-program") || + EQ (S, "--scons-shared")) { + if (++(*pos) >= count) + return 0; + return 1; + } + if (EQ (S, "--scons-env")) { + __scons_env = true; + return 1; + } + + return 0; +} + +void scons_program_info () +{ + printf ("Scons file.\n"); + printf ("Version: 0.1\n"); + printf ("options: --scons-[program | shared | static] --scons-env\n"); +} + +DArray * plugin_init (struct env_t *env) +{ + struct mod_feature * pm; + DArray * Ret; + + __scons_env = false; + ENV = env; + Ret = new DArray (1); + pm = CNEW (mod_feature, 1); + memset (pm, 0, sizeof (mod_feature)); + pm->mod.Type = TYPE_FEATURE; + pm->mod.Version = strdup ("0.1"); + pm->mod.short_info = scons_program_info; + pm->opt = scons_program_opt; + pm->opt2 = scons_program_opt2; + + ENV->listOptions->add ("--scons-program"); + ENV->listOptions->add ("--scons-shared"); + ENV->listOptions->add ("--scons-env"); + ENV->listOptions->add ("--scons-static"); + + Ret->add (LPCHAR (pm)); + return Ret; +} + diff --git a/silentbob/plugins/plugin_test.cxx b/silentbob/plugins/plugin_test.cxx new file mode 100644 index 0000000..79c44d3 --- /dev/null +++ b/silentbob/plugins/plugin_test.cxx @@ -0,0 +1,109 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" DArray * plugin_init (struct env_t *env); +struct env_t *ENV; + +char test_plugin_opt (DArray * d_opts, int * pos) +{ + int count; + char * S; + + if (! d_opts || ! pos) + return 0; + + count = d_opts->get_size (); + S = d_opts->get (*pos); + if (EQ (S, "--test")) { + return 1; + } + + return 0; +} + +int test_plugin_file (char * fileName) +{ + TT * tt; + char * op; + int m_type; + + tt = new TT; + tt->loadFile (fileName); + tt->init (); + + while (true) { + op = tt->nextOperator (); + if (tt->ch == 0) + break; + + // if (tt->bracketDepth) + // continue; + + m_type = tt->wit (); + if (m_type & OT::Class) + globalsPrint (tt->tt, tt->op (), m_type); + } + + delete tt; + return 0; +} + +char test_plugin_opt2 (DArray * d_opts, int * pos) +{ + char * S; + int i; + + if (! d_opts || ! pos) + return 0; + + S = d_opts->get (*pos); + if (EQ (S, "--test")) { + for (i = 0; i < ENV->d_files->get_size (); ++i) + test_plugin_file (ENV->d_files->get (i)); + exit (0); + } + + return 0; +} + +void test_plugin_info () +{ + printf ("Test plugin.\n"); + printf ("Version: 1.0\n"); + printf ("options: --test\n"); +} + +DArray * plugin_init (struct env_t *env) +{ + DArray * Ret; + struct mod_feature * pm; + + ENV = env; + Ret = new DArray (1); + pm = CNEW (mod_feature, 1); + memset (pm, 0, sizeof (mod_feature)); + pm->mod.Type = TYPE_FEATURE; + pm->mod.Version = strdup ("1.0"); + pm->mod.short_info = test_plugin_info; + pm->opt = test_plugin_opt; + pm->opt2 = test_plugin_opt2; + + Ret->add (LPCHAR (pm)); + return Ret; +} + diff --git a/silentbob/plugins/plugin_xml_project.cxx b/silentbob/plugins/plugin_xml_project.cxx new file mode 100644 index 0000000..e960602 --- /dev/null +++ b/silentbob/plugins/plugin_xml_project.cxx @@ -0,0 +1,115 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" DArray * plugin_init (struct env_t *env); +struct env_t *ENV; +char * __xml_project_name; +char * __xml_type; +EHash * __compile_env; + +char xml_project_opt (DArray * d_opts, int * pos) +{ + int count; + char * S; + + if (! d_opts || ! pos) + return 0; + + count = d_opts->get_size (); + S = d_opts->get (*pos); + + if (EQ (S, "--xml-bin") || + EQ (S, "--xml-program")) { + if (++(*pos) >= count) + return 1; + __xml_type = "программа"; + __xml_project_name = d_opts->get (*pos); + return 1; + } + + if (EQ (S, "--xml-shared")) { + if (++(*pos) >= count) + return 1; + __xml_type = "шаровая_лайба"; + __xml_project_name = d_opts->get (*pos); + return 1; + } + + return 0; +} + +void xmlDump () +{ + printf ("\t<модуль имя=\"%s\" тип=\"%s\">\n", __xml_project_name, __xml_type); + printf ("\t<свойство CC=\"%s\" />\n", (*__compile_env)["CC"]); + printf ("\t<свойство CXX=\"%s\" />\n", (*__compile_env)["CXX"]); + printf ("\t<свойство OPTS=\"%s\" />\n", (*__compile_env)["OPTS"]); + printf ("\t<свойство INCLUDE=\"%s\" />\n", (*__compile_env)["INCLUDE"]); + printf ("\t<свойство LIBS=\"%s\" />\n", (*__compile_env)["LIBS"]); + printf ("\t<свойство LDFLAGS=\"%s\" />\n", (*__compile_env)["LDFLAGS"]); + + printf ("\t<исходники>\n"); + for (int i = 0; i < ENV->d_files->get_size (); ++i) + printf ("\t\t<файл имя=\"%s\" />\n", ENV->d_files->get (i)); + printf ("\t\n"); + printf ("\t\n"); +} + +char xml_project_opt2 (DArray * d_opts, int * pos) +{ + char * S; + + if (! d_opts || ! pos) + return 0; + + S = d_opts->get (*pos); + if (EQ (S, "--xml-bin") || + EQ (S, "--xml-program") || + EQ (S, "--xml-shared")) { + __compile_env = bob_init_compile_env (); + xmlDump (); + exit (0); + } + + return 0; +} + +void xml_project_info () +{ + printf ("XML Project.\n"); + printf ("Version: 1.0\n"); + printf ("options: --xml-project --xml-bin --xml-shared\n"); +} + +DArray * plugin_init (struct env_t *env) +{ + DArray * Ret; + struct mod_feature * pm; + + ENV = env; + Ret = new DArray (1); + pm = CNEW (mod_feature, 1); + memset (pm, 0, sizeof (mod_feature)); + pm->mod.Type = TYPE_FEATURE; + pm->mod.Version = strdup ("1.0"); + pm->mod.short_info = xml_project_info; + pm->opt = xml_project_opt; + pm->opt2 = xml_project_opt2; + + Ret->add (LPCHAR (pm)); + return Ret; +} + diff --git a/silentbob/sblib/Makefile.am b/silentbob/sblib/Makefile.am new file mode 100644 index 0000000..b064fb3 --- /dev/null +++ b/silentbob/sblib/Makefile.am @@ -0,0 +1,7 @@ +INCLUDES=-I$(top_srcdir)/include -I$(top_srcdir)/gclib/include +lib_LTLIBRARIES = libsblib.la +libsblib_la_SOURCES = Sblib.cxx the_tt.cxx the_fly.cxx t_op.cxx \ + t_op2.cxx wit.cxx TT.cxx py_tt.cxx + +libsblib_la_LIBADD=-L$(top_builddir)/gclib/src/.libs -lgclib + diff --git a/silentbob/sblib/Makefile.in b/silentbob/sblib/Makefile.in new file mode 100644 index 0000000..083dace --- /dev/null +++ b/silentbob/sblib/Makefile.in @@ -0,0 +1,472 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = sblib +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +libsblib_la_DEPENDENCIES = +am_libsblib_la_OBJECTS = Sblib.lo the_tt.lo the_fly.lo t_op.lo \ + t_op2.lo wit.lo TT.lo py_tt.lo +libsblib_la_OBJECTS = $(am_libsblib_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libsblib_la_SOURCES) +DIST_SOURCES = $(libsblib_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/gclib/include +lib_LTLIBRARIES = libsblib.la +libsblib_la_SOURCES = Sblib.cxx the_tt.cxx the_fly.cxx t_op.cxx \ + t_op2.cxx wit.cxx TT.cxx py_tt.cxx + +libsblib_la_LIBADD = -L$(top_builddir)/gclib/src/.libs -lgclib +all: all-am + +.SUFFIXES: +.SUFFIXES: .cxx .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sblib/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu sblib/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libsblib.la: $(libsblib_la_OBJECTS) $(libsblib_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libsblib_la_OBJECTS) $(libsblib_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Sblib.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TT.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/py_tt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_op.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_op2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/the_fly.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/the_tt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wit.Plo@am__quote@ + +.cxx.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cxx.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cxx.lo: +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(libdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-libLTLIBRARIES + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/silentbob/sblib/Sblib.cxx b/silentbob/sblib/Sblib.cxx new file mode 100644 index 0000000..024f2f1 --- /dev/null +++ b/silentbob/sblib/Sblib.cxx @@ -0,0 +1,1277 @@ +/* + * (c) Oleg Puchinin 2006,2007 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct env_t *ENV; + +char * __bice_get (char *optname) +{ + char * value; + value = ENV->settings->get (optname); + if (! value) + value = getenv (optname); + return value; +} + +EHash * bob_init_compile_env () +{ + EHash * compile_env; + char *cc; + char *cxx; + char *cflags; + char *cxxflags; + char *opts; + char *include; + char *libs; + char *ldflags; + + compile_env = new EHash; + + cc = __bice_get ("CC"); + cxx = __bice_get ("CXX"); + cflags = __bice_get ("CFLAGS"); + cxxflags = __bice_get ("CXXFLAGS"); + opts = __bice_get ("OPTS"); + include = __bice_get ("INCLUDE"); + libs = __bice_get ("LIBS"); + ldflags = __bice_get ("LDFLAGS"); + + if (! cc) + cc = "gcc"; + if (! cxx) + cxx = "g++"; + if (! cflags) + cflags = "-O3 -Wall -pipe"; + if (! cxxflags) + cxxflags = cflags; + if (! opts) + opts = ""; + if (! include) + include = ""; + if (! libs) + libs = ""; + if (! ldflags) + ldflags = ""; + + if (SB_FLGET (SB_FLVERBOSE)) { + printf ("C compiler: %s\n", cc); + printf ("C++ compiler: %s\n", cxx); + printf ("C flags: %s\n", cflags); + printf ("C++ flags: %s\n", cxxflags); + printf ("OPTS: %s\n", opts); + printf ("INCLUDE: %s\n", include); + printf ("LIBS: %s\n", libs); + printf ("LDFLAGS: %s\n", ldflags); + } + + compile_env->set ("CC", strdup (cc)); + compile_env->set ("CXX", strdup (cxx)); + compile_env->set ("CFLAGS", strdup (cflags)); + compile_env->set ("CXXFLAGS", strdup (cxxflags)); + compile_env->set ("OPTS", strdup (opts)); + compile_env->set ("INCLUDE", strdup (include)); + compile_env->set ("LIBS", strdup (libs)); + compile_env->set ("LDFLAGS", strdup (ldflags)); + + return compile_env; +} + +int sb_prname (char *arg) +{ + int i_cmd = 0; + char * d_ptr; + d_ptr = arg + strlen (arg); + d_ptr--; + + while (*d_ptr != '\\' && + d_ptr > arg) + d_ptr--; + + if (*d_ptr == '\\') + d_ptr++; + + if (EQ (d_ptr, "tags")) + i_cmd = cmd_tags; + else if (EQ (d_ptr, "the_tt")) + i_cmd = cmd_the_tt; + else if (EQ (d_ptr, "gc_indent")) + i_cmd = cmd_indent; + else if (EQ (d_ptr, "structs")) + i_cmd = cmd_give_structs; + + return i_cmd; +} + +// SilentBob --tags +void tags (DArray * d_names, char * d_file_output) +{ + struct fdump_param_t d_param; + EArray * d_tags; + struct d_tag_t * d_tag; + int a, i, n_names; + + if (! d_names) + return; + + n_names = d_names->get_size (); + + for (i = 0; i < n_names; i++) { + d_tags = got_tag (d_names->get (i)); + if (d_tags == NULL) { + if (d_tags->get_size () == 0) { + fprintf (ENV->d_stream_dbg, "Tag not found : %s\n", + d_names->get (i)); + fflush (ENV->d_stream_dbg); + delete d_tags; + continue; + } + } + + if (! d_tags) + continue; + + if(! d_tags->get_size ()) { + delete d_tags; + d_tags = NULL; + continue; + } + + fault (! d_tags); + + for (a = 0; a < d_tags->get_size (); a++) { + d_tag = (d_tag_t *) d_tags->get (a); + + fault (! d_tag); + + if (! d_file_output) + printf ("// file %s line %i\n", + d_tag->d_file, d_tag->d_line); + + memset (&d_param, 0, sizeof (struct fdump_param_t)); + d_param.n_trip = 0; + d_param.d_file_name = d_tag->d_file; + d_param.d_line = d_tag->d_line; + d_param.linear = true; + d_param.d_file_output = d_file_output; + if (d_tag->d_type == OT::Function) + d_param.b_force_block = true; + + nogui_fdump (&d_param); + if (! d_file_output) + fputc ('\n', stdout); + + DROP (d_tag); + } + + if (d_tags) { + d_tags->drop (); + delete d_tags; + } + } + + fflush (stdout); +} + +void bug_longmacro () +{ + printf ("Too big macro." + "If your macro have more than 300 lines, please " + "contact \n" + "Program stopped.\n"); + + exit (0); +} + +void bug_nosuch_tag (char * f_name) +{ + printf ("Tag \"%s\" not found. Broken \"tags\" file ? " + "Try \"silent-bob --make-ctags\".\n", f_name); +} + +void bug_nocalltags () +{ + printf ("File \"call_tags\" not found. " + "Try \"silent-bob --call-tags [-L] \"\n"); + exit (1); +} + +void bug_system () +{ + printf ("Can't make tags file. Maybe you do not have write permissions ?\n"); + exit (1); +} + +void bug_fork () +{ + perror ("fork"); + exit (1); +} + +void bug_plugin (char *name) +{ + fprintf (stderr, "Can't load plugin (%s)\n", name); +} + +void bug_notsupported () +{ + printf ("SilentBob (or language plugin)" + " don't support this feature !\n"); +} + +bool bob_tag (char *d_str, char * d_name, d_tag_t * d_tag) +{ + char m_buf[256]; + char *d_file; + char *S; + + strcpy (m_buf, d_str); + d_str = m_buf; + + strncpy (d_tag->d_name, d_name, 255); + d_tag->d_name[255] = 0; + S = strchr (d_str, '\t'); + if (! S) + return false; + + S++; + d_file = S; + S = strchr (d_file, '\t'); + if (! S) + return false; + + *S = 0; + strncpy (d_tag->d_file, d_file, 255); + d_tag->d_file[255] = 0; + + S++; + + if (if_digit (S)) + d_tag->d_line = atoi (S); + else + return false; + + return true; +} + +char * cts (struct c_word * d_word) +{ + char * S; + + if (d_word == NULL) + return NULL; + + S = d_word->S; + if (!strncmp (S, "else ", 5)) + S += 5; + + if (d_word->ch != '(') + return NULL; + + while (!strncmp (S, "do ", 3)) + S += 3; + + if (!strncmp (S, "return ", 7)) + S += 7; + + if (ENV->d_cops->sfind (S) != -1) + return NULL; + + if (words_count (S) != 1) + return NULL; + + return S; +} + +bool def_test (char * d_op) +{ + char * S = d_op; + ++S; + while (*S == ' ' || *S == '\t') + ++S; + + if (! strncmp (S, "define", 6)) + return true; + return false; +} + +int find_cfiles () +{ + find_one_ext ("*.h"); + find_one_ext ("*.hpp"); + find_one_ext ("*.cpp"); + find_one_ext ("*.c"); + find_one_ext ("*.cc"); + find_one_ext ("*.cxx"); + return 0; +} + +int sblib_find (char * path, char * name, char * f_outname) +{ + int devnull; + int fd; + int pid; + int status = -1; + + pid = fork (); + if (pid == 0) { + devnull = open ("/dev/null", O_WRONLY, 0600); + fd = open (f_outname, O_WRONLY, 0600); + if (fd == -1) { + fd = open (f_outname, O_WRONLY | O_CREAT, 0600); + if (fd == -1) { + close (devnull); + return -1; + } + } else + lseek (fd, 0, SEEK_END); + dup2 (devnull, 2); + dup2 (fd, 1); + execlp ("find", path, "-name", name, NULL); + } else if (pid > 0) { + waitpid (pid, &status, 0); + return status; + } + + return status; +} + +# define TMP_FILE_NAME "./silent_bob.tmp" +struct tt_state_t * get_onett_tag (char * f_name, char ** d_tt_buf) +{ + DArray d_array; + tt_state_t * Ret = NULL; + char * S; + + if (d_tt_buf) + *d_tt_buf = NULL; + + d_array.add (f_name); + Ret = CNEW (tt_state_t, 1); + + unlink (TMP_FILE_NAME); + tags (&d_array, TMP_FILE_NAME); + + while( 1 ) { + if (access (TMP_FILE_NAME, R_OK) != 0) + break; + + Ret->fileName = strdup (TMP_FILE_NAME); + S = THE_TT::do_tt_file (Ret); + + if (S == NULL) + break; + + if (Ret->mmaped) + munmap (Ret->fileData, Ret->fileDataSize); + + if (Ret->fd) + close (Ret->fd); + + if (d_tt_buf) + *d_tt_buf = S; + + unlink (TMP_FILE_NAME); + return Ret; + } + + DROP (Ret); + unlink (TMP_FILE_NAME); + return NULL; +} + +void globalsPrint (tt_state_t * tt, char * d_out, int d_found_type) +{ + int t_line; + + if (SB_FLGET (SB_FLSIMULATE)) + return; + + if (d_found_type & OT::Other) + return; + + t_line = tt->attachment[ENV->t_op_no].pair_line+1; + t_line += ww_begin_line (tt, d_out, + tt->attachment[ENV->t_op_no].offset); + + if (SB_FLGET(SB_FLTAGSTYLE)) + mk_tag (d_out, tt->fileName, + t_line, d_found_type); + else + printf ("%s\t\t//file %s //line %i\n", d_out, + tt->fileName, t_line); +} + +#define NOT_VALID 0 +#define CALL_BACK 1 +#define VALID 2 + +EArray * got_tag (char * d_tag) +{ + struct d_tag_t *d_new_tag; + char d_buf[256]; + EArray * d_ret; + int d_len; + char *S; + int i; + + d_ret = new EArray; + + if (ENV->d_tags_file == NULL) { + ENV->d_tags_file = new EArray; + ENV->d_tags_file->from_file ("./tags"); + } + + snprintf (d_buf, 255, "%s\t", d_tag); + d_len = strlen (d_buf); + + if (ENV->d_tags_file->get_size () == 0) + return d_ret; + + i = ENV->d_tags_file->snfind_fast (d_buf, strlen (d_buf)); + + if (i == -1) { + fprintf (ENV->d_stream_dbg, "\tENV->d_tags_file->snfind_fast == -1"); LN; + return d_ret; + } + + d_len = strlen (d_buf); + do { + i++; + S = ENV->d_tags_file->get (i); + if (! S) + break; + } while (! strncmp (S, d_buf, d_len)); + --i; + + while (true) { + S = ENV->d_tags_file->get (i); + fprintf (ENV->d_stream_dbg, "\ttag : %s\n", S); fflush (ENV->d_stream_dbg); + + d_new_tag = CNEW (d_tag_t, 1); + memset (d_new_tag, 0, sizeof (d_tag_t)); + if (strstr (S, ";\tf")) + d_new_tag->d_type = OT::Function; + + if (bob_tag (S, d_tag, d_new_tag) == false) { + DROP (d_new_tag); + fprintf (ENV->d_stream_dbg, "\tBAD tag : %s\n", S); + return d_ret; + } + + d_ret->add ((long) d_new_tag); + + i--; + if (i < 0) + break; + + S = ENV->d_tags_file->get (i); + if (strncmp (S, d_tag, strlen (d_tag))) + break; + } + + return d_ret; +} + +char * macro_name (char * d_op, char * d_macro_name) +{ + char *d_begin; + char *S; + char m_buf[256]; + + strncpy (m_buf, d_op, 255); + m_buf[255] = 0; + + S = strstr (m_buf, "define"); + + if (! S) + return NULL; + + S = strchr (S, ' '); + if (! S) + return NULL; + + while (*S == ' ') + S++; + + d_begin = S; + S = strchr (d_begin, ' '); + if (S) + *S = 0; + + S = strchr (d_begin, '('); + if (S) + *S = 0; + + strcpy (d_macro_name, d_begin); + return d_macro_name; +} + +void mk_tag_macro (char * d_op, char * d_file, int t_line) +{ + char S[256]; + + if (! macro_name (d_op, S)) + return; + + printf ("%s\t%s\t%i\n", S, d_file, t_line); +} + +void mk_tag (char * d_op, char * d_file, int line, int d_found_type) +{ + char * d_format = "%s\t%s\t%i\n"; + char * S; + + if (d_found_type & OT::Define) { + mk_tag_macro (d_op, d_file, line); + return; + } + + if (d_found_type & OT::Class) { + S = strchr (d_op, ':'); + if (S) + *S = 0; + } + + S = ww_last_word (d_op); + if (! S || !(*S) || (*S == ' ')) + return; + + if (*S == 's') { + if (! strncmp (S, "static", 6)) + return; + if (! strncmp (S, "struct", 6)) + return; + } + + if (*S == 'u' && !strncmp (S, "union", 5)) + return; + if (*S == 'e' && !strncmp (S, "enum", 4)) + return; + + if (d_found_type & OT::Function) + d_format = "%s\t%s\t%i\t;\tf\n"; + + printf (d_format, S, d_file, line); +} + +DArray * mk_tag_structtail_split (char *S) +{ + bool b_macro = false; + char * d_old = NULL; + int brace_depth = 0; + DArray * d_array; + + d_array = new DArray (128); + if (! d_array) + return NULL; + + d_old = S; + + while (true) { + if (*S == '\"' || *S == '\'') { + S = sstrend (S); + if (S == NULL || *S == '\0') + break; + } + + if (*S == '(') + brace_depth++; + + if (*S == ')') { + brace_depth--; + if (! brace_depth) { + S++; + break; + } + } + + if (*S == 0) { + if (! b_macro) + d_array->add (d_old); + break; + } + + if (brace_depth) { + S++; + continue; + } + + if (S[1] == '(') { + b_macro = true; + S++; + continue; + } + + if (*S == ' ' || *S == ',') { + *S = 0; + S++; + b_macro = false; + while (*S == ' ' || *S == '*') + S++; + if (! b_macro) + d_array->add (d_old); + d_old = S; + + continue; + } + S++; + } + + return d_array; +} + +void mk_tag_structtail (char * S, char * d_file, int t_line) +{ + char *w; + DArray * d_array; + int i; + + d_array = mk_tag_structtail_split (S); + if (! d_array) + return; + + for (i = 0; i < d_array->get_size (); i++) { + w = ww_last_word (d_array->get (i)); + if (! w || !(*w) || *w == ' ') + continue; + printf ("%s\t%s\t%i\n", w, d_file, t_line); + } + + delete d_array; +} + +void mk_tags (char *f_name, DArray *d_in) +{ + DHeapSort * heap; + DArray * d_array = NULL; + char *S; + FILE * my_file; + int d_size; + int i; + + if (d_in == NULL) { + d_array = new DArray (1024); + d_array->from_file (ENV->tmp_tags); + } else + d_array = d_in; + + d_size = d_array->get_size (); + heap = new DHeapSort (d_size); + + for (i = 0; i < d_size; ++i) + heap->add (d_array->get (i)); + + my_file = fopen (f_name, "w"); + if (my_file == NULL) { + fprintf (stderr, "file %s:\n", f_name); + perror ("fopen"); + return; + } + + fprintf (my_file, "!_TAG_FILE_FORMAT\t2\n"); + fprintf (my_file, "!_TAG_FILE_SORTED\t1\n"); + fprintf (my_file, "!_TAG_PROGRAM_AUTHOR\tOleg Puchinin (graycardinalster@gmail.com)\n"); + fprintf (my_file, "!_TAG_PROGRAM_NAME\tSilent Bob\n"); + fprintf (my_file, "!_TAG_PROGRAM_URL\thttp://sf.net/projects/silentbob\n"); + fprintf (my_file, "!_TAG_PROGRAM_VERSION\t1.6\n"); + + while ((S = heap->extract_min ()) && S) + fprintf (my_file, "%s", S); + + if (d_in == NULL) { + d_array->foreach (free); + delete d_array; + } + + fclose (my_file); + delete heap; +} + +char * name2obj (char * name) +{ + char *S; + char m_buf[512]; + if (! name) + return NULL; + strcpy (m_buf, name); + S = rindex (m_buf, '.'); + if (! S) + return NULL; + strcpy (S, ".o"); + return strdup (m_buf); +} +bool b_in_comment; + +bool brace_count (char * d_str, int * d_count, bool b_force_block) // "nice" +{ + bool Ret = false; + + if (! d_str || ! d_count) + return false; + + while (*d_str != 0) { + if (!strncmp (d_str, "/*", 2)) { + b_in_comment = true; + d_str += 2; + continue; + } + + if (b_in_comment) { + if (strncmp (d_str, "*/", 2)) { + d_str ++; + continue; + } else { + d_str += 2; + b_in_comment = false; + continue; + } + } + + if (!strncmp (d_str, "//", 2)) + break; + + if (*d_str == '\"' || *d_str == '\'') { + d_str = sstrend (d_str); + if (d_str == NULL || *d_str == 0) { + assert (true, "HimTeh 4"); + break; + } + } + + if (*d_str == '{') { + Ret = true; + (*d_count)++; + } + + if (*d_str == '}') { + Ret = true; + (*d_count)--; + } + + if (*d_str == ';' && *d_count == 0 && !b_force_block) { + Ret = true; + break; + } + d_str++; + } + + return Ret; +} + +void nogui_fdump (struct fdump_param_t * d_param) +{ + int d_count = 0; + DArray d_array; + FILE * d_file; + int d_size; + char * S; + int i,a; + + if (!d_array.from_file (d_param->d_file_name)) + return; + + if (d_param->d_file_output == NULL) + d_file = stdout; + else + d_file = fopen (d_param->d_file_output, "w"); + + if (! d_file) + return; + + if (! d_param->linear) { + for (a = 0; a < d_param->n_trip; a++) + fprintf (d_file, "\t"); + fprintf (d_file, "//<***>\n"); + } + + i = d_param->d_line-1; + d_size = d_array.get_size (); + b_in_comment = false; + + if (d_array.get (i)[0] != '#') { + while (i < d_size) { + if (!d_param->linear) { + for (a = 0; a < d_param->n_trip; a++) + fprintf (d_file, "\t"); + } + fprintf (d_file, "%s", d_array.get(i)); + + if (brace_count (d_array.get(i), &d_count, d_param->b_force_block) && !d_count) + break; + + if (!d_count && ((i - d_param->d_line) > 2) && !d_param->b_force_block) + break; + + i++; + } + } else { + do { + S = d_array.get (i); + fprintf (d_file, "%s", S); + S = &S[strlen (S)-2]; + while ((*S == ' ') || (*S == '\t')) + S--; + + if (*S != '\\') + break; + i++; + } while (i < d_size); + } + + if (!d_param->linear) { + for (a = 0; a < d_param->n_trip; a++) + fprintf (d_file, "\t"); + fprintf (d_file, "//\n"); + } + + if (d_param->d_file_output != NULL) + fclose (d_file); + + d_array.foreach (free); + +} + +/* code for "linear" functionality, */ +void nogui_tagsdump (char * f_name, int n_trip) { + DArray * d_tags; + d_tag_t * d_tag; + struct fdump_param_t d_param; + int a,i; + + d_tags = got_tag (f_name); + + assert (d_tags->get_size () == 0, "HimTeh 1"); + for (i = 0; i < d_tags->get_size (); i++) { + d_tag = (d_tag_t *) d_tags->get (i); + if (i != 0) + fputc ('\n', stdout); + + if (!SB_FLGET(SB_FLLINEAR)) { + for (a = 0; a < n_trip; a++) + fputc ('\t', stdout); + } + + printf ("// file %s line %i\n", d_tag->d_file, d_tag->d_line); + + memset (&d_param, 0, sizeof (struct fdump_param_t)); + d_param.n_trip = n_trip; + d_param.d_file_name = d_tag->d_file; + d_param.d_line = d_tag->d_line; + d_param.linear = SB_FLGET (SB_FLLINEAR); + if (d_tag->d_type & OT::Function) + d_param.b_force_block = true; + nogui_fdump (&d_param); + } + + d_tags->foreach (free); + delete d_tags; + printf ("\n"); +} + +void opMacro (char ** d_ptr, char ** d_out, char ch) +{ + char *macro_start; + char * d_my; + int n = 0; + + d_my = *d_out; + macro_start = *d_out; + while (true) { + if (ch == '\n') + n++; + + if ((ch == '\n') && (d_my[strlen (d_my) - 1] != '\\')) + break; + +// if (n > 300) +// break; + + ch = t_op (d_ptr, d_out); + ENV->t_op_no++; + if (ch == 0) + break; + d_my = *d_out; + } +} + +int remove_tmp_files () +{ + char m_buf[512]; + int i = 0; + + for (i = 0; i < ENV->max_proc; ++i) { + sprintf (m_buf, "%s%i", ENV->tmp_files, i); + unlink (m_buf); + } + + unlink (ENV->tmp_files); + unlink (ENV->tmp_tags); + return ENV->max_proc; +} + +void setParam (char *opt) +{ + char m_buf[512]; + char *S; + + if (! opt) + return; + strcpy (m_buf, opt); + S = index (m_buf, '='); + if (! S) + return; + + *S = '\0'; + ++S; + strip2 (m_buf); + strip (S); + ENV->settings->set (m_buf, strdup (S)); +} + +int split_tmp_files () +{ + FILE * f_tmpfiles; + FILE ** proc_files; + char m_buf[512]; + int i = 0; + + f_tmpfiles = fopen (ENV->tmp_files, "r"); + if (! f_tmpfiles) + return -1; + + proc_files = CNEW (FILE *, ENV->max_proc); + memset (proc_files, 0, sizeof (FILE *) * ENV->max_proc); + errno = 0; + for (i = 0; i < ENV->max_proc; ++i) { + sprintf (m_buf, "%s%i", ENV->tmp_files, i); + unlink (m_buf); + proc_files[i] = fopen (m_buf, "w"); + if (! proc_files[i]) { + perror ("fopen"); + return -1; + } + } + + i = 0; + while (fgets (m_buf, 512, f_tmpfiles)) { + fprintf (proc_files[i], "%s", m_buf); + if (++i >= ENV->max_proc) + i = 0; + } + + for (i = 0; i < ENV->max_proc; ++i) + fclose (proc_files[i]); + + return ENV->max_proc; +} + +DArray * split_to_words (char * d_op) +{ + DArray * d_Ret = new DArray (16); + char * d_old = strdup (d_op); + bool b_done = false; + char * S = d_old; + char * d_end; + char ch; + + if (d_Ret == NULL || d_old == NULL) + return NULL; + + while (true) { + b_done = false; + d_end = S; + + if (*d_end == ' ') + d_end++; + + while (*d_end) { + if (!(if_abc(d_end) || + if_digit (d_end) || + *d_end == '_' || + *d_end == ' ') ) + break; + d_end ++; + } + + if (! *d_end) { + ch = 0; + b_done = true; + goto split_to_words_L1; + } + + ch = *d_end; + if (d_end[-1] == ' ') + d_end[-1] = 0; + else + *d_end = 0; + + while (*S && *S == ' ') + S++; + +split_to_words_L1: + d_Ret->add (LPCHAR(new_cword (S, ch))); + + if (b_done) + break; + + if (ch == '\"' || ch == '\'') { + *d_end = ch; + d_end = sstrend (d_end); + assert (d_end == NULL, "Lena 1"); + if (*d_end == '\0' || *(++d_end) == '\0') + break; + } + + S = d_end + 1; + } + + DROP (d_old); + return d_Ret; +} + +char * sstrend (char * d_ptr) +{ + bool t_instring = false; + int d_slash_count; + char ch_last; + char *d_old; + unsigned limit = 1024; + + if (! d_ptr) + return (char *) 0; + + if (!(*d_ptr)) + return (char *) 0; + + ch_last = *d_ptr; + d_old = d_ptr; + limit--; + while (*d_ptr && (limit > 0)) { + if (*d_ptr == '\'' || *d_ptr == '\"') { + if (t_instring && *d_ptr != ch_last) { + d_ptr++; + continue; // Mmm... + } + + if (t_instring) { + if (d_ptr[-1] == '\\') { + d_slash_count = 1; + while (d_ptr [-(d_slash_count)] == '\\') + d_slash_count++; + + if (d_slash_count & 1) + t_instring = false; + } else { + d_ptr++; + t_instring = false; + continue; + } + } else { + ch_last = *d_ptr; + t_instring = true; + } + } + + if (t_instring) { + d_ptr++; + continue; + } else + break; + } + + d_ptr --; + + if (*d_ptr == 0) + return 0; + + return d_ptr; +} + +char * sstrkill (char *OP) +{ + char *S; + char *tail; + + if (! OP) + return NULL; + + S = OP; + while (*S) { + if (*S == '\"' || *S == '\'') { + tail = sstrend (S); + if (! tail) + break; + + if (*tail == '\0' ||*(tail+1) == '\0') { + *S = '\0'; + break; + } + + ++S; + strcpy (S, tail); + } + ++S; + } + + return OP; +} + +int words_count (char *S) +{ + bool b_begin = true; + int d_ret = 0; + + if (S == 0) + return 0; + + while (*S) { + if (*S == ' ') { + b_begin = true; + S++; + continue; + } + + if (b_begin) { + if (if_abc (S) || + (*S == '_') || + (*S == '*') || + (*S == '&')) { + S++; + d_ret ++; + b_begin = false; + continue; + } else + break; + } else { + if (!(if_abc (S) || (*S == '_') + || (*S == '*') || (if_digit (S)))) + break; + } + + S++; + b_begin = false; + } + + return d_ret; +} + +int ww_begin_line (struct tt_state_t * d_tt_state, char *d_out, int d_offset) +{ + char *S = &d_tt_state->fileData [d_offset] - 1; + char * d_end = &d_out[strlen (d_out)] - 1; + int Ret = 0; + + while (d_end > d_out) { + if (*d_end == ' ' || *d_end == '\t') { + while ((S >= d_tt_state->fileData) && (*S == ' ' || *S == '\t')) + --S; + + if (S < d_tt_state->fileData) + return Ret; + + while ((d_end >= d_out) && (*d_end == ' ' || *d_end == '\t')) + --d_end; + + if (d_end <= d_out) + return Ret; + + continue; + } + + if (*S == '\n') + --Ret; + + if (*S == *d_end) + --d_end; + + --S; + } + + return Ret; +} + +char * ww_begin_offset (struct tt_state_t * d_tt_state, char *d_out, int d_offset) +{ + char *S = &d_tt_state->fileData [d_offset] - 1; + char * d_real = &d_out[strlen (d_out)] - 1; + + while (d_real != d_out) { + if (*d_real == ' ' || *d_real == '\t') { + while (*S == ' ' || *S == '\t') + S--; + + while ((*d_real == ' ' || *d_real == '\t') + && (d_real != d_out)) + --d_real; + + continue; + } + + if (*S == *d_real) + --d_real; + + --S; + } + + return S; +} + +char * ww_last_word (char *d_op) +{ + char * S = d_op; + char * d_word; + + while (*S) { + if (*S == '(' || *S == '=' || *S == '[') + break; + S++; + } + + if (S[-1] == ' ') + S--; + + *S = 0; + d_word = d_op; + while (true) { + S = strchr (d_word, ' '); + if (S == NULL) + break; + d_word = S+1; + } + + while (*d_word == '*' || + *d_word == '&' || + *d_word == ' ') + d_word++; + + return d_word; +} + +bool validOption (char *Name) +{ + char *S; + if (! Name) + return false; + + S = ENV->listOptions->first (); + while (S) { + if (EQ (Name, S)) + return true; + S = ENV->listOptions->next (); + } + return false; +} + diff --git a/silentbob/sblib/TT.cxx b/silentbob/sblib/TT.cxx new file mode 100644 index 0000000..4810d04 --- /dev/null +++ b/silentbob/sblib/TT.cxx @@ -0,0 +1,94 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include + +TT::TT () +{ + tt = NULL; + d_out = NULL; + d_ptr = NULL; +} + +TT::~TT () +{ + if (tt) + free_tt_state (tt); +} + +int TT::loadFile (char * fileName) +{ + if (! fileName) + return -1; + tt = CNEW (tt_state_t, 1); + memset (tt, 0, sizeof (tt_state_t)); + tt->fileName = strdup (fileName); + if (do_tt (tt) == NULL) { + DROP (tt->fileName); + DROP (tt); + return -1; + } + + return 0; +} + +int TT::drop () +{ + if (tt) { + free_tt_state (tt); + tt = NULL; + } + return 0; +} + +int TT::init () +{ + if (! tt) + return -1; + d_out = tt->result; + d_ptr = tt->result; + ENV->t_op_no = 0; + bracketDepth = 0; + depthModif = 0; + return 0; +} + +char * TT::op () +{ + return d_out; +} + +char * TT::nextOperator () +{ + if (depthModif > 0) { + ++bracketDepth; + depthModif = 0; + } else if (depthModif < 0) { + if (--bracketDepth < 0) + bracketDepth = 0; + depthModif = 0; + } + + ch = t_op (&d_ptr, &d_out); + if (! ch) + return NULL; + + if (ch == '{') + depthModif = 1; + if (ch == '}') + depthModif = -1; + + ENV->t_op_no ++; + return d_out; +} + +int TT::wit () +{ + return what_is_this (d_out, ch); +} + diff --git a/silentbob/sblib/py_tt.cxx b/silentbob/sblib/py_tt.cxx new file mode 100644 index 0000000..f326f33 --- /dev/null +++ b/silentbob/sblib/py_tt.cxx @@ -0,0 +1,189 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace PYTHON { + +char * t_map; +char * t_new; +char pch; +int i; +int ii; +int t_size; +int spaces; +int nlines; +int t_op_no; +pair_t * d_attachment = NULL; + +#define T t_map[i] +#define TN(ch) do { t_new[ii] = ch; ++ii; } while (0) + +inline void t_attach () +{ + t_op_no++; + d_attachment[t_op_no].pair_op = t_op_no; + d_attachment[t_op_no].pair_line = nlines; + d_attachment[t_op_no].offset = i; +} + +inline void tt_skip () +{ + while (T != '\n' && i < t_size) + ++i; + --i; +} + +void doc_skip () +{ + char * ptrn; + + if (T == '\'') + ptrn = "'''"; + else + ptrn = "\"\"\""; + + i += 3; + if (i >= t_size) + return; + + for (; i < t_size; ++i) { + if (T == '\n') + ++nlines; + + if (! strncmp (&t_map[i], ptrn, 3)) + break; + } + + i+=2; +} + +int py_tt (char * d_input, int size, char * d_output) +{ + char ch; + char * S; + bool b_newline = true; + + i = 0; + ii = 0; + t_size = size; + t_map = d_input; + t_new = d_output; + spaces = 0; + nlines = 0; + t_op_no = 0; + + for (i = 0; i < t_size; ++i) { + if (isalnum (T)) + goto abc; + + if (! strncmp (&t_map[i], "\"\"\"", 3) || + ! strncmp (&t_map[i], "'''", 3)) { + doc_skip (); + continue; + } + + if (T == '\"' || T == '\'') { + ch = T; + S = sstrend (&t_map[i]); + assert (S == NULL, "\n\nSibadi 2006\n\n"); + nlines += Dsyms (&t_map[i], S, '\n'); + i += S - &t_map[i]; + TN (ch); + TN (ch); + continue; + } + + if (T == '#') { + tt_skip (); + continue; + } + + if (T == ' ' || T == '\t') { + if (b_newline) { + ++spaces; + TN (T); + } + if (! spaces) { + ++spaces; + TN (' '); + } + + continue; + } + + if (T == '\n') { + t_attach (); + ++nlines; + TN (T); + continue; + } + + if (T == ':') + t_attach (); + +abc: + b_newline = false; + spaces = 0; + TN(T); + } + + TN ('\0'); + return ii+1; +} + +char * py_tt_file (struct tt_state_t * tt) +{ + if (! tt) + return NULL; + + if (access (tt->fileName, R_OK) != F_OK) { + fprintf (stderr, "No such file %s\n", tt->fileName); + return NULL; + } + + tt_map (tt); + + tt->result = CNEW (char, 1024*1024); + tt->result[0] = 0; + d_attachment = (pair_t *) CNEW (char, 1024*1024); + + tt->attachment = d_attachment; + tt->resultSize = py_tt (tt->fileData, tt->fileDataSize, tt->result); + return tt->result; +} + +char t_op (char ** d_in, char ** d_prev) +{ + char *d_ptr = *d_in; + char ch = 0; + + if (*d_prev) + *d_prev = *d_in; + + while (*d_ptr) { + if (*d_ptr == '\n' || *d_ptr == ':') { + ch = *d_ptr; + *d_ptr = 0; + break; + } + ++d_ptr; + } + + ++d_ptr; + *d_in = d_ptr; + return ch; +} + +} // namespace PYTHON diff --git a/silentbob/sblib/t_op.cxx b/silentbob/sblib/t_op.cxx new file mode 100644 index 0000000..20ec623 --- /dev/null +++ b/silentbob/sblib/t_op.cxx @@ -0,0 +1,85 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +char t_op (char ** d_in, char ** d_prev, bool b_no_operators) +{ + bool b_instring = false; + int brace_depth = 0; // for '(' ! + char *d_ptr = *d_in; + int slash_count; + char ch_last = 0; + char ch = 0; + + if (*d_prev) + *d_prev = *d_in; + + while (*d_ptr) { + if (*d_ptr == '\'' || *d_ptr == '\"') { + if (b_instring && *d_ptr != ch_last) { + ++d_ptr; + continue; // Mmm... + } + + if (b_instring) { + if (d_ptr[-1] == '\\') { + slash_count = 1; + while (d_ptr [-(slash_count)] == '\\') + ++slash_count; + + if (slash_count & 1) + b_instring = false; + } else { + ++d_ptr; + b_instring = false; + continue; + } + } else { + ch_last = *d_ptr; + b_instring = true; + } + } + + if (b_instring) { + ++d_ptr; + continue; + } + + if (d_ptr[0] == '(') + ++brace_depth; + + if (d_ptr[0] == ')') + --brace_depth; + + if (brace_depth < 0) + brace_depth = 0; + + if (b_no_operators && (*d_ptr == '{' || *d_ptr == '}' || *d_ptr == '\n')) { + ch = *d_ptr; + *d_ptr = 0; + if (ch != '\n') + ++d_ptr; + break; + } + + if (d_ptr[0] == '{' || + ((*d_ptr == ';') && + (! brace_depth)) || + d_ptr[0] == '}' || + d_ptr[0] == '\n') { + ch = *d_ptr; + *d_ptr = 0; + if (ch != '\n') + ++d_ptr; // Skip space + break; + } + ++d_ptr; + } + + d_ptr++; + *d_in = d_ptr; + return ch; +} + diff --git a/silentbob/sblib/t_op2.cxx b/silentbob/sblib/t_op2.cxx new file mode 100644 index 0000000..4909f21 --- /dev/null +++ b/silentbob/sblib/t_op2.cxx @@ -0,0 +1,34 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +char t_op2 (char ** d_in, char ** d_prev) +{ + char *d_ptr = *d_in; + char ch = 0; + + if (*d_prev) + *d_prev = *d_in; + + while (*d_ptr) { + if (*d_ptr == '{' || *d_ptr == ';' || + *d_ptr == '}') { + if (d_ptr[-1] == '\\') { + ++d_ptr; + continue; + } + ch = *d_ptr; + *d_ptr = 0; + ++d_ptr; // space + break; + } + ++d_ptr; + } + + ++d_ptr; + *d_in = d_ptr; + return ch; +} + diff --git a/silentbob/sblib/the_fly.cxx b/silentbob/sblib/the_fly.cxx new file mode 100644 index 0000000..69f5d2c --- /dev/null +++ b/silentbob/sblib/the_fly.cxx @@ -0,0 +1,340 @@ +/* + * (c) Oleg Puchinin 2006. + * graycardinalster@gmail.com + * + * Oleg, "THE FLY", and BUGS. + * + * "THE FLY" - "THE TT" analog for Perl code. + * 1 May 2006 - started. + * 26/06/06 - v1.0-rc1. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "the_fly.hpp" + +namespace THE_FLY { + +char * t_map; +char * t_new; +char pch; +int i; +int ii; +int t_size; +int spaces; +int nlines; +int t_op_no; +pair_t * d_attachment = NULL; + +#define T t_map[i] + +inline void t_attach () +{ + t_op_no++; + d_attachment[t_op_no].pair_op = t_op_no; + d_attachment[t_op_no].pair_line = nlines; + d_attachment[t_op_no].offset = i; +} + +inline void TN (char ch) +{ + t_new[ii] = ch; + ++ii; + if ((i && t_map[i-1] != '\\') && (ch == '{' || ch == '}' || ch == ';')) + t_attach (); +} + +inline char * fly_fw (char * word) +{ + char * Ret; + char *S = word; + while (true) { + if (!if_abc (S) && + !if_digit (S) && + *S != '_' && + *S != '*') + break; + ++S; + } + Ret = CNEW (char, S - word + 1); + memcpy (Ret, word, S - word); + Ret[S-word] = '\0'; + return Ret; +} + +void fly_skip () +{ + char * word = NULL; + char * S = NULL; + char * ptrn = NULL; + + word = &t_map[i+2]; + if (*word == '\'' || *word == '\"') + ++word; + + word = fly_fw (word); + if (! word) + return; + + ptrn = CNEW (char, strlen (word)+3); + sprintf (ptrn, "\n%s\n", word); + S = (char *) memmem (&t_map[i+2], t_size-i-2, ptrn, strlen (ptrn)); + assert (! S, "fly_skip fail !"); + if (! S) { + i = t_size; + goto out; + } + + nlines += Dsyms (&t_map[i+2], S, '\n'); + nlines+=2; + i += S - &t_map[i] + strlen (ptrn) + 1; + +out: + DROP (ptrn); + DROP (word); +} + +void doc_skip () +{ + char *S; + char * ptrn = "\n=cut\n"; + + S = (char *) memmem (&t_map[i], t_size-i, ptrn, 6); + if (! S) { + i = t_size; + return; + } + + nlines += Dsyms (&t_map[i], S, '\n'); + ++nlines; + i += S - &t_map[i] + 4; +} + +void regexp_skip () +{ + char ss; + int count; + char * ptr; + int old; + + count = 1; + old = i; + switch (T) { + case 't': + i+=2; + break; + case 's': + ++i; + count = 2; + break; + case 'm': + ++i; + break; + } + + ss = T; + if (ss == '{') + ss = '}'; + ++i; + ptr = &t_map[i]; + while (true) { + for (; i < t_size; ++i) { + if (T == '\n') + break; + + if (t_map[i] == ss && !(ww_nsyms_r (ptr, &t_map[i-1], '\\') % 2)) + break; + } + + if (T == '\n') + break; + + assert (i >= t_size, "Sibadi 2006.2"); + if (i >= t_size) + break; + + if (--count == 0) + break; + ++i; + } + + if (T == '\n') { + i = old; + TN(T); + } +} + +bool regexp_test () +{ + char * ptr; + char ch = T; + char ss; + + if (isalnum (pch) || pch == '_' || pch == ')') + return false; + + if (! (ch == '/' || ch == 's' || ch == 'm' || !strncmp (&t_map[i], "tr", 2))) + return false; + + ptr = &t_map[i]; + ++ptr; + switch (ch) { + case 't': + ++ptr; + case 's': + case 'm': + ss = *ptr; + if (! (ss == '/' || ss == '?' || ss == '#' + || ss == '!' || ss == '&' || ss == '|' || ss == '{')) + return false; + break; + } + + return true; +} + +inline void tt_skip () +{ + while (T != '\n' && i < t_size) + ++i; + --i; +} + +int fly_for_buffers (char * d_input, int size, char * d_output) +{ + char ch; + char * S; + + i = 0; + ii = 0; + t_size = size; + t_map = d_input; + t_new = d_output; + spaces = 0; + nlines = 0; + pch = 'a'; + t_op_no = 0; + + i = 0; + if (T == '#' || T == '=') { + tt_skip (); + ++i; + } + + for (; i < size; i++) { + ch = T; + if (ch == '\n') + ++nlines; + + if (regexp_test ()) { + regexp_skip (); + continue; + } + + if (if_digit (&t_map[i]) || if_abc (&t_map[i])) { + spaces = 0; + goto abc; + } + + if ((ch == '\'' || ch == '\"') && t_map[i-1] != '$' && t_map[i-1] != '\\') { + if (ch == '\'' && (isalnum (t_map[i-1]) || t_map[i-1] == '&')) + goto abc; + + S = sstrend (&t_map[i]); + assert (S == NULL, "\n\nSibadi 2006\n\n"); + nlines += Dsyms (&t_map[i], S, '\n'); + i += S - &t_map[i]; + pch = ch; + TN (ch); + TN (ch); + continue; + } + + if (ch == '\n' || ch == ' ' || ch == '\t') { + if (spaces == 0) { + TN (' '); + spaces++; + continue; + } else + continue; + } + + if (ch == '<' && t_map[i+1] == '<') { + fly_skip (); + if (i >= t_size) { + TN ('\0'); + break; + } + TN (';'); + TN (' '); + spaces = 0; + pch = ch; + continue; + } + + if (ch == ';' || ch == '}' || ch == ')' || + ch == '{' || ch == '(') { + if (! spaces) + TN (' '); + TN (ch); + TN (' '); + spaces = 1; + pch = ch; + continue; + } + + if (ch == '=' && t_map[i-1] == '\n') { + doc_skip (); + pch = ch; + continue; + } + + if (ch == '#' && t_map[i-1] != '$') { + tt_skip (); + pch = ch; + continue; + } + +abc: + pch = ch; + TN(T); + } + + TN('\0'); + return ii; +} + +char * fly_for_file (struct tt_state_t * tt) +{ + int m_size; + + if (! tt) + return NULL; + + if (access (tt->fileName, R_OK) != F_OK) { + fprintf (stderr, "No such file %s\n", tt->fileName); + return NULL; + } + + tt_map (tt); + + m_size = fsize (tt->fileName); + tt->result = CNEW (char, m_size << 2); + tt->result[0] = 0; + d_attachment = (pair_t *) CNEW (char, m_size << 2); + tt->attachment = d_attachment; + tt->resultSize = fly_for_buffers (tt->fileData, tt->fileDataSize, tt->result); + + return tt->result; +} + +} // namespace THE_FLY + diff --git a/silentbob/sblib/the_tt.cxx b/silentbob/sblib/the_tt.cxx new file mode 100644 index 0000000..ab32c57 --- /dev/null +++ b/silentbob/sblib/the_tt.cxx @@ -0,0 +1,413 @@ +/* + * (c) Oleg Puchinin 2006,2007,2008 + * graycardinalster@gmail.com + * + */ + +/* + * "Oleg, THE_TT and BUGs" + * + * 01/01/06 00:00 - Started... + * January 2006 - string BUG fixed. + * "//" BUG fixed. It's work currently ?! + * + * January 2006, last day. added operator to line conversion. + * February 2006 - operator to line conversion work properly. + * February 2006 - "macro BUG" fixed. + * March 2006 - "Style BUG" fixed (?). + * January 2008 - C# patch. + **/ + +#include +#include +#include +#include + +extern FILE * d_stream_dbg; + +namespace THE_TT { + +#define IF(arg) if (t_map[ipos] == arg) +#define IF2(arga, argb) if (t_map[ipos] == arga && t_map[ipos+1] == argb) +#define is_space(arg) (arg == ' ' || arg == '\t' || arg == '\n') +#define IF_breaker if (t_map[ipos]==';' || t_map[ipos] == '}' || t_map[ipos] == '{') +#define T t_map[ipos] +#define T2 t_map[ipos+1] +#define Toff(arg) t_map[ipos+arg] +#define ATTACH t_attach (); + +int ipos; +int opos; +int t_size; +char * t_map; +char * t_new; +int t_current_line; +int t_op_no; +int brace_depth = 0; // for '()' +int block_depth = 0; // for '{}' +bool b_make_attachment; +bool t_in_macro; +pair_t * d_attachment = NULL; +char * tt_out_buf = NULL; +int tt_outbuf_size = 0; +unsigned int t_spaces; +bool b_mustlined; +bool b_instring; +bool b_newline; +int d_slash_count; +bool b_lined; +char ch_last; +bool b_sharp; + +inline void t_attach () +{ + t_op_no++; + d_attachment[t_op_no].pair_op = t_op_no; + d_attachment[t_op_no].pair_line = t_current_line; + d_attachment[t_op_no].offset = ipos; + brace_depth = 0; // Paranoid +} + +inline void TN (char arg) +{ + t_new[opos] = arg; + ++opos; + if (arg == '\n' || + arg == '{' || arg == '}' || + (arg == ';' && !brace_depth)) { + + if (arg == '\n') { + --t_current_line; + ATTACH; + ++t_current_line; + } else + ATTACH; + } +} + +#define TNs(arg) do { t_new[opos] = arg; ++opos; } while (0) + +inline void tt_comment () +{ + while (ipos < t_size) { + IF2('*', '/') + break; + IF ('\n') { + t_current_line++; + } + ++ipos; + } + ++ipos; +} + +inline void tt_skip () +{ + while (T != '\n' && ipos < t_size) + ++ipos; + --ipos; +} + +void tt_init (char * d_input, int t_new_size, char * d_output) +{ + t_spaces = 1; + b_mustlined = false; + b_instring = false; + b_newline = true; + d_slash_count = 0; + b_lined = true; + ch_last = 0; + b_sharp = false; + + ipos = 0; + opos = 0; + b_lined = true; + b_mustlined = false; + b_newline = true; + t_size = t_new_size; + t_map = d_input; + t_new = d_output; + t_current_line = 0; + t_op_no = 0; + brace_depth = 0; + block_depth = 0; +} + +bool tt_process_line () +{ + if (b_instring && ch_last != T) { + TN(T); + return true; + } + + if (b_instring) { + if (b_sharp || (Toff(-1) != '\\')) { // \" and... \\" :) + b_instring = false; + b_sharp = false; + } else { + d_slash_count = 1; + while (Toff (-(d_slash_count)) == '\\') // Yes, I'm don't like this. + d_slash_count++; + + if (d_slash_count & 1) { + b_instring = false; + b_sharp = false; + } + } + } else { // !b_instring + ch_last = T; + b_instring = true; + if (Toff (-1) == '@') + b_sharp = true; + } + + return false; +} + +void tt_process_space () +{ + if (T == '\n') { + b_newline = true; + if (Toff(1) == '#' && !b_lined) { + TN ('\n'); + ++t_spaces; + b_lined = true; + b_mustlined = false; + return; + } + + if (b_mustlined) { + TN('\n'); + ++t_spaces; + if (!(Toff (-1) == '\\')) { + b_mustlined = false; + b_lined = true; + } + } + + if (t_spaces == 0 && !b_lined) { + ++t_spaces; + TN(' '); + } + return; + } else { + ++t_spaces; + if (t_spaces == 1) + TN(' '); + } + + return; +} + +// NOTE: you _must_ allocate d_input and d_output before call this. +int the_tt_for_buffers (char * d_input, + int t_new_size, + char * d_output) +{ + tt_init (d_input, t_new_size, d_output); + + if (t_map[0] == '\n') { + ++ipos; // "mmap BUG" fixed :)) + ++t_current_line; + } + + if (Toff (t_size-1) == '\n') + t_size--; // mmap'ed TT do not work without this ! + + for (; ipos < t_size; ++ipos) { + if (if_abc (&t_map[ipos]) || if_digit (&t_map[ipos])) { + b_lined = false; + t_spaces = 0; + goto abc; + } + + IF ('\n') + ++t_current_line; + + if (T == '\'' || T == '\"') { + if (tt_process_line ()) + continue; + } + + if (b_instring) { + if (T != '\n') + TNs (T); + else { + if (Toff(-1) == '\\') + --opos; + } + continue; + } + + if (T == '\n') { + if (Toff(-1) == '\\') { + if (t_in_macro) + TN(T); + else + --opos; + continue; + } else + t_in_macro = false; + } + + IF2('/','/') { + tt_skip (); + continue; + } + + IF2('/', '*') { + tt_comment (); + continue; + } + + switch (T) { + case '(': + ++brace_depth; + break; + case ')': + --brace_depth; + break; + } + + if (brace_depth < 0) + brace_depth = 0; + + if (is_space (T)) { + tt_process_space (); + continue; + } + + b_lined = false; + if (T == '(' && t_spaces == 0 && b_mustlined == 0) { + ++t_spaces; // No space after '('. + TN(' '); + TN('('); + continue; + } + + if (T == ')' && t_spaces == 0) { + ++t_spaces; + TN(')'); + TN(' '); + continue; + } + + t_spaces = 0; + IF_breaker { + TN(T); + TN(' '); + ++t_spaces; + continue; + } + + IF('#' && b_newline) { + TN ('#'); + t_in_macro = true; + b_mustlined = true; + continue; + } + + IF (0x0D) + continue; + +abc: + b_newline = false; + TNs(T); + } // for + + return opos; +} + +char * do_tt_file (tt_state_t * d_tt_state) +{ + char * t_output = NULL; + char * f_name; + int t_Ret; + + d_attachment = NULL; + + if (! d_tt_state) + return 0; + + f_name = d_tt_state->fileName; + + if (EQ(f_name, "-")) { + d_tt_state->fileData = Dread_to_eof (fileno (stdin), &d_tt_state->fileDataSize); + if (d_tt_state->fileDataSize <= 0) + exit (1); + } else + tt_map (d_tt_state); + + t_size = d_tt_state->fileDataSize; + t_output = CNEW (char, t_size<<1); // Paranoid. + + if (t_size < 4096) + d_attachment = CNEW (pair_t, 4096); + else + d_attachment = CNEW (pair_t, t_size>>1); + d_tt_state->attachment = d_attachment; + + t_Ret = the_tt_for_buffers (d_tt_state->fileData, t_size, t_output); + t_output[t_Ret] = 0; // Required. + d_tt_state->resultSize = t_Ret; + d_tt_state->result = t_output; + + return t_output; +} + +// $ silent_bob --the-tt +int the_tt_main (char * f_name) +{ + char * t_output; + tt_state_t * d_tt_state; + + d_tt_state = CNEW (tt_state_t, 1); + memset (d_tt_state, 0, sizeof (tt_state_t)); + d_tt_state->fileName = f_name; + t_output = do_tt_file (d_tt_state); + + if (! SB_FLGET (SB_FLSIMULATE)) + write (fileno (stdout), t_output, d_tt_state->resultSize); + + free_tt_state (d_tt_state); + return EXIT_SUCCESS; +} + +} // namespace THE_TT + +void free_tt_state (struct tt_state_t * S) +{ + if (S->mmaped) + munmap (S->fileData, S->fileDataSize); + else + DROP (S->fileData); + + if (S->fd) + close (S->fd); + + DROP (S->result); + DROP (S->attachment); + DROP (S); +} + +int tt_map (tt_state_t *tt) +{ + tt->mmaped = true; + tt->fileData = DFMAP (tt->fileName, &tt->fd, &tt->fileDataSize); + + if (tt->fileData == NULL) { + tt->fileDataSize = fsize (tt->fileName); + tt->mmaped = false; + tt->fileData = CNEW (char, tt->fileDataSize); + if (Dfnread (tt->fileName, tt->fileData, tt->fileDataSize) < 0) + DROP (tt->fileData); + } + + if (! tt->fileData) { + fprintf (stderr, "can't open/mmap file %s\n", tt->fileName); + perror ("open/mmap"); + return -1; + } + + return 0; +} + diff --git a/silentbob/sblib/wit.cxx b/silentbob/sblib/wit.cxx new file mode 100644 index 0000000..af00e61 --- /dev/null +++ b/silentbob/sblib/wit.cxx @@ -0,0 +1,134 @@ +/* + * (c) Oleg Puchinin 2006. + * graycardinalster@gmail.com + * + */ + +#include +#include + +int what_is_this (char * d_op, char ch) +{ + bool b_local_ftest; + int d_words_count; + char d_last_ch; + char * S; + int Ret = 0; + + if (*d_op == '#' || ch == '\n') { + if (def_test (d_op)) + return OT::Define; + return OT::Macro; + } + + d_words_count = words_count (d_op); + + if (words_count <= 0) + return OT::Other; + + if (d_words_count == 1) { + if (ww_call_cmp (d_op, "if", 2) || + ww_call_cmp (d_op, "else", 4) || + ww_call_cmp (d_op, "do", 2) || + ww_call_cmp (d_op, "while", 5) || + ww_call_cmp (d_op, "switch", 6) || + ww_case_cmp (d_op, "case", 4)) + return OT::Operator; + + if (ww_after_word (d_op) == '(') + return OT::Call; + + return OT::Other; // Macro or operations (e.g. "+-=*/%^" etc...) + } + + if (! strncmp (d_op, "else if ", 8)) + return OT::Operator; + if (! strncmp (d_op, "class ", 6) && ch == ';') // class definition + return OT::Other; + + d_last_ch = last_ch (d_op); + if (d_last_ch == '=') + return OT::Variable; + + b_local_ftest = local_ftest (d_op); + if ((ch == '{' && d_last_ch == ')')) { + if (b_local_ftest) // Paranoid. + return OT::Function; + } + + if (! strncmp (d_op, "extern ", 7)) + return OT::Extern; + + if (ch == '{') { + Ret = 0; + if (! strncmp (d_op, "typedef ", 8)) { + Ret |= OT::Typedef; + d_op += 8; + } + + if (! strncmp (d_op, "static ", 7)) + d_op += 7; + + if (! strncmp (d_op, "const ", 6)) // "static const struct" + d_op += 6; + + if (! strncmp (d_op, "union ", 6)) + return Ret | OT::Other; + + if (! strncmp (d_op, "enum ", 5)) + return Ret | OT::Other; + + if (! strncmp (d_op, "struct ", 7)) + return Ret | OT::Struct; + + if (! strncmp (d_op, "class ", 6)) + return OT::Class; + + if (! strncmp (d_op, "namespace ", 10)) + return OT::Namespace; + + if ((words_count (d_op) > 1) && !b_local_ftest) + return OT::Variable; + + if (Ret) + return Ret; + return OT::Other; + } + + if (ch == ';') { + if (!strncmp (d_op, "typedef ", 8)) + return OT::Typedef; + + if (b_local_ftest) { + S = strchr (d_op, '('); + if (! S) + return OT::Other; + + S++; + if (words_count (S) <= 1) { + S = strchr_r (S, ')', 0); + S++; + if (words_count (S) > 1) + return OT::Other; // declaration... or not ? + } + } else { + if (d_words_count <= 1) + return OT::Other; + + if (!strncmp (d_op, "struct ", 7) && d_words_count == 2) + return OT::Other; + + if (!strncmp (d_op, "return ", 7)) + return OT::Other; + + if (!strncmp (d_op, "delete ", 7)) + return OT::Other; + + return OT::Variable; + } + // Function defenition, callback defenition... it's all ? + } + + return OT::Other; +} + diff --git a/silentbob/scripts/SConstruct b/silentbob/scripts/SConstruct new file mode 100644 index 0000000..dc094ba --- /dev/null +++ b/silentbob/scripts/SConstruct @@ -0,0 +1,38 @@ +env = Environment (CC='gcc', CXX='g++', CCFLAGS='-O3 -Wall -pipe', CXXFLAGS='-O3 -Wall -pipe', OPTS='', CPPPATH=['..//include', '..//gclib/include'], LINKFLAGS='-L./ ') +env.SharedLibrary ("gclib", ['..//gclib/src/darray.cxx', + '..//gclib/src/deprecated_dsplit.cxx', '..//gclib/src/dhash.cxx', '..//gclib/src/dheapsort.cxx', '..//gclib/src/djobs.cxx', '..//gclib/src/dlist.cxx', '..//gclib/src/dsplit.cxx', '..//gclib/src/earray.cxx', '..//gclib/src/ehash.cxx', '..//gclib/src/elist.cxx', '..//gclib/src/fs.cxx', '..//gclib/src/gclib.cxx', '..//gclib/src/gclib_c.c']) +env = Environment (CC='gcc', CXX='g++', CCFLAGS='-O3 -Wall -pipe', CXXFLAGS='-O3 -Wall -pipe', OPTS='', CPPPATH=['..//include', '..//gclib/include'], LINKFLAGS='-L./ -lsblib -lgclib -ldl ') +env.SharedLibrary ("sblib", ['..//sblib/py_tt.cxx', + '..//sblib/Sblib.cxx', '..//sblib/the_fly.cxx', '..//sblib/the_tt.cxx', '..//sblib/t_op2.cxx', '..//sblib/t_op.cxx', '..//sblib/TT.cxx', '..//sblib/wit.cxx']) + + +env = Environment (CC='gcc', CXX='g++', CCFLAGS='-O3 -Wall -pipe', CXXFLAGS='-O3 -Wall -pipe', OPTS='', CPPPATH=['..//include', '..//gclib/include'], LINKFLAGS='-L./ -lsblib -lgclib -ldl ') +env.Program ("silent_bob", ['..//src/callTags.cxx', + '..//src/cFiles.cxx', '..//src/cgrep.cxx', '..//src/ctags.cxx', '..//src/file.cxx', '..//src/indent.cxx', '..//src/init.cxx', '..//src/interactive.cxx', '..//src/kinds.cxx', '..//src/main.cxx', '..//src/modding.cxx', '..//src/opts_funcs.cxx', '..//src/opts_kinds.cxx', '..//src/opts_list.cxx', '..//src/opts_settings.cxx', '..//src/structs.cxx', '..//src/tree.cxx', '..//src/usage.cxx']) +env = Environment (CC='gcc', CXX='g++', CCFLAGS='-O3 -Wall -pipe', CXXFLAGS='-O3 -Wall -pipe', OPTS='', CPPPATH=['..//include', '..//gclib/include'], LINKFLAGS='-L./ -lsblib -lgclib -ldl ') +env.SharedLibrary ("plugin_perl", ['..//plugins/plugin_perl.cxx', + ]) +env.SharedLibrary ("plugin_perlpackages", ['..//plugins/plugin_perlpackages.cxx', + ]) +env.SharedLibrary ("plugin_cache", ['..//plugins/plugin_cache.cxx', + ]) +env.SharedLibrary ("plugin_editor", ['..//plugins/plugin_editor.cxx', + ]) +env.SharedLibrary ("plugin_grep", ['..//plugins/plugin_grep.cxx', + ]) +env.SharedLibrary ("plugin_compile", ['..//plugins/plugin_compile.cxx', + ]) +env.SharedLibrary ("plugin_aap", ['..//plugins/plugin_aap.cxx', + ]) +env.SharedLibrary ("plugin_python", ['..//plugins/plugin_python.cxx', + ]) +env.SharedLibrary ("plugin_scons", ['..//plugins/plugin_scons.cxx', + ]) +env.SharedLibrary ("plugin_foreach", ['..//plugins/plugin_foreach.cxx', + ]) +env.SharedLibrary ("plugin_make", ['..//plugins/plugin_make.cxx', + ]) +env.SharedLibrary ("plugin_xml_project", ['..//plugins/plugin_xml_project.cxx', + ]) +env.SharedLibrary ("plugin_csharp", ['..//plugins/plugin_csharp.cxx', + ]) diff --git a/silentbob/scripts/build_bob.bob b/silentbob/scripts/build_bob.bob new file mode 100755 index 0000000..2246cd5 --- /dev/null +++ b/silentbob/scripts/build_bob.bob @@ -0,0 +1,107 @@ +#!/bin/bash + +top_srcdir=../ +echo "#!/bin/sh -v" >./build_bob.sh + +export LIBS="-L./" +export INCLUDE="-I${top_srcdir}/include -I${top_srcdir}/gclib/include" + +bob ${top_srcdir}/gclib/src/*.cxx ${top_srcdir}/gclib/src/*.c --scons-env --scons-shared gclib >./SConstruct +bob ${top_srcdir}/gclib/src/*.cxx ${top_srcdir}/gclib/src/*.c --aap-env --aap-shared gclib >./main.aap +bob ${top_srcdir}/gclib/src/*.cxx ${top_srcdir}/gclib/src/*.c -cc --cc-env --cc-script --cc-shared libgclib.so >./build_bob.sh +export LIBS="-L./ -lsblib -lgclib -ldl" + +# Scons. libsblib +bob ${top_srcdir}/sblib/*.cxx --scons-env --scons-shared sblib >>./SConstruct +echo "" >>./SConstruct +echo "" >>./SConstruct + +# Scons. silent_bob +bob ${top_srcdir}/src/*.cxx --scons-env --scons-program silent_bob >>./SConstruct + +# AAP. libsblib +bob ${top_srcdir}/sblib/*.cxx --aap-env --aap-shared sblib >>./main.aap +echo "" >>./main.aap +echo "" >>./main.aap + +# AAP. silent_bob +bob ${top_srcdir}/src/*.cxx --aap-env --aap-program silent_bob >>./main.aap + +# Bash. libsblib +bob ${top_srcdir}/sblib/*.cxx -cc --cc-env --cc-script --cc-shared libsblib.so >>./build_bob.sh +echo "" >>./build_bob.sh + +# Bash. silent_bob +bob ${top_srcdir}/src/*.cxx -cc --cc-env --cc-script --cc-program silent_bob >>./build_bob.sh +chmod a+x ./build_bob.sh + + + + + + + + + + + +# Plugins. +bob ${top_srcdir}/plugins/plugin_perl.cxx \ + -cc --cc-env --cc-script --cc-shared "libplugin_perl.so" >>./build_bob.sh +bob --scons-env --scons-shared "plugin_perl" \ + ${top_srcdir}/plugins/plugin_perl.cxx >>./SConstruct +bob --aap-env --aap-shared "plugin_perl" \ + ${top_srcdir}/plugins/plugin_perl.cxx >>./main.aap + +bob -cc --cc-script --cc-shared "libplugin_perlpackages.so" \ + ${top_srcdir}/plugins/plugin_perlpackages.cxx >>./build_bob.sh +bob --scons-shared "plugin_perlpackages" \ + ${top_srcdir}/plugins/plugin_perlpackages.cxx >>./SConstruct +bob --aap-shared "plugin_perlpackages" \ + ${top_srcdir}/plugins/plugin_perlpackages.cxx >>./main.aap + +bob -cc --cc-script --cc-shared "libplugin_cache.so" ${top_srcdir}/plugins/plugin_cache.cxx >>./build_bob.sh +bob --scons-shared "plugin_cache" ${top_srcdir}/plugins/plugin_cache.cxx >>./SConstruct +bob --aap-shared "plugin_cache" ${top_srcdir}/plugins/plugin_cache.cxx >>./main.aap + +bob -cc --cc-script --cc-shared "libplugin_editor.so" ${top_srcdir}/plugins/plugin_editor.cxx >>./build_bob.sh +bob --scons-shared "plugin_editor" ${top_srcdir}/plugins/plugin_editor.cxx >>./SConstruct +bob --aap-shared "plugin_editor" ${top_srcdir}/plugins/plugin_editor.cxx >>./main.aap + +bob -cc --cc-script --cc-shared "libplugin_grep.so" ${top_srcdir}/plugins/plugin_grep.cxx >>./build_bob.sh +bob --scons-shared "plugin_grep" ${top_srcdir}/plugins/plugin_grep.cxx >>./SConstruct +bob --aap-shared "plugin_grep" ${top_srcdir}/plugins/plugin_grep.cxx >>./main.aap + +bob -cc --cc-script --cc-shared "libplugin_compile.so" ${top_srcdir}/plugins/plugin_compile.cxx >>./build_bob.sh +bob --scons-shared "plugin_compile" ${top_srcdir}/plugins/plugin_compile.cxx >>./SConstruct +bob --aap-shared "plugin_compile" ${top_srcdir}/plugins/plugin_compile.cxx >>./main.aap + +bob -cc --cc-script --cc-shared "libplugin_aap.so" ${top_srcdir}/plugins/plugin_aap.cxx >>./build_bob.sh +bob --scons-shared "plugin_aap" ${top_srcdir}/plugins/plugin_aap.cxx >>./SConstruct +bob --aap-shared "plugin_aap" ${top_srcdir}/plugins/plugin_aap.cxx >>./main.aap + +bob -cc --cc-script --cc-shared "libplugin_python.so" ${top_srcdir}/plugins/plugin_python.cxx >>./build_bob.sh +bob --scons-shared "plugin_python" ${top_srcdir}/plugins/plugin_python.cxx >>./SConstruct +bob --aap-shared "plugin_python" ${top_srcdir}/plugins/plugin_python.cxx >>./main.aap + +bob -cc --cc-script --cc-shared "libplugin_scons.so" ${top_srcdir}/plugins/plugin_scons.cxx >>./build_bob.sh +bob --scons-shared "plugin_scons" ${top_srcdir}/plugins/plugin_scons.cxx >>./SConstruct +bob --aap-shared "plugin_scons" ${top_srcdir}/plugins/plugin_scons.cxx >>./main.aap + +bob -cc --cc-script --cc-shared "libplugin_foreach.so" ${top_srcdir}/plugins/plugin_foreach.cxx >>./build_bob.sh +bob --scons-shared "plugin_foreach" ${top_srcdir}/plugins/plugin_foreach.cxx >>./SConstruct +bob --aap-shared "plugin_foreach" ${top_srcdir}/plugins/plugin_foreach.cxx >>./main.aap + +bob -cc --cc-script --cc-shared "libplugin_make.so" ${top_srcdir}/plugins/plugin_make.cxx >>./build_bob.sh +bob --scons-shared "plugin_make" ${top_srcdir}/plugins/plugin_make.cxx >>./SConstruct +bob --aap-shared "plugin_make" ${top_srcdir}/plugins/plugin_make.cxx >>./main.aap + +bob -cc --cc-script --cc-shared "libplugin_xml_project.so" ${top_srcdir}/plugins/plugin_xml_project.cxx >>./build_bob.sh +bob --scons-shared "plugin_xml_project" ${top_srcdir}/plugins/plugin_xml_project.cxx >>./SConstruct +bob --aap-shared "plugin_xml_project" ${top_srcdir}/plugins/plugin_xml_project.cxx >>./main.aap + +bob -cc --cc-script --cc-shared "libplugin_csharp.so" ${top_srcdir}/plugins/plugin_csharp.cxx >>./build_bob.sh +bob --scons-shared "plugin_csharp" ${top_srcdir}/plugins/plugin_csharp.cxx >>./SConstruct +bob --aap-shared "plugin_csharp" ${top_srcdir}/plugins/plugin_csharp.cxx >>./main.aap + + diff --git a/silentbob/scripts/build_bob.sh b/silentbob/scripts/build_bob.sh new file mode 100755 index 0000000..3e2aa7c --- /dev/null +++ b/silentbob/scripts/build_bob.sh @@ -0,0 +1,105 @@ +export CC="gcc" +export CXX="g++" +export CFLAGS="-O3 -Wall -pipe" +export CXXFLAGS="-O3 -Wall -pipe" +export INCLUDE="-I..//include -I..//gclib/include" +export OPTS="-fPIC -DPIC" +export LDFLAGS="" +export LIBS="-L./" + +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//gclib/src/darray.o ..//gclib/src/darray.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//gclib/src/deprecated_dsplit.o ..//gclib/src/deprecated_dsplit.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//gclib/src/dhash.o ..//gclib/src/dhash.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//gclib/src/dheapsort.o ..//gclib/src/dheapsort.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//gclib/src/djobs.o ..//gclib/src/djobs.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//gclib/src/dlist.o ..//gclib/src/dlist.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//gclib/src/dsplit.o ..//gclib/src/dsplit.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//gclib/src/earray.o ..//gclib/src/earray.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//gclib/src/ehash.o ..//gclib/src/ehash.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//gclib/src/elist.o ..//gclib/src/elist.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//gclib/src/fs.o ..//gclib/src/fs.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//gclib/src/gclib.o ..//gclib/src/gclib.cxx +$CC $CFLAGS $OPTS $INCLUDE -c -o ..//gclib/src/gclib_c.o ..//gclib/src/gclib_c.c +gcc $LDFLAGS $LIBS -shared ..//gclib/src/darray.o ..//gclib/src/deprecated_dsplit.o ..//gclib/src/dhash.o ..//gclib/src/dheapsort.o ..//gclib/src/djobs.o ..//gclib/src/dlist.o ..//gclib/src/dsplit.o ..//gclib/src/earray.o ..//gclib/src/ehash.o ..//gclib/src/elist.o ..//gclib/src/fs.o ..//gclib/src/gclib.o ..//gclib/src/gclib_c.o -o libgclib.so +export CC="gcc" +export CXX="g++" +export CFLAGS="-O3 -Wall -pipe" +export CXXFLAGS="-O3 -Wall -pipe" +export INCLUDE="-I..//include -I..//gclib/include" +export OPTS="-fPIC -DPIC" +export LDFLAGS="" +export LIBS="-L./ -lsblib -lgclib -ldl" + +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//sblib/py_tt.o ..//sblib/py_tt.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//sblib/Sblib.o ..//sblib/Sblib.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//sblib/the_fly.o ..//sblib/the_fly.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//sblib/the_tt.o ..//sblib/the_tt.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//sblib/t_op2.o ..//sblib/t_op2.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//sblib/t_op.o ..//sblib/t_op.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//sblib/TT.o ..//sblib/TT.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//sblib/wit.o ..//sblib/wit.cxx +gcc $LDFLAGS $LIBS -shared ..//sblib/py_tt.o ..//sblib/Sblib.o ..//sblib/the_fly.o ..//sblib/the_tt.o ..//sblib/t_op2.o ..//sblib/t_op.o ..//sblib/TT.o ..//sblib/wit.o -o libsblib.so + +export CC="gcc" +export CXX="g++" +export CFLAGS="-O3 -Wall -pipe" +export CXXFLAGS="-O3 -Wall -pipe" +export INCLUDE="-I..//include -I..//gclib/include" +export OPTS="" +export LDFLAGS="" +export LIBS="-L./ -lsblib -lgclib -ldl" + +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//src/callTags.o ..//src/callTags.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//src/cFiles.o ..//src/cFiles.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//src/cgrep.o ..//src/cgrep.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//src/ctags.o ..//src/ctags.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//src/file.o ..//src/file.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//src/indent.o ..//src/indent.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//src/init.o ..//src/init.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//src/interactive.o ..//src/interactive.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//src/kinds.o ..//src/kinds.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//src/main.o ..//src/main.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//src/modding.o ..//src/modding.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//src/opts_funcs.o ..//src/opts_funcs.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//src/opts_kinds.o ..//src/opts_kinds.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//src/opts_list.o ..//src/opts_list.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//src/opts_settings.o ..//src/opts_settings.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//src/structs.o ..//src/structs.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//src/tree.o ..//src/tree.cxx +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//src/usage.o ..//src/usage.cxx +gcc $LDFLAGS $LIBS ..//src/callTags.o ..//src/cFiles.o ..//src/cgrep.o ..//src/ctags.o ..//src/file.o ..//src/indent.o ..//src/init.o ..//src/interactive.o ..//src/kinds.o ..//src/main.o ..//src/modding.o ..//src/opts_funcs.o ..//src/opts_kinds.o ..//src/opts_list.o ..//src/opts_settings.o ..//src/structs.o ..//src/tree.o ..//src/usage.o -o silent_bob +export CC="gcc" +export CXX="g++" +export CFLAGS="-O3 -Wall -pipe" +export CXXFLAGS="-O3 -Wall -pipe" +export INCLUDE="-I..//include -I..//gclib/include" +export OPTS="-fPIC -DPIC" +export LDFLAGS="" +export LIBS="-L./ -lsblib -lgclib -ldl" + +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//plugins/plugin_perl.o ..//plugins/plugin_perl.cxx +gcc $LDFLAGS $LIBS -shared ..//plugins/plugin_perl.o -o libplugin_perl.so +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//plugins/plugin_perlpackages.o ..//plugins/plugin_perlpackages.cxx +gcc $LDFLAGS $LIBS -shared ..//plugins/plugin_perlpackages.o -o libplugin_perlpackages.so +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//plugins/plugin_cache.o ..//plugins/plugin_cache.cxx +gcc $LDFLAGS $LIBS -shared ..//plugins/plugin_cache.o -o libplugin_cache.so +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//plugins/plugin_editor.o ..//plugins/plugin_editor.cxx +gcc $LDFLAGS $LIBS -shared ..//plugins/plugin_editor.o -o libplugin_editor.so +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//plugins/plugin_grep.o ..//plugins/plugin_grep.cxx +gcc $LDFLAGS $LIBS -shared ..//plugins/plugin_grep.o -o libplugin_grep.so +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//plugins/plugin_compile.o ..//plugins/plugin_compile.cxx +gcc $LDFLAGS $LIBS -shared ..//plugins/plugin_compile.o -o libplugin_compile.so +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//plugins/plugin_aap.o ..//plugins/plugin_aap.cxx +gcc $LDFLAGS $LIBS -shared ..//plugins/plugin_aap.o -o libplugin_aap.so +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//plugins/plugin_python.o ..//plugins/plugin_python.cxx +gcc $LDFLAGS $LIBS -shared ..//plugins/plugin_python.o -o libplugin_python.so +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//plugins/plugin_scons.o ..//plugins/plugin_scons.cxx +gcc $LDFLAGS $LIBS -shared ..//plugins/plugin_scons.o -o libplugin_scons.so +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//plugins/plugin_foreach.o ..//plugins/plugin_foreach.cxx +gcc $LDFLAGS $LIBS -shared ..//plugins/plugin_foreach.o -o libplugin_foreach.so +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//plugins/plugin_make.o ..//plugins/plugin_make.cxx +gcc $LDFLAGS $LIBS -shared ..//plugins/plugin_make.o -o libplugin_make.so +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//plugins/plugin_xml_project.o ..//plugins/plugin_xml_project.cxx +gcc $LDFLAGS $LIBS -shared ..//plugins/plugin_xml_project.o -o libplugin_xml_project.so +$CXX $CXXFLAGS $OPTS $INCLUDE -c -o ..//plugins/plugin_csharp.o ..//plugins/plugin_csharp.cxx +gcc $LDFLAGS $LIBS -shared ..//plugins/plugin_csharp.o -o libplugin_csharp.so diff --git a/silentbob/scripts/clean.sh b/silentbob/scripts/clean.sh new file mode 100755 index 0000000..26d442c --- /dev/null +++ b/silentbob/scripts/clean.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +CLEAN_MASK="*.o *.so *.os *.lo *.la .deps .libs" + +make distclean +cd src +rm -fr $CLEAN_MASK +cd .. +rm -f ./silent_bob +rm -f src/silent_bob +rm -fr ./autom4te.cache +cd sblib +rm -fr $CLEAN_MASK +cd ../gclib/src +rm -fr $CLEAN_MASK +cd ../gclib_c +rm -fr $CLEAN_MASK +cd ../../plugins +rm -fr $CLEAN_MASK +cd ../ +rm -fr ./tags +rm -fr ./cfiles +rm -fr debug/* +rm -fr package/* +rm -fr debian/silentbob/* +cd scripts +scons -c +aap cleanALL +cd ../gclib/scripts +scons -c +aap cleanALL diff --git a/silentbob/scripts/fixdoxy.pl b/silentbob/scripts/fixdoxy.pl new file mode 100755 index 0000000..235684e --- /dev/null +++ b/silentbob/scripts/fixdoxy.pl @@ -0,0 +1,19 @@ +#!/usr/bin/perl + +my $fileName; +foreach $fileName (@ARGV) { + fixFile ($fileName); +} + +sub fixFile ($) { + my $m_fileName = shift; + open (FILE, "< $m_fileName") or die "Не могу открыть файл $m_fileName"; + @allData = ; + close FILE; + $data = join ("", @allData); + $data =~ s/charset=iso-8859-1/charset=utf8/g; + open (FILE, "> $m_fileName"); + print FILE $data; + close FILE; +} + diff --git a/silentbob/scripts/install.sh b/silentbob/scripts/install.sh new file mode 100755 index 0000000..0ffa11a --- /dev/null +++ b/silentbob/scripts/install.sh @@ -0,0 +1,12 @@ +#!/bin/bash +cp ./silent_bob /usr/bin/ +ln -s silent_bob /usr/bin/bob +ln -s silent_bob /usr/bin/tags +ln -s silent_bob /usr/bin/the_tt +ln -s silent_bob /usr/bin/gc_indent + +mkdir -p /usr/lib/silent_bob +cp ./libplugin_*.so /usr/lib/silent_bob/ +cp ./libsblib.so /usr/lib +cp ./libgclib.so /usr/lib + diff --git a/silentbob/scripts/main.aap b/silentbob/scripts/main.aap new file mode 100644 index 0000000..1feb120 --- /dev/null +++ b/silentbob/scripts/main.aap @@ -0,0 +1,103 @@ +CC=gcc +CXX=g++ +CFLAGS=-O3 -Wall -pipe +CXXFLAGS=$CFLAGS +OPTS= +INCLUDE=-I..//include -I..//gclib/include +LIBS=-L./ +OPTIMIZE=0 +LDFLAGS= +:dll gclib : ..//gclib/src/darray.cxx + ..//gclib/src/deprecated_dsplit.cxx ..//gclib/src/dhash.cxx + ..//gclib/src/dheapsort.cxx ..//gclib/src/djobs.cxx + ..//gclib/src/dlist.cxx ..//gclib/src/dsplit.cxx + ..//gclib/src/earray.cxx ..//gclib/src/ehash.cxx + ..//gclib/src/elist.cxx ..//gclib/src/fs.cxx + ..//gclib/src/gclib.cxx ..//gclib/src/gclib_c.c + + +CC=gcc +CXX=g++ +CFLAGS=-O3 -Wall -pipe +CXXFLAGS=$CFLAGS +OPTS= +INCLUDE=-I..//include -I..//gclib/include +LIBS=-L./ -lsblib -lgclib -ldl +OPTIMIZE=0 +LDFLAGS= +:dll sblib : ..//sblib/py_tt.cxx + ..//sblib/Sblib.cxx ..//sblib/the_fly.cxx + ..//sblib/the_tt.cxx ..//sblib/t_op2.cxx + ..//sblib/t_op.cxx ..//sblib/TT.cxx + ..//sblib/wit.cxx + + + +CC=gcc +CXX=g++ +CFLAGS=-O3 -Wall -pipe +CXXFLAGS=$CFLAGS +OPTS= +INCLUDE=-I..//include -I..//gclib/include +LIBS=-L./ -lsblib -lgclib -ldl +OPTIMIZE=0 +LDFLAGS= +:program silent_bob : ..//src/callTags.cxx + ..//src/cFiles.cxx ..//src/cgrep.cxx + ..//src/ctags.cxx ..//src/file.cxx + ..//src/indent.cxx ..//src/init.cxx + ..//src/interactive.cxx ..//src/kinds.cxx + ..//src/main.cxx ..//src/modding.cxx + ..//src/opts_funcs.cxx ..//src/opts_kinds.cxx + ..//src/opts_list.cxx ..//src/opts_settings.cxx + ..//src/structs.cxx ..//src/tree.cxx + ..//src/usage.cxx + +CC=gcc +CXX=g++ +CFLAGS=-O3 -Wall -pipe +CXXFLAGS=$CFLAGS +OPTS= +INCLUDE=-I..//include -I..//gclib/include +LIBS=-L./ -lsblib -lgclib -ldl +OPTIMIZE=0 +LDFLAGS= +:dll plugin_perl : ..//plugins/plugin_perl.cxx + + +:dll plugin_perlpackages : ..//plugins/plugin_perlpackages.cxx + + +:dll plugin_cache : ..//plugins/plugin_cache.cxx + + +:dll plugin_editor : ..//plugins/plugin_editor.cxx + + +:dll plugin_grep : ..//plugins/plugin_grep.cxx + + +:dll plugin_compile : ..//plugins/plugin_compile.cxx + + +:dll plugin_aap : ..//plugins/plugin_aap.cxx + + +:dll plugin_python : ..//plugins/plugin_python.cxx + + +:dll plugin_scons : ..//plugins/plugin_scons.cxx + + +:dll plugin_foreach : ..//plugins/plugin_foreach.cxx + + +:dll plugin_make : ..//plugins/plugin_make.cxx + + +:dll plugin_xml_project : ..//plugins/plugin_xml_project.cxx + + +:dll plugin_csharp : ..//plugins/plugin_csharp.cxx + + diff --git a/silentbob/scripts/make.sed b/silentbob/scripts/make.sed new file mode 100644 index 0000000..82b6397 --- /dev/null +++ b/silentbob/scripts/make.sed @@ -0,0 +1,2 @@ +s/^/\t/ +s/$/ \\/ diff --git a/silentbob/scripts/package.sh b/silentbob/scripts/package.sh new file mode 100755 index 0000000..4690800 --- /dev/null +++ b/silentbob/scripts/package.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +export "prefix=../package" +rm -fr $prefix/* +mkdir -p $prefix/usr/bin/ +cp ./silent_bob $prefix/usr/bin/ +ln -s silent_bob $prefix/usr/bin/bob +ln -s silent_bob $prefix/usr/bin/tags +ln -s silent_bob $prefix/usr/bin/the_tt +ln -s silent_bob $prefix/usr/bin/gc_indent + +mkdir -p $prefix/usr/lib/silent_bob +cp ./libplugin_*.so $prefix/usr/lib/silent_bob/ +cp ./libsblib.so $prefix/usr/lib + diff --git a/silentbob/scripts/recode_texts.sh b/silentbob/scripts/recode_texts.sh new file mode 100755 index 0000000..31ea278 --- /dev/null +++ b/silentbob/scripts/recode_texts.sh @@ -0,0 +1,5 @@ +#!/bin/bash +cp doc/FAQ_utf8 doc/FAQ_koi8r +cp doc/HACKING_utf8 doc/HACKING_koi8r +cp doc/README_utf8 doc/README_koi8r +recode ..koi8-r doc/*_koi8r diff --git a/silentbob/silent_bob.1 b/silentbob/silent_bob.1 new file mode 100644 index 0000000..152fe8b --- /dev/null +++ b/silentbob/silent_bob.1 @@ -0,0 +1,228 @@ +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sh \" Subsection heading +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. | will give a +.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to +.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' +.\" expand to `' in nroff, nothing in troff, for use with C<>. +.tr \(*W-|\(bv\*(Tr +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.\" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.hy 0 +.if n .na +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "SILENT_BOB 1" +.TH SILENT_BOB 1 "2006-12-13" "SilentBob 1.2" "" +.SH "NAME" +silent_bob \- The SilentBob is yet another indexing tool. +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +.Vb 5 +\& silent_bob [] [] [] +\& bob [] [] [] +\& tags ... +\& the_tt +\& structs +.Ve +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +The SilentBob is yet another indexing tool helping you to find your way through +the software source code. Although SilentBob is also able to index sources in +many popular programming languages, currently C/\*(C+ is the most functional back\-end. Main features are: + \- Code indexing + \- Function call traverse + \- Call backtrace + \- File searching + \- Fast searching in the source code +.PP +\&\fBsilent_bob\fR \-. + When started with single argument the SillentBob traverse the given function name + up to he most outer caller. A simple to understand tree will be build on the screen. + Both \*(L"tags\*(R" and \*(L"call_tags\*(R" files are required to perform traversal quickly. +.PP +.Vb 2 +\& the SilentBob is also capable to handle "tags" file by "exuberant\-ctags" program, +\& but it is not designed to do so. +.Ve +.PP +\&\fBbob\fR \- runs silent_bob +.PP +\&\fBtags\fR \- alias for \*(L"silent_bob \-\-tags\*(R" +.PP +\&\fBthe_tt\fR \- alias for \*(L"silent_bob \-\-the\-tt\*(R" +.PP +\&\fBstructs\fR \- alias for \*(L"silent_bob \-\-structs\*(R" +.SH "OPTIONS" +.IX Header "OPTIONS" +\&\fB\-V\fR show version info and exit +.PP +\&\fB\-L\fR specify file list to process as a text file +.PP +\&\fB\-\-cfiles\fR list all C/\*(C+ related files (.h, .cpp etc) +.PP +\&\fB\-\-file\fR dump all function names from file +.PP +\&\fB\-\-give\-structs\fR dump all C structures from file +.PP +\&\fB\-\-indent\fR indent the source code +.PP +\&\fB\-\-tags\fR show parts of referenced code +.PP +\&\fB\-\-make\-ctags\fR Create \*(L"./tags\*(R" index file +.PP +\&\fB\-\-call\-tags\fR Create function calls index file (\*(L"./call_tags\*(R") +.PP +\&\fB\-\-cgrep\fR Search by operation (exmpl: bob \-\-cgrep if,var \*(-- finds all comparisons of var) +.PP +\&\fB\-\-plugins\-info\fR list available plug\-in's +.PP +\&\fB\-u\fR Show reversed function call tree +.PP +\&\fB\-\-tag\-style\fR Enforce ctags file format (for \*(L"\-\-cgrep\*(R") +.PP +\&\fB\-\-depth\fR Set maximum traversal (tree) depth +.PP +\&\fB\-fn\fR Show source file names while traversing function calls +.SH "EXAMPLES" +.IX Header "EXAMPLES" +Build \*(L"ctags\*(R" file: +.PP +.Vb 1 +\& bob \-\-make\-ctags +.Ve +.PP +Build \*(L"call_tags\*(R" : +.PP +.Vb 2 +\& bob \-\-cfiles +\& bob \-L ./cfiles \-\-call\-tags +.Ve +.PP +Created \*(L"call_tags\*(R" file is compatible with Vim! +.PP +Show code of \*(L"sys_socket\*(R" and \*(L"file_operations\*(R" : +.PP +.Vb 2 +\& bob \-\-make\-ctags +\& tags sys_socket file_operations +.Ve +.SH "AUTHOR" +.IX Header "AUTHOR" +Oleg Puchinin diff --git a/silentbob/silent_bob.pod b/silentbob/silent_bob.pod new file mode 100644 index 0000000..3a8a4cb --- /dev/null +++ b/silentbob/silent_bob.pod @@ -0,0 +1,93 @@ +=head1 NAME + +silent_bob - The SilentBob is yet another indexing tool. + +=head1 SYNOPSIS + + silent_bob [] [] [] + bob [] [] [] + tags ... + the_tt + structs + +=head1 DESCRIPTION + +The SilentBob is yet another indexing tool helping you to find your way through +the software source code. Although SilentBob is also able to index sources in +many popular programming languages, currently C/C++ is the most functional back-end. Main features are: + - Code indexing + - Function call traverse + - Call backtrace + - File searching + - Fast searching in the source code + +B -. + When started with single argument the SillentBob traverse the given function name + up to he most outer caller. A simple to understand tree will be build on the screen. + Both "tags" and "call_tags" files are required to perform traversal quickly. + + the SilentBob is also capable to handle "tags" file by "exuberant-ctags" program, + but it is not designed to do so. + +B - runs silent_bob + +B - alias for "silent_bob --tags" + +B - alias for "silent_bob --the-tt" + +B - alias for "silent_bob --give-structs" + +=head1 OPTIONS + +B<-V> show version info and exit + +B<-L> specify file list to process as a text file + +B<--cfiles> list all C/C++ related files (.h, .cpp etc) + +B<--file> dump all function names from file + +B<--give-structs> dump all C structures from file + +B<--indent> indent the source code + +B<--tags> show parts of referenced code + +B<--make-ctags> Create "./tags" index file + +B<--call-tags> Create function calls index file ("./call_tags") + +B<--cgrep> Search by operation (exmpl: bob --cgrep if,var -- finds all comparisons of var) + +B<--plugins-info> list available plug-in's + +B<--u> Show reversed function call tree + +B<--tag-style> Enforce ctags file format (for "--cgrep") + +B<--depth> Set maximum traversal (tree) depth + +B<-fn> Show source file names while traversing function calls + +=head1 EXAMPLES + +Build "ctags" file: + + bob --make-ctags + +Build "call_tags" : + + bob --cfiles + bob -L ./cfiles --call-tags + +Created "call_tags" file is compatible with Vim! + +Show code of "sys_socket" and "file_operations" : + + bob --make-ctags + tags sys_socket file_operations + +=head1 AUTHOR + +Oleg Puchinin + diff --git a/silentbob/silentbob-1.5.ebuild b/silentbob/silentbob-1.5.ebuild new file mode 100644 index 0000000..91deab8 --- /dev/null +++ b/silentbob/silentbob-1.5.ebuild @@ -0,0 +1,23 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +DESCRIPTION="Yet another indexing tool." +HOMEPAGE="http://silentbob.sourceforge.net" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" + +LICENSE="GPL" +SLOT="0" +KEYWORDS="~x86" +IUSE="" + +src_compile() { + econf || die "econf failed" + emake || die "emake failed" +} + +src_install() { + einstall || die "einstall failed" + + dodoc README +} + diff --git a/silentbob/src/Makefile.am b/silentbob/src/Makefile.am new file mode 100644 index 0000000..43d0f9c --- /dev/null +++ b/silentbob/src/Makefile.am @@ -0,0 +1,24 @@ +INCLUDES=-I$(top_srcdir)/include -I$(top_srcdir)/gclib/include + +bin_PROGRAMS=silent_bob +silent_bob_SOURCES=cFiles.cxx file.cxx init.cxx modding.cxx opts_list.cxx tree.cxx \ + cgrep.cxx opts_funcs.cxx opts_settings.cxx opts_kinds.cxx usage.cxx \ + callTags.cxx ctags.cxx indent.cxx main.cxx structs.cxx kinds.cxx \ + interactive.cxx + +silent_bob_LDADD=-L$(top_builddir)/gclib/src/.libs \ + -L$(top_builddir)/sblib/.libs \ + -lgclib -ldl -lsblib + +install-exec-local: + ln -sf silent_bob $(prefix)/bin/bob + ln -sf silent_bob $(prefix)/bin/tags + ln -sf silent_bob $(prefix)/bin/the_tt + ln -sf silent_bob $(prefix)/bin/structs + +#install-exec-hook: +# ln -sf silent_bob.1.gz $(mandir)/man1/bob.1.gz +# ln -sf silent_bob.1.gz $(mandir)/man1/tags.1.gz +# ln -sf silent_bob.1.gz $(mandir)/man1/the_tt.1.gz +# ln -sf silent_bob.1.gz $(mandir)/man1/structs.1.gz + diff --git a/silentbob/src/Makefile.in b/silentbob/src/Makefile.in new file mode 100644 index 0000000..03f01ea --- /dev/null +++ b/silentbob/src/Makefile.in @@ -0,0 +1,498 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = silent_bob$(EXEEXT) +subdir = src +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_silent_bob_OBJECTS = cFiles.$(OBJEXT) file.$(OBJEXT) init.$(OBJEXT) \ + modding.$(OBJEXT) opts_list.$(OBJEXT) tree.$(OBJEXT) \ + cgrep.$(OBJEXT) opts_funcs.$(OBJEXT) opts_settings.$(OBJEXT) \ + opts_kinds.$(OBJEXT) usage.$(OBJEXT) callTags.$(OBJEXT) \ + ctags.$(OBJEXT) indent.$(OBJEXT) main.$(OBJEXT) \ + structs.$(OBJEXT) kinds.$(OBJEXT) interactive.$(OBJEXT) +silent_bob_OBJECTS = $(am_silent_bob_OBJECTS) +silent_bob_DEPENDENCIES = +DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(silent_bob_SOURCES) +DIST_SOURCES = $(silent_bob_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/gclib/include +silent_bob_SOURCES = cFiles.cxx file.cxx init.cxx modding.cxx opts_list.cxx tree.cxx \ + cgrep.cxx opts_funcs.cxx opts_settings.cxx opts_kinds.cxx usage.cxx \ + callTags.cxx ctags.cxx indent.cxx main.cxx structs.cxx kinds.cxx \ + interactive.cxx + +silent_bob_LDADD = -L$(top_builddir)/gclib/src/.libs \ + -L$(top_builddir)/sblib/.libs \ + -lgclib -ldl -lsblib + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cxx .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +silent_bob$(EXEEXT): $(silent_bob_OBJECTS) $(silent_bob_DEPENDENCIES) + @rm -f silent_bob$(EXEEXT) + $(CXXLINK) $(silent_bob_OBJECTS) $(silent_bob_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cFiles.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callTags.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cgrep.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctags.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indent.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interactive.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kinds.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modding.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opts_funcs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opts_kinds.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opts_list.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opts_settings.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/structs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tree.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usage.Po@am__quote@ + +.cxx.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cxx.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cxx.lo: +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: install-binPROGRAMS install-exec-local + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-exec-local \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-binPROGRAMS + + +install-exec-local: + ln -sf silent_bob $(prefix)/bin/bob + ln -sf silent_bob $(prefix)/bin/tags + ln -sf silent_bob $(prefix)/bin/the_tt + ln -sf silent_bob $(prefix)/bin/structs + +#install-exec-hook: +# ln -sf silent_bob.1.gz $(mandir)/man1/bob.1.gz +# ln -sf silent_bob.1.gz $(mandir)/man1/tags.1.gz +# ln -sf silent_bob.1.gz $(mandir)/man1/the_tt.1.gz +# ln -sf silent_bob.1.gz $(mandir)/man1/structs.1.gz +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/silentbob/src/cFiles.cxx b/silentbob/src/cFiles.cxx new file mode 100644 index 0000000..11b2140 --- /dev/null +++ b/silentbob/src/cFiles.cxx @@ -0,0 +1,18 @@ +/* + * (c) Oleg Puchinin 2006,2007 + * graycardinalster@gmail.com + * + */ + +#include + +/// Точка входа для --cfiles +int bob_cfiles () +{ + char m_buf[512]; + unlink ("./cfiles"); + find_cfiles (); + sprintf (m_buf, "mv \"%s\" ./cfiles", ENV->tmp_files); + return system (m_buf); +} + diff --git a/silentbob/src/callTags.cxx b/silentbob/src/callTags.cxx new file mode 100644 index 0000000..1172ca1 --- /dev/null +++ b/silentbob/src/callTags.cxx @@ -0,0 +1,151 @@ +/* + * (c) Oleg Puchinin 2006,2007 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include +#include + +int callTagsFile (char * fileName) +{ + char * functionName = NULL; + char m_name[256]; + char * oldName = NULL; + char * ptr = NULL; + bool b_inmacro = false; + char * S = NULL; + int i; + TT * tt = NULL; + DArray * d_words = NULL; + + tt = new TT; + tt->loadFile (fileName); + tt->init (); + + while (true) { + tt->nextOperator (); + if (tt->ch == 0) + break; + + ptr = tt->op (); + + if ((ptr[0] == '#') && def_test (ptr)) { + if (macro_name (ptr, m_name)) + functionName = m_name; + b_inmacro = true; + } + + if (! tt->bracketDepth) { + if (tt->ch == '\n' && ptr[strlen(ptr) - 1] != '\\') { + b_inmacro = false; + functionName = oldName; + } + } + + if (tt->wit () == OT::Function ) { + functionName = ww_last_word (tt->op ()); + oldName = functionName; + } + + if (! tt->bracketDepth) + continue; + + d_words = split_to_words (ptr); + for (i = 0; i < d_words->get_size (); i++) { + S = cts ((c_word *) d_words->get (i)); + if (! S) + continue; + + if (functionName != NULL) { + printf ("%s\t%s\t%i\t;\tby\t%s\n", S, + tt->tt->fileName, + tt->tt->attachment[ENV->t_op_no].pair_line+1, + functionName); + } else { + printf ("%s\t%s\t%i\n", S, + tt->tt->fileName, + tt->tt->attachment[ENV->t_op_no].pair_line+1); + } + } + + d_words->foreach ((Dfunc_t) free_cword); + delete d_words; + } + + fflush (stdout); + delete tt; + return 0; +} + +int call_tags_multi (EArray * d_files) +{ + char m_buf[512]; + __djob_t * j; + int i; + + if (! d_files) + return -1; + + d_files->strings_to_file (ENV->tmp_files); + split_tmp_files (); + + for (i = 0; i < ENV->max_proc; ++i) { + j = ENV->proc_list->fork (); + if (j->child) { + sprintf (m_buf, "silent_bob -L %s%i --thread --call-tags", ENV->tmp_files, i); + exit (execlp ("sh", "sh", "-c", m_buf, NULL)); + } + usleep (500); + } + + while ((j = ENV->proc_list->wait_all ()) && j) + Dexec_done (j); + + mk_tags ("./call_tags", NULL); + remove_tmp_files (); + return 0; +} + +/// Точка входа для --call-tags +int call_tags (EArray * d_files) +{ + int fd; + int i; + + if (!d_files || d_files->get_size () == 0) { + fprintf (stderr, "No such files.\n"); + return -1; + } + + if (! SB_FLGET (SB_FLTHREAD)) + unlink (ENV->tmp_tags); + + if (ENV->max_proc > 1) + return call_tags_multi (d_files); + + fd = open (ENV->tmp_tags, O_APPEND | O_WRONLY); + if (fd < 0) { + fd = open (ENV->tmp_tags, O_CREAT | O_APPEND | O_WRONLY, 0666); + if (fd < 0) + return -1; + } + + dup2 (fd, 1); + for (i = 0; i < d_files->get_size (); i++) + callTagsFile (d_files->get (i)); + + close (fd); + fclose (stdout); + if (! SB_FLGET (SB_FLTHREAD)) { + mk_tags ("./call_tags", NULL); + remove_tmp_files (); + } + + return 0; +} + diff --git a/silentbob/src/call_tags b/silentbob/src/call_tags new file mode 100644 index 0000000..4f6627f --- /dev/null +++ b/silentbob/src/call_tags @@ -0,0 +1,590 @@ +!_TAG_FILE_FORMAT 2 +!_TAG_FILE_SORTED 1 +!_TAG_PROGRAM_AUTHOR Oleg Puchinin (graycardinalster@gmail.com) +!_TAG_PROGRAM_NAME Silent Bob +!_TAG_PROGRAM_URL http://sf.net/projects/silentbob +!_TAG_PROGRAM_VERSION 1.6 +CNEW ./cgrep.cxx 94 ; by file +CNEW ./file.cxx 30 +CNEW ./indent.cxx 46 +CNEW ./init.cxx 28 +CNEW ./init.cxx 31 +CNEW ./init.cxx 34 +CNEW ./init.cxx 48 +CNEW ./init.cxx 50 +CNEW ./modding.cxx 147 +CNEW ./structs.cxx 13 +DLSTAT ./modding.cxx 143 +Dexec_done ./callTags.cxx 105 +Dexec_done ./cgrep.cxx 184 ; by cgrep +Dexec_done ./ctags.cxx 39 +Dfiles ./modding.cxx 200 +Dsplit ./cgrep.cxx 107 ; by file +Dsplit ./interactive.cxx 23 +Dtimer ./opts_funcs.cxx 98 +Dtimer ./opts_settings.cxx 56 +EQ ./ctags.cxx 22 +EQ ./ctags.cxx 59 +EQ ./modding.cxx 206 +EQ ./modding.cxx 208 +EQ ./modding.cxx 59 +EQ ./opts_funcs.cxx 19 +EQ ./opts_funcs.cxx 19 +EQ ./opts_funcs.cxx 24 +EQ ./opts_funcs.cxx 24 +EQ ./opts_funcs.cxx 29 +EQ ./opts_funcs.cxx 34 +EQ ./opts_funcs.cxx 39 +EQ ./opts_funcs.cxx 44 +EQ ./opts_funcs.cxx 49 +EQ ./opts_funcs.cxx 55 +EQ ./opts_funcs.cxx 55 +EQ ./opts_funcs.cxx 61 +EQ ./opts_funcs.cxx 61 +EQ ./opts_funcs.cxx 67 +EQ ./opts_funcs.cxx 76 +EQ ./opts_funcs.cxx 81 +EQ ./opts_funcs.cxx 86 +EQ ./opts_funcs.cxx 92 +EQ ./opts_funcs.cxx 92 +EQ ./opts_funcs.cxx 98 +EQ ./opts_kinds.cxx 19 +EQ ./opts_settings.cxx 104 +EQ ./opts_settings.cxx 104 +EQ ./opts_settings.cxx 109 +EQ ./opts_settings.cxx 116 +EQ ./opts_settings.cxx 124 +EQ ./opts_settings.cxx 129 +EQ ./opts_settings.cxx 136 +EQ ./opts_settings.cxx 136 +EQ ./opts_settings.cxx 136 +EQ ./opts_settings.cxx 144 +EQ ./opts_settings.cxx 23 +EQ ./opts_settings.cxx 28 +EQ ./opts_settings.cxx 34 +EQ ./opts_settings.cxx 34 +EQ ./opts_settings.cxx 39 +EQ ./opts_settings.cxx 45 +EQ ./opts_settings.cxx 50 +EQ ./opts_settings.cxx 55 +EQ ./opts_settings.cxx 61 +EQ ./opts_settings.cxx 66 +EQ ./opts_settings.cxx 66 +EQ ./opts_settings.cxx 71 +EQ ./opts_settings.cxx 71 +EQ ./opts_settings.cxx 76 +EQ ./opts_settings.cxx 81 +EQ ./opts_settings.cxx 89 +EQ ./opts_settings.cxx 97 +LPCHAR ./modding.cxx 272 +NE ./main.cxx 72 +NE ./main.cxx 72 +SB_FLGET ./callTags.cxx 124 +SB_FLGET ./callTags.cxx 142 +SB_FLGET ./cgrep.cxx 111 ; by file +SB_FLGET ./cgrep.cxx 57 ; by print +SB_FLGET ./ctags.cxx 33 +SB_FLGET ./ctags.cxx 68 +SB_FLGET ./ctags.cxx 80 +SB_FLGET ./kinds.cxx 17 +SB_FLGET ./kinds.cxx 35 +SB_FLGET ./main.cxx 157 +SB_FLGET ./main.cxx 79 +SB_FLGET ./modding.cxx 155 +SB_FLGET ./modding.cxx 91 +SB_FLGET ./structs.cxx 45 +SB_FLGET ./tree.cxx 120 +SB_FLGET ./tree.cxx 166 +SB_FLGET ./tree.cxx 166 +SB_FLGET ./tree.cxx 206 +SB_FLGET ./tree.cxx 212 +SB_FLGET ./tree.cxx 212 +SB_FLSET ./opts_funcs.cxx 62 +SB_FLSET ./opts_settings.cxx 105 +SB_FLSET ./opts_settings.cxx 125 +SB_FLSET ./opts_settings.cxx 139 +SB_FLSET ./opts_settings.cxx 145 +SB_FLSET ./opts_settings.cxx 24 +SB_FLSET ./opts_settings.cxx 29 +SB_FLSET ./opts_settings.cxx 35 +SB_FLSET ./opts_settings.cxx 51 +SB_FLSET ./opts_settings.cxx 57 +SB_FLSET ./opts_settings.cxx 62 +SB_FLSET ./opts_settings.cxx 67 +SB_FLSET ./opts_settings.cxx 72 +SB_FLSET ./opts_settings.cxx 77 +S_ISDIR ./modding.cxx 143 +S_ISREG ./modding.cxx 247 +access ./file.cxx 24 +add ./main.cxx 36 +add ./main.cxx 46 +add ./modding.cxx 272 +add ./opts_settings.cxx 19 +add ./tree.cxx 208 +add ./tree.cxx 217 +add ./tree.cxx 78 +add ./tree.cxx 85 +assert ./modding.cxx 123 +assert ./tree.cxx 194 +assert ./tree.cxx 96 +atoi ./opts_settings.cxx 100 +atoi ./opts_settings.cxx 120 +atoi ./opts_settings.cxx 85 +atoi ./opts_settings.cxx 93 +bob_cfiles ./opts_funcs.cxx 93 +bug_nocalltags ./tree.cxx 104 +bug_nosuch_tag ./tree.cxx 173 +bug_notsupported ./modding.cxx 179 +bug_plugin ./modding.cxx 253 +bug_plugin ./modding.cxx 260 +bug_system ./ctags.cxx 83 +c_str ./ctags.cxx 28 +c_str ./ctags.cxx 78 +callTagsFile ./callTags.cxx 138 +call_tags ./main.cxx 92 +call_tags ./modding.cxx 175 +call_tags_multi ./callTags.cxx 127 +call_tree ./main.cxx 157 +call_tree ./tree.cxx 219 +cgrep ./main.cxx 89 +chdir ./opts_settings.cxx 41 +chdir ./opts_settings.cxx 46 +chomp ./cgrep.cxx 146 ; by thread +chomp ./interactive.cxx 22 +chomp ./main.cxx 144 +chomp ./tree.cxx 73 +close ./callTags.cxx 140 +cts ./callTags.cxx 58 +cts ./tree.cxx 197 +def_test ./callTags.cxx 40 +dlerror ./modding.cxx 249 +dlerror ./modding.cxx 251 +dlerror ./modding.cxx 258 +dlopen ./modding.cxx 250 +dlsym ./modding.cxx 257 +do_tt ./file.cxx 34 +do_tt ./structs.cxx 24 +do_tt_file ./cgrep.cxx 98 ; by file +do_tt_file ./file.cxx 32 +do_tt_file ./indent.cxx 48 +dup2 ./callTags.cxx 136 +execlp ./callTags.cxx 99 +execlp ./ctags.cxx 29 +exit ./callTags.cxx 99 +exit ./cgrep.cxx 143 ; by thread +exit ./cgrep.cxx 151 ; by thread +exit ./ctags.cxx 29 +exit ./main.cxx 103 +exit ./main.cxx 137 +exit ./main.cxx 28 +exit ./main.cxx 61 +exit ./main.cxx 74 +exit ./modding.cxx 107 +exit ./modding.cxx 95 +exit ./opts_funcs.cxx 21 +exit ./opts_funcs.cxx 26 +exit ./opts_funcs.cxx 78 +exit ./opts_funcs.cxx 88 +exit ./opts_funcs.cxx 94 +fault ./tree.cxx 185 +fclose ./callTags.cxx 141 +fclose ./cgrep.cxx 150 ; by thread +fclose ./modding.cxx 187 +fflush ./callTags.cxx 78 +fflush ./cgrep.cxx 60 ; by print +fflush ./ctags.cxx 35 +fflush ./interactive.cxx 17 +fflush ./main.cxx 169 +fflush ./tree.cxx 111 +fgets ./cgrep.cxx 145 ; by thread +fgets ./interactive.cxx 20 +fgets ./main.cxx 143 +file ./cgrep.cxx 147 ; by thread +file ./cgrep.cxx 171 ; by cgrep +fileno ./modding.cxx 157 +find_cfiles ./cFiles.cxx 14 +find_cfiles ./ctags.cxx 62 +find_language ./modding.cxx 121 +fixPosition ./cgrep.cxx 54 ; by print +flist_main ./main.cxx 109 +flist_main ./main.cxx 150 +fopen ./cgrep.cxx 141 ; by thread +fopen ./init.cxx 63 +fopen ./modding.cxx 101 +fopen ./modding.cxx 97 +foreach ./callTags.cxx 74 +foreach ./cgrep.cxx 127 ; by file +foreach ./init.cxx 59 +foreach ./interactive.cxx 27 +foreach ./main.cxx 167 +foreach ./modding.cxx 212 +foreach ./opts_settings.cxx 112 +foreach ./tree.cxx 109 +foreach ./tree.cxx 223 +foreach ./tree.cxx 229 +foreach ./tree.cxx 90 +fork ./callTags.cxx 96 +fork ./cgrep.cxx 178 ; by cgrep +fork ./ctags.cxx 25 +fprintf ./callTags.cxx 119 +fprintf ./cgrep.cxx 165 ; by cgrep +fprintf ./main.cxx 60 +fprintf ./modding.cxx 105 +fprintf ./modding.cxx 93 +fprintf ./tree.cxx 68 +fputc ./file.cxx 60 +fputc ./indent.cxx 100 +fputc ./indent.cxx 108 +fputc ./indent.cxx 74 +fputc ./indent.cxx 88 +fputc ./indent.cxx 92 +fputc ./indent.cxx 97 +fputc ./indent.cxx 99 +fputc ./structs.cxx 65 +fputc ./structs.cxx 74 +fputc ./structs.cxx 80 +fputc ./tree.cxx 133 +fputc ./tree.cxx 145 +fputc ./tree.cxx 80 +free_tt_state ./cgrep.cxx 131 ; by file +free_tt_state ./cgrep.cxx 99 ; by file +free_tt_state ./file.cxx 61 +free_tt_state ./indent.cxx 116 +free_tt_state ./modding.cxx 161 +free_tt_state ./structs.cxx 92 +from_file ./cgrep.cxx 113 ; by file +from_file ./init.cxx 58 +from_file ./opts_settings.cxx 111 +from_file ./tree.cxx 102 +func_handle ./modding.cxx 264 +get ./callTags.cxx 138 +get ./callTags.cxx 58 +get ./cgrep.cxx 171 ; by cgrep +get ./cgrep.cxx 45 ; by fixPosition +get ./cgrep.cxx 59 ; by print +get ./cgrep.cxx 71 ; by scan +get ./main.cxx 109 +get ./main.cxx 112 +get ./main.cxx 115 +get ./main.cxx 118 +get ./main.cxx 157 +get ./main.cxx 159 +get ./main.cxx 39 +get ./main.cxx 46 +get ./main.cxx 59 +get ./main.cxx 59 +get ./main.cxx 60 +get ./modding.cxx 143 +get ./modding.cxx 149 +get ./modding.cxx 168 +get ./modding.cxx 175 +get ./modding.cxx 206 +get ./modding.cxx 208 +get ./modding.cxx 209 +get ./modding.cxx 25 +get ./modding.cxx 269 +get ./modding.cxx 51 +get ./modding.cxx 75 +get ./opts_funcs.cxx 17 +get ./opts_funcs.cxx 72 +get ./opts_kinds.cxx 19 +get ./opts_kinds.cxx 25 +get ./opts_settings.cxx 100 +get ./opts_settings.cxx 104 +get ./opts_settings.cxx 104 +get ./opts_settings.cxx 109 +get ./opts_settings.cxx 111 +get ./opts_settings.cxx 116 +get ./opts_settings.cxx 120 +get ./opts_settings.cxx 124 +get ./opts_settings.cxx 129 +get ./opts_settings.cxx 133 +get ./opts_settings.cxx 144 +get ./opts_settings.cxx 18 +get ./opts_settings.cxx 19 +get ./opts_settings.cxx 23 +get ./opts_settings.cxx 28 +get ./opts_settings.cxx 34 +get ./opts_settings.cxx 34 +get ./opts_settings.cxx 39 +get ./opts_settings.cxx 41 +get ./opts_settings.cxx 45 +get ./opts_settings.cxx 50 +get ./opts_settings.cxx 55 +get ./opts_settings.cxx 61 +get ./opts_settings.cxx 66 +get ./opts_settings.cxx 66 +get ./opts_settings.cxx 71 +get ./opts_settings.cxx 71 +get ./opts_settings.cxx 76 +get ./opts_settings.cxx 81 +get ./opts_settings.cxx 85 +get ./opts_settings.cxx 89 +get ./opts_settings.cxx 93 +get ./opts_settings.cxx 97 +get ./tree.cxx 126 +get ./tree.cxx 197 +get ./tree.cxx 54 +get ./tree.cxx 61 +get ./tree.cxx 68 +get_onett_tag ./tree.cxx 170 +get_size ./callTags.cxx 118 +get_size ./callTags.cxx 138 +get_size ./callTags.cxx 57 +get_size ./cgrep.cxx 171 ; by cgrep +get_size ./cgrep.cxx 45 ; by fixPosition +get_size ./cgrep.cxx 69 ; by scan +get_size ./ctags.cxx 62 +get_size ./main.cxx 38 +get_size ./main.cxx 67 +get_size ./modding.cxx 130 +get_size ./modding.cxx 204 +get_size ./modding.cxx 24 +get_size ./modding.cxx 268 +get_size ./modding.cxx 50 +get_size ./modding.cxx 63 +get_size ./modding.cxx 74 +get_size ./opts_funcs.cxx 69 +get_size ./opts_kinds.cxx 18 +get_size ./opts_settings.cxx 16 +get_size ./tree.cxx 103 +get_size ./tree.cxx 124 +get_size ./tree.cxx 132 +get_size ./tree.cxx 173 +get_size ./tree.cxx 196 +getenv ./init.cxx 47 +getenv ./init.cxx 55 +globalsPrint ./kinds.cxx 42 +got_structs ./main.cxx 115 +got_structs ./main.cxx 135 +got_tag ./tree.cxx 122 +index ./main.cxx 40 +init ./callTags.cxx 28 +init ./kinds.cxx 25 +kindsFile ./main.cxx 118 +kindsFile ./main.cxx 147 +loadFile ./callTags.cxx 27 +loadFile ./kinds.cxx 20 +logToFile ./kinds.cxx 17 +macro_name ./callTags.cxx 42 +make_ctags ./main.cxx 83 +make_ctags ./modding.cxx 136 +make_ctags ./modding.cxx 168 +make_ctags_fork ./ctags.cxx 75 +memset ./cgrep.cxx 95 ; by file +memset ./init.cxx 35 +memset ./modding.cxx 148 +memset ./structs.cxx 22 +mk_dirs ./init.cxx 54 +mk_tags ./callTags.cxx 107 +mk_tags ./callTags.cxx 143 +mk_tags ./ctags.cxx 86 +mk_tags ./modding.cxx 190 +mkctags_prepare ./modding.cxx 128 +mkdir ./init.cxx 19 +mkdir ./init.cxx 21 +modding_init ./init.cxx 69 +modding_load_dir ./modding.cxx 220 +modding_load_dir ./modding.cxx 221 +modding_load_plugin ./modding.cxx 209 +modding_optparse ./main.cxx 64 +modding_optparse ./main.cxx 70 +modding_start ./main.cxx 73 +mods_info ./opts_funcs.cxx 77 +nextOperator ./callTags.cxx 31 +nextOperator ./kinds.cxx 31 +nogui_indent ./main.cxx 86 +nogui_tagsdump ./tree.cxx 166 +nogui_tagsdump ./tree.cxx 213 +op ./callTags.cxx 38 +op ./callTags.cxx 52 +op ./kinds.cxx 42 +open ./callTags.cxx 129 +open ./callTags.cxx 131 +opt ./modding.cxx 31 +opt2 ./modding.cxx 36 +opts_funcs ./main.cxx 51 +opts_kinds ./main.cxx 57 +opts_settings ./main.cxx 54 +perror ./file.cxx 26 +perror ./modding.cxx 106 +perror ./modding.cxx 94 +print ./cgrep.cxx 123 ; by file +print_the_time ./main.cxx 102 +print_the_time ./main.cxx 136 +print_the_time ./main.cxx 162 +printf ./callTags.cxx 66 +printf ./callTags.cxx 70 +printf ./cgrep.cxx 57 ; by print +printf ./cgrep.cxx 59 ; by print +printf ./ctags.cxx 34 +printf ./file.cxx 25 +printf ./file.cxx 36 +printf ./file.cxx 47 +printf ./indent.cxx 104 +printf ./indent.cxx 65 +printf ./indent.cxx 80 +printf ./indent.cxx 86 +printf ./interactive.cxx 16 +printf ./modding.cxx 158 +printf ./modding.cxx 73 +printf ./modding.cxx 83 +printf ./opts_funcs.cxx 25 +printf ./structs.cxx 45 +printf ./structs.cxx 51 +printf ./structs.cxx 57 +printf ./structs.cxx 71 +printf ./structs.cxx 73 +printf ./structs.cxx 78 +printf ./structs.cxx 81 +printf ./structs.cxx 83 +printf ./structs.cxx 88 +printf ./structs.cxx 90 +printf ./tree.cxx 130 +printf ./tree.cxx 132 +printf ./tree.cxx 139 +printf ./usage.cxx 11 +printf ./usage.cxx 12 +printf ./usage.cxx 34 +printf ./usage.cxx 36 +push ./indent.cxx 51 +push ./indent.cxx 52 +push ./indent.cxx 53 +push ./init.cxx 38 +rctree_iter ./tree.cxx 107 +rctree_iter ./tree.cxx 86 +remove_tmp_files ./callTags.cxx 108 +remove_tmp_files ./callTags.cxx 144 +remove_tmp_files ./cgrep.cxx 186 ; by cgrep +remove_tmp_files ./ctags.cxx 87 +rename ./modding.cxx 92 +reverse_calltree ./main.cxx 159 +sb_init ./main.cxx 23 +sb_prname ./main.cxx 24 +scan ./cgrep.cxx 122 ; by file +setParam ./main.cxx 41 +setvbuf ./init.cxx 32 +sfind ./tree.cxx 16 +sfind ./tree.cxx 203 +sfind ./tree.cxx 216 +sfind ./tree.cxx 76 +sfind ./tree.cxx 84 +short_info ./modding.cxx 82 +sizeof ./cgrep.cxx 95 ; by file +sizeof ./init.cxx 35 +sizeof ./modding.cxx 148 +sizeof ./structs.cxx 22 +snfind ./file.cxx 45 +snfind ./indent.cxx 73 +snfind_fast ./tree.cxx 47 +snprintf ./modding.cxx 243 +snprintf ./tree.cxx 44 +split_tmp_files ./callTags.cxx 93 +split_tmp_files ./cgrep.cxx 176 ; by cgrep +split_tmp_files ./ctags.cxx 19 +split_to_words ./callTags.cxx 56 +split_to_words ./tree.cxx 193 +sprintf ./cFiles.cxx 15 +sprintf ./callTags.cxx 98 +sprintf ./cgrep.cxx 140 ; by thread +sprintf ./ctags.cxx 28 +sprintf ./ctags.cxx 43 +sprintf ./ctags.cxx 69 +sprintf ./ctags.cxx 78 +sprintf ./init.cxx 18 +sprintf ./init.cxx 20 +sprintf ./init.cxx 49 +sprintf ./init.cxx 51 +sprintf ./init.cxx 55 +stail ./modding.cxx 240 +stail ./modding.cxx 240 +stat ./modding.cxx 245 +strcat ./ctags.cxx 80 +strchr ./cgrep.cxx 164 ; by cgrep +strchr ./cgrep.cxx 164 ; by cgrep +strchr ./structs.cxx 42 +strdup ./cgrep.cxx 96 ; by file +strdup ./file.cxx 31 +strdup ./indent.cxx 47 +strdup ./init.cxx 22 +strdup ./init.cxx 23 +strdup ./main.cxx 46 +strdup ./modding.cxx 270 +strdup ./opts_settings.cxx 133 +strdup ./opts_settings.cxx 138 +strdup ./opts_settings.cxx 19 +strdup ./structs.cxx 23 +strdup ./tree.cxx 208 +strdup ./tree.cxx 217 +strdup ./tree.cxx 78 +strdup ./tree.cxx 85 +stringOffset ./cgrep.cxx 45 ; by fixPosition +strings_to_file ./callTags.cxx 92 +strings_to_file ./cgrep.cxx 175 ; by cgrep +strings_to_file ./ctags.cxx 65 +strlen ./callTags.cxx 46 +strlen ./cgrep.cxx 18 ; by stringOffset +strlen ./cgrep.cxx 75 ; by scan +strlen ./file.cxx 43 +strlen ./init.cxx 48 +strlen ./init.cxx 48 +strlen ./init.cxx 50 +strlen ./init.cxx 50 +strlen ./structs.cxx 71 +strlen ./structs.cxx 78 +strlen ./structs.cxx 88 +strlen ./tree.cxx 46 +strlen ./tree.cxx 47 +strncmp ./cgrep.cxx 24 ; by stringOffset +strncmp ./structs.cxx 34 +strncmp ./structs.cxx 36 +strncmp ./tree.cxx 57 +strncmp ./tree.cxx 63 +strstr ./cgrep.cxx 72 ; by scan +strstr ./tree.cxx 65 +system ./cFiles.cxx 16 +system ./ctags.cxx 44 +system ./ctags.cxx 70 +system ./ctags.cxx 81 +t_op ./cgrep.cxx 117 ; by file +t_op ./file.cxx 38 +t_op ./indent.cxx 56 +t_op ./structs.cxx 27 +t_op ./structs.cxx 54 +t_op ./structs.cxx 76 +t_op ./structs.cxx 86 +t_op ./tree.cxx 181 +t_op ./tree.cxx 188 +tags ./interactive.cxx 26 +tags ./main.cxx 95 +tags_interactive ./opts_funcs.cxx 87 +the ./modding.cxx 154 +the_tt_main ./main.cxx 112 +the_tt_main ./main.cxx 133 +thread ./cgrep.cxx 180 ; by cgrep +tree_echo ./tree.cxx 100 +tree_echo ./tree.cxx 164 +tree_echo ./tree.cxx 209 +tree_echo ./tree.cxx 82 +tree_immune ./tree.cxx 212 +tree_immune ./tree.cxx 219 +tree_mkpos ./tree.cxx 206 +unlink ./cFiles.cxx 13 +unlink ./callTags.cxx 124 +unlink ./ctags.cxx 54 +unlink ./ctags.cxx 55 +unlink ./ctags.cxx 72 +unlink ./modding.cxx 100 +unlink ./modding.cxx 99 +usage ./main.cxx 27 +usage ./opts_funcs.cxx 20 +usleep ./callTags.cxx 101 +validOption ./main.cxx 59 +wait_all ./callTags.cxx 105 +wait_all ./cgrep.cxx 184 ; by cgrep +wait_all ./ctags.cxx 39 +what_is_this ./file.cxx 47 +wit ./callTags.cxx 51 +wit ./kinds.cxx 40 +write ./modding.cxx 157 +ww_last_word ./callTags.cxx 52 diff --git a/silentbob/src/cgrep.cxx b/silentbob/src/cgrep.cxx new file mode 100644 index 0000000..9935e09 --- /dev/null +++ b/silentbob/src/cgrep.cxx @@ -0,0 +1,191 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include + +namespace cgrep { + +/// смещение (в строках) строки str в буфере d_buf. +int stringOffset (char ** d_buf, char *str) +{ + char * S; + int len = strlen (str); + int fix = 0;; + + S = *d_buf; + while (true) { + if (! strncmp (S, str, len)) + break; + if (*S == '\n') + fix--; + --S; + } + + *d_buf = S; + return fix; +} + +int fixPosition (tt_state_t *tt, int t_op_no, DArray * exp) +{ + int fix = 0; + char * d_buf; + int i; + + if (! tt || ! exp) + return 0; + + d_buf = tt->fileData + tt->attachment[t_op_no].offset; + for (i = exp->get_size () - 1; i >= 0; --i) + fix += stringOffset (&d_buf, exp->get (i)); + + return fix; +} + +void print (tt_state_t * tt, DArray * d_array, DArray * d_lines) +{ + int line; + line = tt->attachment[ENV->t_op_no].pair_line + 1; + line += fixPosition (tt, ENV->t_op_no, d_array); + if (SB_FLGET (SB_FLTAGSTYLE)) + printf ("%s\t%s\t+%i\n", ENV->cgrep_exp, + tt->fileName, line); + else + printf ("%s +%i: %s", tt->fileName, line, d_lines->get (line-1)); + fflush (stdout); +} + +bool scan (char *S, DArray * d_array) +{ + char * one; + int size; + int i; + + size = d_array->get_size (); + for (i = 0; i < size; i++) { + one = d_array->get (i); + S = strstr (S, one); + if (! S) + break; + S += strlen (one); + } + + if (i == size) + return true; + return false; +} + +int file (char * fileName) +{ + char * d_ptr, *d_out; + DArray * d_array; + DArray * d_lines = NULL; + tt_state_t * tt; + char ch; + + if (ENV->cgrep_exp == NULL) + return -1; + + tt = CNEW (tt_state_t, 1); + memset (tt, 0, sizeof (tt_state_t)); + tt->fileName = strdup (fileName); + + if (THE_TT::do_tt_file (tt) == NULL) { + free_tt_state (tt); + return -1; // broken file + } + + d_out = tt->result; + d_ptr = tt->result; + ENV->t_op_no = 0; + + d_array = Dsplit (ENV->cgrep_exp, ","); + if (d_array == NULL) + return -2; + + if (! SB_FLGET (SB_FLTAGSTYLE)) { + d_lines = new DArray (1024); + d_lines->from_file (tt->fileName); + } + + while (true) { + ch = t_op (&d_ptr, &d_out); + ENV->t_op_no++; + if (! ch) + break; + if (! scan (d_out, d_array)) + continue; + print (tt, d_array, d_lines); + } + + if (d_lines) { + d_lines->foreach (free); + delete d_lines; + } + + free_tt_state (tt); + return 0; +} + +int thread (int N) +{ + char m_buf[512]; + FILE * m_file; + + sprintf (m_buf, "%s%i", ENV->tmp_files, N); + m_file = fopen (m_buf, "r"); + if (! m_file) + exit (-1); + + while (fgets (m_buf, 512, m_file)) { + chomp (m_buf); + file (m_buf); + } + + fclose (m_file); + exit (0); + return 0; +} + +int cgrep (EArray * d_files) +{ + __djob_t * j; + int i; + + if (! d_files) + return -1; + + if (strchr (ENV->cgrep_exp, ' ') || + strchr (ENV->cgrep_exp, '\t')) { + fprintf (stderr, "You can't use spaces and tabs in expression.\n"); + return -1; + } + + if (ENV->max_proc == 1) { + for (i = 0; i < d_files->get_size (); ++i) + file (d_files->get (i)); + return 0; + } + + d_files->strings_to_file (ENV->tmp_files); + split_tmp_files (); + for (i = 0; i < ENV->max_proc; ++i) { + j = ENV->proc_list->fork (); + if (j->child) + thread (i); + } + + while ((j = ENV->proc_list->wait_all ()) && j) + Dexec_done (j); + + remove_tmp_files (); + return 0; +} + +} // namespace cgrep + diff --git a/silentbob/src/ctags.cxx b/silentbob/src/ctags.cxx new file mode 100644 index 0000000..6c1eed4 --- /dev/null +++ b/silentbob/src/ctags.cxx @@ -0,0 +1,89 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include + +void make_ctags_fork () +{ + std::string bob_cmd; + char m_buf[512]; + int i; + __djob_t * j; + + split_tmp_files (); + bob_cmd = "silent_bob "; + if (EQ (ENV->language, "C++")) + bob_cmd += "--lang cpp "; + + for (i = 0; i < ENV->max_proc; ++i) { + j = ENV->proc_list->fork (); + if (j->child) { + sprintf (m_buf, "%s -L %s%i -ts --kinds a >%s%i", bob_cmd.c_str (), + ENV->tmp_files, i, ENV->tmp_tags, i); + exit (execlp ("sh", "sh", "-c", m_buf, NULL)); + } + } + + if (SB_FLGET (SB_FLVERBOSE)) { + printf ("%s", "waiting threads...\n"); + fflush (stdout); + } + + while ((j = ENV->proc_list->wait_all ()) && j) + Dexec_done (j); + + for (i = 0; i < ENV->max_proc; ++i) { + sprintf (m_buf, "cat %s%i >>%s", ENV->tmp_tags, + i, ENV->tmp_tags); + system (m_buf); + } +} + +void make_ctags (EArray * d_files) +{ + std::string bob_cmd; + char m_buf[1024]; + int i; + + unlink (ENV->tmp_files); + unlink (ENV->tmp_tags); + + bob_cmd = "silent_bob "; + if (EQ (ENV->language, "C++")) + bob_cmd += "--lang cpp "; + + if (! d_files || d_files->get_size () == 0) + find_cfiles (); + else { + if (d_files->strings_to_file (ENV->tmp_files) <= 0) + return; + } + + if (SB_FLGET (SB_FLCTAGSAPPEND)) { + sprintf (m_buf, "cp ./tags %s", ENV->tmp_tags); + system (m_buf); + } else + unlink ("./tags"); + + if (ENV->max_proc > 1) + make_ctags_fork (); + else { + sprintf (m_buf, "%s -L %s -ts --kinds a >>%s ", bob_cmd.c_str(), + ENV->tmp_files, ENV->tmp_tags); + if (SB_FLGET (SB_FLDEBUG)) + strcat (m_buf, "--debug "); + i = system (m_buf); + if (i != 0) + bug_system (); + } + + mk_tags ("tags", NULL); + remove_tmp_files (); +} + diff --git a/silentbob/src/file.cxx b/silentbob/src/file.cxx new file mode 100644 index 0000000..57cbeaa --- /dev/null +++ b/silentbob/src/file.cxx @@ -0,0 +1,63 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include + +extern char * d_lpsz_operators[]; // from nogui_indent.cpp + +// $ silent_bob --file +// Get functions list from file. +void flist_main (char * d_file) +{ + struct tt_state_t * d_tt_state; + EArray d_operators; + int d_len = 0; + char *d_out,*d_ptr; + char ch; + int brace_depth = 0; + + if (access (d_file, R_OK) != F_OK) { + printf ("/*** %s ***/\n", d_file); + perror (""); + return; + } + + d_tt_state = CNEW (tt_state_t, 1); + d_tt_state->fileName = strdup (d_file); + d_ptr = THE_TT::do_tt_file (d_tt_state); + + d_ptr = do_tt(d_tt_state); + + printf ("/*** %s ***/\n", d_file); + while (true) { + ch = t_op (&d_ptr, &d_out, true); + + if (ch == 0) + break; + + d_len = strlen (d_out); + + if (!brace_depth && d_operators.snfind (d_out) == -1) { + if (what_is_this (d_out, ch) == OT::Function) + printf ("%s;\n", d_out); + } + + if (ch == '{') + brace_depth ++; + + if (ch == '}') + brace_depth --; + + if (brace_depth < 0) + brace_depth = 0; + } + + fputc ('\n', stdout); + free_tt_state (d_tt_state); +} + diff --git a/silentbob/src/indent.cxx b/silentbob/src/indent.cxx new file mode 100644 index 0000000..8b98c9a --- /dev/null +++ b/silentbob/src/indent.cxx @@ -0,0 +1,119 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include + +// \033[01;32m +extern FILE * d_stream_dbg; + +char * d_lpsz_operators [] = { "if", "else", "for", "while", "do", "switch", "#define", + "#include", "#else", "#if", "#elif","typedef", "struct", "class", + "case", "return", NULL }; + +char * d_lpsz_oneopops [] = {"if", "else", "for", "while", "do", NULL}; +char * d_lpsz_mustlined_ops [] = {"if", "for", "while", "do", NULL}; +char * d_lpsz_greenpeace [] = {"struct", + "class", + "extern", + "typedef", + "int", + "char", + "long", + "double", + "short", + NULL +}; + +// $ silent_bob --indent +void nogui_indent () // "UN-TT" ;) +{ + struct tt_state_t * d_tt_state; + bool b_inmacro = false; + char * d_out, *d_ptr; + int brace_depth = 0; + bool t_lined = true; + EArray d_must_lined; + EArray d_operators; + EArray d_array; + char ch; + int i; + + d_tt_state = CNEW (tt_state_t, 1); + d_tt_state->fileName = strdup ("-"); + d_ptr = THE_TT::do_tt_file (d_tt_state); + d_out = d_ptr; + + d_array.push (d_lpsz_oneopops); + d_must_lined.push (d_lpsz_mustlined_ops); + d_operators.push (d_lpsz_operators); + + while (true) { + ch = t_op (&d_ptr, &d_out); // t_op on top + + if (! ch) + break; + + if (*d_out == '#') + b_inmacro = true; + + if (ch == '\n' && d_ptr[-1] != '\\') { + printf ("%s\n", d_out); + b_inmacro = false; + continue; + } + + if (ch == '}') + brace_depth--; + + if (d_must_lined.snfind (d_out) != -1 && !t_lined && !b_inmacro) { + fputc ('\n', stdout); + t_lined = true; + } + + if (ch != '\n' && !b_inmacro) { + for (i = 0; i < brace_depth; i++) + printf (" "); + } + + if (ch == '{') + brace_depth++; + + printf ("%s", d_out); + + fputc (ch, stdout); + t_lined = false; + + if (b_inmacro && ch == '}') + fputc (' ', stdout); + + if (!b_inmacro) { + if (ch == '}' && brace_depth == 0) { + if (*d_ptr == '#' || *d_ptr == '\n') + fputc ('\n', stdout); + else if (*d_ptr && *d_ptr != ';') { + fputc ('\n', stdout); + fputc ('\n', stdout); + } + else if (*d_ptr && *d_ptr == ';') { + d_ptr+=2; + printf (";\n\n"); + } + } else { + if (ch != '\n') { + fputc ('\n', stdout); + } + if (ch == '{') + t_lined = true; + } + } + } + + free_tt_state (d_tt_state); + dbg_out; +} + diff --git a/silentbob/src/init.cxx b/silentbob/src/init.cxx new file mode 100644 index 0000000..f0851af --- /dev/null +++ b/silentbob/src/init.cxx @@ -0,0 +1,72 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include + +#define SB_IMMUNE_FILE ".silent_bob/silent_bob_immune" +char * c_ops [] = { "if", "else", "do", "while", + "switch", "case", "for", "return", NULL }; + +void mk_dirs () +{ + char m_buf[4096]; + sprintf (m_buf, "%s/.silent_bob", ENV->home_dir); + mkdir (m_buf, 0700); + sprintf (m_buf, "%s/.silent_bob/plugins", ENV->home_dir); + mkdir (m_buf, 0700); + ENV->home_plugins = strdup (m_buf); + ENV->shared_plugins = strdup ("/usr/lib/silent_bob/"); +} + +int sb_init () +{ + char * sb_immune_path = CNEW (char, 256); + char * stdout_vbuf; + + stdout_vbuf = CNEW (char, 4096 * 100); + setvbuf (stdout, stdout_vbuf, _IOFBF, 4096*100); + + ENV = CNEW(env_t, 1); + memset (ENV, 0, sizeof (env_t)); + + ENV->d_cops = new EArray(10); + ENV->d_cops->push (c_ops); + ENV->d_depth = 6; + ENV->sb_flags = 0; + + ENV->d_tags_file = NULL; + ENV->immune_list = NULL; + ENV->cgrep_A = 0; + ENV->cgrep_B = 0; + + ENV->home_dir = getenv ("HOME"); + ENV->tmp_files = CNEW (char, strlen (ENV->home_dir) + strlen (TMPNAME_FILES) + 20); + sprintf (ENV->tmp_files, "%s/.silent_bob/%s", ENV->home_dir, TMPNAME_FILES); + ENV->tmp_tags = CNEW (char, strlen (ENV->home_dir) + strlen (TMPNAME_TAGS) + 20); + sprintf (ENV->tmp_tags, "%s/.silent_bob/%s", ENV->home_dir, TMPNAME_TAGS); + ENV->debug_file = "/tmp/silent_bob.log"; + + mk_dirs (); + sprintf (sb_immune_path, "%s/.silent_bob/%s", getenv ("HOME"), SB_IMMUNE_FILE); + + ENV->immune_list = new EArray; + ENV->immune_list->from_file (sb_immune_path); + ENV->immune_list->foreach ((Dfunc_t) chomp); + ENV->full_list = new EArray; + ENV->settings = new EHash; + + ENV->d_stream_dbg = fopen ("/dev/null", "w"); + ENV->max_proc = 1; + ENV->nproc = 1; + ENV->proc_list = new DJobs; + ENV->listOptions = new EList; + + modding_init (); + return 0; +} + diff --git a/silentbob/src/interactive.cxx b/silentbob/src/interactive.cxx new file mode 100644 index 0000000..43923ff --- /dev/null +++ b/silentbob/src/interactive.cxx @@ -0,0 +1,31 @@ +/* + * (c) Oleg Puchinin 2008 + * graycardinalster@gmail.com + * + */ + +#include + +void tags_interactive () +{ + DArray * t; + char m_buf[512]; + + m_buf[511] = '\0'; + while (true) { + printf ("Tag: "); + fflush (stdout); + + if (! fgets (m_buf, 511, stdin)) + break; + + chomp (m_buf); + t = Dsplit (m_buf, " "); + if (! t) + continue; + tags (t, NULL); + t->foreach (free); + delete t; + } +} + diff --git a/silentbob/src/kinds.cxx b/silentbob/src/kinds.cxx new file mode 100644 index 0000000..4b81b90 --- /dev/null +++ b/silentbob/src/kinds.cxx @@ -0,0 +1,50 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#include +#include + +int kindsFile (char * fileName, int type) +{ + TT * tt; + char * op; + int m_type; + + if (SB_FLGET (SB_FLDEBUG)) + logToFile (ENV->debug_file, "kindsFile: %s %d\n", fileName, type); + + tt = new TT; + if (tt->loadFile (fileName) < 0) { + delete tt; + return -1; + } + + if (tt->init () < 0) { + delete tt; + return -1; + } + + while (true) { + op = tt->nextOperator (); + if (tt->ch == 0) + break; + + if (! SB_FLGET (SB_FLCPP)) { + if (tt->bracketDepth) + continue; + } + + m_type = tt->wit (); + if (m_type & type) + globalsPrint (tt->tt, tt->op (), m_type); + } + + delete tt; + return 0; +} + + + diff --git a/silentbob/src/main.cxx b/silentbob/src/main.cxx new file mode 100644 index 0000000..d2727d5 --- /dev/null +++ b/silentbob/src/main.cxx @@ -0,0 +1,173 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include + +extern "C" struct env_t *ENV; + +/* MAIN */ +int main (int argc, char ** argv) +{ + char * opt; + int n_files = 0; + DArray * d_opts; + int i; + + sb_init (); + ENV->sb_cmd = sb_prname (argv[0]); + + if (argc == 1 && !ENV->sb_cmd) { + usage (); + exit (0); + } + + ENV->d_files = new EArray (128); + ENV->language = "C"; + d_opts = new EArray (argc); + ENV->d_opts = d_opts; + for (i = 0; i < argc; i++) + d_opts->add (argv[i]); + + for (i = 1; i < d_opts->get_size (); i++) { + opt = d_opts->get (i); + if (opt[0] != '-' && index (opt, '=')) { + setParam (opt); + continue; + } + + if (opt[0] != '-') { + ENV->d_files->add (strdup (d_opts->get (i))); + continue; + } + + if (! opts_funcs (d_opts, i)) + continue; + + if (! opts_settings (d_opts, i)) + continue; + + if (! opts_kinds (d_opts, i)) + continue; + + if (d_opts->get (i)[0] == '-' && !validOption (d_opts->get(i))) { + fprintf (stderr, "unknown option : %s\n", d_opts->get (i)); + exit (1); + } + + modding_optparse (&i, 1); + } // for (i = 1; i < argc; i++) + + n_files = ENV->d_files->get_size (); + + for (i = 0; i < argc; i++) + modding_optparse (&i, 2); + + if (NE (ENV->language, "C") && NE (ENV->language, "C++")) { + i = modding_start (ENV->sb_cmd); + exit (i); + } + + if (SB_FLGET (SB_FLCPP)) + ENV->d_kinds &= OT::Class | OT::Struct | OT::Function + | OT::Namespace | OT::Define; + + switch (ENV->sb_cmd) { + case cmd_makectags: + make_ctags (ENV->d_files); + break; + case cmd_indent: + nogui_indent (); + break; + case cmd_cgrep: + cgrep::cgrep (ENV->d_files); + break; + case cmd_call_tags: + call_tags (ENV->d_files); + goto out; + case cmd_tags: + tags (ENV->d_files, NULL); + goto out; + } + + if (ENV->sb_cmd == cmd_makectags || + ENV->sb_cmd == cmd_indent || + ENV->sb_cmd == cmd_cgrep) { + print_the_time (NULL); + exit (0); + } + + for (i = 0; i < n_files; i++) { + switch (ENV->sb_cmd) { + case cmd_file: + flist_main (ENV->d_files->get (i)); + break; + case cmd_the_tt: + THE_TT::the_tt_main (ENV->d_files->get(i)); + break; + case cmd_give_structs: + got_structs (ENV->d_files->get (i)); + break; + case cmd_kinds: + kindsFile (ENV->d_files->get(i), ENV->d_kinds); + break; + } + } + + if (ENV->sb_cmd == cmd_file || + ENV->sb_cmd == cmd_the_tt || + ENV->sb_cmd == cmd_give_structs || + ENV->sb_cmd == cmd_kinds) + goto out; + + + ENV->sb_cmd = ENV->sb_cmd; + + if (ENV->sb_cmd == cmd_the_tt && !n_files) // THE_TT for stdin + THE_TT::the_tt_main ("-"); + else if (ENV->sb_cmd == cmd_give_structs && !n_files) { + got_structs ("-"); + print_the_time (NULL); + exit (0); + } + + if ((ENV->sb_cmd == cmd_kinds || ENV->sb_cmd == cmd_file) && !n_files) { + char d_buf[1024]; + + while (fgets (d_buf, 1023, stdin)) { + chomp (d_buf); + switch (ENV->sb_cmd) { + case cmd_kinds: + kindsFile (d_buf, ENV->d_kinds); + break; + case cmd_file: + flist_main (d_buf); + break; + } + } + } + + if (!SB_FLGET (SB_FLRTREE)) + call_tree (ENV->d_files->get (0), 0); + else + reverse_calltree (ENV->d_files->get (0)); + +out: + print_the_time (NULL); + + if (ENV->immune_list) + delete ENV->immune_list; + + ENV->d_files->foreach (free); + delete ENV->d_files; + fflush (stdout); + + return EXIT_SUCCESS; +} + diff --git a/silentbob/src/modding.cxx b/silentbob/src/modding.cxx new file mode 100644 index 0000000..75691b9 --- /dev/null +++ b/silentbob/src/modding.cxx @@ -0,0 +1,277 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include +#include + +#define PLUGINS_MASK "find ~/plugins/ -name \"libplugin_*.so.*\"" + +typedef struct DArray *(*plug_init_t) (struct env_t *env); + +char modding_optparse (int * i, int step) +{ + int pos; + mod_t * plug; + mod_feature * f; + + for (pos = 0; pos < ENV->modding->get_size (); pos++) { + plug = (mod_t *) ENV->modding->get (pos); + if (plug->Type == TYPE_FEATURE) { + f = (mod_feature *) plug; + + if (step == 1) { + if (f->opt && f->opt (ENV->d_opts, i)) + return 1; + } + + if (step == 2) { + if (f->opt2 && f->opt2 (ENV->d_opts, i)) + return 1; + } + } + } + + return 0; +} + +struct mod_language * find_language (char *S) +{ + struct mod_language *pm = NULL; + int i; + + //printf ("Plugins count : %i\n", ENV->modding->get_size ()); + for (i = 0; i < ENV->modding->get_size (); i++) { + pm = (struct mod_language *) ENV->modding->get (i); + if (! pm) + continue; + + if (pm->mod.Type != TYPE_LANGUAGE) + continue; + + if (EQ (pm->language, S)) + break; + } + + if (i < ENV->modding->get_size ()) + return pm; + + return NULL; +} + +void mods_info () +{ + struct mod_t *pm = NULL; + int i; + + printf ("Available plugins: \n"); + for (i = 0; i < ENV->modding->get_size (); i++) { + pm = (mod_t *) ENV->modding->get (i); + if (! pm) + continue; + + if (! pm->short_info) + continue; + + pm->short_info (); + printf ("\n"); + } +} + +FILE * mkctags_prepare () +{ + FILE * ofile; + + if (SB_FLGET (SB_FLCTAGSAPPEND)) { + if (rename ("./tags", ENV->tmp_tags) < 0) { + fprintf (stderr, "$ rename: ./tags %s\n", ENV->tmp_tags); + perror ("rename"); + exit (1); + } + ofile = fopen (ENV->tmp_tags, "a"); + } else { + unlink (ENV->tmp_tags); + unlink ("./tags"); + ofile = fopen (ENV->tmp_tags, "w"); + } + + if (ofile == NULL) { + fprintf (stderr, "fopen (\"%s\", \"w\")\n", ENV->tmp_tags); + perror ("fopen"); + exit (1); + } + + return ofile; +} + +int modding_start (int i_cmd) +{ + struct mod_language *pm = NULL; + struct tt_state_t * tt; + int i; + int size; + FILE * ofile = NULL; + + pm = find_language (ENV->language); + if (pm == NULL || pm->the == NULL) { + assert (true, "Language plugin not found !\n"); + return 1; + } + + if (i_cmd == cmd_makectags) + ofile = mkctags_prepare (); + + size = ENV->d_files->get_size (); + if (! size) { + switch (i_cmd) { + case cmd_makectags: + if (! pm->make_ctags) + return 2; + pm->make_ctags (NULL, ofile); + } + goto mod_out; + } + + for (i = 0; i < size; i++) { + if (S_ISDIR (DLSTAT (ENV->d_files->get (i))->st_mode)) + continue; + + switch (i_cmd) { + case cmd_the_tt: + tt = CNEW (tt_state_t, 1); + memset (tt, 0, sizeof (struct tt_state_t)); + tt->fileName = ENV->d_files->get (i); + + if (! pm->the) + return 2; + + pm->the (tt); + if (! SB_FLGET (SB_FLSIMULATE)) { + write (fileno (stdout), tt->result, + tt->resultSize); + printf ("\n"); + } + + free_tt_state (tt); + break; + + case cmd_makectags: + if (! pm->make_ctags || !pm->the) + return 2; + + pm->make_ctags (ENV->d_files->get (i), ofile); + break; + + case cmd_call_tags: + if (! pm->call_tags) + return 2; + + pm->call_tags (ENV->d_files->get (i)); + break; + + default: + bug_notsupported (); + i = size; + break; + } + } + +mod_out: + if (ofile) + fclose (ofile); + + if (i_cmd == cmd_makectags) + mk_tags ("tags", NULL); + + return 0; +} + +int modding_load_dir (char * path) +{ + int i; + DArray * files; + + files = Dfiles (path); + if (! files) + return -1; + + for (i = 0; i < files->get_size (); i++) { + if (EQ (files->get (i), ".")) + continue; + if (EQ (files->get (i), "..")) + continue; + modding_load_plugin (files->get (i), path); + } + + files->foreach (free); + delete files; + return 0; +} + +int modding_init () +{ + ENV->modding = new EArray(32); + modding_load_dir (ENV->home_plugins); + modding_load_dir (ENV->shared_plugins); + return 0; +} + +int modding_load_plugin (char * name, char * path) +{ + int n; + struct stat st; + char * s_dlerror; + void * lib_handle; + DArray *plug_list; + struct mod_t * sb_plugin; + plug_init_t func_handle; + char m_buf[512]; + + if (! path || ! name) + return -1; + + if (*stail (path) == '/') + *stail(m_buf) = '\0'; + + m_buf[511] = 0; + snprintf (m_buf, 511, "%s/%s", path, name); + + stat (m_buf, &st); + if (! S_ISREG (st.st_mode)) + return -1; + + dlerror (); + lib_handle = dlopen (m_buf, RTLD_NOW); + s_dlerror = dlerror (); + if (s_dlerror) { + bug_plugin (s_dlerror); + return -1; + } + + func_handle = (plug_init_t) dlsym (lib_handle, "plugin_init"); + s_dlerror = dlerror (); + if (s_dlerror) { + bug_plugin (s_dlerror); + return -1; + } + + plug_list = func_handle (ENV); + if (plug_list == NULL) + return -1; + + for (n = 0; n < plug_list->get_size (); n++) { + sb_plugin = (struct mod_t *) plug_list->get (n); + sb_plugin->mod_file = strdup (m_buf); + if (sb_plugin) + ENV->modding->add (LPCHAR (sb_plugin)); + } + + return 0; +} + diff --git a/silentbob/src/opts_funcs.cxx b/silentbob/src/opts_funcs.cxx new file mode 100644 index 0000000..afad32e --- /dev/null +++ b/silentbob/src/opts_funcs.cxx @@ -0,0 +1,102 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include + +int opts_funcs (DArray * d_opts, int & i) +{ + char * opt; + + if (! d_opts) + return -1; + + opt = d_opts->get (i); + + if (EQ (opt, "--help") || EQ (opt, "-h")) { + usage (); + exit (0); + } + + if (EQ (opt, "-V") || EQ (opt, "--version")) { + printf ("Silent Bob 1.6.1\n"); + exit (0); + } + + if (EQ (opt, "--file")) { + ENV->sb_cmd = cmd_file; + return 0; + } + + if (EQ (opt, "--the-tt")) { + ENV->sb_cmd = cmd_the_tt; + return 0; + } + + if (EQ (opt, "--structs")) { + ENV->sb_cmd = cmd_give_structs; + return 0; + } + + if (EQ (opt, "--indent")) { + ENV->sb_cmd = cmd_indent; + return 0; + } + + if (EQ (opt, "--tags")) { + ENV->sb_cmd = cmd_tags; + return 0; + } + + if (EQ (opt, "--make-ctags") || + EQ (opt, "-c")) { + ENV->sb_cmd = cmd_makectags; + return 0; + } + + if (EQ (opt, "--call-tags") || + EQ (opt, "-ct")) { + SB_FLSET (SB_FLTAGSTYLE); + ENV->sb_cmd = cmd_call_tags; + return 0; + } + + if (EQ (opt, "--cgrep")) { + if (++i >= d_opts->get_size ()) + return 0; + + ENV->sb_cmd = cmd_cgrep; + ENV->cgrep_exp = d_opts->get (i); + return 0; + } + + if (EQ (opt, "--plugins-info")) { + mods_info (); + exit (0); + } + + if (EQ (opt, "--tags")) { + ENV->sb_cmd = cmd_tags; + return 0; + } + + if (EQ (opt, "-i")) { + tags_interactive (); + exit (0); + } + + if (EQ (opt, "--cfiles") || + EQ (opt, "-f")) { + bob_cfiles (); + exit (0); + } + + if (EQ (opt, "--time-test")) + Dtimer (); + + return -1; +} + diff --git a/silentbob/src/opts_kinds.cxx b/silentbob/src/opts_kinds.cxx new file mode 100644 index 0000000..6703c61 --- /dev/null +++ b/silentbob/src/opts_kinds.cxx @@ -0,0 +1,48 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#include +#include + +int opts_kinds (DArray * d_opts, int & i) +{ + char *S; + int argc; + + if (! d_opts) + return 0; + + argc = d_opts->get_size (); + if (EQ (d_opts->get (i), "--kinds")) { + if (++i >= argc) + return 0; + + ENV->sb_cmd = cmd_kinds; + ENV->d_kinds = 0; + S = d_opts->get (i); + while (*S) { + switch (*S) { + case 'a': + ENV->d_kinds = 0xFFF & ~OT::Extern; + break; + case 'c': + ENV->d_kinds |= OT::Class; + break; + case 'f': + ENV->d_kinds |= OT::Function; + break; + case 's': + ENV->d_kinds |= OT::Struct; + break; + } + ++S; + } + return 0; + } + + return -1; +} + diff --git a/silentbob/src/opts_list.cxx b/silentbob/src/opts_list.cxx new file mode 100644 index 0000000..af6897c --- /dev/null +++ b/silentbob/src/opts_list.cxx @@ -0,0 +1,39 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#if 0 + +#include + +struct option long_options[] = { + {"help", 0, 0, 'h'}, + {"version", 0, 0, 'v'}, + {"file", 0, 0, 0}, + {"the-tt", 0, 0, 0}, + {"give-structs", 0, 0, 0}, + {"indent", 0, 0, 0}, + {"tags", 0, 0, 0}, + {"make-ctags", 0, 0, 0}, + {"call-tags", 0, 0, 0}, + {"cgrep", 1, 0, 0}, + {"plugins-info", 0, 0, 0}, + {"cfiles", 0, 0, 0}, + {"time-test", 0, 0, 0} + + {"debug", 0, 0, 0}, + {"simulate", 0, 0, 0}, + {"no-links", 0, 0, 0}, + {"all", 0, 0, 'a'}, + {"test", 0, 0, 0}, + {"ctags-append", 0, 0, 0}, + {"tag-style", 0, 0, 0}, + {"depth", 0, 0, 0}, + {"lang", 1, 0, 0} + +}; + +#endif + diff --git a/silentbob/src/opts_settings.cxx b/silentbob/src/opts_settings.cxx new file mode 100644 index 0000000..28adb6a --- /dev/null +++ b/silentbob/src/opts_settings.cxx @@ -0,0 +1,157 @@ +/* + * (c) Oleg Puchinin 2006,2007 + * graycardinalster@gmail.com + * + */ + +#include + +int opts_settings (DArray * d_opts, int & i) +{ + int argc; + + if (! d_opts) + return 0; + + argc = d_opts->get_size (); + + if (d_opts->get (i)[0] != '-') { + ENV->d_files->add (strdup (d_opts->get (i))); + return 0; + } + + if (EQ (d_opts->get (i), "--verbose")) { + SB_FLSET (SB_FLVERBOSE); + return 0; + } + + if (EQ (d_opts->get (i), "-u")) { + SB_FLSET (SB_FLRTREE); + return 0; + } + + if (EQ (d_opts->get (i), "--linear") || + EQ (d_opts->get (i), "-l")) { + SB_FLSET (SB_FLLINEAR); + return 0; + } + + if (EQ (d_opts->get (i), "-C") && i < argc) { + ++i; + chdir (d_opts->get (i)); + return 0; + } + + if (EQ (d_opts->get (i), "--linux")) { + chdir ("/usr/src/linux"); + return 0; + } + + if (EQ (d_opts->get (i), "--debug")) { + SB_FLSET (SB_FLDEBUG); + return 0; + } + + if (EQ (d_opts->get (i), "--simulate")) { + Dtimer (); + SB_FLSET (SB_FLSIMULATE); + return 0; + } + + if (EQ (d_opts->get (i), "--no-links")) { + SB_FLSET (SB_FLNOLINKS); + return 0; + } + + if (EQ (d_opts->get (i), "-a") || EQ (d_opts->get (i), "--all")) { + SB_FLSET (SB_FLALL); + return 0; + } + + if (EQ (d_opts->get (i), "--test") || EQ (d_opts->get (i), "-t")) { + SB_FLSET (SB_FLTEST); + return 0; + } + + if (EQ (d_opts->get (i), "--ctags-append")) { + SB_FLSET (SB_FLCTAGSAPPEND); + return 0; + } + + if (EQ (d_opts->get (i), "-A")) { + if (++i >= argc) + return 0; + + ENV->cgrep_A = atoi (d_opts->get (i)); + return 0; + } + + if (EQ (d_opts->get (i), "-B")) { + if (++i >= argc) + return 0; + + ENV->cgrep_B = atoi (d_opts->get (i)); + return 0; + } + + if (EQ (d_opts->get (i), "-j")) { + if (++i >= argc) + return 0; + ENV->max_proc = atoi (d_opts->get (i)); + return 0; + } + + if (EQ (d_opts->get (i), "--tag-style") || EQ (d_opts->get (i), "-ts")) { + SB_FLSET (SB_FLTAGSTYLE); + return 0; + } + + if (EQ (d_opts->get (i), "-L") && (i+1) < argc) { + ++i; + ENV->d_files->from_file (d_opts->get (i)); + ENV->d_files->foreach ((Dfunc_t) chomp); + return 0; + } + + if (EQ (d_opts->get (i), "--depth")) { + if (++i >= argc) + return 0; + + ENV->d_depth = atoi (d_opts->get (i)); + return 0; + } + + if (EQ (d_opts->get (i), "-fn")) { + SB_FLSET (SB_FLFNAMES); + return 0; + } + + if (EQ (d_opts->get (i), "--lang")) { + if (++i >= argc) + return 0; + + ENV->language = strdup (d_opts->get (i)); + if (EQ (ENV->language, "cpp") || + EQ (ENV->language, "cxx") || + EQ (ENV->language, "c++")) { + delete ENV->language; + ENV->language = strdup ("C++"); + SB_FLSET (SB_FLCPP); + } + return 0; + } + + if (EQ (d_opts->get (i), "--thread")) { + SB_FLSET (SB_FLTHREAD); + return 0; + } + + return -1; +} + + + + + + + diff --git a/silentbob/src/structs.cxx b/silentbob/src/structs.cxx new file mode 100644 index 0000000..33c023c --- /dev/null +++ b/silentbob/src/structs.cxx @@ -0,0 +1,94 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include + +// $ silent_bob --structs +void got_structs (char * d_file) +{ + struct tt_state_t * d_tt_state = CNEW (tt_state_t, 1); + char *d_ptr, *d_out; + EArray d_operators; + int brace_depth; + bool b_typedef; + bool b_struct; + char ch; + int i; + + memset (d_tt_state, 0, sizeof (struct tt_state_t)); + d_tt_state->fileName = strdup (d_file); + d_ptr = do_tt (d_tt_state); + + while (true) { + ch = t_op (&d_ptr, &d_out); + if (ch == 0) + break; + + b_typedef = false; + b_struct = false; + if (!strncmp (d_out, "typedef", 7)) + b_typedef = true; + else if (!strncmp (d_out, "struct", 6)) + b_struct = true; + + if (! b_typedef && ! b_struct) + continue; + + if (strchr (d_out, '(')) + continue; + + if (ch == ';' && b_typedef && !SB_FLGET (SB_FLNOLINKS)) // Link... + printf ("%s;\n", d_out); + + if (ch != '{') + continue; + + brace_depth = 1; + printf ("%s{\n", d_out); + + while (brace_depth > 0) { + ch = t_op (&d_ptr, &d_out); + if (ch == '\n') { + if (*d_out == '#') + printf ("%s\n", d_out); + continue; + } + + if (ch == '}') + --brace_depth; + + for (i = 0; i < brace_depth; i++) + fputc ('\t', stdout); + + if (ch == '{') + ++brace_depth; + + if (ch != '}' && ch != '{' && strlen (d_out)) + printf ("%s;\n", d_out); + else if (brace_depth) { + printf ("%s", d_out); + fputc (ch, stdout); + if (ch == '}') { + t_op (&d_ptr, &d_out); + if (strlen (d_out)) + printf (" %s;", d_out); + else + fputc (';', stdout); + printf ("\n"); + } + printf ("\n"); + } + } // while (brace_deph > 0) + ch = t_op (&d_ptr, &d_out); + if (strlen (d_out)) + printf ("} %s;\n\n", d_out); + else + printf ("};\n\n"); + } // if (!strncmp (d_out, "typedef", 7)) + free_tt_state (d_tt_state); +} + diff --git a/silentbob/src/tree.cxx b/silentbob/src/tree.cxx new file mode 100644 index 0000000..69a41e8 --- /dev/null +++ b/silentbob/src/tree.cxx @@ -0,0 +1,232 @@ +/* + * (c) Oleg Puchinin 2006 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include + +EArray * d_calltags_file; + +inline bool tree_immune (char * m_fname) +{ + return ENV->immune_list->sfind (m_fname) == -1 ? false : true; +} + +/* "SilentBob -u" functionality. */ +void rctree_iter (char * f_name, int n_trip) +{ + EArray * d_donelist; + char m_buf[256]; + char * S; + int len; + int i; + int a; + + n_trip ++; + if (n_trip > ENV->d_depth) + return; + + /* + * 1. Find record in d_calltags_file. + * 2. Find _first_ record in d_calltags_file. + * 3. Parse record. + * 4. Check d_donelist list. + * 5. If f_name not in ENV->full_list : + * 5.1 Add f_name to ENV->full_list. + * 5.2 New iteration. + * + */ + + snprintf (m_buf, 255, "%s\t", f_name); + m_buf[255] = 0; + len = strlen (m_buf); + i = d_calltags_file->snfind_fast (m_buf, strlen (m_buf)); + d_donelist = new EArray (32); + + do { + i--; + if (i < 0) + break; + S = d_calltags_file->get (i); + if (! S) + break; + } while (! strncmp (S, m_buf, len)); + + while (true) { + ++i; + S = d_calltags_file->get (i); + if (! S || strncmp (S, m_buf, len)) + break; + + S = strstr (S, "\tby\t"); + if (S == NULL) { + fprintf (ENV->d_stream_dbg, "\tBUG (no \"by\") : %s\n", + d_calltags_file->get (i)); + continue; + } + + S += 4; + chomp (S); + + if (d_donelist->sfind (S) != -1) + continue; + + d_donelist->add (strdup (S)); + for (a = 0; a < n_trip; a++) + fputc ('\t', stdout); + + tree_echo (n_trip, S); + + if (ENV->full_list->sfind (S) == -1) { + ENV->full_list->add (strdup (S)); + rctree_iter (S, n_trip); + } + } + + d_donelist->foreach (free); + delete d_donelist; +} + +void reverse_calltree (char * f_name) +{ + assert (f_name == NULL, "Lena 2"); + if (! f_name) + return; + + tree_echo (0, f_name); + d_calltags_file = new EArray; + d_calltags_file->from_file ("./call_tags"); + if (d_calltags_file->get_size () == 0) { + bug_nocalltags (); + } + + rctree_iter (f_name, 0); + + d_calltags_file->foreach (free); + delete d_calltags_file; + fflush (stdout); +} + +void tree_echo (int n_trip, char *S) +{ + struct d_tag_t * tag; + EArray * tags; + + if (! SB_FLGET (SB_FLFNAMES)) + goto out_min; + else { + tags = got_tag (S); + if (! tags || (tags->get_size () == 0)) + goto out_min; + + tag = (struct d_tag_t *) tags->get (0); + if (! tag) + goto out_min; + + printf ("// %i // %s\t%s", n_trip, S, tag->d_file); + if (tags->get_size () > 1) + printf (" (more)"); + fputc ('\n', stdout); + } + + return; + +out_min: + printf ("// %i // %s\n", n_trip, S); +} + +inline void tree_mkpos (int N) +{ + while (N--) + fputc ('\t', stdout); +} + +/* SilentBob call-tree functionality. */ +void call_tree (char * f_name, int n_trip) +{ + struct tt_state_t * d_tt_state; + char * d_ptr, *d_out; + EArray * d_donelist; + DArray * d_words; + DArray * d_vars; // hash_t ** + char * S; + char ch; + int i; + + if (n_trip > ENV->d_depth) + return; + + if (n_trip == 0) { + tree_echo (0, f_name); + if (SB_FLGET (SB_FLLINEAR) || SB_FLGET (SB_FLVERBOSE)) + nogui_tagsdump (f_name, 0); + ++n_trip; + } + + d_tt_state = get_onett_tag (f_name, &d_ptr); + if (! d_tt_state) { + if (ENV->full_list->get_size () == 0) + bug_nosuch_tag (f_name); + return; + } + + d_out = d_ptr; + d_donelist = new EArray (256); + d_vars = new DArray (32); + + ch = t_op (&d_ptr, &d_out); + if (ch == 0) + return; + + fault (! d_out); + + while (true) { + ch = t_op (&d_ptr, &d_out); + + if (ch == 0) + break; + + d_words = split_to_words (d_out); + assert (d_words == NULL, "Lena 28"); + + for (i = 0; i < d_words->get_size (); i++) { + S = cts ((struct c_word *) d_words->get (i)); + + if (S == NULL) + continue; + + if (d_donelist->sfind (S) != -1) + continue; + + if (! SB_FLGET (SB_FLLINEAR)) + tree_mkpos (n_trip); + + d_donelist->add (strdup (S)); + tree_echo (n_trip, S); + + if ((SB_FLGET (SB_FLVERBOSE) || SB_FLGET (SB_FLLINEAR)) + && !tree_immune (S)) { + nogui_tagsdump (S, n_trip); + } + + if (ENV->full_list->sfind (S) == -1) { + ENV->full_list->add (strdup (S)); + if (!tree_immune (S)) + call_tree (S, n_trip+1); + } + } + + d_words->foreach ((Dfunc_t) free_cword); + delete d_words; + } + + delete d_donelist; + if (d_vars) + d_vars->foreach (free); + delete d_vars; +} + diff --git a/silentbob/src/usage.cxx b/silentbob/src/usage.cxx new file mode 100644 index 0000000..8eb910f --- /dev/null +++ b/silentbob/src/usage.cxx @@ -0,0 +1,37 @@ +/* + * (c) Oleg Puchinin 2006,2007 + * graycardinalster@gmail.com + * + */ + +#include + +void usage () +{ + printf ("usage:\tsilent_bob [|] []\n"); + printf ("\ttags ... []\n"); + printf ("\t options:\n" + "\t\t -C \t\t-\tchdir to \n" + "\t\t--cgrep\t\t\t-\tsearch in code\n" + "\t\t--call-tags\t\t-\tcreate \"call_tags\" file\n" + "\t\t--cfiles\t\t-\tcreate \"cfiles\" file\n" + "\t\t--ctags-append\t\t-\tdon't rewrite \"tags\" file\n" + "\t\t--depth \t\t-\tset reentrant level\n" + "\t\t--file \t\t-\tshow file functions\n" + "\t\t -fn\t\t\t-\techo filenames\n" + "\t\t--structs\t\t-\tshow all structs in stream\n" + "\t\t -i\t\t\t-\tinteractive mode \"tags\"\n" + "\t\t--indent\t\t-\tindention\n" + "\t\t -j\t\t\t-\tnumber of jobs\n" + "\t\t--kinds\t\t\t-\t(a - all, c - classes, s - structs, f - functions)\n" + "\t\t--L \t\t-\tread files list from file\n" + "\t\t--make-ctags\t\t-\tcreate \"tags\" file\n" + "\t\t--plugins-info\t\t-\tshow available plugins\n" + "\t\t--the-tt\t\t-\tC preprocessor\n" + "\t\t -ts\t\t\t-\tforce ctags style\n" + "\t\t -u\t\t\t-\treverse call-tree\n" + "\t\t--verbose\t\t-\tprint more other info\n" + ); + + printf ("\nCONTACTS\nOleg Puchinin \n"); +} diff --git a/silentbob/templates/simple_plugin.cxx b/silentbob/templates/simple_plugin.cxx new file mode 100644 index 0000000..d05c901 --- /dev/null +++ b/silentbob/templates/simple_plugin.cxx @@ -0,0 +1,79 @@ +/* + * (c) Oleg Puchinin 2007 + * graycardinalster@gmail.com + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" DArray * plugin_init (struct env_t *env); +struct env_t *ENV; + +char simple_plugin_opt (DArray * d_opts, int * pos) +{ + int count; + char * S; + + if (! d_opts || ! pos) + return 0; + + count = d_opts->get_size (); + S = d_opts->get (*pos); + if (EQ (S, "--simple_plugin")) { + if (++(*pos) >= count) + return 0; // Missed argument for option "--simple-plugin". + // Do somethings. + } + + return 0; +} + +char simple_plugin_opt2 (DArray * d_opts, int * pos) +{ + char * S; + + if (! d_opts || ! pos) + return 0; + + S = d_opts->get (*pos); + if (EQ (S, "--simple_plugin")) { + // Do somethings at stage two. + } + + return 0; +} + +void simple_plugin_info () +{ + printf ("Simple plugin.\n"); + printf ("Version: 1.0\n"); + printf ("options: --simple-plugin\n"); +} + +DArray * plugin_init (struct env_t *env) +{ + DArray * Ret; + struct mod_feature * pm; + + ENV = env; + Ret = new DArray (1); + pm = CNEW (mod_feature, 1); + memset (pm, 0, sizeof (mod_feature)); + pm->mod.Type = TYPE_FEATURE; + pm->mod.Version = strdup ("1.0"); + pm->mod.short_info = simple_plugin_info; + pm->opt = simple_plugin_opt; + pm->opt2 = simple_plugin_opt2; + + Ret->add (LPCHAR (pm)); + return Ret; +} + -- 2.11.4.GIT