diff --git a/.gitignore b/.gitignore index acd4903..66bc884 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ docs/JetCore.dvi docs/JetCore.log docs/JetCore.toc -# jetc build byproducts (compiled JET-to-C++ output, binaries, .so/.a artifacts). +# jetc build byproducts (compiled JET-to-C++ output, binaries, .jtc/.a artifacts). # Generated .cpp files are always named "*.compiled.cpp" (see build-compiled.sh/ # build-shared.sh) - deliberately not a blanket "*.cpp", which would also # swallow real source files added to jetc/ later (bit us once already: an @@ -19,7 +19,11 @@ jetc/host_test jetc/api_test jetc/demo.cpp jetc/demo2.cpp +jetc/demo4 +jetc/demo5 +jetc/demo6 +jetc/demo7 jetc/*.compiled.cpp jetc/*.pic.o -jetc/*.so +jetc/*.jtc jetc/libCoreUtils_pic.a diff --git a/jetc/JetCodegen.h b/jetc/JetCodegen.h index d8f8b15..31a60d2 100644 --- a/jetc/JetCodegen.h +++ b/jetc/JetCodegen.h @@ -10,7 +10,7 @@ namespace jetc { // One `#api METHOD /path` directive from the top of the source template // (see jetc.cpp) - a compile-time-known route this template wants to - // serve once loaded as a .so. Purely descriptive data handed to Codegen; + // serve once loaded as a .jtc. Purely descriptive data handed to Codegen; // jetc itself never interprets the method/path beyond storing them. struct ApiRoute { std::string method; @@ -34,7 +34,7 @@ namespace jetc { // // sharedMode == true: emits no main() at all. Instead the render // logic is exported as `extern "C" void (jet::Global - // &global, coreutils::MString &out)`, meant to be built into a .so + // &global, coreutils::MString &out)`, meant to be built into a .jtc // (see build-shared.sh) and dlsym()'d by a long-running host server - // one call renders one request into the caller-owned `out`, using // whatever Global the host passes in (its lifecycle, cgi/session @@ -45,7 +45,7 @@ namespace jetc { // letting coreutils::Exception propagate to the caller) across the // dlopen() boundary is safe; this is a same-ABI plugin boundary, not // a foreign C ABI one. entrySymbol should be unique per compiled - // template (see jetc.cpp) so multiple .so's can coexist even if a + // template (see jetc.cpp) so multiple .jtc's can coexist even if a // host ever dlopen()s them RTLD_GLOBAL instead of keeping separate // handles. // diff --git a/jetc/api_test.cpp b/jetc/api_test.cpp index b6c1b41..289399f 100644 --- a/jetc/api_test.cpp +++ b/jetc/api_test.cpp @@ -1,7 +1,7 @@ // Minimal dlsym() check for the jetc_api_ route-metadata export added // alongside jetc_render_ in --shared mode (see JetCodegen.cpp). Proves // a host can discover a compiled module's declared routes purely from the -// .so itself, with no separate manifest file - the actual point of putting +// .jtc itself, with no separate manifest file - the actual point of putting // routing metadata in an exported symbol instead of a sidecar file. #include #include @@ -12,7 +12,7 @@ typedef const JetApiRoute *(*ApiFn)(int *count); int main(int argc, char **argv) { if (argc < 3) { - std::cerr << "usage: api_test " << std::endl; + std::cerr << "usage: api_test " << std::endl; return 1; } void *handle = dlopen(argv[1], RTLD_NOW); diff --git a/jetc/build-shared.sh b/jetc/build-shared.sh index b1fd781..f53298a 100755 --- a/jetc/build-shared.sh +++ b/jetc/build-shared.sh @@ -1,12 +1,14 @@ #!/bin/bash -# Compiles a .jet file into a shared object exporting a stable, dlsym()-able -# render entry point - `jetc_render_(jet::Global &global, -# coreutils::MString &out)` - for a long-running server to load and call -# directly instead of spawning a jet-2.0 process per request. +# Compiles a .jet file into a shared object (conventionally named .jtc - +# "jet compiled" - to mark it as an APIServer-loadable content module, not +# a generic .so) exporting a stable, dlsym()-able render entry point - +# `jetc_render_(jet::Global &global, coreutils::MString &out)` +# - for a long-running server to load and call directly instead of +# spawning a jet-2.0 process per request. # -# Usage: ./build-shared.sh +# Usage: ./build-shared.sh # -# The host server links/dlopen()s the .so and calls the exported symbol +# The host server links/dlopen()s the .jtc and calls the exported symbol # (see the "entry symbol:" line jetc prints) with its own jet::Global - # this script does not decide that lifecycle, only builds the module. # coreutils::Exception propagates out of the call uncaught; the host @@ -18,13 +20,13 @@ CU="$JC/../CoreUtils" HERE="$JC/jetc" if [ $# -ne 2 ]; then - echo "usage: $0 " + echo "usage: $0 " exit 1 fi INPUT="$1" OUTPUT="$2" -STEM="$(basename "$OUTPUT" .so)" +STEM="$(basename "$OUTPUT" .jtc)" if [ ! -x "$HERE/jetc" ]; then echo "Building jetc..." diff --git a/jetc/host_test.cpp b/jetc/host_test.cpp old mode 100755 new mode 100644 index 3bcc4c3..38e6d87 --- a/jetc/host_test.cpp +++ b/jetc/host_test.cpp @@ -1,5 +1,5 @@ -// Minimal stand-in for the not-yet-built server: dlopen()s a compiled -// template .so and calls its exported render entry point directly, the +// Minimal stand-in for a server: dlopen()s a compiled +// template .jtc and calls its exported render entry point directly, the // way a persistent content-provider process would (no process spawn per // request, no re-parsing the .jet source - both the compile step AND // the shared-object load happen once, ahead of time). @@ -14,7 +14,7 @@ typedef void (*RenderFn)(jet::Global &, coreutils::MString &); int main(int argc, char **argv, char **envp) { if (argc < 3) { - std::cerr << "usage: host_test " << std::endl; + std::cerr << "usage: host_test " << std::endl; return 1; } void *handle = dlopen(argv[1], RTLD_NOW); @@ -31,7 +31,7 @@ int main(int argc, char **argv, char **envp) { } // Simulate the host calling the SAME module twice, for two different - // "requests", to prove the .so is reusable across calls without being + // "requests", to prove the .jtc is reusable across calls without being // reloaded - the actual point of a persistent content provider. for (int i = 0; i < 2; ++i) { jet::Global global(envp); diff --git a/jetc/jetc.cpp b/jetc/jetc.cpp index 8124405..96b6e3c 100644 --- a/jetc/jetc.cpp +++ b/jetc/jetc.cpp @@ -63,7 +63,7 @@ int main(int argc, char **argv) { // is stripped - a plain directive line, not a new tag/attribute concept, // since jetc's parser has no existing notion of the enclosing tag's // attributes to hang this off of. Each becomes one route this template - // wants to serve once loaded as a .so (see JetCodegen's apiRoutes). + // wants to serve once loaded as a .jtc (see JetCodegen's apiRoutes). std::vector apiRoutes; while (src.rfind("#api ", 0) == 0) { size_t nl = src.find('\n'); @@ -88,8 +88,8 @@ int main(int argc, char **argv) { jetc::Codegen codegen; // Both symbols are derived from the input filename (not the output // path) so they stay stable and predictable for whatever builds and - // dlsym()'s the resulting .so - unique per template, so multiple - // compiled templates' .so's can coexist in one process even under + // dlsym()'s the resulting .jtc - unique per template, so multiple + // compiled templates' .jtc's can coexist in one process even under // dlopen(..., RTLD_GLOBAL) instead of requiring isolated handles. std::string baseIdent = sanitizeIdent(baseNameNoExt(inputPath)); std::string symbol = "jetc_render_" + baseIdent;