{"TRUNC", fun_trunc, 1, 1, FN_REG},
{"TYPE", fun_type, 1, 1, FN_REG},
{"UCSTR", fun_ucstr, 1, -1, FN_REG},
- {"UDEFAULT", fun_uldefault, 2, 12, FN_NOPARSE},
+ {"UDEFAULT", fun_udefault, 2, 12, FN_NOPARSE},
{"UFUN", fun_ufun, 1, 11, FN_REG},
- {"ULAMBDA", fun_ulambda, 1, 11, FN_REG},
- {"ULDEFAULT", fun_uldefault, 1, 12, FN_NOPARSE},
- {"ULOCAL", fun_ulocal, 1, 11, FN_REG},
+ {"ULAMBDA", fun_ufun, 1, 11, FN_REG},
+ {"ULDEFAULT", fun_udefault, 1, 12, FN_NOPARSE | FN_LOCALIZE},
+ {"ULOCAL", fun_ufun, 1, 11, FN_REG | FN_LOCALIZE},
{"UNIQUE", fun_unique, 1, 4, FN_REG},
{"IDLE_TIMES", fun_idle_times, 1, 1, FN_REG},
{"UTCTIME", fun_time, 0, 0, FN_REG},
first = 0;
}
- if (fp->flags & FN_LOCALIZE) {
+ if (fp->flags & FN_USERFN) {
if (first == 0)
safe_strl(", ", 2, tbuf, &tp);
safe_str("Userfn", tbuf, &tp);
ENTER_OOREF;
- if (!fetch_ufun_attrib(args[0], executor, &ufun, 0)) {
+ if (!fetch_ufun_attrib(args[0], executor, &ufun, (!strcmp(called_as, "ULAMBDA")))) {
safe_str(T(ufun.errmess), buff, bp);
LEAVE_OOREF;
return;
call_ufun(&ufun, args + 1, nargs - 1, rbuff, executor, enactor, pe_info);
- safe_str(rbuff, buff, bp);
-
- LEAVE_OOREF;
-
- return;
-}
-
-/* ARGSUSED */
-FUNCTION(fun_ulambda)
-{
- char rbuff[BUFFER_LEN];
- ufun_attrib ufun;
- OOREF_DECL;
-
- ENTER_OOREF;
-
- if (!fetch_ufun_attrib(args[0], executor, &ufun, 1)) {
- safe_str(T(ufun.errmess), buff, bp);
- LEAVE_OOREF;
- return;
- }
-
- call_ufun(&ufun, args + 1, nargs - 1, rbuff, executor, enactor, pe_info);
-
- safe_str(rbuff, buff, bp);
-
- LEAVE_OOREF;
-
- return;
-}
-
-/* ARGSUSED */
-FUNCTION(fun_ulocal)
-{
- /* Like fun_ufun, but saves the state of the q0-q9 registers
- * when called
- */
- char *preserve[NUMQ];
- char rbuff[BUFFER_LEN];
- ufun_attrib ufun;
- OOREF_DECL;
- ENTER_OOREF;
- if (!fetch_ufun_attrib(args[0], executor, &ufun, 0)) {
- safe_str(T(ufun.errmess), buff, bp);
- LEAVE_OOREF;
- return;
- }
-
- /* Save global regs */
- save_global_regs("ulocal.save", preserve);
-
- call_ufun(&ufun, args + 1, nargs - 1, rbuff, executor, enactor, pe_info);
safe_str(rbuff, buff, bp);
- restore_global_regs("ulocal.save", preserve);
-
LEAVE_OOREF;
return;
* then preserve registers, too.
*/
/* ARGSUSED */
-FUNCTION(fun_uldefault)
+FUNCTION(fun_udefault)
{
dbref thing;
ATTR *attrib;
char mstr[BUFFER_LEN];
char **xargs;
int i;
- char *preserve[NUMQ];
OOREF_DECL;
ENTER_OOREF;
*dp = '\0';
}
}
- if (called_as[1] == 'L')
- save_global_regs("uldefault.save", preserve);
do_userfn(buff, bp, thing, attrib, nargs - 2, xargs,
executor, caller, enactor, pe_info, 0);
- if (called_as[1] == 'L')
- restore_global_regs("uldefault.save", preserve);
/* Free the xargs */
if (nargs > 2) {
/* We couldn't get it. Evaluate args[1] and return it */
sp = args[1];
- if (called_as[1] == 'L')
- save_global_regs("uldefault.save", preserve);
process_expression(buff, bp, &sp, executor, caller, enactor,
PE_DEFAULT, PT_DEFAULT, pe_info);
- if (called_as[1] == 'L')
- restore_global_regs("uldefault.save", preserve);
LEAVE_OOREF;
safe_str(T(" ARGUMENTS BUT GOT "), buff, bp);
safe_integer(nfargs, buff, bp);
} else {
+ char *preserve[NUMQ];
global_fun_recursions++;
pe_info->fun_depth++;
+ if (fp->flags & FN_LOCALIZE)
+ save_global_regs("@function.save", preserve);
if (fp->flags & FN_BUILTIN) {
global_fun_invocations++;
pe_info->fun_invocations++;
safe_str(fp->where.ufun->name, buff, bp);
safe_chr(')', buff, bp);
} else {
- char *preserve[NUMQ];
- if (fp->flags & FN_LOCALIZE)
- save_global_regs("@function.save", preserve);
do_userfn(buff, bp, thing, attrib, nfargs, fargs,
executor, caller, enactor, pe_info, PE_USERFN);
- if (fp->flags & FN_LOCALIZE)
- restore_global_regs("@function.save", preserve);
}
}
+ if (fp->flags & FN_LOCALIZE)
+ restore_global_regs("@function.save", preserve);
pe_info->fun_depth--;
global_fun_recursions--;
}