summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <programble@gmail.com>2016-10-10 22:53:02 -0400
committerJune McEnroe <programble@gmail.com>2016-10-10 22:53:02 -0400
commitb7ce8a5789e66db396a9d4fb5f6acc57fb4d5667 (patch)
tree1bc454f895e0197b6c6e2a8287775fb5fc2b877a
parentSplit jrp nops on dword boundaries (diff)
downloadsrc-b7ce8a5789e66db396a9d4fb5f6acc57fb4d5667.tar.gz
src-b7ce8a5789e66db396a9d4fb5f6acc57fb4d5667.zip
Add JRP_DUMP
Diffstat (limited to '')
-rwxr-xr-x.bin/jrp.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/.bin/jrp.c b/.bin/jrp.c
index 0904e705..d6a9272f 100755
--- a/.bin/jrp.c
+++ b/.bin/jrp.c
@@ -202,6 +202,12 @@ static void jitSrc(const char *src) {
     }
 }
 
+static void jitDump(const char *path, FILE *file) {
+    size_t nitems = code.ptr - code.base;
+    size_t written = fwrite(code.base, sizeof(qop), nitems, file);
+    if (written < nitems) err(EX_IOERR, "%s", path);
+}
+
 static char *prompt(EditLine *el __attribute((unused))) {
     static char buf[4096];
     char *bufPtr = buf;
@@ -223,6 +229,13 @@ static char *prompt(EditLine *el __attribute((unused))) {
 }
 
 int main(int argc, char *argv[]) {
+    FILE *file = NULL;
+    char *path = getenv("JRP_DUMP");
+    if (path) {
+        file = fopen(path, "w");
+        if (!file) err(EX_CANTCREAT, "%s", path);
+    }
+
     jitInit();
     stackInit();
 
@@ -231,6 +244,7 @@ int main(int argc, char *argv[]) {
         for (int i = 1; i < argc; ++i)
             jitSrc(argv[i]);
         jitEnd();
+        if (file) jitDump(path, file);
         jitExec();
         return EX_OK;
     }
@@ -248,6 +262,7 @@ int main(int argc, char *argv[]) {
         jitBegin();
         jitSrc(line);
         jitEnd();
+        if (file) jitDump(path, file);
         jitExec();
     }
 
'2021-01-12 23:36:03 -0500'>2021-01-12Style causal.agency like bin HTMLJune McEnroe 2021-01-12Avoid matching tag text inside HTML elementsJune McEnroe 2021-01-12Use hilex for up -hJune McEnroe 2021-01-12Use hilex for bin HTMLJune McEnroe 2021-01-12Don't output a pre in hilex by defaultJune McEnroe 2021-01-12Move hilex out of hilex directoryJune McEnroe 2021-01-12Consolidate hilex formatters into hilex.cJune McEnroe 2021-01-12Remove hacky tagging from hilexJune McEnroe 2021-01-12Add htagml -iJune McEnroe 2021-01-12Render tag index in HTMLJune McEnroe 2021-01-12Add htagml -xJune McEnroe 2021-01-12Prevent matching the same tag twiceJune McEnroe 2021-01-12Process htagml file line by lineJune McEnroe 2021-01-12Split fields by tab onlyJune McEnroe 2021-01-12List both Makefile and html.sh under README.7June McEnroe 2021-01-12Add htagml exampleJune McEnroe 2021-01-12Use mandoc and htagml for bin htmlJune McEnroe 2021-01-12Add htagmlJune McEnroe 2021-01-12Replace causal.agency with a simple mdoc pageJune McEnroe 2021-01-11Publish "Using vi"June McEnroe 2021-01-11Enable diff.colorMovedJune McEnroe 2021-01-10Set less search case-insensitiveJune McEnroe 2021-01-10Set EXINITJune McEnroe 2021-01-09Add c -t flag to print expression typeJune McEnroe 2021-01-05Update taglineJune McEnroe