Browse Source

ncd: modules: remove call module, and rename the call2() command from the call2 module to call(). This way the call() command
remains the same, but callrefhere() is gone for good.

ambrop7 13 years ago
parent
commit
520cec03fd

+ 0 - 1
blog_channels.txt

@@ -20,7 +20,6 @@ ncd_run 4
 ncd_runonce 4
 ncd_runonce 4
 ncd_daemon 4
 ncd_daemon 4
 ncd_spawn 4
 ncd_spawn 4
-ncd_call 4
 ncd_imperative 4
 ncd_imperative 4
 ncd_ref 4
 ncd_ref 4
 ncd_index 4
 ncd_index 4

+ 0 - 4
generated/blog_channel_ncd_call.h

@@ -1,4 +0,0 @@
-#ifdef BLOG_CURRENT_CHANNEL
-#undef BLOG_CURRENT_CHANNEL
-#endif
-#define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_call

+ 116 - 117
generated/blog_channels_defines.h

@@ -20,120 +20,119 @@
 #define BLOG_CHANNEL_ncd_runonce 19
 #define BLOG_CHANNEL_ncd_runonce 19
 #define BLOG_CHANNEL_ncd_daemon 20
 #define BLOG_CHANNEL_ncd_daemon 20
 #define BLOG_CHANNEL_ncd_spawn 21
 #define BLOG_CHANNEL_ncd_spawn 21
-#define BLOG_CHANNEL_ncd_call 22
-#define BLOG_CHANNEL_ncd_imperative 23
-#define BLOG_CHANNEL_ncd_ref 24
-#define BLOG_CHANNEL_ncd_index 25
-#define BLOG_CHANNEL_ncd_alias 26
-#define BLOG_CHANNEL_ncd_process_manager 27
-#define BLOG_CHANNEL_ncd_ondemand 28
-#define BLOG_CHANNEL_ncd_foreach 29
-#define BLOG_CHANNEL_ncd_choose 30
-#define BLOG_CHANNEL_ncd_net_backend_waitdevice 31
-#define BLOG_CHANNEL_ncd_net_backend_waitlink 32
-#define BLOG_CHANNEL_ncd_net_backend_badvpn 33
-#define BLOG_CHANNEL_ncd_net_backend_wpa_supplicant 34
-#define BLOG_CHANNEL_ncd_net_backend_rfkill 35
-#define BLOG_CHANNEL_ncd_net_up 36
-#define BLOG_CHANNEL_ncd_net_dns 37
-#define BLOG_CHANNEL_ncd_net_iptables 38
-#define BLOG_CHANNEL_ncd_net_ipv4_addr 39
-#define BLOG_CHANNEL_ncd_net_ipv4_route 40
-#define BLOG_CHANNEL_ncd_net_ipv4_dhcp 41
-#define BLOG_CHANNEL_ncd_net_ipv4_arp_probe 42
-#define BLOG_CHANNEL_ncd_net_watch_interfaces 43
-#define BLOG_CHANNEL_ncd_sys_watch_input 44
-#define BLOG_CHANNEL_ncd_sys_watch_usb 45
-#define BLOG_CHANNEL_ncd_sys_evdev 46
-#define BLOG_CHANNEL_ncd_sys_watch_directory 47
-#define BLOG_CHANNEL_StreamPeerIO 48
-#define BLOG_CHANNEL_DatagramPeerIO 49
-#define BLOG_CHANNEL_BReactor 50
-#define BLOG_CHANNEL_BSignal 51
-#define BLOG_CHANNEL_FragmentProtoAssembler 52
-#define BLOG_CHANNEL_BPredicate 53
-#define BLOG_CHANNEL_ServerConnection 54
-#define BLOG_CHANNEL_Listener 55
-#define BLOG_CHANNEL_DataProto 56
-#define BLOG_CHANNEL_FrameDecider 57
-#define BLOG_CHANNEL_BSocksClient 58
-#define BLOG_CHANNEL_BDHCPClientCore 59
-#define BLOG_CHANNEL_BDHCPClient 60
-#define BLOG_CHANNEL_NCDIfConfig 61
-#define BLOG_CHANNEL_BUnixSignal 62
-#define BLOG_CHANNEL_BProcess 63
-#define BLOG_CHANNEL_PRStreamSink 64
-#define BLOG_CHANNEL_PRStreamSource 65
-#define BLOG_CHANNEL_PacketProtoDecoder 66
-#define BLOG_CHANNEL_DPRelay 67
-#define BLOG_CHANNEL_BThreadWork 68
-#define BLOG_CHANNEL_DPReceive 69
-#define BLOG_CHANNEL_BInputProcess 70
-#define BLOG_CHANNEL_NCDUdevMonitorParser 71
-#define BLOG_CHANNEL_NCDUdevMonitor 72
-#define BLOG_CHANNEL_NCDUdevCache 73
-#define BLOG_CHANNEL_NCDUdevManager 74
-#define BLOG_CHANNEL_BTime 75
-#define BLOG_CHANNEL_BEncryption 76
-#define BLOG_CHANNEL_SPProtoDecoder 77
-#define BLOG_CHANNEL_LineBuffer 78
-#define BLOG_CHANNEL_BTap 79
-#define BLOG_CHANNEL_lwip 80
-#define BLOG_CHANNEL_NCDConfigTokenizer 81
-#define BLOG_CHANNEL_NCDConfigParser 82
-#define BLOG_CHANNEL_NCDValParser 83
-#define BLOG_CHANNEL_nsskey 84
-#define BLOG_CHANNEL_addr 85
-#define BLOG_CHANNEL_PasswordListener 86
-#define BLOG_CHANNEL_NCDInterfaceMonitor 87
-#define BLOG_CHANNEL_NCDRfkillMonitor 88
-#define BLOG_CHANNEL_udpgw 89
-#define BLOG_CHANNEL_UdpGwClient 90
-#define BLOG_CHANNEL_SocksUdpGwClient 91
-#define BLOG_CHANNEL_BNetwork 92
-#define BLOG_CHANNEL_BConnection 93
-#define BLOG_CHANNEL_BSSLConnection 94
-#define BLOG_CHANNEL_BDatagram 95
-#define BLOG_CHANNEL_PeerChat 96
-#define BLOG_CHANNEL_BArpProbe 97
-#define BLOG_CHANNEL_NCDModuleIndex 98
-#define BLOG_CHANNEL_NCDModuleProcess 99
-#define BLOG_CHANNEL_NCDValGenerator 100
-#define BLOG_CHANNEL_ncd_from_string 101
-#define BLOG_CHANNEL_ncd_to_string 102
-#define BLOG_CHANNEL_ncd_value 103
-#define BLOG_CHANNEL_ncd_try 104
-#define BLOG_CHANNEL_ncd_sys_request_server 105
-#define BLOG_CHANNEL_NCDRequest 106
-#define BLOG_CHANNEL_ncd_net_ipv6_wait_dynamic_addr 107
-#define BLOG_CHANNEL_NCDRequestClient 108
-#define BLOG_CHANNEL_ncd_request 109
-#define BLOG_CHANNEL_ncd_sys_request_client 110
-#define BLOG_CHANNEL_ncd_exit 111
-#define BLOG_CHANNEL_ncd_getargs 112
-#define BLOG_CHANNEL_ncd_arithmetic 113
-#define BLOG_CHANNEL_ncd_parse 114
-#define BLOG_CHANNEL_ncd_valuemetic 115
-#define BLOG_CHANNEL_ncd_file 116
-#define BLOG_CHANNEL_ncd_netmask 117
-#define BLOG_CHANNEL_ncd_implode 118
-#define BLOG_CHANNEL_ncd_call2 119
-#define BLOG_CHANNEL_ncd_assert 120
-#define BLOG_CHANNEL_ncd_reboot 121
-#define BLOG_CHANNEL_ncd_explode 122
-#define BLOG_CHANNEL_NCDPlaceholderDb 123
-#define BLOG_CHANNEL_NCDVal 124
-#define BLOG_CHANNEL_ncd_net_ipv6_addr 125
-#define BLOG_CHANNEL_ncd_net_ipv6_route 126
-#define BLOG_CHANNEL_ncd_net_ipv4_addr_in_network 127
-#define BLOG_CHANNEL_ncd_net_ipv6_addr_in_network 128
-#define BLOG_CHANNEL_dostest_server 129
-#define BLOG_CHANNEL_dostest_attacker 130
-#define BLOG_CHANNEL_ncd_timer 131
-#define BLOG_CHANNEL_ncd_file_open 132
-#define BLOG_CHANNEL_ncd_backtrack 133
-#define BLOG_CHANNEL_ncd_socket 134
-#define BLOG_CHANNEL_ncd_depend_scope 135
-#define BLOG_CHANNEL_ncd_substr 136
-#define BLOG_CHANNEL_ncd_sys_start_process 137
-#define BLOG_NUM_CHANNELS 138
+#define BLOG_CHANNEL_ncd_imperative 22
+#define BLOG_CHANNEL_ncd_ref 23
+#define BLOG_CHANNEL_ncd_index 24
+#define BLOG_CHANNEL_ncd_alias 25
+#define BLOG_CHANNEL_ncd_process_manager 26
+#define BLOG_CHANNEL_ncd_ondemand 27
+#define BLOG_CHANNEL_ncd_foreach 28
+#define BLOG_CHANNEL_ncd_choose 29
+#define BLOG_CHANNEL_ncd_net_backend_waitdevice 30
+#define BLOG_CHANNEL_ncd_net_backend_waitlink 31
+#define BLOG_CHANNEL_ncd_net_backend_badvpn 32
+#define BLOG_CHANNEL_ncd_net_backend_wpa_supplicant 33
+#define BLOG_CHANNEL_ncd_net_backend_rfkill 34
+#define BLOG_CHANNEL_ncd_net_up 35
+#define BLOG_CHANNEL_ncd_net_dns 36
+#define BLOG_CHANNEL_ncd_net_iptables 37
+#define BLOG_CHANNEL_ncd_net_ipv4_addr 38
+#define BLOG_CHANNEL_ncd_net_ipv4_route 39
+#define BLOG_CHANNEL_ncd_net_ipv4_dhcp 40
+#define BLOG_CHANNEL_ncd_net_ipv4_arp_probe 41
+#define BLOG_CHANNEL_ncd_net_watch_interfaces 42
+#define BLOG_CHANNEL_ncd_sys_watch_input 43
+#define BLOG_CHANNEL_ncd_sys_watch_usb 44
+#define BLOG_CHANNEL_ncd_sys_evdev 45
+#define BLOG_CHANNEL_ncd_sys_watch_directory 46
+#define BLOG_CHANNEL_StreamPeerIO 47
+#define BLOG_CHANNEL_DatagramPeerIO 48
+#define BLOG_CHANNEL_BReactor 49
+#define BLOG_CHANNEL_BSignal 50
+#define BLOG_CHANNEL_FragmentProtoAssembler 51
+#define BLOG_CHANNEL_BPredicate 52
+#define BLOG_CHANNEL_ServerConnection 53
+#define BLOG_CHANNEL_Listener 54
+#define BLOG_CHANNEL_DataProto 55
+#define BLOG_CHANNEL_FrameDecider 56
+#define BLOG_CHANNEL_BSocksClient 57
+#define BLOG_CHANNEL_BDHCPClientCore 58
+#define BLOG_CHANNEL_BDHCPClient 59
+#define BLOG_CHANNEL_NCDIfConfig 60
+#define BLOG_CHANNEL_BUnixSignal 61
+#define BLOG_CHANNEL_BProcess 62
+#define BLOG_CHANNEL_PRStreamSink 63
+#define BLOG_CHANNEL_PRStreamSource 64
+#define BLOG_CHANNEL_PacketProtoDecoder 65
+#define BLOG_CHANNEL_DPRelay 66
+#define BLOG_CHANNEL_BThreadWork 67
+#define BLOG_CHANNEL_DPReceive 68
+#define BLOG_CHANNEL_BInputProcess 69
+#define BLOG_CHANNEL_NCDUdevMonitorParser 70
+#define BLOG_CHANNEL_NCDUdevMonitor 71
+#define BLOG_CHANNEL_NCDUdevCache 72
+#define BLOG_CHANNEL_NCDUdevManager 73
+#define BLOG_CHANNEL_BTime 74
+#define BLOG_CHANNEL_BEncryption 75
+#define BLOG_CHANNEL_SPProtoDecoder 76
+#define BLOG_CHANNEL_LineBuffer 77
+#define BLOG_CHANNEL_BTap 78
+#define BLOG_CHANNEL_lwip 79
+#define BLOG_CHANNEL_NCDConfigTokenizer 80
+#define BLOG_CHANNEL_NCDConfigParser 81
+#define BLOG_CHANNEL_NCDValParser 82
+#define BLOG_CHANNEL_nsskey 83
+#define BLOG_CHANNEL_addr 84
+#define BLOG_CHANNEL_PasswordListener 85
+#define BLOG_CHANNEL_NCDInterfaceMonitor 86
+#define BLOG_CHANNEL_NCDRfkillMonitor 87
+#define BLOG_CHANNEL_udpgw 88
+#define BLOG_CHANNEL_UdpGwClient 89
+#define BLOG_CHANNEL_SocksUdpGwClient 90
+#define BLOG_CHANNEL_BNetwork 91
+#define BLOG_CHANNEL_BConnection 92
+#define BLOG_CHANNEL_BSSLConnection 93
+#define BLOG_CHANNEL_BDatagram 94
+#define BLOG_CHANNEL_PeerChat 95
+#define BLOG_CHANNEL_BArpProbe 96
+#define BLOG_CHANNEL_NCDModuleIndex 97
+#define BLOG_CHANNEL_NCDModuleProcess 98
+#define BLOG_CHANNEL_NCDValGenerator 99
+#define BLOG_CHANNEL_ncd_from_string 100
+#define BLOG_CHANNEL_ncd_to_string 101
+#define BLOG_CHANNEL_ncd_value 102
+#define BLOG_CHANNEL_ncd_try 103
+#define BLOG_CHANNEL_ncd_sys_request_server 104
+#define BLOG_CHANNEL_NCDRequest 105
+#define BLOG_CHANNEL_ncd_net_ipv6_wait_dynamic_addr 106
+#define BLOG_CHANNEL_NCDRequestClient 107
+#define BLOG_CHANNEL_ncd_request 108
+#define BLOG_CHANNEL_ncd_sys_request_client 109
+#define BLOG_CHANNEL_ncd_exit 110
+#define BLOG_CHANNEL_ncd_getargs 111
+#define BLOG_CHANNEL_ncd_arithmetic 112
+#define BLOG_CHANNEL_ncd_parse 113
+#define BLOG_CHANNEL_ncd_valuemetic 114
+#define BLOG_CHANNEL_ncd_file 115
+#define BLOG_CHANNEL_ncd_netmask 116
+#define BLOG_CHANNEL_ncd_implode 117
+#define BLOG_CHANNEL_ncd_call2 118
+#define BLOG_CHANNEL_ncd_assert 119
+#define BLOG_CHANNEL_ncd_reboot 120
+#define BLOG_CHANNEL_ncd_explode 121
+#define BLOG_CHANNEL_NCDPlaceholderDb 122
+#define BLOG_CHANNEL_NCDVal 123
+#define BLOG_CHANNEL_ncd_net_ipv6_addr 124
+#define BLOG_CHANNEL_ncd_net_ipv6_route 125
+#define BLOG_CHANNEL_ncd_net_ipv4_addr_in_network 126
+#define BLOG_CHANNEL_ncd_net_ipv6_addr_in_network 127
+#define BLOG_CHANNEL_dostest_server 128
+#define BLOG_CHANNEL_dostest_attacker 129
+#define BLOG_CHANNEL_ncd_timer 130
+#define BLOG_CHANNEL_ncd_file_open 131
+#define BLOG_CHANNEL_ncd_backtrack 132
+#define BLOG_CHANNEL_ncd_socket 133
+#define BLOG_CHANNEL_ncd_depend_scope 134
+#define BLOG_CHANNEL_ncd_substr 135
+#define BLOG_CHANNEL_ncd_sys_start_process 136
+#define BLOG_NUM_CHANNELS 137

+ 0 - 1
generated/blog_channels_list.h

@@ -20,7 +20,6 @@
 {"ncd_runonce", 4},
 {"ncd_runonce", 4},
 {"ncd_daemon", 4},
 {"ncd_daemon", 4},
 {"ncd_spawn", 4},
 {"ncd_spawn", 4},
-{"ncd_call", 4},
 {"ncd_imperative", 4},
 {"ncd_imperative", 4},
 {"ncd_ref", 4},
 {"ncd_ref", 4},
 {"ncd_index", 4},
 {"ncd_index", 4},

+ 0 - 1
ncd/CMakeLists.txt

@@ -143,7 +143,6 @@ add_library(ncdinterpreter
     modules/print.c
     modules/print.c
     modules/blocker.c
     modules/blocker.c
     modules/spawn.c
     modules/spawn.c
-    modules/call.c
     modules/imperative.c
     modules/imperative.c
     modules/ref.c
     modules/ref.c
     modules/index.c
     modules/index.c

+ 0 - 360
ncd/modules/call.c

@@ -1,360 +0,0 @@
-/**
- * @file call.c
- * @author Ambroz Bizjak <ambrop7@gmail.com>
- * 
- * @section LICENSE
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the author nor the
- *    names of its contributors may be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * 
- * @section DESCRIPTION
- * 
- * Synopsis:
- *   callrefhere()
- * 
- * Description:
- *   Exposes variables and objects to call() statements as seen from this
- *   callrefhere() statement.
- * 
- * Synopsis:
- *   call(string template_name, list args)
- *   callhefhere::call(string template_name, list args)
- * 
- * Description:
- *   Module which allows using a single statement to represent multiple statements
- *   in a process template, allowing reuse of repetitive code.
- *   The created template process can access variables and objects as seen from the
- *   call statement via "_caller.variable".
- *   The second form also exposes variables and objects from the corresponding
- *   callrefhere() statement via "_ref.variable".
- *   If template_name is "<none>", then the call() is a no-op - it goes up
- *   immediately and immediately terminates on request.
- * 
- * Variables:
- *   Exposes variables as seen from the end of the called process template.
- * 
- * Behavior in detail (assuming template_name is not "<none>"):
- *   - On initialization, creates a new process from the template named
- *     template_name, with arguments args.
- *   - When all the statements in the created process go UP, transitions UP.
- *   - When one of the statements is no longer UP, transitions DOWN. The
- *     created process remais paused until the call statement receives the
- *     clean signal, to wait for following statements to deinitialize.
- *   - On deinitialization, initiates termination of the created process and waits
- *     for all its statements to deinitialize.
- */
-
-#include <stdlib.h>
-
-#include <misc/string_begins_with.h>
-#include <misc/offset.h>
-#include <structure/LinkedList0.h>
-#include <ncd/NCDModule.h>
-#include <ncd/extra/value_utils.h>
-
-#include <generated/blog_channel_ncd_call.h>
-
-#define ModuleLog(i, ...) NCDModuleInst_Backend_Log((i), BLOG_CURRENT_CHANNEL, __VA_ARGS__)
-
-#define STATE_WORKING 1
-#define STATE_UP 2
-#define STATE_WAITING 3
-#define STATE_TERMINATING 4
-#define STATE_NONE 5
-
-struct callrefhere_instance {
-    NCDModuleInst *i;
-    LinkedList0 calls_list;
-};
-
-struct instance {
-    NCDModuleInst *i;
-    NCDValMem args_mem;
-    NCDModuleProcess process;
-    int state;
-    struct callrefhere_instance *crh;
-    LinkedList0Node calls_list_node;
-};
-
-static void instance_free (struct instance *o);
-static int caller_obj_func_getobj (const NCDObject *obj, NCD_string_id_t name, NCDObject *out_object);
-static int ref_obj_func_getobj (const NCDObject *obj, NCD_string_id_t name, NCDObject *out_object);
-
-enum {STRING_CALLER, STRING_REF};
-
-static struct NCD_string_request strings[] = {
-    {"_caller"}, {"_ref"}, {NULL}
-};
-
-static void process_handler_event (NCDModuleProcess *process, int event)
-{
-    struct instance *o = UPPER_OBJECT(process, struct instance, process);
-    
-    switch (event) {
-        case NCDMODULEPROCESS_EVENT_UP: {
-            ASSERT(o->state == STATE_WORKING)
-            
-            // signal up
-            NCDModuleInst_Backend_Up(o->i);
-            
-            // set state up
-            o->state = STATE_UP;
-        } break;
-        
-        case NCDMODULEPROCESS_EVENT_DOWN: {
-            ASSERT(o->state == STATE_UP)
-            
-            // signal down
-            NCDModuleInst_Backend_Down(o->i);
-            
-            // set state waiting
-            o->state = STATE_WAITING;
-        } break;
-        
-        case NCDMODULEPROCESS_EVENT_TERMINATED: {
-            ASSERT(o->state == STATE_TERMINATING)
-            
-            // die finally
-            instance_free(o);
-            return;
-        } break;
-        
-        default: ASSERT(0);
-    }
-}
-
-static int process_func_getspecialobj (NCDModuleProcess *process, NCD_string_id_t name, NCDObject *out_object)
-{
-    struct instance *o = UPPER_OBJECT(process, struct instance, process);
-    
-    if (name == strings[STRING_CALLER].id) {
-        *out_object = NCDObject_Build(-1, o, NCDObject_no_getvar, caller_obj_func_getobj);
-        return 1;
-    }
-    
-    if (name == strings[STRING_REF].id) {
-        *out_object = NCDObject_Build(-1, o, NCDObject_no_getvar, ref_obj_func_getobj);
-        return 1;
-    }
-    
-    return 0;
-}
-
-static void callrefhere_func_new (void *vo, NCDModuleInst *i, const struct NCDModuleInst_new_params *params)
-{
-    struct callrefhere_instance *o = vo;
-    o->i = i;
-    
-    // init calls list
-    LinkedList0_Init(&o->calls_list);
-    
-    // signal up
-    NCDModuleInst_Backend_Up(o->i);
-}
-
-static void callrefhere_func_die (void *vo)
-{
-    struct callrefhere_instance *o = vo;
-    
-    // disconnect calls
-    while (!LinkedList0_IsEmpty(&o->calls_list)) {
-        struct instance *inst = UPPER_OBJECT(LinkedList0_GetFirst(&o->calls_list), struct instance, calls_list_node);
-        ASSERT(inst->crh == o)
-        LinkedList0_Remove(&o->calls_list, &inst->calls_list_node);
-        inst->crh = NULL;
-    }
-    
-    NCDModuleInst_Backend_Dead(o->i);
-}
-
-static void func_new (void *vo, NCDModuleInst *i, const struct NCDModuleInst_new_params *params)
-{
-    struct instance *o = vo;
-    o->i = i;
-    
-    // check arguments
-    NCDValRef template_name_arg;
-    NCDValRef args_arg;
-    if (!NCDVal_ListRead(params->args, 2, &template_name_arg, &args_arg)) {
-        ModuleLog(o->i, BLOG_ERROR, "wrong arity");
-        goto fail0;
-    }
-    if (!NCDVal_IsString(template_name_arg) || !NCDVal_IsList(args_arg)) {
-        ModuleLog(o->i, BLOG_ERROR, "wrong type");
-        goto fail0;
-    }
-    
-    // calling none?
-    if (ncd_is_none(template_name_arg)) {
-        // signal up
-        NCDModuleInst_Backend_Up(o->i);
-        
-        // set state none
-        o->state = STATE_NONE;
-    } else {
-        // init args mem
-        NCDValMem_Init(&o->args_mem);
-        
-        // copy arguments
-        NCDValRef args = NCDVal_NewCopy(&o->args_mem, args_arg);
-        if (NCDVal_IsInvalid(args)) {
-            NCDValMem_Free(&o->args_mem);
-            goto fail0;
-        }
-        
-        // create process
-        if (!NCDModuleProcess_InitValue(&o->process, o->i, template_name_arg, args, process_handler_event)) {
-            ModuleLog(o->i, BLOG_ERROR, "NCDModuleProcess_Init failed");
-            NCDValMem_Free(&o->args_mem);
-            goto fail0;
-        }
-        
-        // set special functions
-        NCDModuleProcess_SetSpecialFuncs(&o->process, process_func_getspecialobj);
-        
-        // set callrefhere
-        o->crh = (params->method_user ? NCDModuleInst_Backend_GetUser((NCDModuleInst *)params->method_user) : NULL);
-        
-        // add to callrefhere's calls list
-        if (o->crh) {
-            LinkedList0_Prepend(&o->crh->calls_list, &o->calls_list_node);
-        }
-        
-        // set state working
-        o->state = STATE_WORKING;
-    }
-    return;
-    
-fail0:
-    NCDModuleInst_Backend_DeadError(i);
-}
-
-void instance_free (struct instance *o)
-{
-    if (o->state != STATE_NONE) {
-        // remove from callrefhere's calls list
-        if (o->crh) {
-            LinkedList0_Remove(&o->crh->calls_list, &o->calls_list_node);
-        }
-        
-        // free args mem
-        NCDValMem_Free(&o->args_mem);
-        
-        // free process
-        NCDModuleProcess_Free(&o->process);
-    }
-    
-    NCDModuleInst_Backend_Dead(o->i);
-}
-
-static void func_die (void *vo)
-{
-    struct instance *o = vo;
-    ASSERT(o->state != STATE_TERMINATING)
-    
-    // if none, die now
-    if (o->state == STATE_NONE) {
-        instance_free(o);
-        return;
-    }
-    
-    // request process to terminate
-    NCDModuleProcess_Terminate(&o->process);
-    
-    // set state terminating
-    o->state = STATE_TERMINATING;
-}
-
-static void func_clean (void *vo)
-{
-    struct instance *o = vo;
-    if (o->state != STATE_WAITING) {
-        return;
-    }
-    
-    // allow process to continue
-    NCDModuleProcess_Continue(&o->process);
-    
-    // set state working
-    o->state = STATE_WORKING;
-}
-
-static int func_getobj (void *vo, NCD_string_id_t name, NCDObject *out_object)
-{
-    struct instance *o = vo;
-    
-    if (o->state == STATE_NONE) {
-        return 0;
-    }
-    
-    return NCDModuleProcess_GetObj(&o->process, name, out_object);
-}
-
-static int caller_obj_func_getobj (const NCDObject *obj, NCD_string_id_t name, NCDObject *out_object)
-{
-    struct instance *o = NCDObject_DataPtr(obj);
-    
-    return NCDModuleInst_Backend_GetObj(o->i, name, out_object);
-}
-
-static int ref_obj_func_getobj (const NCDObject *obj, NCD_string_id_t name, NCDObject *out_object)
-{
-    struct instance *o = NCDObject_DataPtr(obj);
-    
-    if (!o->crh) {
-        return 0;
-    }
-    
-    return NCDModuleInst_Backend_GetObj(o->crh->i, name, out_object);
-}
-
-static struct NCDModule modules[] = {
-    {
-        .type = "callrefhere",
-        .func_new2 = callrefhere_func_new,
-        .func_die = callrefhere_func_die,
-        .alloc_size = sizeof(struct callrefhere_instance)
-    }, {
-        .type = "call",
-        .func_new2 = func_new,
-        .func_die = func_die,
-        .func_clean = func_clean,
-        .func_getobj = func_getobj,
-        .flags = NCDMODULE_FLAG_CAN_RESOLVE_WHEN_DOWN,
-        .alloc_size = sizeof(struct instance)
-    }, {
-        .type = "callrefhere::call",
-        .func_new2 = func_new,
-        .func_die = func_die,
-        .func_clean = func_clean,
-        .func_getobj = func_getobj,
-        .flags = NCDMODULE_FLAG_CAN_RESOLVE_WHEN_DOWN,
-        .alloc_size = sizeof(struct instance)
-    }, {
-        .type = NULL
-    }
-};
-
-const struct NCDModuleGroup ncdmodule_call = {
-    .modules = modules,
-    .strings = strings
-};

+ 2 - 2
ncd/modules/call2.c

@@ -29,7 +29,7 @@
  * @section DESCRIPTION
  * @section DESCRIPTION
  * 
  * 
  * Synopsis:
  * Synopsis:
- *   call2(string template, list args)
+ *   call(string template, list args)
  *   embcall2_multif(string cond1, string template1, ..., [string else_template])
  *   embcall2_multif(string cond1, string template1, ..., [string else_template])
  */
  */
 
 
@@ -288,7 +288,7 @@ static int func_getobj (void *vo, NCD_string_id_t name, NCDObject *out_object)
 
 
 static struct NCDModule modules[] = {
 static struct NCDModule modules[] = {
     {
     {
-        .type = "call2",
+        .type = "call",
         .func_new2 = func_new_call,
         .func_new2 = func_new_call,
         .func_die = func_die,
         .func_die = func_die,
         .func_clean = func_clean,
         .func_clean = func_clean,

+ 0 - 2
ncd/modules/modules.h

@@ -47,7 +47,6 @@ extern const struct NCDModuleGroup ncdmodule_sleep;
 extern const struct NCDModuleGroup ncdmodule_print;
 extern const struct NCDModuleGroup ncdmodule_print;
 extern const struct NCDModuleGroup ncdmodule_blocker;
 extern const struct NCDModuleGroup ncdmodule_blocker;
 extern const struct NCDModuleGroup ncdmodule_spawn;
 extern const struct NCDModuleGroup ncdmodule_spawn;
-extern const struct NCDModuleGroup ncdmodule_call;
 extern const struct NCDModuleGroup ncdmodule_imperative;
 extern const struct NCDModuleGroup ncdmodule_imperative;
 extern const struct NCDModuleGroup ncdmodule_ref;
 extern const struct NCDModuleGroup ncdmodule_ref;
 extern const struct NCDModuleGroup ncdmodule_index;
 extern const struct NCDModuleGroup ncdmodule_index;
@@ -130,7 +129,6 @@ static const struct NCDModuleGroup *ncd_modules[] = {
     &ncdmodule_print,
     &ncdmodule_print,
     &ncdmodule_blocker,
     &ncdmodule_blocker,
     &ncdmodule_spawn,
     &ncdmodule_spawn,
-    &ncdmodule_call,
     &ncdmodule_imperative,
     &ncdmodule_imperative,
     &ncdmodule_ref,
     &ncdmodule_ref,
     &ncdmodule_index,
     &ncdmodule_index,