/[anubis]/anubis/src/guile.c
ViewVC logotype

Diff of /anubis/src/guile.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by polak, Sun Feb 2 11:20:54 2003 UTC revision 1.3 by gray, Wed Feb 5 21:50:41 2003 UTC
# Line 24  Line 24 
24    
25  #include "headers.h"  #include "headers.h"
26  #include "extern.h"  #include "extern.h"
27    #include "rcfile.h"
28    
29  #ifdef WITH_GUILE  #ifdef WITH_GUILE
30    
# Line 34  static SCM Line 35  static SCM
35  catch_body (void *data)  catch_body (void *data)
36  {  {
37          scm_init_load_path();          scm_init_load_path();
         read_rcfile_guile();  
38          anubis(data);          anubis(data);
39          return SCM_BOOL_F;          return SCM_BOOL_F;
40  }  }
# Line 69  guile_ports_open() Line 69  guile_ports_open()
69          int fd = -1;          int fd = -1;
70          char *name = options.guile_logfile;          char *name = options.guile_logfile;
71    
72          if (topt & T_FOREGROUND_INIT)          if (topt & (T_FOREGROUND_INIT|T_STDINOUT))
73                  return;                  return;
74                    
75          if (name) {          if (name) {
# Line 95  guile_ports_open() Line 95  guile_ports_open()
95  void  void
96  guile_ports_close()  guile_ports_close()
97  {  {
98          if (topt & T_FOREGROUND_INIT)          if (topt & (T_FOREGROUND_INIT|T_STDINOUT))
99                  return;                  return;
100          scm_close_output_port(scm_current_error_port());          scm_close_output_port(scm_current_error_port());
101          scm_close_output_port(scm_current_output_port());          scm_close_output_port(scm_current_output_port());
# Line 369  guile_postprocess_proc(char *procname, s Line 369  guile_postprocess_proc(char *procname, s
369          guile_ports_close();          guile_ports_close();
370  }  }
371    
372    /* RC file stuff */
373    
374    #define KW_GUILE_OUTPUT           0
375    #define KW_GUILE_DEBUG            1
376    #define KW_GUILE_LOAD_PATH_APPEND 2
377    #define KW_GUILE_LOAD_PROGRAM     3
378    #define KW_GUILE_PROCESS          4
379    #define KW_GUILE_POSTPROCESS      5
380    #define KW_GUILE_REWRITE_LINE     6
381    
382    /* GUILE section */
383    static struct rc_kwdef guile_kw[] = {
384            { "guile-output",           KW_GUILE_OUTPUT },
385            { "guile-debug",            KW_GUILE_DEBUG },
386            { "guile-load-path-append", KW_GUILE_LOAD_PATH_APPEND },
387            { "guile-load-program",     KW_GUILE_LOAD_PROGRAM },
388            { "guile-process",          KW_GUILE_PROCESS },
389            { "guile-postprocess",      KW_GUILE_POSTPROCESS },
390            { NULL }
391    };
392    
393    static struct rc_kwdef guile_rule_kw[] = {
394            { "guile-debug",            KW_GUILE_DEBUG },
395            { "guile-load-path-append", KW_GUILE_LOAD_PATH_APPEND },
396            { "guile-load-program",     KW_GUILE_LOAD_PROGRAM },
397            { "guile-rewrite-line",     KW_GUILE_REWRITE_LINE },
398            { NULL }
399    };
400    
401    int
402    guile_parser(int method, int key, char *arg,
403                 void *inv_data, void *func_data, char *line)
404    {
405            switch (key) {
406            case KW_GUILE_OUTPUT:
407                    xfree(options.guile_logfile);
408                    options.guile_logfile = strdup(arg);
409                    break;
410                    
411            case KW_GUILE_DEBUG:
412                    guile_debug(strncmp("yes", arg, 3) == 0);
413                    break;
414                    
415            case KW_GUILE_LOAD_PATH_APPEND:
416                    guile_load_path_append(arg);
417                    break;
418                    
419            case KW_GUILE_LOAD_PROGRAM:
420                    guile_load_program(arg);
421                    break;
422    
423    #if 0
424            case KW_GUILE_PROCESS:
425                    xfree(options.guile_process);
426                    options.guile_process = strdup(arg);
427                    break;
428    #endif
429            case KW_GUILE_POSTPROCESS:      
430                    xfree(options.guile_postprocess);
431                    options.guile_postprocess = strdup(arg);
432                    break;
433    
434            case KW_GUILE_REWRITE_LINE:
435                    guile_rewrite_line(arg, line);
436                    break;
437                    
438            default:
439                    return RC_KW_UNKNOWN;
440            }
441            return RC_KW_HANDLED;
442    }
443    
444    static struct rc_secdef_child guile_secdef_child = {
445            NULL,
446            CF_SUPERVISOR|CF_CLIENT,
447            guile_kw,
448            guile_parser,
449            NULL
450    };
451    
452    static struct rc_secdef_child guile_rule_secdef_child = {
453            NULL,
454            CF_SUPERVISOR|CF_CLIENT,
455            guile_rule_kw,
456            guile_parser,
457            NULL
458    };
459    
460    void
461    guile_section_init()
462    {
463            struct rc_secdef *sp = anubis_add_section("GUILE");
464            rc_secdef_add_child(sp, &guile_secdef_child);
465            sp = anubis_add_section("RULE");
466            rc_secdef_add_child(sp, &guile_rule_secdef_child);
467    }
468            
469    
470  #endif /* WITH_GUILE */  #endif /* WITH_GUILE */
471    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26