]> git.neil.brown.name Git - edlib.git/commitdiff
call macro rework step 5: comm_call
authorNeilBrown <neil@brown.name>
Thu, 21 Sep 2017 03:25:15 +0000 (05:25 +0200)
committerNeilBrown <neil@brown.name>
Thu, 21 Sep 2017 03:25:15 +0000 (05:25 +0200)
Used for callbacks.

Signed-off-by: NeilBrown <neil@brown.name>
29 files changed:
core-doc.c
core-editor.c
core.h
display-ncurses.c
doc-dir.c
doc-docs.c
doc-email.c
doc-multipart.c
doc-text.c
emacs-search.c
lib-base64.c
lib-crop.c
lib-history.c
lib-input.c
lib-keymap.c
lib-libevent.c
lib-messageline.c
lib-popup.c
lib-qprint.c
lib-renderline.c
lib-rfc822header.c
lib-tile.c
lib-utf8.c
lib-view.c
lib-viewer.c
render-complete.c
render-format.c
render-hex.c
render-lines.c

index c5bf15b010d2222ab9db4a71f628f577ba9fd3e3..11473bb87fc907fa39d532df22cfc44d07fb8e6d 100644 (file)
@@ -453,7 +453,7 @@ DEF_CMD(doc_get_attr)
                a = "no";
        if (a)
                return comm_call(ci->comm2, "callback:get_attr", ci->focus, 0,
-                                NULL, a, 0);
+                                NULL, a);
        /* Once a get-attr request reaches a document, it needs to stop there,
         * as parents might have a different idea about attributes, and about marks
         */
@@ -523,8 +523,8 @@ DEF_CMD(doc_vmarkget)
                m2 = doc_new_mark(ci->home->data, ci->numeric);
        if (ci->extra == 3 && ci->mark)
                m2 = do_vmark_at_or_before(ci->focus, ci->home->data, ci->mark, ci->numeric);
-       return comm_call7(ci->comm2, "callback:vmark", ci->focus,
-                         0, m, NULL, 0, NULL, m2);
+       return comm_call(ci->comm2, "callback:vmark", ci->focus,
+                        0, m, NULL, 0, m2);
 }
 
 DEF_CMD(doc_drop_cache)
@@ -757,7 +757,7 @@ DEF_CMD(doc_handle)
                        m = do_mark_at_point(pt, ci->extra);
 
                return comm_call(ci->comm2, "callback:dup-point", ci->focus,
-                                0, m, NULL, 0);
+                                0, m);
        }
 
        if (strcmp(ci->key, "doc:assign") == 0) {
@@ -767,7 +767,7 @@ DEF_CMD(doc_handle)
                p2 = doc_assign(ci->home, ci->focus, ci->numeric, ci->str);
                if (!p2)
                        return -1;
-               comm_call(ci->comm2, "callback:doc", p2, 0, NULL, NULL, 0);
+               comm_call(ci->comm2, "callback:doc", p2);
                return 1;
        }
 
@@ -783,7 +783,7 @@ DEF_CMD(doc_handle)
                a = pane_attr_get(dd->doc, ci->str);
                if (!a)
                        return 0;
-               return comm_call(ci->comm2, "callback", ci->focus, 0, NULL, a, 0);
+               return comm_call(ci->comm2, "callback", ci->focus, 0, NULL, a);
        }
 
        if (strcmp(ci->key, "Move-to") == 0) {
@@ -861,7 +861,7 @@ DEF_CMD(doc_do_attach)
        struct pane *p = doc_attach(ci->focus, NULL);
        if (!p)
                return -1;
-       return comm_call(ci->comm2, "callback:doc", p, 0, NULL, NULL, 0);
+       return comm_call(ci->comm2, "callback:doc", p);
 }
 
 DEF_CMD(doc_open)
@@ -926,8 +926,7 @@ DEF_CMD(doc_open)
        }
        if (fd != ci->numeric)
                close(fd);
-       return comm_call(ci->comm2, "callback", p, 0, NULL,
-                        NULL, 0);
+       return comm_call(ci->comm2, "callback", p);
 }
 
 struct pane *doc_attach_view(struct pane *parent safe, struct pane *doc safe, char *render)
@@ -957,8 +956,7 @@ DEF_CMD(doc_from_text)
                call("global-multicall-doc:appeared-", p, 1, NULL, NULL, 0);
        }
        call("doc:replace", p, 1, NULL, text, 1, NULL, NULL);
-       return comm_call(ci->comm2, "callback", p, 0, NULL,
-                        NULL, 0);
+       return comm_call(ci->comm2, "callback", p);
 }
 
 DEF_CMD(doc_str_callback)
index 69e08df36547335cade50459ec93c188dc5caebe..e6a09b1f68a10eeae221a632cd8df9e070e83e27 100644 (file)
@@ -70,8 +70,8 @@ DEF_CMD(global_get_command)
        if (!ci->str ||
            !(cm = key_lookup_cmd(map, ci->str)))
                return -1;
-       return comm_call8(ci->comm2, ci->focus, "callback:comm", ci->focus, 0, NULL, ci->str,
-                         0, NULL, NULL, cm);
+       return comm_call(ci->comm2, "callback:comm", ci->focus, 0, NULL, ci->str,
+                        0, NULL, NULL, cm);
 }
 
 DEF_CMD(editor_load_module)
@@ -165,7 +165,7 @@ DEF_CMD(editor_clean_up)
        while (ei->idle_calls) {
                struct idle_call *i = ei->idle_calls;
                ei->idle_calls = i->next;
-               comm_call(i->callback, "idle-callback", i->focus, 0, NULL, NULL, 0);
+               comm_call(i->callback, "idle-callback", i->focus);
                command_put(i->callback);
                free(i);
        }
diff --git a/core.h b/core.h
index fbd3f3dab047b0b5b9aeb51d34a9b45bf40f248b..f4bf9461cd3ab9b46656bcdcf7518dab46f2292a 100644 (file)
--- a/core.h
+++ b/core.h
@@ -523,7 +523,6 @@ static inline void doc_del_view(struct pane *p safe, int num)
        do_call(key, focus, 0, NULL, NULL, 0, NULL, NULL, comm2, 0, 0, NULL)
 
 
-
 static inline int do_call(char *key safe, struct pane *focus safe, int numeric, struct mark *m,
                          char *str, int extra, struct mark *m2, char *str2,
                          struct command *comm2, int x, int y, struct pane *home)
@@ -537,6 +536,49 @@ static inline int do_call(char *key safe, struct pane *focus safe, int numeric,
        return key_handle(&ci);
 }
 
+/* comm_call() is quite different to call*(). It calls a specific command,
+ * not a stack of panes.  The comm comes first.
+ * This is mostly used for callback.
+ */
+#define comm_call(...) VFUNC(comm_call, __VA_ARGS__)
+#define comm_call13(comm, key, focus, numeric, mark, str, extra, mark2, str2, comm2, x, y, home) \
+       do_comm_call(comm, key, focus, numeric, mark, str, extra, mark2, str2, comm2, x, y, home)
+#define comm_call12(comm, key, focus, numeric, mark, str, extra, mark2, str2, comm2, x, y) \
+       do_comm_call(comm, key, focus, numeric, mark, str, extra, mark2, str2, comm2, x, y, NULL)
+#define comm_call10(comm, key, focus, numeric, mark, str, extra, mark2, str2, comm2) \
+       do_comm_call(comm, key, focus, numeric, mark, str, extra, mark2, str2, comm2, 0, 0, NULL)
+#define comm_call9(comm, key, focus, numeric, mark, str, extra, mark2, str2) \
+       do_comm_call(comm, key, focus, numeric, mark, str, extra, mark2, str2, NULL, 0, 0, NULL)
+#define comm_call8(comm, key, focus, numeric, mark, str, extra, mark2) \
+       do_comm_call(comm, key, focus, numeric, mark, str, extra, mark2, NULL, NULL, 0, 0, NULL)
+#define comm_call7(comm, key, focus, numeric, mark, str, extra) \
+       do_comm_call(comm, key, focus, numeric, mark, str, extra, NULL, NULL, NULL, 0, 0, NULL)
+#define comm_call6(comm, key, focus, numeric, mark, str) \
+       do_comm_call(comm, key, focus, numeric, mark, str, 0, NULL, NULL, NULL, 0, 0, NULL)
+#define comm_call5(comm, key, focus, numeric, mark) \
+       do_comm_call(comm, key, focus, numeric, mark, NULL, 0, NULL, NULL, NULL, 0, 0, NULL)
+#define comm_call4(comm, key, focus, numeric) \
+       do_comm_call(comm, key, focus, numeric, NULL, NULL, 0, NULL, NULL, NULL, 0, 0, NULL)
+#define comm_call3(comm, key, focus) \
+       do_comm_call(comm, key, focus, 0, NULL, NULL, 0, NULL, NULL, NULL, 0, 0, NULL)
+
+static inline int do_comm_call(struct command *comm,
+                              char *key safe, struct pane *focus safe, int numeric, struct mark *m,
+                              char *str, int extra, struct mark *m2, char *str2,
+                              struct command *comm2, int x, int y, struct pane *home)
+{
+       struct cmd_info ci = {.key = key, .focus = focus, .home = home ?: focus,
+                             .numeric = numeric, .mark = m, .str = str,
+                             .extra = extra, .mark2 = m2, .str2 = str2,
+                             .comm2 = comm2, .x = x, .y = y,
+                             .comm = safe_cast 0};
+
+       if (!comm)
+               return -1;
+       ci.comm = comm;
+       return ci.comm->func(&ci);
+}
+
 struct call_return {
        struct command c;
        struct mark *m, *m2;
@@ -547,36 +589,6 @@ struct call_return {
        struct command *comm;
 };
 
-static inline int comm_call(struct command *comm, char *key safe, struct pane *focus safe,
-                           int numeric, struct mark *m, char *str, int extra)
-{
-       struct cmd_info ci = {.key = key, .focus = focus, .home = focus, .comm = safe_cast 0};
-
-       if (!comm)
-               return -1;
-       ci.numeric = numeric;
-       ci.mark = m;
-       ci.str = str;
-       ci.extra = extra;
-       ci.comm = comm;
-       return ci.comm->func(&ci);
-}
-
-static inline int comm_call_xy(struct command *comm, char *key safe, struct pane *focus safe,
-                              int numeric, int extra, int x, int y)
-{
-       struct cmd_info ci = {.key = key, .focus = focus, .home = focus, .comm = safe_cast 0};
-
-       if (!comm)
-               return -1;
-       ci.numeric = numeric;
-       ci.extra = extra;
-       ci.x = x;
-       ci.y = y;
-       ci.comm = comm;
-       return ci.comm->func(&ci);
-}
-
 static inline int comm_call_pane(struct pane *home, char *key safe,
                                 struct pane *focus safe,
                                 int numeric, struct mark *m, char *str, int extra,
@@ -618,44 +630,3 @@ static inline int comm_call_pane8(struct pane *home, char *key safe,
        ci.comm2 = comm2;
        return ci.comm->func(&ci);
 }
-
-static inline int comm_call7(struct command *comm, char *key safe,
-                            struct pane *focus safe,
-                            int numeric, struct mark *m, char *str,
-                            int extra, char *str2, struct mark *m2)
-{
-       struct cmd_info ci = {.key = key, .focus = focus, .home = focus, .comm = safe_cast 0};
-
-       if (!comm)
-               return -1;
-       ci.numeric = numeric;
-       ci.mark = m;
-       ci.mark2 = m2;
-       ci.str = str;
-       ci.str2 = str2;
-       ci.extra = extra;
-       ci.comm = comm;
-       return ci.comm->func(&ci);
-}
-
-static inline int comm_call8(struct command *comm, struct pane *home safe,
-                            char *key safe,
-                            struct pane *focus safe,
-                            int numeric, struct mark *m, char *str,
-                            int extra, char *str2, struct mark *m2,
-                            struct command *comm2)
-{
-       struct cmd_info ci = {.key = key, .focus = focus, .home = home, .comm = safe_cast 0};
-
-       if (!comm)
-               return -1;
-       ci.numeric = numeric;
-       ci.mark = m;
-       ci.mark2 = m2;
-       ci.str = str;
-       ci.str2 = str2;
-       ci.extra = extra;
-       ci.comm = comm;
-       ci.comm2 = comm2;
-       return ci.comm->func(&ci);
-}
index 9f1a5e7fb32a708117d7e5f2314e8dc67be421af..7380a8fff10741c6f7d042353bd968a5b2d88bf5 100644 (file)
@@ -153,8 +153,9 @@ DEF_CMD(ncurses_handle)
                        if (size <= max_space)
                                max_bytes = offset;
                }
-               return comm_call_xy(ci->comm2, "callback:size", ci->focus,
-                                   max_bytes, 0, size, 1);
+               return comm_call(ci->comm2, "callback:size", ci->focus,
+                                max_bytes, NULL, NULL,
+                                0, NULL, NULL, NULL, size, 1);
        }
        if (strcmp(ci->key, "Draw:text") == 0 && ci->str) {
                int attr = cvt_attrs(ci->str2);
@@ -442,8 +443,7 @@ DEF_CMD(display_ncurses)
 {
        struct pane *p = ncurses_init(ci->focus);
        if (p)
-               return comm_call(ci->comm2, "callback:display", p, 0, NULL,
-                                NULL, 0);
+               return comm_call(ci->comm2, "callback:display", p);
        return -1;
 }
 
index 1e72df1a54f45af943164b7d6fc5ebf807a21d8f..ba6713ae0f6bcbd6880753664b66673de9f8b2f0 100644 (file)
--- a/doc-dir.c
+++ b/doc-dir.c
@@ -129,7 +129,7 @@ DEF_CMD(dir_new)
        p = pane_register(ci->home, 0, &doc_handle.c, &dr->doc, NULL);
        dr->doc.home = p;
        if (p)
-               return comm_call(ci->comm2, "callback:doc", p, 0, NULL, NULL, 0);
+               return comm_call(ci->comm2, "callback:doc", p);
        return -1;
 }
 
@@ -500,8 +500,7 @@ DEF_CMD(dir_doc_get_attr)
 
        if (!val)
                return 0;
-       comm_call(ci->comm2, "callback:get_attr", ci->focus,
-                 0, NULL, val, 0);
+       comm_call(ci->comm2, "callback:get_attr", ci->focus, 0, NULL, val);
        return 1;
 }
 
@@ -529,8 +528,7 @@ DEF_CMD(dir_get_attr)
                val = dr->fname;
        else
                return 0;
-       comm_call(ci->comm2, "callback:get_attr", ci->focus,
-                 0, NULL, val, 0);
+       comm_call(ci->comm2, "callback:get_attr", ci->focus, 0, NULL, val);
        return 1;
 }
 
index 282dfecb1150b11184eb28e2ba612058de3855dd..24e74b5f9cea1bcf1461d36b3c3eef8b643fcfcb 100644 (file)
@@ -272,7 +272,7 @@ DEF_CMD(docs_modified_handle)
                        prev_modified(ci->home->parent, m);
                attr = pane_mark_attr(ci->home->parent, m, 1, ci->str);
                mark_free(m);
-               comm_call(ci->comm2, "callback:get_attr", ci->focus, 0, NULL, attr, 0);
+               comm_call(ci->comm2, "callback:get_attr", ci->focus, 0, NULL, attr);
                return 1;
        }
        if (strcmp(ci->key, "doc:mark-same") == 0 &&
@@ -301,7 +301,7 @@ DEF_CMD(docs_modified_handle)
            ci->str &&
            strcmp(ci->str, "doc-name") == 0)
                return comm_call(ci->comm2, "callback:get_attr", ci->focus,
-                                0, NULL, "*Modified Documents*", 0);
+                                0, NULL, "*Modified Documents*");
 
        return 0;
 }
@@ -313,14 +313,12 @@ DEF_CMD(docs_callback)
 
        if (strcmp(ci->key, "docs:byname") == 0) {
                if (ci->str == NULL || strcmp(ci->str, "*Documents*") == 0)
-                       return comm_call(ci->comm2, "callback:doc", doc->doc.home,
-                                        0, NULL, NULL, 0);
+                       return comm_call(ci->comm2, "callback:doc", doc->doc.home);
                list_for_each_entry(p, &doc->collection->children, siblings) {
                        struct doc *dc = p->data;
                        char *n = dc->name;
                        if (n && strcmp(ci->str, n) == 0)
-                               return comm_call(ci->comm2, "callback:doc", p, 0,
-                                                NULL, NULL, 0);
+                               return comm_call(ci->comm2, "callback:doc", p);
                }
                return -1;
        }
@@ -328,8 +326,7 @@ DEF_CMD(docs_callback)
                list_for_each_entry(p, &doc->collection->children, siblings) {
                        if (call("doc:same-file", p, 0, NULL, ci->str,
                                 ci->extra) > 0)
-                               return comm_call(ci->comm2, "callback:doc", p, 0,
-                                                NULL, NULL, 0);
+                               return comm_call(ci->comm2, "callback:doc", p);
                }
                return -1;
        }
@@ -356,8 +353,7 @@ DEF_CMD(docs_callback)
                        choice = last;
                if (!choice)
                        choice = doc->doc.home;
-               return comm_call(ci->comm2, "callback:doc", choice, 0,
-                                NULL, NULL, 0);
+               return comm_call(ci->comm2, "callback:doc", choice);
        }
 
        if (strcmp(ci->key, "docs:save-all") == 0) {
@@ -571,8 +567,7 @@ DEF_CMD(docs_doc_get_attr)
 
        if (!val)
                return 0;
-       comm_call(ci->comm2, "callback:get_attr", ci->focus,
-                 0, NULL, val, 0);
+       comm_call(ci->comm2, "callback:get_attr", ci->focus, 0, NULL, val);
        return 1;
 }
 
@@ -599,7 +594,7 @@ DEF_CMD(docs_get_attr)
                return 0;
 
        comm_call(ci->comm2, "callback:get_attr", ci->focus,
-                 0, NULL, val, 0);
+                 0, NULL, val);
        return 1;
 }
 
@@ -838,7 +833,7 @@ DEF_CMD(attach_docs)
 
        call_home(p, "doc:set-parent", doc->collection);
 
-       return comm_call(ci->comm2, "callback:doc", doc->doc.home, 0, NULL, NULL, 0);
+       return comm_call(ci->comm2, "callback:doc", doc->doc.home);
 }
 
 void edlib_init(struct pane *ed safe)
index 258285e2d2161e851b1460fcaf7bad8bca236072..cce3ce223b0433e18d1fc6c5aca7b778f01d2e65 100644 (file)
@@ -128,7 +128,7 @@ DEF_CMD(email_spacer)
        }
 
        ret = comm_call(ci->comm2, "callback:render", ci->focus, 0, NULL,
-                       buf_final(&b), 0);
+                       buf_final(&b));
        free(b.b);
        return ret;
 }
@@ -189,7 +189,7 @@ DEF_CMD(email_get_attr)
                fields += 1;
        }
        sprintf(ret, "%d", fields);
-       return comm_call(ci->comm2, "callback", ci->focus, 0, ci->mark, ret, 0);
+       return comm_call(ci->comm2, "callback", ci->focus, 0, ci->mark, ret);
 }
 static struct map *email_map safe;
 
@@ -598,7 +598,7 @@ DEF_CMD(open_email)
                attr_set_str(&h->attrs, "render-default", "text");
                attr_set_str(&p->attrs, "filename", ci->str+6);
                attr_set_str(&p->attrs, "doc-type", "email");
-               return comm_call(ci->comm2, "callback:attach", h, 0, NULL, NULL, 0);
+               return comm_call(ci->comm2, "callback:attach", h);
        }
 out:
        mark_free(start);
index 82ce1b79408acb6cf77c2c4c0110f45a62e76576..1949822941c0055dcf9cc1648a2ad84018e7c469 100644 (file)
@@ -345,9 +345,9 @@ DEF_CMD(mp_attr)
        if (strcmp(attr, "multipart:visible") == 0) {
                if (d >= 0 && d < mpi->nparts &&
                    mpi->parts[d].visible)
-                       comm_call(ci->comm2, "callback:get_attr", ci->focus, 0, NULL, "1", 0);
+                       comm_call(ci->comm2, "callback:get_attr", ci->focus, 0, NULL, "1");
                else
-                       comm_call(ci->comm2, "callback:get_attr", ci->focus, 0, NULL, "0", 0);
+                       comm_call(ci->comm2, "callback:get_attr", ci->focus, 0, NULL, "0");
                return 1;
        }
 
@@ -358,8 +358,7 @@ DEF_CMD(mp_attr)
                /* Get a pane attribute, not char attribute */
                char *s = pane_attr_get(mpi->parts[d].pane, attr);
                if (s)
-                       return comm_call(ci->comm2, "callback", ci->focus, 0, NULL,
-                                        s, 0);
+                       return comm_call(ci->comm2, "callback", ci->focus, 0, NULL, s);
                return 1;
        }
 
@@ -566,7 +565,7 @@ DEF_CMD(attach_mp)
        h = pane_register(ci->home, 0, &mp_handle.c, &mpi->doc, NULL);
        mpi->doc.home = h;
        if (h)
-               return comm_call(ci->comm2, "callback:doc", h, 0, NULL, NULL, 0);
+               return comm_call(ci->comm2, "callback:doc", h);
 
 
        free(mpi);
index 4b3afa5371e96da63cb10a0ef22a80629271ef3c..09b66a9943761e9673d0325d22bccce72bb89712 100644 (file)
@@ -1171,7 +1171,7 @@ DEF_CMD(text_new)
        p = pane_register(ci->home, 0, &text_handle.c, &t->doc, NULL);
        t->doc.home = p;
        if (p)
-               return comm_call(ci->comm2, "callback:doc", p, 0, NULL, NULL, 0);
+               return comm_call(ci->comm2, "callback:doc", p);
        return -1;
 }
 
@@ -1271,7 +1271,7 @@ DEF_CMD(text_get_str)
                        break;
        }
        ret[l] = 0;
-       comm_call(ci->comm2, "callback:get-str", ci->focus, 0, NULL, ret, 0);
+       comm_call(ci->comm2, "callback:get-str", ci->focus, 0, NULL, ret);
        free(ret);
        return 1;
 }
@@ -1658,14 +1658,14 @@ DEF_CMD(text_doc_get_attr)
                return -1;
        a = text_attrset(d, m, forward, &o);
        val = attr_get_str(a, attr, o);
-       comm_call(ci->comm2, "callback:get_attr", ci->focus, 0, NULL, val, 0);
+       comm_call(ci->comm2, "callback:get_attr", ci->focus, 0, NULL, val);
        if (ci->extra == 1) {
                char *key = attr;
                int len = strlen(attr);
                while ((key = attr_get_next_key(a, key, o, &val)) != NULL &&
                       strncmp(key, attr, len) == 0)
-                       comm_call7(ci->comm2, "callback:get_attr", ci->focus, 0, NULL, val, 0,
-                                  key, NULL);
+                       comm_call(ci->comm2, "callback:get_attr", ci->focus, 0, NULL, val, 0,
+                                  NULL, key);
        }
        return 1;
 }
@@ -1693,7 +1693,7 @@ DEF_CMD(text_get_attr)
        else
                return 0;
 
-       comm_call(ci->comm2, "callback:get_attr", ci->focus, 0, NULL, val, 0);
+       comm_call(ci->comm2, "callback:get_attr", ci->focus, 0, NULL, val);
        return 1;
 }
 
index 436c35b8db41ed2c8f294b20f16fb4bce500d356..2818dfab7f0145f6a652b4f5d3766d651f02c0ee 100644 (file)
@@ -264,7 +264,7 @@ DEF_CMD(emacs_search)
        p = pane_register(ci->focus, 0, &search_handle.c, esi, NULL);
        if (p) {
                call("Request:Notify:doc:Replace", p);
-               comm_call(ci->comm2, "callback:attach", p, 0, NULL, NULL, 0);
+               comm_call(ci->comm2, "callback:attach", p);
        }
        return 1;
 }
index cca9bf871a0b6f7d885fc5f96424fb810e71002d..8adc0019867c237eebe4876b3fc02aa216be2936 100644 (file)
@@ -223,7 +223,7 @@ DEF_CMD(b64_attach)
        }
        call("doc:set:filter", p, 1, NULL, NULL, 0);
 
-       return comm_call(ci->comm2, "callback:attach", p, 0, NULL, NULL, 0);
+       return comm_call(ci->comm2, "callback:attach", p);
 }
 
 void edlib_init(struct pane *ed safe)
index fd13eb6a312f618f45e8f4f74b789c4fbb38672e..f5d66aee81739149c7bb658079833fba1e8132db 100644 (file)
@@ -122,7 +122,7 @@ DEF_CMD(crop_attach)
        cd->start = mark_dup(ci->mark, 1);
        cd->end = mark_dup(ci->mark2, 1);
 
-       return comm_call(ci->comm2, "callback:attach", p, 0, NULL, NULL, 0);
+       return comm_call(ci->comm2, "callback:attach", p);
 }
 
 void edlib_init(struct pane *ed safe)
index be7a0adfe597a0d63be136b5a307939456ea0af1..2c9fa45c798a85fbdcca8acd97639ce7f4159b64 100644 (file)
@@ -147,7 +147,7 @@ DEF_CMD(history_attach)
        p = pane_register(ci->focus, 0, &history_handle, hi, NULL);
        pane_add_notify(p, hi->history, "Notify:Close");
        call("Request:Notify:doc:Replace", p);
-       return comm_call(ci->comm2, "callback:attach", p, 0, NULL, NULL, 0);
+       return comm_call(ci->comm2, "callback:attach", p);
 }
 
 void edlib_init(struct pane *ed safe)
index 6ece5bf8ec58c00c01eddeaab99940803c7609a1..921ada0e773e0ef95536716b3c7ba06ca00a60a4 100644 (file)
@@ -182,7 +182,7 @@ DEF_CMD(input_attach)
 
        p = pane_register(ci->focus, 0, &input_handle.c, im, NULL);
        if (p)
-               return comm_call(ci->comm2, "callback:attach", p, 0, NULL, NULL, 0);
+               return comm_call(ci->comm2, "callback:attach", p);
        return -1;
 }
 
index 7c371c4fbb821231aafa9762f93464475a322297..397359720df3a11dbe145927a0cee0b23ef1ebfd 100644 (file)
@@ -164,7 +164,7 @@ DEF_CMD(keymap_attach)
 {
        struct pane *p = do_keymap_attach(ci->focus, 1);
        if (p)
-               return comm_call(ci->comm2, "callback:attach", p, 0, NULL, NULL, 0);
+               return comm_call(ci->comm2, "callback:attach", p);
        return -1;
 }
 
index 8f8defca7ddc89a5390fca8b0bf285725254bfc2..dc4bb99ee643913e1b00d47c9557e354a8fd47f0 100644 (file)
@@ -36,8 +36,7 @@ static void call_event(int thing, short sev, void *evv)
        int ret;
        int oldfd = ev->fd;
 
-       if ((ret=comm_call(ev->comm, "callback:event", ev->home, thing,
-                          NULL, NULL, 0)) < 0) {
+       if ((ret=comm_call(ev->comm, "callback:event", ev->home, thing)) < 0) {
                if (oldfd == ev->fd)
                        /* No early removal */
                        event_del(ev->l);
@@ -52,8 +51,7 @@ static void call_timeout_event(int thing, short sev, void *evv)
 {
        struct evt *ev safe = safe_cast evv;
 
-       if (comm_call(ev->comm, "callback:event", ev->home, thing,
-                     NULL, NULL, 0) < 0) {
+       if (comm_call(ev->comm, "callback:event", ev->home, thing) < 0) {
                event_free(ev->l);
                list_del(&ev->lst);
                command_put(ev->comm);
index 8d4dde916c7f9fe24f44f0b88e8de3583d601584..298e60f0e94b27972769957926422660cd62e99c 100644 (file)
@@ -153,7 +153,7 @@ DEF_CMD(messageline_attach)
        ret = do_messageline_attach(ci->focus);
        if (!ret)
                return -1;
-       return comm_call(ci->comm2, "callback:attach", ret, 0, NULL, NULL, 0);
+       return comm_call(ci->comm2, "callback:attach", ret);
 }
 
 void edlib_init(struct pane *ed safe)
index 6730e24ba85270a59a33cdb4841846260ad47b61..2fe9946a41c9771e0a7b1e0a7f5c17f26e905486 100644 (file)
@@ -112,8 +112,7 @@ DEF_CMD(popup_handle)
                return 1;
        }
        if (strcmp(ci->key, "popup:get-target") == 0)
-               return comm_call(ci->comm2, "callback:get-target",
-                                ppi->target, 0, NULL, NULL, 0);
+               return comm_call(ci->comm2, "callback:get-target", ppi->target);
 
        if (strcmp(ci->key, "popup:close") == 0) {
                char *key, *str;
@@ -203,7 +202,7 @@ DEF_CMD(popup_attach)
 
        if (!p)
                return -1;
-       return comm_call(ci->comm2, "callback:attach", p, 0, NULL, NULL, 0);
+       return comm_call(ci->comm2, "callback:attach", p);
 }
 
 void edlib_init(struct pane *ed safe)
index 7533ea887d42eeaa7bce611d7582c4505e2e0e49..a13efd48b47c1aeba6cd95d967fcc06924043ef1 100644 (file)
@@ -208,7 +208,7 @@ DEF_CMD(qp_attach)
                return -1;
        call("doc:set:filter", p, 1, NULL, NULL, 0);
 
-       return comm_call(ci->comm2, "callback:attach", p, 0, NULL, NULL, 0);
+       return comm_call(ci->comm2, "callback:attach", p);
 }
 
 void edlib_init(struct pane *ed safe)
index dc489e3669b9a1a3b8ac97c0b2f767635f124a11..d6ff1074aca9f9ef86af84ea33edf86a20d8ce31 100644 (file)
@@ -327,7 +327,7 @@ DEF_CMD(render_line)
        }
 
        ret = comm_call(ci->comm2, "callback:render", ci->focus, 0, NULL,
-                       buf_final(&b), 0);
+                       buf_final(&b));
        free(b.b);
        return ret;
 }
@@ -352,7 +352,7 @@ DEF_CMD(renderline_attach)
        ret = do_renderline_attach(ci->focus);
        if (!ret)
                return -1;
-       return comm_call(ci->comm2, "callback:attach", ret, 0, NULL, NULL, 0);
+       return comm_call(ci->comm2, "callback:attach", ret);
 }
 
 DEF_CMD(rl_clone)
index 349f9950591ac893279148082cc036ad8de87f70..4d7294f1509e17ab2d1b3bc17d082755d8497e87 100644 (file)
@@ -424,7 +424,7 @@ DEF_CMD(header_attach)
        if (start && end)
                find_headers(p, start, end);
 
-       return comm_call(ci->comm2, "callback:attach", p, 0, NULL, NULL, 0);
+       return comm_call(ci->comm2, "callback:attach", p);
 }
 
 void edlib_init(struct pane *ed safe)
index 15759b54ec24ed4714c0059a187cca9228959323..f21a01905bcd94895439ae1f8d363718cefddcd9 100644 (file)
@@ -145,7 +145,7 @@ DEF_CMD(tile_attach)
                ti->name = strdup(ci->str2);
        INIT_LIST_HEAD(&ti->tiles);
        attr_set_str(&p->attrs, "borders", "BL");
-       return comm_call(ci->comm2, "callback:attach", p, 0, NULL, NULL, 0);
+       return comm_call(ci->comm2, "callback:attach", p);
 }
 
 static struct pane *tile_split(struct pane **pp safe, int horiz, int after, char *name,
@@ -784,8 +784,7 @@ DEF_CMD(tile_other)
 
        ti2 = tile_next_named(ti, ci->str2);
        if (ti2 != ti)
-               return comm_call(ci->comm2, "callback:pane", ti2->p, 0,
-                                NULL, NULL, 0);
+               return comm_call(ci->comm2, "callback:pane", ti2->p);
 
        /* Need to create a tile.  If wider than 120 (FIXME configurable?),
         * horiz-split else vert
@@ -800,8 +799,7 @@ DEF_CMD(tile_other)
                p2 = tile_split(&p, p->w * 1000 >= 1200 * xy.x, 1, ci->str2, 0);
        }
        if (p2)
-               return comm_call(ci->comm2, "callback:pane", p2, 0,
-                                NULL, NULL, 0);
+               return comm_call(ci->comm2, "callback:pane", p2);
        return -1;
 }
 
@@ -818,7 +816,7 @@ DEF_CMD(tile_this)
                /* same group - continue */
        }
        return comm_call(ci->comm2, "callback:pane", ci->home, 0,
-                        NULL, ti->name, 0);
+                        NULL, ti->name);
 }
 
 DEF_CMD(tile_root)
@@ -836,8 +834,7 @@ DEF_CMD(tile_root)
                /* same group - continue */
        }
 
-       return comm_call(ci->comm2, "callback:pane", p, 0,
-                        NULL, NULL, 0);
+       return comm_call(ci->comm2, "callback:pane", p);
 }
 
 DEF_CMD(tile_child_closed)
index f9c504420150b4c50e09890ed35d0c303f033959..473a1f965aeed89ef4eed7ca63cb6af2abb155b8 100644 (file)
@@ -90,7 +90,7 @@ DEF_CMD(utf8_attach)
                return -1;
        call("doc:set:filter", p, 1, NULL, NULL, 0);
 
-       return comm_call(ci->comm2, "callback:attach", p, 0, NULL, NULL, 0);
+       return comm_call(ci->comm2, "callback:attach", p);
 }
 
 void edlib_init(struct pane *ed safe)
index 1163706471ac88103be9fdee3333385da9ea8696..e2da604a5ef446f3cab0d8da125511b9a5f1520b 100644 (file)
@@ -294,10 +294,8 @@ DEF_CMD(view_attach)
        if (strchr(borderstr, 'L')) borders |= BORDER_LEFT;
        if (strchr(borderstr, 'R')) borders |= BORDER_RIGHT;
 
-       return comm_call(ci->comm2, "callback:attach", do_view_attach(ci->focus, borders),
-                        0, NULL, NULL, 0);
+       return comm_call(ci->comm2, "callback:attach", do_view_attach(ci->focus, borders));
 }
-
 DEF_CMD(view_click)
 {
        struct pane *p = ci->home;
index d3d9e014e976f14e3739c25728dee881999865e2..45204a49ca5dab1ab3831446cb46f13cbad24b00 100644 (file)
@@ -28,8 +28,7 @@ static struct pane *safe do_viewer_attach(struct pane *par)
 
 DEF_CMD(viewer_attach)
 {
-       return comm_call(ci->comm2, "callback:attach", do_viewer_attach(ci->focus),
-                        0, NULL, NULL, 0);
+       return comm_call(ci->comm2, "callback:attach", do_viewer_attach(ci->focus));
 }
 
 DEF_CMD(no_replace)
index fe1f827a15ca40c2e0fe12390f2b2c01a1ecee3c..880eb632bc87ad3411168394ece2ceb34c89430b 100644 (file)
@@ -88,7 +88,7 @@ DEF_CMD(render_complete_line)
                      0, ci->mark2, &cr.c) == 0)
                return 0;
 
-       ret = comm_call(ci->comm2, "callback:render", ci->focus, 0, NULL, cr.s, 0);
+       ret = comm_call(ci->comm2, "callback:render", ci->focus, 0, NULL, cr.s);
        free(cr.s);
        if (ci->numeric != NO_NUMERIC)
                return ret;
@@ -252,9 +252,9 @@ DEF_CMD(complete_eol)
        while (rpt > 1) {
                struct call_return cr;
                cr.c = eol_cb;
-               if (comm_call8(&render_complete_line, ci->home, "render-line",
-                              ci->focus, NO_NUMERIC, ci->mark, NULL,
-                              0, NULL, NULL, &cr.c) <= 0)
+               if (comm_call(&render_complete_line, "render-line",
+                             ci->focus, NO_NUMERIC, ci->mark, NULL,
+                             0, NULL, NULL, &cr.c, 0, 0, ci->home) <= 0)
                        rpt = 1;
                rpt -= 1;
        }
@@ -307,7 +307,7 @@ DEF_CMD(complete_set_prefix)
                        common[common_len(c, common)] = 0;
                cnt += 1;
        }
-       comm_call(ci->comm2, "callback:prefix", ci->focus, 0, NULL, common, 0);
+       comm_call(ci->comm2, "callback:prefix", ci->focus, 0, NULL, common);
        free(common);
        call("Move-to", ci->focus, 0, m);
        mark_free(m);
@@ -336,9 +336,9 @@ DEF_CMD(complete_return)
 
        cr.c = save_str;
        cr.s = NULL;
-       comm_call8(&render_complete_line, ci->home, "render-line",
-                  ci->home, NO_NUMERIC, ci->mark, NULL, 0, NULL,
-                  NULL, &cr.c);
+       comm_call(&render_complete_line, "render-line",
+                 ci->home, NO_NUMERIC, ci->mark, NULL, 0, NULL,
+                 NULL, &cr.c, 0, 0, ci->home);
        if (!cr.s)
                return 1;
        l = strlen(cr.s);
@@ -403,7 +403,7 @@ REDEF_CMD(complete_attach)
        }
        cd->prefix = strdup("");
 
-       return comm_call(ci->comm2, "callback:attach", complete, 0, NULL, NULL, 0);
+       return comm_call(ci->comm2, "callback:attach", complete);
 }
 
 void edlib_init(struct pane *ed safe)
index aa9b3f91184e2e9ebb8729bfa7669482234ef933..b127f75d64871493f030331304734cd60a77defd 100644 (file)
@@ -157,7 +157,7 @@ endwhile:
                }
        }
        rv = comm_call(ci->comm2, "callback:render", ci->focus, 0, NULL,
-                      buf_final(&ret), 0);
+                      buf_final(&ret));
        free(ret.b);
        return rv;
 }
@@ -205,7 +205,7 @@ DEF_CMD(format_get_attr)
            strcmp(ci->str, "renderline:fields") != 0)
                return 0;
        sprintf(attr, "%u:%u", rf->home_field, rf->fields);
-       return comm_call(ci->comm2, "attr", ci->focus, 0, ci->mark, attr, 0);
+       return comm_call(ci->comm2, "attr", ci->focus, 0, ci->mark, attr);
 }
 
 static struct map *rf_map;
@@ -244,7 +244,7 @@ DEF_CMD(render_format_attach)
        p = do_render_format_attach(ci->focus);
        if (!p)
                return -1;
-       return comm_call(ci->comm2, "callback:attach", p, 0, NULL, NULL, 0);
+       return comm_call(ci->comm2, "callback:attach", p, 0, NULL, NULL);
 }
 
 void edlib_init(struct pane *ed safe)
index b42e750c1208f05b3fea0d3e982b9e7744226ee4..2c4c289c2b560922044748d7fe2f647312ecce78 100644 (file)
@@ -158,7 +158,7 @@ done:
        if (m)
                mark_free(m);
        rv = comm_call(ci->comm2, "callback:render", ci->focus, 0, NULL,
-                      buf_final(&ret), 0);
+                      buf_final(&ret));
        free(ret.b);
        return rv;
 }
@@ -221,9 +221,7 @@ DEF_CMD(render_hex_attach)
 
        if (!p)
                return -1;
-       return comm_call(ci->comm2, "callback:attach",
-                        p,
-                        0, NULL, NULL, 0);
+       return comm_call(ci->comm2, "callback:attach", p);
 }
 
 DEF_CMD(hex_appeared)
index e7e9b59a86d2e1aefed5a4eb0c1bc22c5cc29291..4de6c762ec6d84d5d7d941157c617977d75b7566 100644 (file)
@@ -1736,8 +1736,7 @@ REDEF_CMD(render_lines_attach)
        p = pane_register(p, 0, &render_lines_handle.c, rl, NULL);
        call("Request:Notify:doc:Replace", p, 0, NULL);
 
-       return comm_call(ci->comm2, "callback:attach", p,
-                        0, NULL, NULL, 0);
+       return comm_call(ci->comm2, "callback:attach", p);
 }
 
 void edlib_init(struct pane *ed safe)