We have debated the merits of encouraging a consumer to test and make decisions based on only the
return code. Doing so guarantees any component that can return the list of general error
return codes we have defined will be compatible.
typedef int (*fptr)(); /* Type of the function we will be calling */ void cspec mk_unmarshal(type_t *types, int nargs) { int i; fptr vspec fp = param(fptr, 0); /* Arg 0: the function to invoke */ type *vspec m = param(type *, 1); /* Arg 1: the vector to unmarshal */ void cspec args = push_init(); /* Initialize the dynamic argument list */ for (i = 0; i < nargs; i++) { /* Build up the dynamic argument list */ switch(types[i]) { case INTEGER: push(args, `m[$i].i); break; case DOUBLE: push(args, `m[$i].d); break; case POINTER: push(args, `m[$i].p); break; } } /*
Return code spec to call the given function with unmarshaled args */ return `{ fp(args); }; } 4.3 Dynamic Inlining