diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-09-16 12:10:02 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-09-16 12:10:02 +0000 |
commit | 99c453be5795d76e10b0a9cf1a2558367e538a1c (patch) | |
tree | 7810d5bed75fe0e6e24a647d754c187a714e9819 /NEWS | |
parent | d6f4adec375f9f50186248462f2774d9dc6ae59e (diff) | |
download | mailfromd-99c453be5795d76e10b0a9cf1a2558367e538a1c.tar.gz mailfromd-99c453be5795d76e10b0a9cf1a2558367e538a1c.tar.bz2 |
Implement functions with variable number of arguments and 'run' mode.
* mfd/symtab.c (function_install): Take additional argument.
* mfd/lex.l: New tokens `vaptr', `...' and ARGX.
* mfd/snarf.m4 (MF_VASTRING): New define.
* mfd/gram.y: Handle functions with variable number of arguments,
$(expr), and vaptr() expressions. This raises shift/reduce
expectation to 29 conflicts.
(parmtype_function): Return dtype_string for
arguments from vararg list.
(FUNC_HIDDEN_ARGS): Return 1 if f->varargs is set.
(type_to_string): Handle pointer argument.
(function_call): Handle function->varargs.
(node_type): Handle node_type_argx, and node_type_vaptr.
(cast_arg_list): Handle variable number of arguments.
(cast_to): Handle dtype_pointer as dtype_number.
* mfd/drivers.c (argx, vaptr): New node types.
(code_type_call): Handle variable number of arguments.
(code_cast): Handle dtype_pointer as dtype_number.
* mfd/mailfromd.h (MAILFROMD_RUN): New define.
(struct argx_node): New type.
(struct node): Add argx_node.
(struct function): New member `varargs'.
(function_install): Add varargs.
(mailfromd_run): New prototype.
* mfd/prog.c (env_vaptr, env_get_reg): New functions.
(env_make_frame0): New function.
(instr_xmemstk): New instruction handler.
* mfd/opcodes (XMEMSTK): New opcode.
* mfd/prog.h (env_get_reg, env_vaptr): New protos.
* mfd/main.c (options): New option `--run'.
(main): Handle `run' mode.
* mfd/Makefile.am (M4_FILES): Add bi_getopt.m4.
* NEWS: Update.
git-svn-id: file:///svnroot/mailfromd/trunk@1669 7a8a7f39-df28-0410-adc6-e0d955640f24
Diffstat (limited to 'NEWS')
-rw-r--r-- | NEWS | 44 |
1 files changed, 42 insertions, 2 deletions
@@ -1,4 +1,4 @@ -Mailfromd NEWS -- history of user-visible changes. 2008-09-15 +Mailfromd NEWS -- history of user-visible changes. 2008-09-16 Copyright (C) 2005, 2006, 2007, 2008 Sergey Poznyakoff See the end of file for copying conditions. @@ -19,6 +19,8 @@ It can be converted to a usual string using the `body_string' function * Changes to MFL +** Function aliases + Functions can have several names. Alternative function names, or aliases, are introduced by `alias' statement, placed between the function declaration and return type declaration, e.g.: @@ -32,6 +34,30 @@ done Any number of aliases is allowed. +** Functions with variable number of arguments + +Ellipsis as the last argument in a list of formal arguments to a +function indicates that this function takes a variable number of +arguments. For example: + + func foo (string a ; string b, ...) + +Actual arguments passed in a list of variable arguments have string +data type. A special construct is provided to access these arguments: + + $(expr) + +where expr is any valid MFL expression, evaluating to a number. This +construct returns exprth argument from the variable argument list. + +FIXME: Document it. + +** getopt and varptr + +New function `getopt' is provided. + +FIXME: Document it. + * New MFL functions ** body_string @@ -93,6 +119,20 @@ the end of the string. Thus: substring("mailfrom",4,-1) => "from" substring("mailfrom",4,-2) => "fro" +* New operation mode. + +When given `--run' command line option, mailfromd looks for a function +named `main' and invokes it, passing the rest of command line as its +arguments. The function `main' must be declared as: + + func main(...) returns number + +The return value from this function is used as the exit code. + +Command line arguments may be processed using `getopt' builtin function. + +FIXME: Document it. + * New programs: ** smap. @@ -172,7 +212,7 @@ Quarantines the message using the given reason. * mtasim -New command line options `--usage' and `--group' allow to specify user +New command line options `--user' and `--group' allow to specify user name and a list of additional groups when the program is run with `root' privileges. |