1 #ifndef __Dillo_lib_h
2 # define __Dillo_lib_h
3 
4 # ifndef __Platform_h
5 #  include "platform.h"
6 # endif
7 # ifndef __Dillo_Msgs_h
8 #  include "dillomsgs.h"
9 # endif
10 # ifdef HAVE_LTDL_H
11 #  include <ltdl.h>
12 extern lt_dlhandle  __Plugin_load (const char* Name) ATTR(INIT);
13 # endif
14 
15 #include "LDL.h"
16 C_BEGIN
17 
18 # define DILLO_NEWIN     (1)
19 # define DILLO_SHARE_ERR (2)
20 # define DILLO_TTY       (4)
21 
22 /* Bill of materials list */
23 typedef struct __BOM_t
24 {
25    struct __BOM_t *q_forw, *q_back; /* List linkages */
26    double      Quantity; /* The amount of each item that is needed */
27    const char* Units;    /* The units that we measure the items in */
28    const char* Item;     /* The item that is needed */
29 } __BOM_t;
30 
31 typedef struct __Step_t
32 {
33    struct __Step_t* q_forw, *q_back;
34    const char* Step;
35 } __Step_t;
36 
37 typedef struct __Seg_t
38 {
39    struct __Seg_t* q_forw, *q_back;
40    const char* Heading;    /* The heading for this segment */
41 } __Seg_t;
42 
43 typedef enum
44 {
45    Materials,            /* The materials (BOM) used in the project */
46    Tools,
47    Steps,                /* The steps to do the project */
48    Recipes_imported,
49    LAST_SEGMENT
50 } __Segs_t;
51 
52 
53 typedef struct
54 {
55    const char* Name;       /* The name of the project */
56    unsigned NSegs;         /* Number of segments this recipe has */
57    __Seg_t* Segment;       /* The segments in the recipe */
58 } __Recipe_t;
59 
60 
61 extern void   splitc(char* Src, char** Strs, const char* Sep, int Cols);
62 
63 extern pid_t  __Dillo_fork (const int* ChildIO, unsigned Flags);
64 extern pid_t  __Dillo_fork2(int* FileDes, unsigned Flags);
65 extern pid_t  __Dillo_spawn(int* Filedes, char* const ArgV[],
66 			    char* const Env[], unsigned Flags);
67 extern char* const* __ArgV_create (const char*,...);
68 extern char* const* __Env_create  (const char* Name, ...);
69 extern int          __Plugins_load(const char* Path) ATTR(INIT);
70 extern int          __PTY_pipe(int filedes[2]);
71 ssize_t _screen_write (void* SPtr, const char* buf, size_t buflen);
72 
73 int timeval_diff(struct timeval* Result, const struct timeval* A,
74 		 const struct timeval* B);
75 
76 #include <regex.h>
77 typedef struct
78 {
79   regex_t Reg; /* compiled regular expression */
80   char*   Hint; /* the hint that gets displayed */
81 } __AutoHelpEntry_t;
82 
83 typedef void (*LabelProc_t) (void*, const char* Short, const char* Long);
84 
85 typedef struct
86 {
87   __AutoHelpEntry_t* Rules;
88   size_t             NRules;
89 
90   __AutoHelpEntry_t* CurrentPrompt; /* Currently displayed item */
91 
92   LabelProc_t DispProc;
93   void*       DispProcData;
94 } __AutoHelp_t;
95 
96 void __AutoHelp_init(__AutoHelp_t* VPtr, __AutoHelpEntry_t* Rules, int NRules,
97 		     LabelProc_t DispProc, void* DispProcData) ATTR(INIT);
98 
99 void __AutoHelp_text(__AutoHelp_t* VPtr, const char* Text);
100 int __AutoHelp_load(const char *Path, __AutoHelpEntry_t**Rules,size_t* NRules)
101      ATTR(INIT);
102 
103 C_END
104 #endif
105