Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • owl.h

    rb9517cf rca1fb26a  
    1010#define INC_BARNOWL_OWL_H
    1111
    12 #include "config.h"
     12#include <config.h>
    1313
    1414#include "compat/compat.h"
     
    4747/* Perl and curses don't play nice. */
    4848#ifdef OWL_PERL
    49 typedef void WINDOW;
    50 typedef void PANEL;
     49typedef struct _owl_fake_WINDOW WINDOW;
     50typedef struct _owl_fake_PANEL PANEL;
    5151/* logout is defined in FreeBSD. */
    5252#define logout logout_
     
    5757#include "XSUB.h"
    5858#else
    59 typedef void SV;
    60 typedef void AV;
    61 typedef void HV;
     59typedef struct _owl_fake_SV SV;
     60typedef struct _owl_fake_AV AV;
     61typedef struct _owl_fake_HV HV;
    6262#endif
    6363
    6464#include "window.h"
    6565
    66 #ifndef OWL_VERSION_STRING
    67 #ifdef  GIT_VERSION
    68 #define stringify(x)       __stringify(x)
    69 #define __stringify(x)     #x
    70 #define OWL_VERSION_STRING stringify(GIT_VERSION)
    71 #else
    72 #define OWL_VERSION_STRING PACKAGE_VERSION
    73 #endif
    74 #endif /* !OWL_VERSION_STRING */
     66extern const char *version;
    7567
    7668/* Feature that is being tested to redirect stderr through a pipe.
     
    235227  char *name;
    236228  int   type;  /* OWL_VARIABLE_* */
    237   void *pval_default;  /* for types other and string */
    238   int   ival_default;  /* for types int and bool     */
    239   const char *validsettings;    /* documentation of valid settings */
     229  char *default_str;            /* the default value as a string */
     230  char *validsettings;          /* documentation of valid settings */
    240231  char *summary;                /* summary of usage */
    241232  char *description;            /* detailed description */
    242   void *val;                    /* current value */
    243   int  (*validate_fn)(const struct _owl_variable *v, const void *newval);
     233  bool takes_on_off;            /* allow passing on/off in argument-less set/unset */
     234  GClosure *set_fromstring_fn;
     235                                /* sets the variable to a value
     236                                 * of the appropriate type.
     237                                 * unless documented, this
     238                                 * should make a copy.
     239                                 * returns 0 on success. */
     240  GClosure *get_tostring_fn;
     241                                /* converts val to a string;
     242                                 * caller must free the result */
     243
     244  /* These are only valid for OWL_VARIABLE_{INT,BOOL,STRING} */
     245  GValue val;                   /* current value, if default get_fn/set_fn */
     246
     247  GCallback get_fn;
     248                                /* returns a reference to the current value.
     249                                 * WARNING:  this approach is hard to make
     250                                 * thread-safe... */
     251  GCallback validate_fn;
    244252                                /* returns 1 if newval is valid */
    245   int  (*set_fn)(struct _owl_variable *v, const void *newval);
     253  GCallback set_fn;
    246254                                /* sets the variable to a value
    247                                  * of the appropriate type.
    248                                  * unless documented, this
    249                                  * should make a copy.
    250                                  * returns 0 on success. */
    251   int  (*set_fromstring_fn)(struct _owl_variable *v, const char *newval);
    252                                 /* sets the variable to a value
    253                                  * of the appropriate type.
    254                                  * unless documented, this
    255                                  * should make a copy.
    256                                  * returns 0 on success. */
    257   const void *(*get_fn)(const struct _owl_variable *v);
    258                                 /* returns a reference to the current value.
    259                                  * WARNING:  this approach is hard to make
    260                                  * thread-safe... */
    261   CALLER_OWN char *(*get_tostring_fn)(const struct _owl_variable *v, const void *val);
    262                                 /* converts val to a string;
    263                                  * caller must free the result */
    264   void (*delete_fn)(struct _owl_variable *v);
    265                                 /* frees val as needed */
     255                                 * of the appropriate type.
     256                                 * unless documented, this
     257                                 * should make a copy.
     258                                 * returns 0 on success. */
    266259} owl_variable;
     260
    267261
    268262typedef struct _owl_input {
     
    452446  char *name;
    453447  owl_filter *filter;
    454   owl_messagelist ml;
     448  owl_messagelist *ml;
    455449  const owl_style *style;
    456450  int cachedmsgid;
     
    533527
    534528typedef struct _owl_global {
    535   owl_mainwin mw;
     529  owl_mainwin *mw;
    536530  owl_popwin *pw;
    537531  owl_msgwin msgwin;
     
    551545  int curmsg_vert_offset;
    552546  owl_view current_view;
    553   owl_messagelist msglist;
     547  owl_messagelist *msglist;
    554548  WINDOW *input_pad;
    555549  owl_mainpanel mainpanel;
     
    569563  time_t starttime;
    570564  time_t lastinputtime;
     565  time_t last_wakeup_time;
    571566  char *startupargs;
    572567  int nextmsgid;
     
    596591  char *kill_buffer;
    597592  int interrupt_count;
     593#if GLIB_CHECK_VERSION(2, 31, 0)
     594  GMutex interrupt_lock;
     595#else
    598596  GMutex *interrupt_lock;
     597#endif
    599598} owl_global;
    600599
     
    602601extern owl_global g;
    603602
    604 #include "owl_prototypes.h"
     603#include <owl_prototypes.h>
    605604
    606605/* These were missing from the Zephyr includes before Zephyr 3. */
     
    610609#endif
    611610
     611/* We have to dynamically bind these ourselves */
     612extern gboolean (*gvalue_from_sv) (GValue * value, SV * sv);
     613extern SV * (*sv_from_gvalue) (const GValue * value);
     614extern GClosure * (*perl_closure_new) (SV * callback, SV * data, gboolean swap);
     615
     616
    612617#endif /* INC_BARNOWL_OWL_H */
Note: See TracChangeset for help on using the changeset viewer.