[[project @ 2002-07-09 14:28:08 by unknown_lamer] unknown_lamer**20020709142808 - Removed bobot-scheme.scm.in and moved its single function into bobot-utils.scm. - The PREFIX preprocessor symbol is now defined as the install prefix - getopt_long is used instead of normal getopt, --help has been expanded to cover new options as well as give more detail. - The default action for bobotpp when encountering a bad argument is to display the short help (just lists the commands you may use). - Hooks list (BotInterp.C, RunHooks) is now read from end to beggining because we want to call the higher priority hooks before the lower priority hooks ] { rmfile ./source/bobot-scheme.scm.in hunk ./ChangeLog 2 + + * source/BotInterp.C (RunHooks): Changed iterators to + reverse_iterators because the hooks list is sorted in ascending + order--higher priority and fallthrough hooks appear _after_ the + lower priority and non-fallthrough hooks. + + * source/Main.C (print_long_help): Added function + (print_short_help): Renamed from printUsage + (namespace): Most stuff in here is now defined in an anonymouse + namespace so it doesn't have external linkage + (real_main): Uses getopt_long instead of getopt. Added several + command line arguments (bobotpp --help for a full list). + + * scripts/bobot-utils.scm (bot-load): Function moved from + bobot-scheme.scm + + * source/Interp.C (Startup): Autoloads + PREFIX/bobotpp/scripts/bobot-utils.scm now + (Startup): New Scheme variable: bot-sys-scripts-dir (system + scripts dir) + + * source/bobot-scheme.scm.in: Removed + + * source/Makefile.am: Removed bobot-scheme.scm compiliation + + * configure.ac (PREFIX): configure.ac defined prefix now hunk ./Makefile.in 98 - mkinstalldirs + mkinstalldirs texinfo.tex hunk ./NEWS 5 + +Version 2.1.0: Hook! +- Hooks can now be fallthrough or non fallthrough. You can set a hooks + priority and whether or not it falls through (i.e. continues hook + matching after it has been executed) using two optional args to + (bot-addhook). The new args are pri (integer priority) and fallthru + (#t or #f) and are at the end. Higher priority hooks are executed + before lower priority hooks, and fallthrough hooks are executed + before non-fallthrough hooks. +- The default config is read from ~/.bobotpp/config/default/ or + /etc/bobotpp/default/ if the user config is not found. Put your + default config is either dir. You may also specify a specific config + under these dirs using the --config or -c arg to bobotpp (see + bobotpp --help for the full list of commands you may use and how to + use them). +- Scripts are now stored in ~/.bobotpp/scripts/ or + PREFIX/bobotpp/scripts (where PREFIX is /usr/local unless you + changed it with the --prefix arg to configure). The new function + bot-load will take a filename and load it from these dirs, returning + #t if the file was loaded and #f if it wasn't. You can modify the + search list by appending to %bot-loadpath. +- bobot-utils.scm is now autoloaded, so you don't need to + load it if you want to use its functions. + hunk ./TODO 27 -* Use getopt long -* User config dir +* Audit code and see what data in classes should be made private and + have getters/setters added (e.g. logFileName in Bot--if this is + changed the log file doesn't change after the Bot is started). hunk ./bobot++.info 26 +* Configuration:: +* Scripting:: +* Concept Index:: +* Function Index:: +* Variable Index:: hunk ./bobot++.info 33 -File: bobot++.info, Node: Introduction, Prev: Top, Up: Top +File: bobot++.info, Node: Introduction, Next: Configuration, Prev: Top, Up: Top hunk ./bobot++.info 38 - This manual contains nothing. Stay tuned. + This manual feels abused and neglected because it has almost no +content. hunk ./bobot++.info 41 + +File: bobot++.info, Node: Configuration, Next: Scripting, Prev: Introduction, Up: Top + +Configuration +************* + + Bobot++ is easy to configure. The configuration file format may be +changing in the 2.1 series, so it is not documented for now. See the +`examples' directory for an example configuration. + +* Menu: + +* Configuration File Syntax:: +* Configure File Placement:: + + +File: bobot++.info, Node: Configuration File Syntax, Next: Configure File Placement, Prev: Configuration, Up: Configuration + +Configuration File Syntax +========================= + + Not here yet. + + +File: bobot++.info, Node: Configure File Placement, Prev: Configuration File Syntax, Up: Configuration + +Configuration File Placement +============================ + + Bobot++ will look in `/etc/bobotpp/default/' for its default config +if none is specified on the command line. Put the configuration files +you want to be loaded by default in this directory. If you are not root +or you want to have your own personal configration, put it in +`~/.bobotpp/config/default/'. + + +File: bobot++.info, Node: Scripting, Next: Concept Index, Prev: Configuration, Up: Top + +Scripting +********* + + Bobot++'s most powerful feature is its scripting system. You write +scripts using Guile Scheme. This manual does not cover how to use Guile +or how to learn Scheme. *Note Guile Reference Manual: (guile)Top, for +the Guile reference manual and + for a +good tutorial on Scheme. + + +File: bobot++.info, Node: Concept Index, Next: Function Index, Prev: Scripting, Up: Top + +Concept Index +************* + +* Menu: + +File: bobot++.info, Node: Function Index, Next: Variable Index, Prev: Concept Index, Up: Top + +Function Index +************** + +* Menu: + +File: bobot++.info, Node: Variable Index, Prev: Function Index, Up: Top + +Variable Index +************** + +* Menu: hunk ./bobot++.info 114 -Node: Introduction817 +Node: Introduction905 +Node: Configuration1096 +Node: Configuration File Syntax1478 +Node: Configure File Placement1680 +Node: Scripting2154 +Node: Concept Index2607 +Node: Function Index2739 +Node: Variable Index2878 hunk ./bobot++.texinfo 82 -@section Configure File Placement +@section Configuration File Placement hunk ./bobot++.texinfo 86 -files you want to be loaded by default in this directory. FIXME: add -bobot++ config in user home dir. +files you want to be loaded by default in this directory. If you are +not root or you want to have your own personal configration, put it in +@file{~/.bobotpp/config/default/}. hunk ./bobot++.texinfo 95 -Guile or how to learn Scheme. @xref{Top, Guile Reference Manual, -guile}, for the Guile reference manual and +Guile or how to learn Scheme. @xref{Top, , Guile Reference Manual, +guile, The Guile Reference Manual}, for the Guile reference manual and hunk ./config.h.in 8 +#undef PREFIX hunk ./configure 1489 -VERSION=2.1.0 +VERSION=2.1.0CVS hunk ./configure 4428 + +if test "x$prefix" == "xNONE" +then + cat >>confdefs.h <<_ACEOF +#define PREFIX "$ac_default_prefix" +_ACEOF + +else + cat >>confdefs.h <<_ACEOF +#define PREFIX "$prefix" +_ACEOF + +fi + hunk ./configure.ac 4 -AM_INIT_AUTOMAKE([Bobot++], [2.1.0]) +AM_INIT_AUTOMAKE([Bobot++], [2.1.0CVS]) hunk ./configure.ac 76 + +dnl PREFIX +if test "x$prefix" == "xNONE" +then + AC_DEFINE_UNQUOTED(PREFIX, "$ac_default_prefix") +else + AC_DEFINE_UNQUOTED(PREFIX, "$prefix") +fi + hunk ./scripts/bobot-utils.scm 2 -;;; want to use. +;;; want to use. This file is autoloaded by bobot++ hunk ./scripts/bobot-utils.scm 11 +;;; Bot load (loads a file from %bot-loadpath) + +(define %bot-loadpath (list + (string-append (getenv "HOME") + "/.bobotpp/scripts") + bot-sys-scripts-dir)) + +(define (bot-load file) + (let loop ((load-path %bot-loadpath)) + (if (not (null? load-path)) + (if (catch 'system-error + (lambda () + (load + (string-append (car load-path) + file))) + (lambda args + #f )) + #t + (loop (cdr load-path))) + #f ))) + + hunk ./scripts/bobot-utils.scm 54 -;;; arg is a procedure it will be executed and it's output will be +;;; arg is a thunk it will be executed and it's output will be hunk ./scripts/bobot-utils.scm 59 - (if (procedure? x) + (if (thunk? x) hunk ./source/BotInterp.C 99 - std::list::iterator it = hooksMap[hooktype].begin(); - std::list::iterator it2 = hooksMap[hooktype].end(); + // We want to execute higher priority hooks first, so we start at + // the end of the list instead of the beggining + std::list::reverse_iterator it = hooksMap[hooktype].rbegin(); + std::list::reverse_iterator it2 = hooksMap[hooktype].rend(); hunk ./source/Interp.C 54 - scm_primitive_load (scm_makfrom0str ("/etc/bobotpp/bobot-scheme.scm")); + scm_c_define ("bot-sys-scripts-dir", + scm_makfrom0str (String(PREFIX) + + "/share/bobotpp/scripts/")); + scm_primitive_load + (scm_makfrom0str (String(PREFIX) + + "/share/bobotpp/scripts/bobot-utils.scm")); hunk ./source/Main.C 28 +#include hunk ./source/Main.C 36 +namespace +{ hunk ./source/Main.C 40 +option bot_options[] = +{ + { "help", no_argument, 0, 'h' }, + { "version", no_argument, 0, 'v' }, + { "no-background", no_argument, 0, 'b'}, + { "config-file", required_argument, 0, 'f'}, + { "config-dir", required_argument, 0, 'd'}, + { "config", required_argument, 0, 'c'}, + { "sys-config", required_argument, 0, 's'}, + { "user-config", required_argument, 0, 'u'}, + { "debug", no_argument, 0, 'D' } +}; + hunk ./source/Main.C 61 -void printUsage(char *name) +void print_version () hunk ./source/Main.C 63 - std::cout << "Usage: " << name << " [-h] [-b] [-f file] [-d dir] [-D]\n" - " -h Shows this help.\n" - " -b Do not run in background.\n" + std::cerr << VERSION_STRING << std::endl + << COPYRIGHT_STRING << std::endl + << PACKAGE" comes with ABSOLUTELY NO WARRANTY\n" + << "This is free software, and you are welcome to redistribute it\n" + << "under certain conditions; See the COPYING file for details.\n"; +} +void print_short_help (const char *name) +{ + std::cerr << "Usage: " << name << " [--help] [--version] [--no-background]\n\t" + << "[--config-file file] [--config-dir dir] [--debug]\n\t" + << "[--config dir-under-configpath]\n\t" + << "[--sys-config dir-in-sysconfdir]\n\t" + << "[--user-config dir-userdir] [--debug]\n" + << "\n--help shows long help.\n"; + /* " -b Do not run in background.\n" hunk ./source/Main.C 84 + */ +} + +void print_long_help (const char *name) +{ + std::cerr << "Long Help for " << PACKAGE << std::endl; + std::cerr << + "The manual (info bobot++) will contain the best information on general\n" + "usage of Bobot++. Here is a detailed summary of the command line\n" + "arguments: (in long arg short arg format). All args are optional.\n"; + print_short_help (name); + std::cerr << +"[--help][-h] Shows this help and exits\n" +"[--version][-v] Shows version information and exits\n" +"[--no-background][-b] Run bobot++ in the foreground\n" +"[--config-file file][-f] Use file instead of bot.conf\n" +"[--config-dir dir][-d] Use dir as dir to load config file from\n" +"[--config dir][-c] Search your config path (defaults to\n" +" " + << getenv ("HOME") + << "/.bobotpp/config/ and then\n" + << +" /etc/bobotpp/) for dir and\n" +" then loads your config data using dir\n" +"[--sys-config dir][-s] Looks for config in /etc/bobotpp/dir. Note\n" +" that the user dir is still searched first\n" +"[--user-config dir][-u] Looks for config in\n" +" " + << getenv("HOME") + << "/.bobotpp/config/dir/.\n" + << +" Note that\n" +" the system dir is still searched after this if\n" +" dir is not found.\n" +"[--debug][-D] Makes Bobot++ print debugging info and run in\n" +" the foreground" + << std::endl + << std::endl + << "The default configuration is read from\n" + << getenv("HOME") + << "/.bobotpp/config/default/ and then\n" + "/etc/bobotpp/default/ if the user config is not found.\n"; hunk ./source/Main.C 132 - extern char *optarg; hunk ./source/Main.C 146 - while ((opt = getopt(argc,argv,"hbf:d:c:D")) != EOF) + while ((opt = getopt_long (argc,argv,"vhbf:d:c:D", bot_options, 0)) + != -1) hunk ./source/Main.C 150 - printUsage(argv[0]); exit(0); + print_long_help (argv[0]); + exit(0); + break; + case 'v': + print_version (); + exit (0); + break; hunk ./source/Main.C 180 - printUsage(argv[0]); exit(1); + print_short_help (argv[0]); + exit(1); hunk ./source/Main.C 201 - std::cout << COPYRIGHT_STRING << - "\n"PACKAGE" comes with ABSOLUTELY NO WARRANTY\n" - "This is free software, and you are welcome to redistribute it\n" - "under certain conditions; See the COPYING file for details.\n"; + // std::cout << COPYRIGHT_STRING << + // "\n"PACKAGE" comes with ABSOLUTELY NO WARRANTY\n" + // "This is free software, and you are welcome to redistribute it\n" + // "under certain conditions; See the COPYING file for details.\n"; + print_version (); hunk ./source/Main.C 235 +} // static functions and data + hunk ./source/Makefile.am 76 -bobot-scheme.scm: bobot-scheme.scm.in - sed -e 's|\!pkgdatadir\!|@datadir@\/bobotpp|g' bobot-scheme.scm.in > bobot-scheme.scm +#bobot-scheme.scm: bobot-scheme.scm.in +# sed -e 's|\!pkgdatadir\!|@datadir@\/bobotpp|g' bobot-scheme.scm.in > bobot-scheme.scm hunk ./source/Makefile.am 79 -scmconfigdir = /etc/bobotpp -scmconfig_DATA = bobot-scheme.scm +#scmconfigdir = /etc/bobotpp +#scmconfig_DATA = bobot-scheme.scm hunk ./source/Makefile.in 150 - -scmconfigdir = /etc/bobotpp -scmconfig_DATA = bobot-scheme.scm hunk ./source/Makefile.in 208 -DATA = $(scmconfig_DATA) - hunk ./source/Makefile.in 304 -install-scmconfigDATA: $(scmconfig_DATA) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(scmconfigdir) - @list='$(scmconfig_DATA)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(scmconfigdir)/$$f"; \ - $(INSTALL_DATA) $$d$$p $(DESTDIR)$(scmconfigdir)/$$f; \ - done - -uninstall-scmconfigDATA: - @$(NORMAL_UNINSTALL) - @list='$(scmconfig_DATA)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " rm -f $(DESTDIR)$(scmconfigdir)/$$f"; \ - rm -f $(DESTDIR)$(scmconfigdir)/$$f; \ - done hunk ./source/Makefile.in 360 -all-am: Makefile $(PROGRAMS) $(DATA) +all-am: Makefile $(PROGRAMS) hunk ./source/Makefile.in 363 - $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(scmconfigdir) + $(mkinstalldirs) $(DESTDIR)$(bindir) hunk ./source/Makefile.in 405 -install-data-am: install-scmconfigDATA +install-data-am: hunk ./source/Makefile.in 423 -uninstall-am: uninstall-binPROGRAMS uninstall-info-am \ - uninstall-scmconfigDATA +uninstall-am: uninstall-binPROGRAMS uninstall-info-am hunk ./source/Makefile.in 430 - install-info-am install-man install-scmconfigDATA install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ hunk ./source/Makefile.in 434 - uninstall-binPROGRAMS uninstall-info-am uninstall-scmconfigDATA + uninstall-binPROGRAMS uninstall-info-am + hunk ./source/Makefile.in 437 +#bobot-scheme.scm: bobot-scheme.scm.in +# sed -e 's|\!pkgdatadir\!|@datadir@\/bobotpp|g' bobot-scheme.scm.in > bobot-scheme.scm hunk ./source/Makefile.in 440 -bobot-scheme.scm: bobot-scheme.scm.in - sed -e 's|\!pkgdatadir\!|@datadir@\/bobotpp|g' bobot-scheme.scm.in > bobot-scheme.scm +#scmconfigdir = /etc/bobotpp +#scmconfig_DATA = bobot-scheme.scm }