Subversion Repositories Tewi

Rev

Rev 315 | Rev 368 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
17 nishi 1
/* $Id: tw_module.h 367 2024-10-17 04:22:49Z nishi $ */
2
 
3
#ifndef __TW_MODULE_H__
4
#define __TW_MODULE_H__
5
 
140 nishi 6
#ifdef __cplusplus
7
extern "C" {
8
#endif
9
 
17 nishi 10
#include "tw_config.h"
18 nishi 11
#include "tw_http.h"
17 nishi 12
 
367 nishi 13
#ifdef __NETWARE__
14
#include <nwconio.h>
15
#define END_MODULE int main(){DestroyScreen(GetCurrentScreen());while(1);return 0;}
16
#else
17
#define END_MODULE
18
#endif
19
 
313 nishi 20
#if defined(__OS2__)
21
#define INCL_DOSMODULEMGR
22
#define INCL_DOSERRORS
23
#include <os2.h>
314 nishi 24
#define MODULE_DECL __export APIENTRY
315 nishi 25
#elif defined(__WATCOMC__)
26
#define MODULE_DECL __export
313 nishi 27
#else
28
#define MODULE_DECL
29
#endif
30
 
17 nishi 31
struct tw_tool {
32
	void (*log)(const char* name, const char* log, ...);
18 nishi 33
	void (*add_version)(const char* string);
156 nishi 34
	void (*add_define)(const char* string);
35
	void (*delete_define)(const char* string);
17 nishi 36
};
37
 
18 nishi 38
enum TW_MODULE_RETURN {
20 nishi 39
	_TW_MODULE_PASS = 0, /* Pass to the next module. */
40
	_TW_MODULE_STOP,     /* Do not pass to the next module. */
141 nishi 41
	_TW_MODULE_STOP2,    /* Do not pass to the next module, and do not handle response. */
39 nishi 42
	_TW_MODULE_ERROR,    /* Error, and do not pass to the next module. */
43
 
44
	_TW_CONFIG_PARSED, /* Got parsed */
45
	_TW_CONFIG_NOTME,  /* Did not parse */
46
	_TW_CONFIG_ERROR   /* Error */
18 nishi 47
};
48
 
20 nishi 49
#define TW_MODULE_PASS _TW_MODULE_PASS
50
#define TW_MODULE_STOP _TW_MODULE_STOP
141 nishi 51
#define TW_MODULE_STOP2 _TW_MODULE_STOP2
20 nishi 52
#define TW_MODULE_ERROR(x) (_TW_MODULE_ERROR | ((x) << 8))
53
 
39 nishi 54
#define TW_CONFIG_PARSED _TW_CONFIG_PARSED
55
#define TW_CONFIG_NOTME _TW_CONFIG_NOTME
56
#define TW_CONFIG_ERROR _TW_CONFIG_ERROR
57
 
315 nishi 58
typedef int(MODULE_DECL* tw_mod_init_t)(struct tw_config* config, struct tw_tool* tools);
59
typedef int(MODULE_DECL* tw_mod_request_t)(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res);
60
typedef int(MODULE_DECL* tw_mod_config_t)(struct tw_tool* tools, char** argv, int argc);
17 nishi 61
 
140 nishi 62
#ifdef SOURCE
17 nishi 63
void* tw_module_load(const char* path);
64
void* tw_module_symbol(void* mod, const char* sym);
65
void tw_init_tools(struct tw_tool* tools);
66
int tw_module_init(void* mod);
156 nishi 67
 
68
void tw_add_version(const char* string);
69
void tw_add_define(const char* string);
70
void tw_delete_define(const char* string);
140 nishi 71
#endif
17 nishi 72
 
140 nishi 73
#ifdef __cplusplus
74
}
17 nishi 75
#endif
140 nishi 76
 
77
#endif