diff --git a/bin/uce_fastcgi.debug.linux.bin b/bin/uce_fastcgi.debug.linux.bin index 8e19e76..8acd07f 100755 Binary files a/bin/uce_fastcgi.debug.linux.bin and b/bin/uce_fastcgi.debug.linux.bin differ diff --git a/doc/areas/noise.txt b/doc/areas/noise.txt index 3affdde..cc9cdfe 100644 --- a/doc/areas/noise.txt +++ b/doc/areas/noise.txt @@ -1,9 +1,9 @@ -Noise Functions +Noise/Hash Functions draw_float draw_int -generate_float -generate_int -noise01 -noise32 -noise64 +gen_noise01 +gen_noise32 +gen_noise64 +gen_float +gen_int diff --git a/doc/index.uce b/doc/index.uce index fae0dfc..407484b 100644 --- a/doc/index.uce +++ b/doc/index.uce @@ -25,9 +25,9 @@ RENDER() String page = first(context->get["p"], "index"); <> -
- -
+ + +

UCE Docs: @@ -72,9 +72,10 @@ RENDER() { auto doc = split(file_get_contents("pages/"+page+".txt"), "\n"); String layout_class = "text"; - ?>
1) + { + ?>

Parameters

Related

Related

') { render_see_section(s.substr(1)); @@ -131,7 +134,6 @@ RENDER() { ?>
()
* { + background: rgba(255,255,255,0.1); + padding: 32px; + margin: 16px; } -h1 { - font-size: 200%; - padding-top: 16px; - padding-bottom: 16px; - border-bottom: 8px solid rgba(0,0,0,0.5); - margin: 0; - margin-bottom: 8px; +a { + color: yellow; } form > div, label { @@ -79,7 +82,11 @@ pre { } h3 { - + margin: 0; + font-family: monospace; + font-size: 1.4em; + margin-bottom: 0.8em; + opacity: 0.7; } .sig { diff --git a/src/lib/hash.cpp b/src/lib/hash.cpp index 2f48a75..85351df 100644 --- a/src/lib/hash.cpp +++ b/src/lib/hash.cpp @@ -257,7 +257,7 @@ unsigned char c; /* ================ end of sha1.c ================ */ String -sha1(String s, bool as_binary) +gen_sha1(String s, bool as_binary) { unsigned char v[20]; SHA1_CTX ctx; @@ -279,7 +279,7 @@ sha1(String s, bool as_binary) #define BIT_NOISE3 0x1B56C4E9 // based on Squirrel3 https://www.youtube.com/watch?v=LWFzPP8ZbdU&t=2666s -u32 noise32(u32 index, u32 seed) +u32 gen_noise32(u32 index, u32 seed) { u32 r = index; r *= BIT_NOISE1; @@ -296,7 +296,7 @@ u32 noise32(u32 index, u32 seed) #define BIT_NOISE62 0xb8E31DA41B56C4E9 #define BIT_NOISE63 0x18cd227aaa1168c1 -u64 noise64(u64 index, u64 seed) +u64 gen_noise64(u64 index, u64 seed) { u64 r = index; r *= BIT_NOISE61; @@ -311,31 +311,31 @@ u64 noise64(u64 index, u64 seed) #define MAX_64 0xffffffffffffffff -f64 noise01(u64 index, u64 seed) +f64 gen_noise01(u64 index, u64 seed) { - return((float)noise64(index, seed)/(float)MAX_64); + return((float)gen_noise64(index, seed)/(float)MAX_64); } -u64 generate_int(u64 from, u64 to, u64 index, u64 seed) +u64 gen_int(u64 from, u64 to, u64 index, u64 seed) { u64 b = 1 + to - from; - return(from + (noise64(index, seed) % b)); + return(from + (gen_noise64(index, seed) % b)); } #include -f64 generate_float(f64 from, f64 to, u64 index, u64 seed, f64 decimal_precision) +f64 gen_float(f64 from, f64 to, u64 index, u64 seed, f64 decimal_precision) { f64 b = to - from; - return(from + fmod( decimal_precision*(f64)noise64(index, seed), b)); + return(from + fmod( decimal_precision*(f64)gen_noise64(index, seed), b)); } u64 draw_int(u64 from, u64 to) { - return(generate_int(from, to, context->random_index++, context->random_seed)); + return(gen_int(from, to, context->random_index++, context->random_seed)); } f64 draw_float(f64 from, f64 to, f64 decimal_precision) { - return(generate_float(from, to, context->random_index++, context->random_seed, decimal_precision)); + return(gen_float(from, to, context->random_index++, context->random_seed, decimal_precision)); } diff --git a/src/lib/hash.h b/src/lib/hash.h index 2df0edd..2460e55 100644 --- a/src/lib/hash.h +++ b/src/lib/hash.h @@ -6,14 +6,14 @@ By Steve Reid */ -String sha1(String s, bool as_binary = false); +String gen_sha1(String s, bool as_binary = false); -u32 noise32(u32 index, u32 seed = 0); -u64 noise64(u64 index, u64 seed = 0); -f64 noise01(u64 index, u64 seed = 0); +u32 gen_noise32(u32 index, u32 seed = 0); +u64 gen_noise64(u64 index, u64 seed = 0); +f64 gen_noise01(u64 index, u64 seed = 0); -u64 generate_int(u64 from, u64 to, u64 index, u64 seed = 0); -f64 generate_float(f64 from, f64 to, u64 index, u64 seed = 0, f64 decimal_precision = 0.000000000001); +u64 gen_int(u64 from, u64 to, u64 index, u64 seed = 0); +f64 gen_float(f64 from, f64 to, u64 index, u64 seed = 0, f64 decimal_precision = 0.000000000001); u64 draw_int(u64 from, u64 to); f64 draw_float(f64 from, f64 to, f64 decimal_precision = 0.000000000001); diff --git a/src/lib/types.h b/src/lib/types.h index 5cc9f03..39e2a6e 100644 --- a/src/lib/types.h +++ b/src/lib/types.h @@ -147,7 +147,7 @@ String to_string(s64 v) { return(std::to_string(v)); } struct ServerSettings { - String BIN_DIRECTORY = "work"; + String BIN_DIRECTORY = "/tmp/uce/work"; String COMPILE_SCRIPT = "scripts/compile"; String LIT_ESC = "3d5b5_1"; String CONTENT_TYPE = "text/html; charset=utf-8"; diff --git a/src/linux_fastcgi.cpp b/src/linux_fastcgi.cpp index cfa632e..0f02cd0 100644 --- a/src/linux_fastcgi.cpp +++ b/src/linux_fastcgi.cpp @@ -47,7 +47,7 @@ int handle_complete(FastCGIRequest& request) { request.header["Content-Type"] = context->server->config.CONTENT_TYPE; request.get = parse_query(request.params["QUERY_STRING"]); request.random_index = 0; - request.random_seed = noise64(*reinterpret_cast(&request.stats.time_start)); + request.random_seed = gen_noise64(*reinterpret_cast(&request.stats.time_start)); request.ob_start(); if(request.params["HTTP_COOKIE"].length() > 0) @@ -118,8 +118,6 @@ int main(int argc, char** argv) printf("Compiler base path: %s\n", server_state.config.COMPILER_SYS_PATH.c_str()); - server_state.config.BIN_DIRECTORY = - server_state.config.COMPILER_SYS_PATH + "/" + server_state.config.BIN_DIRECTORY; server_state.config.COMPILE_SCRIPT = server_state.config.COMPILER_SYS_PATH + "/" + server_state.config.COMPILE_SCRIPT; if(server_state.config.LISTEN_PORT) @@ -131,6 +129,7 @@ int main(int argc, char** argv) dirname(server_state.config.COMPILER_SYS_PATH); basename(server_state.config.COMPILER_SYS_PATH); + mkdir(server_state.config.BIN_DIRECTORY); mkdir(server_state.config.TMP_UPLOAD_PATH); mkdir(server_state.config.SESSION_PATH); diff --git a/start.sh b/start.sh index 585ecbc..1c10d67 100755 --- a/start.sh +++ b/start.sh @@ -1,3 +1,3 @@ #!/bin/bash -rm -r work/* ; ./build_linux.sh && bin/uce_fastcgi.debug.linux.bin +rm -r /tmp/uce/work/* ; ./build_linux.sh && bin/uce_fastcgi.debug.linux.bin diff --git a/test/empty.uce b/test/empty.uce new file mode 100644 index 0000000..7d604e4 --- /dev/null +++ b/test/empty.uce @@ -0,0 +1,4 @@ +void hello() +{ + +} diff --git a/test/index.uce b/test/index.uce index f6301ee..ea1d3d4 100644 --- a/test/index.uce +++ b/test/index.uce @@ -6,7 +6,7 @@ RENDER() p.set(context->params); <> - +

UCE Test: Index diff --git a/test/style.css b/test/style.css index 033090f..1ac1b4f 100644 --- a/test/style.css +++ b/test/style.css @@ -14,6 +14,7 @@ h1 { font-size: 200%; padding-top: 8px; padding-bottom: 8px; + font-family: monospace; } body { @@ -25,11 +26,17 @@ body { font-family: Tahoma, Helvetica, Arial; font-size: 1.2em; box-sizing: border-box; - background: #24f; + background: #139; color: white; line-height: 150%; } +body > * { + background: rgba(255,255,255,0.1); + padding: 32px; + margin: 16px; +} + form > div, label { display: block; padding-top: 8px; @@ -69,7 +76,7 @@ pre { overflow: auto; padding: 8px; border: 2px solid rgba(0,0,0,0.2); - background: rgba(100,100,100,0.15); + background: rgba(255,255,255,0.1); font-family: monospace; white-space: pre-wrap; }