--- parser3/src/include/pa_globals.h 2001/03/19 15:29:37 1.13 +++ parser3/src/include/pa_globals.h 2001/03/23 10:14:33 1.22 @@ -1,9 +1,11 @@ /** @file - Parser + Parser: global decls. + Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) + Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_globals.h,v 1.13 2001/03/19 15:29:37 paf Exp $ + $Id: pa_globals.h,v 1.22 2001/03/23 10:14:33 paf Exp $ */ #ifndef PA_GLOBALS_H @@ -12,6 +14,8 @@ #include "pa_string.h" #include "pa_hash.h" +//@{ +/// constant string. class name, predefined method & co #define AUTO_FILE_NAME "auto.p" #define CONTENT_TYPE_NAME "content-type" @@ -19,6 +23,9 @@ #define VALUE_NAME "value" #define EXPIRES_NAME "expires" #define PATH_NAME "path" +#define NAME_NAME "name" +#define SIZE_NAME "size" +#define TEXT_NAME "text" #define EXCEPTION_METHOD_NAME "exception" @@ -41,29 +48,42 @@ #define DEFAULTS_NAME "defaults" #define RESULT_VAR_NAME "result" +//@} -struct Service_funcs { - int (*read_post)(char *buf, int max_bytes); - void (*output_header_attribute)(const char *key, const char *value); - void (*output_body)(const char *buf, size_t size); +/// target-specific service functions +struct SAPI { + /// get env + const char *(*get_env)(Pool& pool, const char *name); + /// read POST request bytes + uint (*read_post)(Pool& pool, char *buf, uint max_bytes); + /// add response header attribute + void (*add_header_attribute)(Pool& pool, const char *key, const char *value); + /// add response header attribute + void (*send_header)(Pool& pool); + /// output body bytes + void (*send_body)(Pool& pool, const char *buf, size_t size); }; -// core func +/// core func void globals_init(Pool& pool); -// hex_value[c] = hex value of c +/// hex_value[c] = hex value of c extern short hex_value[0x100]; -// -extern Service_funcs service_funcs; +/// target-specific service functions +extern SAPI sapi; -// global strings +//@{ +/// global string extern String *content_type_name; extern String *body_name; extern String *value_name; extern String *expires_name; extern String *path_name; +extern String *name_name; +extern String *size_name; +extern String *text_name; extern String *exception_method_name; @@ -88,8 +108,9 @@ extern String *post_max_size_name; extern String *defaults_name; extern String *result_var_name; +//@} -// global hashes +/// global hash extern Hash *untaint_lang_name2enum; #endif