[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1 MELT macros

There are 34 documented macros.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.1 ASSERT_MSG

Macro defined at file ‘warmelt-macro.melt’, line 5266.

macro description: ASSERT_MSG macro with a message cstring and an optional condition. Generates an assertion -if checking is enabled- and also issues a compile warning if condition is missing so false.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.2 COMPILE_WARNING

Macro defined at file ‘warmelt-macro.melt’, line 5180.

macro description: The COMPILE_WARNING syntax issues a warning, inspired by GCC #warning. Syntax is (COMPILE_WARNING <string> [<expression>]).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.3 EXIT

Macro defined at file ‘warmelt-macro.melt’, line 5142.

macro description: The EXIT syntax is for exitting a local FOREVER loop in the same function. Syntax is (EXIT <loop-name> <expression>...).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.4 FOREVER

Macro defined at file ‘warmelt-macro.melt’, line 5102.

macro description: The FOREVER syntax is for infinite loops exited thru EXIT. Syntax is (FOREVER <loop-name> <expr>...). Use EXIT to go out of the loop with a result.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.5 RETURN

Macro defined at file ‘warmelt-macro.melt’, line 5063.

macro description: The RETURN syntax is for returning a primary and possibly secondary results. Syntax is (RETURN <expression>...). If no expression is given, returns nil.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.6 PROGN

Macro defined at file ‘warmelt-macro.melt’, line 5045.

macro description: The PROGN syntax evaluate a sequence of expressions ignoring all but the last which is the result. Syntax is (PROGN <expression>...).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.7 COMMENT

Macro defined at file ‘warmelt-macro.melt’, line 4988.

macro description: The COMMENT syntax inserts comment in the generated code, or skips MELT code. Syntax is (COMMENT <string>) to insert a comment in the generated C code, or (COMMENT ...) to skip some syntax.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.8 QUOTE

Macro defined at file ‘warmelt-macro.melt’, line 4958.

macro description: The QUOTE syntax (usually noted with a prefix quote-character) is for quotations. Only symbols or literals can be quoted. A quoted literal reifies a value, so ’2 is a value of DISCR_CONSTANT_INTEGER.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.9 MULTICALL

Macro defined at file ‘warmelt-macro.melt’, line 4915.

macro description: The MULTICALL syntax is for accumulating the primary and secondary results of a function application or a message sending. Syntax is (MULTICALL ( <formals> ) <application-or-sending> <body>...). The first formal is bound to the primary result and should be a :value. Other are for secondary results. The body is evaluated with these results of the given application or sending expression bound by the formals. Inspired by Scheme’s CALL-WITH-VALUES or CommonLisp’s MULTIPLE-VALUE-BIND.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.10 LAMBDA

Macro defined at file ‘warmelt-macro.melt’, line 4859.

macro description: The LAMBDA syntax is for anonymous functions e.g. closures, with closed values (however closing things like :gimple or :long is not permitted, you have to box them explicitly as :value-s.). Syntax is (LAMBDA ( <formals> ) <body>...). The formal argument list should have its first formal be a :value. Other arguments can bec(-typed with keywords like :value :gimple :long etc. which applies to all succeeding arguments up to the next ctype keyword. The body is a non-empty sequence of expressions. LAMBDA functions can RETURN a value with possible secondary results. See also MULTICALL. LAMBDA expressions are construcitive so can appear in LETREC bindings.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.11 LETREC

Macro defined at file ‘warmelt-macro.melt’, line 4821.

macro description: The LETREC syntax is for mutually recursive local bindings. Syntax is (LETREC ( <binding>... ) <body>...). Each binding is an optional ctype such as :long or :gimple or :value (which is the default), followed by a local variable name, followed by a single constructive expression, like LAMBDA INSTANCE TUPLE LIST. The body is a non-empty sequence of sub-expressions evaluated in an augmented environment. MELT LETREC is similar to Scheme’s LETREC.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.12 LET

Macro defined at file ‘warmelt-macro.melt’, line 4651.

macro description: The LET syntax is for sequential local bindings of expressions. Syntax is (LET ( <binding>... ) <body>...). Each binding is an optional ctype such as :long or :gimple or :value (which is the default), followed by a local variable name, followed by a single expression. The body is a non-empty sequence of expressions, evaluated in an environment enriched with the local bindings. The MELT LET syntax is sequential, like LET* in Scheme so a variable bound in a previous binding can appear in the expression of a later binding.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.13 MATCH

Macro defined at file ‘warmelt-macro.melt’, line 4511.

macro description: The MATCH syntax is for pattern-matching expressions. Syntax is (MATCH <matched-expression> <match-case>...). Each match-case starts with a pattern followed by expressions. The catch-all pattern ?_ should appear in the last match-case if any. Pattern variables like ?x are bound by the matching in their match-case.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.14 COND

Macro defined at file ‘warmelt-macro.melt’, line 4104.

macro description: The usual lisp COND conditional. Syntax is (COND <conditions>...). Each condition is a list of the form (<test> <expr>...). The last catch-all condition can be (:else <epxr>...).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.15 GCCIF

Macro defined at file ‘warmelt-macro.melt’, line 4008.

macro description: The GCCIF macro expands the rest of the expression if the version string of the GCC translating this MELT expression matches the condition. Syntax is (GCCIF condition expr...), where the condition is a string such as "4.5." or a list of strings.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.16 CPPIF

Macro defined at file ‘warmelt-macro.melt’, line 3936.

macro description: The CPPIF macro expands to C-code with an #if condition, so the condition is handled when compiling the generated C code into a MELT module. Syntax is (CPPIF <symbol> <then> [<else>]).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.17 IF

Macro defined at file ‘warmelt-macro.melt’, line 3882.

macro description: The IF syntax is for simple conditional expressions. Syntax is (IF <test-expression> <then-expression> [<else-expression>]).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.18 SETQ

Macro defined at file ‘warmelt-macro.melt’, line 3831.

macro description: The SETQ syntax is for assignment of local variables, usually bound by a LET in the same function. Syntax is (SETQ <symbol> <expr>).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.19 GET_FIELD

Macro defined at file ‘warmelt-macro.melt’, line 3799.

macro description: The GET_FIELD syntax safely access a field. Syntax is (GET_FIELD :<field> <expression>) which evaluates to nil if the expression is not of the class defining the field. See also UNSAFE_GET_FIELD.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.20 UNSAFE_GET_FIELD

Macro defined at file ‘warmelt-macro.melt’, line 3758.

macro description: The UNSAFE_GET_FIELD syntax retrieves dangerously a field from an instance and may crash when the instance is not an object of the appropriate class. Syntax is (UNSAFE_GET_FIELD :<field> <expression>). Using GET_FIELD is preferrable.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.21 PUT_FIELDS

Macro defined at file ‘warmelt-macro.melt’, line 3716.

macro description: The PUT_FIELDS syntax is for safely setting fields in an object. Syntax is (PUT_FIELDS <instance-expression> {:<field> <field-expression>}*). If the instance is not an object of the class containing all the fields, no harm is done. See also UNSAFE_PUT_FIELDS which does not produces checks.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.22 UNSAFE_PUT_FIELDS

Macro defined at file ‘warmelt-macro.melt’, line 3671.

macro description: The UNSAFE_PUT_FIELDS is for expert use only, since it can crash the running GCC MELT compilation. Syntax is (UNSAFE_PUT_FIELDS <instance> {:<field> <expression>}). It sets fields in an instance without any checks. Using PUT_FIELDS is prefered.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.23 CODE_CHUNK

Macro defined at file ‘warmelt-macro.melt’, line 3628.

macro description: The CODE_CHUNK macro is for low-level C code chunks. The syntax is (CODE_CHUNK state-symbol chunk) where chunk is a macro-string. It generates a C block. Since it does not make any type verification, it should be usually avoided. See DEFPRIMITIVE etc.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.24 LOAD

Macro defined at file ‘warmelt-macro.melt’, line 3337.

macro description: The LOAD macro is for reading expressions from another file. Syntax is (LOAD <file-name>).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.25 INSTANCE

Macro defined at file ‘warmelt-macro.melt’, line 3296.

macro description: The INSTANCE syntax is for making new objects. Syntax is (INSTANCE <class> {:<field> <expression>}*).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.26 DEFSELECTOR

Macro defined at file ‘warmelt-macro.melt’, line 3228.

macro description: The DEFSELECTOR syntax defines a selector for sending messages. Syntax is (DEFSELECTOR <symbol> <selector-class> [:doc <documentation>] [:formals ( <formals>...)]).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.27 DEFINSTANCE

Macro defined at file ‘warmelt-macro.melt’, line 3086.

macro description: The DEFINSTANCE syntax defines a static instance bound by a symbol. Syntax is (DEFINSTANCE <symbol> <class> [:doc documentation] {:<field> <value>}*). The symbol is bound to the newly made instance.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.28 DEFCLASS

Macro defined at file ‘warmelt-macro.melt’, line 2880.

macro description: The DEFCLASS macro defines a class. Syntax is (DEFCLASS symbol [:doc documentation] :super super-class :fields fields-list). Conventionally, the class name (i.e. the symbol) should preferably start with CLASS_. The fields’ names should preferably be globally unique, and usually share a common prefix. See also CLASS_ROOT CLASS_CLASS CLASS_FIELD etc.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.29 DEFINE

Macro defined at file ‘warmelt-macro.melt’, line 2613.

macro description: The DEFINE macro defines a named non-recursive value. Syntax is (DEFINE name expr [:doc documentation]). Use EXPORT_VALUES to make that name visible outside its module.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.30 DEFUN

Macro defined at file ‘warmelt-macro.melt’, line 2568.

macro description: The DEFUN macro defines a function. Syntax is (DEFUN funame formals [:doc documentation] body...). The first formal argument, if any, is required to be of ctype :value. The expressions in the body are evaluated in sequence. The value of the last is returned. See also RETURN and LAMBDA macros. A function defined by DEFUN has to be exported with EXPORT_VALUES to be visible outside its module.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.31 DEFUNMATCHER

Macro defined at file ‘warmelt-macro.melt’, line 2499.

macro description: The DEFUNMATCHER syntax defines a matcher thru a MELT function. Syntax is (DEFUNMATCHER <symbol> <in-formals> <out-formals> [:doc docum] <match-function> [<apply-function> [<data>]])


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.32 DEFCMATCHER

Macro defined at file ‘warmelt-macro.melt’, line 2362.

macro description: The DEFCMATCHER macro defines pattern-matching operator by their C expansion. Syntax is (DEFCMATCHER symbol match&ins-formals out-formals state-symbol [:doc documentation] test-expansion fill-expansion [operator-expansion]).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.33 DEFCITERATOR

Macro defined at file ‘warmelt-macro.melt’, line 2183.

macro description: The DEFCITERATOR macro defines a c-iterator which itself implements iterative for-like loops. Syntax is (DEFCITERATOR name start-formals state-symbol variable-formals [:doc documentation] before-expansion after-expansion). To be visible outside the module, the c-iterator should be exported using EXPORT_VALUES. See also CLASS_CITERATOR.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1.34 DEFPRIMITIVE

Macro defined at file ‘warmelt-macro.melt’, line 2057.

macro description: The DEFPRIMITIVE macro defines new primitive operations by their C expansion. Syntax is (DEFPRIMITIVE name formals type [:doc documentation] expansion) which defines a primitive of given name with formal arguments formals, result c-type type, optional documentation, and given expansion. A macro is expanded into a C instruction if its c-type is :void, otherwise into a C expression. Primitives have to be exported with EXPORT_VALUES to be visible in other modules. See also the classes CLASS_PRIMITIVE, and CLASS_PRIMITIVE_BINDING and the CODE_CHUNK macro.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated on June 22, 2011 using texi2html 1.82.