added qse_awk_pushecb()/qse_awk_popecb()/qse_sed_pushecb()/qse_sed_popecb()/qse_httpd_pushecb()/qse_httpd_popecb().
started reorganizing samples/httpd01 to net/httpd-std.c
This commit is contained in:
parent
69b118fcbf
commit
ea3ebef8f1
@ -350,8 +350,7 @@ static void dprint_return (qse_awk_rtx_t* rtx, qse_awk_val_t* ret)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_CALLBACK
|
||||
static void on_statement (
|
||||
qse_awk_rtx_t* rtx, qse_awk_nde_t* nde, void* data)
|
||||
static void on_statement (qse_awk_rtx_t* rtx, qse_awk_nde_t* nde)
|
||||
{
|
||||
dprint (QSE_T("running %d at line %d\n"), (int)nde->type, (int)nde->loc.line);
|
||||
}
|
||||
@ -975,13 +974,18 @@ static int awk_main (int argc, qse_char_t* argv[])
|
||||
qse_awk_t* awk = QSE_NULL;
|
||||
qse_awk_rtx_t* rtx = QSE_NULL;
|
||||
qse_awk_val_t* retv;
|
||||
#ifdef ENABLE_CALLBACK
|
||||
qse_awk_rcb_t rcb;
|
||||
#endif
|
||||
int i;
|
||||
struct arg_t arg;
|
||||
int ret = -1;
|
||||
|
||||
#ifdef ENABLE_CALLBACK
|
||||
static qse_awk_rtx_ecb_t rtx_ecb =
|
||||
{
|
||||
QSE_FV(.close, QSE_NULL),
|
||||
QSE_FV(.stmt, on_statement)
|
||||
};
|
||||
#endif
|
||||
|
||||
/* TODO: change it to support multiple source files */
|
||||
qse_awk_parsestd_t psin;
|
||||
qse_awk_parsestd_t psout;
|
||||
@ -1080,12 +1084,6 @@ static int awk_main (int argc, qse_char_t* argv[])
|
||||
goto oops;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_CALLBACK
|
||||
qse_memset (&rcb, 0, QSE_SIZEOF(rcb));
|
||||
rcb.stmt = on_statement;
|
||||
rcb.ctx = &arg;
|
||||
#endif
|
||||
|
||||
rtx = qse_awk_rtx_openstd (
|
||||
awk, 0, QSE_T("qseawk"),
|
||||
(const qse_char_t*const*)arg.icf.ptr,
|
||||
@ -1104,7 +1102,7 @@ static int awk_main (int argc, qse_char_t* argv[])
|
||||
|
||||
app_rtx = rtx;
|
||||
#ifdef ENABLE_CALLBACK
|
||||
qse_awk_rtx_pushrcb (rtx, &rcb);
|
||||
qse_awk_rtx_pushecb (rtx, &rtx_ecb);
|
||||
#endif
|
||||
|
||||
set_intr_run ();
|
||||
|
@ -617,6 +617,8 @@ struct qse_awk_prm_t
|
||||
};
|
||||
typedef struct qse_awk_prm_t qse_awk_prm_t;
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
* The qse_awk_sio_t type defines a script stream handler set.
|
||||
* The qse_awk_parse() function calls the input and output handler to parse
|
||||
@ -664,6 +666,8 @@ struct qse_awk_sio_t
|
||||
};
|
||||
typedef struct qse_awk_sio_t qse_awk_sio_t;
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
* The qse_awk_rio_t type defines a runtime I/O handler set.
|
||||
* @sa qse_awk_rtx_t
|
||||
@ -676,56 +680,93 @@ struct qse_awk_rio_t
|
||||
};
|
||||
typedef struct qse_awk_rio_t qse_awk_rio_t;
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
* The qse_awk_rcb_close_t type defines the callback function
|
||||
* The qse_awk_ecb_close_t type defines the callback function
|
||||
* called when an awk object is closed.
|
||||
*/
|
||||
typedef void (*qse_awk_ecb_close_t) (
|
||||
qse_awk_t* awk /**< awk */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_awk_ecb_clear_t type defines the callback function
|
||||
* called when an awk object is cleared.
|
||||
*/
|
||||
typedef void (*qse_awk_ecb_clear_t) (
|
||||
qse_awk_t* awk /**< awk */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_awk_ecb_t type defines an event callback set.
|
||||
* You can register a callback function set with
|
||||
* qse_awk_pushecb(). The callback functions in the registered
|
||||
* set are called in the reverse order of registration.
|
||||
*/
|
||||
typedef struct qse_awk_ecb_t qse_awk_ecb_t;
|
||||
struct qse_awk_ecb_t
|
||||
{
|
||||
/**
|
||||
* called by qse_awk_close().
|
||||
*/
|
||||
qse_awk_ecb_close_t close;
|
||||
|
||||
/**
|
||||
* called by qse_awk_clear().
|
||||
*/
|
||||
qse_awk_ecb_clear_t clear;
|
||||
|
||||
/* internal use only. don't touch this field */
|
||||
qse_awk_ecb_t* next;
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
* The qse_awk_rtx_ecb_close_t type defines the callback function
|
||||
* called when the runtime context is closed.
|
||||
*/
|
||||
typedef void (*qse_awk_rcb_close_t) (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
void* ctx /**< user-defined data */
|
||||
typedef void (*qse_awk_rtx_ecb_close_t) (
|
||||
qse_awk_rtx_t* rtx /**< runtime context */
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* The qse_awk_rcb_stmt_t type defines the callback function for each
|
||||
* The qse_awk_rtx_ecb_stmt_t type defines the callback function for each
|
||||
* statement.
|
||||
*/
|
||||
typedef void (*qse_awk_rcb_stmt_t) (
|
||||
typedef void (*qse_awk_rtx_ecb_stmt_t) (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
qse_awk_nde_t* nde, /**< node */
|
||||
void* ctx /**< user-defined data */
|
||||
qse_awk_nde_t* nde /**< node */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_awk_rcb_t type defines a runtime callback set. You can
|
||||
* register a callback function set with qse_awk_rtx_pushrcb().
|
||||
* The callback functions in the set registered are called in a
|
||||
* proper context in the reverse order of registeration.
|
||||
* The qse_awk_rtx_ecb_t type defines an event callback set for a
|
||||
* runtime context. You can register a callback function set with
|
||||
* qse_awk_rtx_pushecb(). The callback functions in the registered
|
||||
* set are called in the reverse order of registration.
|
||||
*/
|
||||
typedef struct qse_awk_rcb_t qse_awk_rcb_t;
|
||||
struct qse_awk_rcb_t
|
||||
typedef struct qse_awk_rtx_ecb_t qse_awk_rtx_ecb_t;
|
||||
struct qse_awk_rtx_ecb_t
|
||||
{
|
||||
/**
|
||||
* called by qse_awk_rtx_close().
|
||||
*/
|
||||
qse_awk_rcb_close_t close;
|
||||
qse_awk_rtx_ecb_close_t close;
|
||||
|
||||
/**
|
||||
* called by qse_awk_rtx_loop() and qse_awk_rtx_call() for
|
||||
* each statement executed.
|
||||
*/
|
||||
qse_awk_rcb_stmt_t stmt;
|
||||
|
||||
/**
|
||||
* A caller may store a user-defined data pointer into this field. This
|
||||
* is passed to an actual callback.
|
||||
*/
|
||||
void* ctx;
|
||||
qse_awk_rtx_ecb_stmt_t stmt;
|
||||
|
||||
/* internal use only. don't touch this field */
|
||||
qse_awk_rcb_t* next;
|
||||
qse_awk_rtx_ecb_t* next;
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
* The qse_awk_option_t type defines various options to change the behavior
|
||||
* of #qse_awk_t.
|
||||
@ -1381,6 +1422,23 @@ void qse_awk_setmaxdepth (
|
||||
qse_size_t depth /**< maximum depth */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_awk_popecb() function pops an awk event callback set
|
||||
* and returns the pointer to it. If no callback set can be popped,
|
||||
* it returns #QSE_NULL.
|
||||
*/
|
||||
qse_awk_ecb_t* qse_awk_popecb (
|
||||
qse_awk_t* awk /**< awk */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_awk_pushecb() function register a runtime callback set.
|
||||
*/
|
||||
void qse_awk_pushecb (
|
||||
qse_awk_t* awk, /**< awk */
|
||||
qse_awk_ecb_t* ecb /**< callback set */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_awk_addgbl() function adds an intrinsic global variable.
|
||||
* @return the ID of the global variable added on success, -1 on failure.
|
||||
@ -1717,20 +1775,20 @@ void qse_awk_rtx_setrio (
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_awk_rtx_poprcb() function pops a runtime callback set
|
||||
* The qse_awk_rtx_popecb() function pops a runtime callback set
|
||||
* and returns the pointer to it. If no callback set can be popped,
|
||||
* it returns #QSE_NULL.
|
||||
*/
|
||||
qse_awk_rcb_t* qse_awk_rtx_poprcb (
|
||||
qse_awk_rtx_ecb_t* qse_awk_rtx_popecb (
|
||||
qse_awk_rtx_t* rtx /**< runtime context */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_awk_rtx_pushrcb() function register a runtime callback set.
|
||||
* The qse_awk_rtx_pushecb() function register a runtime callback set.
|
||||
*/
|
||||
void qse_awk_rtx_pushrcb (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
qse_awk_rcb_t* rcb /**< callback set */
|
||||
void qse_awk_rtx_pushecb (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
qse_awk_rtx_ecb_t* ecb /**< callback set */
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -216,6 +216,15 @@
|
||||
} \
|
||||
)
|
||||
|
||||
/**
|
||||
* The QSE_FV() macro is used to specify a initial value
|
||||
* for a field of an aggregate type.
|
||||
*/
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
|
||||
# define QSE_FV(field,value) field = value
|
||||
#else
|
||||
# define QSE_FV(field,value) value
|
||||
#endif
|
||||
|
||||
/* number of characters to number of bytes */
|
||||
#define QSE_NCTONB(x) ((x)*sizeof(qse_char_t))
|
||||
|
@ -305,6 +305,32 @@ struct qse_httpd_client_t
|
||||
} task;
|
||||
};
|
||||
|
||||
/**
|
||||
* The qse_httpd_ecb_close_t type defines the callback function
|
||||
* called when an httpd object is closed.
|
||||
*/
|
||||
typedef void (*qse_httpd_ecb_close_t) (
|
||||
qse_httpd_t* httpd /**< httpd */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_httpd_ecb_t type defines an event callback set.
|
||||
* You can register a callback function set with
|
||||
* qse_httpd_pushecb(). The callback functions in the registered
|
||||
* set are called in the reverse order of registration.
|
||||
*/
|
||||
typedef struct qse_httpd_ecb_t qse_httpd_ecb_t;
|
||||
struct qse_httpd_ecb_t
|
||||
{
|
||||
/**
|
||||
* called by qse_httpd_close().
|
||||
*/
|
||||
qse_httpd_ecb_close_t close;
|
||||
|
||||
/* internal use only. don't touch this field */
|
||||
qse_httpd_ecb_t* next;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -344,6 +370,23 @@ void qse_httpd_setoption (
|
||||
int option
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_httpd_popecb() function pops an httpd event callback set
|
||||
* and returns the pointer to it. If no callback set can be popped,
|
||||
* it returns #QSE_NULL.
|
||||
*/
|
||||
qse_httpd_ecb_t* qse_httpd_popecb (
|
||||
qse_httpd_t* httpd /**< httpd */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_httpd_pushecb() function register a runtime callback set.
|
||||
*/
|
||||
void qse_httpd_pushecb (
|
||||
qse_httpd_t* httpd, /**< httpd */
|
||||
qse_httpd_ecb_t* ecb /**< callback set */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_httpd_loop() function starts a httpd server loop.
|
||||
*/
|
||||
@ -360,7 +403,6 @@ void qse_httpd_stop (
|
||||
qse_httpd_t* httpd
|
||||
);
|
||||
|
||||
|
||||
int qse_httpd_addserver (
|
||||
qse_httpd_t* httpd,
|
||||
const qse_char_t* uri
|
||||
@ -502,6 +544,23 @@ void qse_httpd_freemem (
|
||||
void* ptr
|
||||
);
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
|
||||
qse_httpd_t* qse_httpd_openstd (
|
||||
qse_size_t xtnsize
|
||||
);
|
||||
|
||||
qse_httpd_t* qse_httpd_openstdwithmmgr (
|
||||
qse_mmgr_t* mmgr,
|
||||
qse_size_t xtnsize
|
||||
);
|
||||
|
||||
void* qse_httpd_getxtnstd (
|
||||
qse_httpd_t* httpd
|
||||
);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -345,6 +345,32 @@ typedef int (*qse_sed_lformatter_t) (
|
||||
int (*cwriter) (qse_sed_t*, qse_char_t)
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_sed_ecb_close_t type defines the callback function
|
||||
* called when an sed object is closed.
|
||||
*/
|
||||
typedef void (*qse_sed_ecb_close_t) (
|
||||
qse_sed_t* sed /**< sed */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_sed_ecb_t type defines an event callback set.
|
||||
* You can register a callback function set with
|
||||
* qse_sed_pushecb(). The callback functions in the registered
|
||||
* set are called in the reverse order of registration.
|
||||
*/
|
||||
typedef struct qse_sed_ecb_t qse_sed_ecb_t;
|
||||
struct qse_sed_ecb_t
|
||||
{
|
||||
/**
|
||||
* called by qse_sed_close().
|
||||
*/
|
||||
qse_sed_ecb_close_t close;
|
||||
|
||||
/* internal use only. don't touch this field */
|
||||
qse_sed_ecb_t* next;
|
||||
};
|
||||
|
||||
#ifdef QSE_ENABLE_SEDTRACER
|
||||
enum qse_sed_exec_op_t
|
||||
{
|
||||
@ -515,6 +541,23 @@ void qse_sed_seterror (
|
||||
const qse_sed_loc_t* errloc /**< error location */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_sed_popecb() function pops an sed event callback set
|
||||
* and returns the pointer to it. If no callback set can be popped,
|
||||
* it returns #QSE_NULL.
|
||||
*/
|
||||
qse_sed_ecb_t* qse_sed_popecb (
|
||||
qse_sed_t* sed /**< sed */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_sed_pushecb() function register a runtime callback set.
|
||||
*/
|
||||
void qse_sed_pushecb (
|
||||
qse_sed_t* sed, /**< sed */
|
||||
qse_sed_ecb_t* ecb /**< callback set */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_sed_comp() function compiles editing commands into an internal form.
|
||||
* @return 0 on success, -1 on error
|
||||
|
@ -262,8 +262,14 @@ oops:
|
||||
|
||||
int qse_awk_close (qse_awk_t* awk)
|
||||
{
|
||||
qse_awk_ecb_t* ecb;
|
||||
|
||||
if (qse_awk_clear (awk) <= -1) return -1;
|
||||
/*qse_awk_clrfnc (awk);*/
|
||||
|
||||
for (ecb = awk->ecb; ecb; ecb = ecb->next)
|
||||
if (ecb->close) ecb->close (awk);
|
||||
|
||||
qse_htb_close (awk->fnc.user);
|
||||
|
||||
qse_lda_close (awk->parse.params);
|
||||
@ -287,6 +293,11 @@ int qse_awk_close (qse_awk_t* awk)
|
||||
|
||||
int qse_awk_clear (qse_awk_t* awk)
|
||||
{
|
||||
qse_awk_ecb_t* ecb;
|
||||
|
||||
for (ecb = awk->ecb; ecb; ecb = ecb->next)
|
||||
if (ecb->clear) ecb->clear (awk);
|
||||
|
||||
awk->stopall = QSE_FALSE;
|
||||
|
||||
clear_token (&awk->tok);
|
||||
@ -439,3 +450,18 @@ void qse_awk_setmaxdepth (qse_awk_t* awk, int types, qse_size_t depth)
|
||||
awk->parse.depth.max.incl = depth;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
qse_awk_ecb_t* qse_awk_popecb (qse_awk_t* awk)
|
||||
{
|
||||
qse_awk_ecb_t* top = awk->ecb;
|
||||
if (top) awk->ecb = top->next;
|
||||
return top;
|
||||
}
|
||||
|
||||
void qse_awk_pushecb (qse_awk_t* awk, qse_awk_ecb_t* ecb)
|
||||
{
|
||||
ecb->next = awk->ecb;
|
||||
awk->ecb = ecb;
|
||||
}
|
||||
|
||||
|
@ -235,6 +235,7 @@ struct qse_awk_t
|
||||
qse_awk_errinf_t errinf;
|
||||
|
||||
qse_bool_t stopall;
|
||||
qse_awk_ecb_t* ecb;
|
||||
};
|
||||
|
||||
struct qse_awk_chain_t
|
||||
@ -371,7 +372,7 @@ struct qse_awk_rtx_t
|
||||
qse_awk_errinf_t errinf;
|
||||
|
||||
qse_awk_t* awk;
|
||||
qse_awk_rcb_t* rcb;
|
||||
qse_awk_rtx_ecb_t* ecb;
|
||||
};
|
||||
|
||||
|
||||
|
@ -744,10 +744,10 @@ qse_awk_rtx_t* qse_awk_rtx_open (
|
||||
|
||||
void qse_awk_rtx_close (qse_awk_rtx_t* rtx)
|
||||
{
|
||||
qse_awk_rcb_t* rcb;
|
||||
qse_awk_rtx_ecb_t* ecb;
|
||||
|
||||
for (rcb = rtx->rcb; rcb; rcb = rcb->next)
|
||||
if (rcb->close) rcb->close (rtx, rcb->ctx);
|
||||
for (ecb = rtx->ecb; ecb; ecb = ecb->next)
|
||||
if (ecb->close) ecb->close (rtx);
|
||||
|
||||
/* NOTE:
|
||||
* the close callbacks are called before data in rtx
|
||||
@ -784,17 +784,17 @@ void qse_awk_rtx_setrio (qse_awk_rtx_t* rtx, const qse_awk_rio_t* rio)
|
||||
rtx->rio.handler[QSE_AWK_RIO_CONSOLE] = rio->console;
|
||||
}
|
||||
|
||||
qse_awk_rcb_t* qse_awk_rtx_poprcb (qse_awk_rtx_t* rtx)
|
||||
qse_awk_rtx_ecb_t* qse_awk_rtx_popecb (qse_awk_rtx_t* rtx)
|
||||
{
|
||||
qse_awk_rcb_t* top = rtx->rcb;
|
||||
if (top) rtx->rcb = top->next;
|
||||
qse_awk_rtx_ecb_t* top = rtx->ecb;
|
||||
if (top) rtx->ecb = top->next;
|
||||
return top;
|
||||
}
|
||||
|
||||
void qse_awk_rtx_pushrcb (qse_awk_rtx_t* rtx, qse_awk_rcb_t* rcb)
|
||||
void qse_awk_rtx_pushecb (qse_awk_rtx_t* rtx, qse_awk_rtx_ecb_t* ecb)
|
||||
{
|
||||
rcb->next = rtx->rcb;
|
||||
rtx->rcb = rcb;
|
||||
ecb->next = rtx->ecb;
|
||||
rtx->ecb = ecb;
|
||||
}
|
||||
|
||||
static void free_namedval (qse_htb_t* map, void* dptr, qse_size_t dlen)
|
||||
@ -1826,10 +1826,10 @@ static int run_block0 (qse_awk_rtx_t* rtx, qse_awk_nde_blk_t* nde)
|
||||
}
|
||||
|
||||
#define ON_STATEMENT(rtx,nde) QSE_BLOCK ( \
|
||||
qse_awk_rcb_t* rcb; \
|
||||
qse_awk_rtx_ecb_t* ecb; \
|
||||
if ((rtx)->awk->stopall) (rtx)->exit_level = EXIT_ABORT; \
|
||||
for (rcb = (rtx)->rcb; rcb; rcb = rcb->next) \
|
||||
if (rcb->stmt) rcb->stmt (rtx, nde, rcb->ctx); \
|
||||
for (ecb = (rtx)->ecb; ecb; ecb = ecb->next) \
|
||||
if (ecb->stmt) ecb->stmt (rtx, nde); \
|
||||
)
|
||||
|
||||
static int run_statement (qse_awk_rtx_t* rtx, qse_awk_nde_t* nde)
|
||||
|
@ -1478,7 +1478,7 @@ static qse_ssize_t awk_rio_console (
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void fini_rxtn (qse_awk_rtx_t* rtx, void* ctx)
|
||||
static void fini_rxtn (qse_awk_rtx_t* rtx)
|
||||
{
|
||||
rxtn_t* rxtn = (rxtn_t*) QSE_XTN (rtx);
|
||||
|
||||
@ -1876,11 +1876,10 @@ qse_awk_rtx_t* qse_awk_rtx_openstd (
|
||||
const qse_char_t*const ocf[],
|
||||
qse_cmgr_t* cmgr)
|
||||
{
|
||||
static qse_awk_rcb_t rcb =
|
||||
static qse_awk_rtx_ecb_t ecb =
|
||||
{
|
||||
fini_rxtn,
|
||||
QSE_NULL,
|
||||
QSE_NULL
|
||||
QSE_FV (.close, fini_rxtn),
|
||||
QSE_FV (.stmt, QSE_NULL)
|
||||
};
|
||||
|
||||
qse_awk_rtx_t* rtx;
|
||||
@ -1921,7 +1920,7 @@ qse_awk_rtx_t* qse_awk_rtx_openstd (
|
||||
rxtn->cmgrtab_inited = 1;
|
||||
}
|
||||
|
||||
qse_awk_rtx_pushrcb (rtx, &rcb);
|
||||
qse_awk_rtx_pushecb (rtx, &ecb);
|
||||
|
||||
rxtn->seed = (qse_gettime (&now) <= -1)? 0u: (qse_long_t)now;
|
||||
/* i don't care if the seed becomes negative or overflows.
|
||||
|
@ -16,6 +16,7 @@ libqsenet_la_SOURCES = \
|
||||
httpd-cgi.c \
|
||||
httpd-proxy.c \
|
||||
httpd-resol.c \
|
||||
httpd-std.c \
|
||||
httpd-task.c \
|
||||
upxd.c
|
||||
|
||||
|
@ -79,8 +79,8 @@ am__installdirs = "$(DESTDIR)$(libdir)"
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
libqsenet_la_DEPENDENCIES =
|
||||
am_libqsenet_la_OBJECTS = http.lo htre.lo htrd.lo httpd.lo \
|
||||
httpd-cgi.lo httpd-proxy.lo httpd-resol.lo httpd-task.lo \
|
||||
upxd.lo
|
||||
httpd-cgi.lo httpd-proxy.lo httpd-resol.lo httpd-std.lo \
|
||||
httpd-task.lo upxd.lo
|
||||
libqsenet_la_OBJECTS = $(am_libqsenet_la_OBJECTS)
|
||||
libqsenet_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
@ -273,6 +273,7 @@ libqsenet_la_SOURCES = \
|
||||
httpd-cgi.c \
|
||||
httpd-proxy.c \
|
||||
httpd-resol.c \
|
||||
httpd-std.c \
|
||||
httpd-task.c \
|
||||
upxd.c
|
||||
|
||||
@ -358,6 +359,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpd-cgi.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpd-proxy.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpd-resol.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpd-std.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpd-task.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpd.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upxd.Plo@am__quote@
|
||||
|
1627
qse/lib/net/httpd-std.c
Normal file
1627
qse/lib/net/httpd-std.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -84,6 +84,11 @@ qse_httpd_t* qse_httpd_open (qse_mmgr_t* mmgr, qse_size_t xtnsize)
|
||||
|
||||
void qse_httpd_close (qse_httpd_t* httpd)
|
||||
{
|
||||
qse_httpd_ecb_t* ecb;
|
||||
|
||||
for (ecb = httpd->ecb; ecb; ecb = ecb->next)
|
||||
if (ecb->close) ecb->close (httpd);
|
||||
|
||||
qse_httpd_fini (httpd);
|
||||
QSE_MMGR_FREE (httpd->mmgr, httpd);
|
||||
}
|
||||
@ -128,6 +133,23 @@ void qse_httpd_setoption (qse_httpd_t* httpd, int option)
|
||||
httpd->option = option;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------- */
|
||||
|
||||
qse_httpd_ecb_t* qse_httpd_popecb (qse_httpd_t* httpd)
|
||||
{
|
||||
qse_httpd_ecb_t* top = httpd->ecb;
|
||||
if (top) httpd->ecb = top->next;
|
||||
return top;
|
||||
}
|
||||
|
||||
void qse_httpd_pushecb (qse_httpd_t* httpd, qse_httpd_ecb_t* ecb)
|
||||
{
|
||||
ecb->next = httpd->ecb;
|
||||
httpd->ecb = ecb;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------- */
|
||||
|
||||
QSE_INLINE void* qse_httpd_allocmem (qse_httpd_t* httpd, qse_size_t size)
|
||||
{
|
||||
void* ptr = QSE_MMGR_ALLOC (httpd->mmgr, size);
|
||||
|
@ -29,7 +29,8 @@ struct qse_httpd_t
|
||||
{
|
||||
QSE_DEFINE_COMMON_FIELDS (httpd)
|
||||
qse_httpd_errnum_t errnum;
|
||||
qse_httpd_cbs_t* cbs;
|
||||
qse_httpd_ecb_t* ecb; /* event callbacks */
|
||||
qse_httpd_cbs_t* cbs;
|
||||
|
||||
int option;
|
||||
int stopreq;
|
||||
|
@ -75,6 +75,11 @@ qse_sed_t* qse_sed_open (qse_mmgr_t* mmgr, qse_size_t xtnsize)
|
||||
|
||||
void qse_sed_close (qse_sed_t* sed)
|
||||
{
|
||||
qse_sed_ecb_t* ecb;
|
||||
|
||||
for (ecb = sed->ecb; ecb; ecb = ecb->next)
|
||||
if (ecb->close) ecb->close (sed);
|
||||
|
||||
qse_sed_fini (sed);
|
||||
QSE_MMGR_FREE (sed->mmgr, sed);
|
||||
}
|
||||
@ -4142,6 +4147,19 @@ void qse_sed_setlinenum (qse_sed_t* sed, qse_size_t num)
|
||||
sed->e.in.num = num;
|
||||
}
|
||||
|
||||
qse_sed_ecb_t* qse_sed_popecb (qse_sed_t* sed)
|
||||
{
|
||||
qse_sed_ecb_t* top = sed->ecb;
|
||||
if (top) sed->ecb = top->next;
|
||||
return top;
|
||||
}
|
||||
|
||||
void qse_sed_pushecb (qse_sed_t* sed, qse_sed_ecb_t* ecb)
|
||||
{
|
||||
ecb->next = sed->ecb;
|
||||
sed->ecb = ecb;
|
||||
}
|
||||
|
||||
#ifdef QSE_ENABLE_SEDTRACER
|
||||
qse_sed_exec_tracer_t qse_sed_getexectracer (qse_sed_t* sed)
|
||||
{
|
||||
|
@ -99,6 +99,8 @@ struct qse_sed_t
|
||||
} rex;
|
||||
} depth;
|
||||
|
||||
qse_sed_ecb_t* ecb;
|
||||
|
||||
/** source text pointers */
|
||||
struct
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user