Lugaru's Epsilon Programmer's Editor 14.04
Context:
|
Epsilon User's Manual and Reference > Epsilon Extension Language > Global Definitions > Function Definitionsfunction-definition:function-head block function-head argument-decl-list block ansi-function-head block callable-function-head block callable-function-head: typed-function-head command typed-function-headtyped-function-head on binding-listcommand typed-function-head on binding-listbinding-list: keytable-name [ constant-expression ] keytable-name [ constant-expression ] , binding-listkeytable-name: identifier typed-function-head: identifier () type-specifier identifier () function-head: identifier ( argument-list ) type-specifier identifier ( argument-list ) ansi-function-head: identifier ( ansi-argument-list ) type-specifier identifier ( ansi-argument-list ) ansi-argument-list: type-specifier declarator type-specifier declarator , ansi-argument-listargument-list: identifier identifier , argument-listargument-decl-list: type-specifier declarator-list ; type-specifier declarator-list ; argument-decl-listA function definition begins with a type specifier, the name of the function, and parentheses surrounding a comma-separated list of arguments. Any bindings may be given here using the on keyword,
as described below. Declarations for the arguments then appear, and
the body of the function follows. If the command keyword appears
before the type specifier, the function is a command, and Epsilon
will do completion on the function when it asks for the name of a
command. A function may be a command only if it has no arguments.You may omit the type specifier before the function name, in which case the function's type is int. You may also omit the declaration for any argument, in which case the argument will be an int. Note that unlike some languages such as Pascal, if there are no arguments, an empty pair of parentheses must still appear, both in the definition and where you call the function. You may also define functions using ANSI C/C++ syntax, in which type information for function arguments appears with the argument names inside parentheses. These function headers have the same effect:
When you call a function, arguments of type char or short are automatically changed to ints. A corresponding change happens to declarations of function arguments and return values. Additionally, function arguments declared as an array of some type are changed to be a pointer to the same type, just as array variables are changed to pointers to the start of the array when their names appear in expressions (see Constants and Identifiers). For example, these two function headers have the same effect.
The user can call any function which takes no arguments, or bind such
a function to a key. Functions which are normally invoked in this
way can be made commands with the Sometimes it is necessary to declare an identifier as a function, although the function is actually defined in a separately compiled source file. For example, you must declare a function before you use a pointer to that function. Also, the EEL compiler must know that a function returns a non-numeric type if its return value is used. Any declaration of an identifier with type function returning ... is a function declaration. Function declarations may appear anywhere a local or global variable declaration is legal. So long as the identifier is not masked by a local variable of the same name, the declaration has effect until the end of the file.
Any function named when_loading( ) is automatically executed when
you load the bytecode file it appears in into Epsilon. There may be
any number of
|