int main() { the_function(); the_static_function(); the_used_function(); the_hidden_function(); the_visible_function(); }
// ### multiple-value-call Value CL_multiple_value_call(Value args, Environment * env, Thread * thread) { const unsigned long numargs = length(args); if (numargs == 0) return wrong_number_of_arguments(S_multiple_value_call, numargs, 1, MANY); Function * function; Value value = eval(car(args), env, thread); args = xcdr(args); if (symbolp(value)) { Symbol * sym = the_symbol(value); if (sym->is_special_operator() || sym->is_macro() || (function = (Function *) sym->function()) == NULL) { String * string = new String("The symbol "); string->append(sym->prin1_to_string()); string->append(" does not designate a function."); return signal_lisp_error(new Error(string)); } } else if (functionp(value)) function = the_function(value); else { String * string = new String("The value "); string->append(::prin1_to_string(value)); string->append(" does not designate a function."); return signal_lisp_error(new Error(string)); } Value list = NIL; while (args != NIL) { Value result = eval(car(args), env, thread); if (thread->values_length() >= 0) { Value * values = thread->values(); const long limit = thread->values_length(); for (long i = 0; i < limit; i++) list = make_cons(values[i], list); } else list = make_cons(result, list); args = xcdr(args); } unsigned long len = length(list); Value * funcall_args = new (GC) Value[len + 1]; funcall_args[0] = make_value(function); if (list != NIL) { for (long i = len; i > 0; i--) { funcall_args[i] = xcar(list); list = xcdr(list); } } return CL_funcall(len + 1, funcall_args); }
int main(int argc, char **argv) { struct sigaction act; printf("Registering signal handler\n"); memset(&act, 0, sizeof(act)); act.sa_sigaction = handle_sigtrap; act.sa_flags |= SA_SIGINFO; sigaction(SIGTRAP, &act, NULL); printf("Before call got_sigtrap=%d\n", got_sigtrap); the_function(); printf("After call got_sigtrap=%d\n", got_sigtrap); return 0; }
// ### set-function-call-count Value SYS_set_function_call_count(Value arg1, Value arg2) { if (functionp(arg1)) the_function(arg1)->set_call_count(check_index(arg2)); return signal_type_error(arg1, S_function); }
// ### function-call-count Value SYS_function_call_count(Value arg) { if (functionp(arg)) return make_unsigned_integer(the_function(arg)->call_count()); return signal_type_error(arg, S_function); }
/* The function call below is defined in a separate translation unit, so is not usually * able to be inlined during compile/link. By compiling both TUs with -flto and linking * with the same, gcc's Link-time optimisation is able to perform inter-process optimisation * that would otherwise be missed. * Note that it doesn't work well with -g. */ int main() { return the_function(); }