Fix bunch of bugs, endianess of numbers seems to befucked, i have no idea why
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
|
||||
include "std/core.mcl";
|
||||
|
||||
const MAX_CONTEXT_VARS: usize = 32;
|
||||
const MAX_KEY_LEN: usize = 64;
|
||||
@@ -23,73 +23,73 @@ enum ContextType {
|
||||
type ContextType = i32;
|
||||
struct CV_array_data {
|
||||
values: &&char,
|
||||
count: i32,
|
||||
count: i32
|
||||
}
|
||||
|
||||
struct CV_2d_array_data {
|
||||
values: &&&char,
|
||||
count: i32,
|
||||
count: i32
|
||||
}
|
||||
|
||||
|
||||
struct ContextVarStr {
|
||||
key: char[MAX_KEY_LEN],
|
||||
key: [char; MAX_KEY_LEN],
|
||||
typ: ContextType,
|
||||
value: char[MAX_VALUE_LEN]
|
||||
value: [char; MAX_VALUE_LEN]
|
||||
}
|
||||
|
||||
struct ContextVarArr {
|
||||
key: char[MAX_KEY_LEN],
|
||||
key: [char; MAX_KEY_LEN],
|
||||
typ: ContextType,
|
||||
value: CV_array_data,
|
||||
}
|
||||
|
||||
struct ContextVar2dArr {
|
||||
key: char[MAX_KEY_LEN],
|
||||
key: [char; MAX_KEY_LEN],
|
||||
typ: ContextType,
|
||||
value: CV_2d_array_data,
|
||||
}
|
||||
|
||||
struct ContextVar {
|
||||
key: char[MAX_KEY_LEN],
|
||||
key: [char; MAX_KEY_LEN],
|
||||
typ: ContextType,
|
||||
value: char[MAX_VALUE_LEN]
|
||||
value: [char; MAX_VALUE_LEN]
|
||||
}
|
||||
|
||||
struct TemplateContext {
|
||||
vars: ContextVar[MAX_CONTEXT_VARS],
|
||||
vars: [ContextVar; MAX_CONTEXT_VARS],
|
||||
count: i32,
|
||||
}
|
||||
|
||||
struct UrlParam {
|
||||
key: char[MAX_KEY_LEN],
|
||||
value: char[MAX_VALUE_LEN],
|
||||
key: [char; MAX_KEY_LEN],
|
||||
value: [char; MAX_VALUE_LEN],
|
||||
}
|
||||
|
||||
struct UrlParams {
|
||||
params: UrlParam[MAX_URL_PARAMS],
|
||||
params: [UrlParam; MAX_URL_PARAMS],
|
||||
count: i32
|
||||
}
|
||||
struct Cookie {
|
||||
name: char[MAX_KEY_LEN],
|
||||
value: char[MAX_VALUE_LEN],
|
||||
expires: char[MAX_VALUE_LEN],
|
||||
path: char[MAX_KEY_LEN],
|
||||
name: [char; MAX_KEY_LEN],
|
||||
value: [char; MAX_VALUE_LEN],
|
||||
expires: [char; MAX_VALUE_LEN],
|
||||
path: [char; MAX_KEY_LEN],
|
||||
http_only: bool,
|
||||
secure: bool
|
||||
}
|
||||
|
||||
type RequestHandler = fn(params: &UrlParams);
|
||||
type RequestHandler = fn(params: &UrlParams) -> i32;
|
||||
|
||||
struct RouteHandler {
|
||||
path: char[MAX_PATH_LEN],
|
||||
path: [char; MAX_PATH_LEN],
|
||||
handler: RequestHandler
|
||||
}
|
||||
|
||||
extern fn new_context() -> TemplateContext;
|
||||
extern fn context_set(ctx: &mut TemplateContext, key: &cstr, value: &cstr);
|
||||
extern fn context_set_string_array(ctx: &mut TemplateContext, key: &cstr, values: &cstr, count: i32);
|
||||
extern fn context_set_array_of_arrays(ctx: &mut TemplateContext, key: &cstr, values: &cstr[][], outer_count: i32, inner_count: i32);
|
||||
extern fn context_set_array_of_arrays(ctx: &mut TemplateContext, key: &cstr, values: [[&cstr]], outer_count: i32, inner_count: i32);
|
||||
extern fn free_context(ctx: &mut TemplateContext);
|
||||
extern fn render_template(template_file: &cstr, ctx: &mut TemplateContext) -> &cstr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user