This file documents the MELT plugin for GCC.
Copyright © 2011 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with the Invariant Sections being “Funding Free Software”, the Front-Cover Texts being (a) (see below), and with the Back-Cover Texts being (b) (see below). A copy of the license is included in the section entitled “GNU Free Documentation License”.
(a) The FSF’s Front-Cover Text is:
A GNU Manual
(b) The FSF’s Back-Cover Text is:
You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development.
[Top] | [Contents] | [Index] | [ ? ] |
This manual documents briefly how to use the MELT plugin for GCC. The use of the GNU compilers is documented in a separate manual. See (gcc)Top section ‘Introduction’ in Using the GNU Compiler Collection (GCC). The MELT plugin for GCC permits you to develop your specific extensions of GCC in a powerful, lispy, domain specific language (also called MELT).
This manual is mainly a reference manual rather than a tutorial. It discusses how to use the MELT plugin for GCC. Additional tutorial information for GCC is linked to from http://gcc.gnu.org/readings.html and for MELT is linked to from http://gcc-melt.org/.
MELT documentation is made of a human written docuemtation (this document) and of a machine generated documentation. The machine generated documentation explains the MELT definitions (of functions, classes, selectors, primitives, etc...). Since it is generated from a GPLv3 source code, that generated documentation is released separately under a GPLv3 license. (the main author of this document, Basile Starynkevitch, understands that GPL and GFDL licenses are incompatible, so merging these two documentations is inappropriate.).
1. MELT: Middle End Lisp Translator | the Middle End Lisp Translator. | |
Funding Free Software | How to help assure funding for free software. | |
• GNU Project | The GNU Project and GNU/Linux. | |
GNU General Public License | GNU General Public License says how you can copy and share GCC. | |
GNU Free Documentation License | How you can copy and share this manual. | |
MELT Option Index | Index to MELT plugin command line options. | |
MELT Concept Index | Index of MELT concepts and symbol names. |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The MELT branch introduces a powerful Lisp dialect to express middle-end analyzers and passes. This chapter describes the dialect and how to use it. A working knowledge of Scheme or Lisp is presupposed.
See the MELT wiki page and the GCC MELT site
1.1 MELT Prerequisites | Prerequisites and topics not yet covered in this MELT chapter. | |
1.2 MELT overview | An overview of MELT. | |
1.3 Building the MELT branch | Configuration and building requirements and instructions for MELT. | |
1.4 MELT as a plugin | Building and using MELT as a plugin. | |
1.5 Invoking MELT | ||
1.6 Tutorial about MELT | Tutorial describing MELT. | |
1.7 Reference on MELT | MELT language reference. | |
1.8 Writing C code for MELT | How to write C code for MELT. |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The reader is expected to have some working knowledge of some Lisp dialect (Common Lisp, Emacs Lisp, Guile, ...). The reader is also expected to be somehow familiar with the internal architecture of GCC (i.e. knowing what GCC gimple-s and tree-s are).
MELT is different of other Lisps, because it is tightly suited to GCC internals. For that purpose, it has several peculiarities; MELT can:
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Any MELT enabling compilation is really a long lasting compilation. It
is supposed that you use a powerful workstation (or laptop) with
enough memory (at least 4Gigabytes of RAM is receommended on a 64 bits
machine like x86-64), and that the MELT-enabled compilation will run a
lot slower than a simple gcc -O1
compilation (hopefully doing
some useful stuff). Notice that a MELT-enabled compilation usually
generates C code, compile it (using another GCC compilation process)
to a dynamically loadable library, and load its into the MELT-enabled
GCC compilation process started by the user. In practice, the
compilation of the generated C code (which is much bigger than the
original MELT source) is the main bottleneck. Often, when using an
existing MELT module, no C code has to be generated (it already
exists).
The MELT plugin or branch contains several (related) stuff. Everything can be enabled or disabled at GCC run time:
MELT is bootstrapped, in the sense that the translation from the MELT dialect to C is coded in MELT (hence the MELT generated C code is available from the source code).
The generated C code is including only one file run-melt.h
which includes many GCC include files internal to the compiler. It is
compiled into a dynamic library by a shell script
*melt-cc-script*
which invokes the host GCC with appropriate
flags.
MELT obviously need that the binary (dynamic libraries warm*.so
)
for the MELT translator are already available. More generally, it uses
several kind of files:
*.c
file and
the second argument is the MELT loaded output *.so
dynamic
library.
-I
to the compiler)
containing all the useful GCC headers. This directory is only written by
the installation procedure.
MELT can be used as a plugin for GCC (and can also be compiled as a separate GCC branch). It uses some of the plugin machinery, even inside the MELT branch.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To compile the MELT branch, you need the Parma Polyhedra Library. The
Parma Polyhedra Library (PPL) is a free library available
here, it is a C++ library (GPLv3
licensed) handling lattices like intervals etc. Also, the host
compiler (the compiler which compiles the source code of GCC), also
used to compile MELT generated C code during MELT enabled gcc
execution, should be some version of gcc
(preferably a 4.x
version at least).
Note that currently MELT is only compiled on Linux machines.
MELT can also be used as a plugin to GCC (4.5).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MELT can be used as a plugin to a GCC 4.5 (or better?) binary (i.e. future gcc 4.6) build with plugin enabled. You’ll need both the source and build trees of your GCC to build MELT.
Detailed instructions about building MELT as a plugin are available at MELT wiki tutorial page. Of special importance is the installation of all headers required by MELT, i.e. included with ‘run-melt.h’. Also, a ‘melt-module.mk’ makefile should be installed to compile C files generated by MELT. both a default MELT source directory and default MELT module directory should be installed.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Without any MELT specific program flags, the MELT variant of gcc
behave as the trunk. So to get or use MELT features, you need to pass
some special flags. Most of these flags are starting with
-fmelt
for the MELT branch or with -fplugin-melt-arg
for
the plugin. They for the middle-end of GCC so are common for every
source language (ie gcc
, g++
… commands) and
target.
MELT is usually invoked while compiling a (C, C++, …) source
file but may occasionnally be invoked with an empty C input to perform
tasks which are not related to a particular GCC input source file. In
practice, you should pass an empty C file to gcc
for that
purpose. In particular, the translation of a MELT file foo.melt
into C code foo.c
is done with a special invocation like
gcc -fmelt-mode=translatefile -fmelt-arg=foo.melt
-fmelt-secondarg=foo.c
(possibly with other options like some
appropriate -fmelt-init=
). It is possible but deprecated to
invoke with -fmelt-mode=compilefile
instead of
-fmelt-mode=translatefile
. In other words, the MELT translator to C
is not a GCC front-end, like e.g. g++
is a C++ front-end
of GCC.
The table below lists all MELT specific options, in alphabetical
order. We list both MELT branch options like -fmelt-arg=
and
MELT plugin option like -fplugin-arg-melt-arg=
-fmelt-mode=
-fplugin-arg-melt-mode= |
This flag (called the MELT mode flag) is required for every MELT
enabled compilation. If it is not given, no MELT specific processing
is done. If given, this gives the mode to be used before any
MELT passes. It uses the :sysdata_mode_dict
field of
INITIAL_SYSTEM_DATA
internal object of MELT to determine the
MELT function applied to execute the mode. If this application
returns nil, no GCC compilation occur (i.e. no *.c
or
*.cc
etc… source file is read). Hence, some modes may
be used for their side-effects. In particular, the compilation of MELT
lisp source file *.melt
into C code *.c
is done this
way.
Several modes may be given by separating them with commas. They are handled in that case in succession.
-fmelt-arg=
-fplugin-arg-melt-arg= |
This gives the first argument string to MELT. It is incompatible with
the -fmelt-arglist=
option.
-fmelt-arglist=
-fplugin-arg-melt-arglist= |
This gives the first argument list of strings to MELT. It is
incompatible with the -fmelt-arg=
option. The string program
argument is split into a list of strings using the comma
separator. For example, -fmelt-arglist=1,BB,3
makes a
three-element list argument with first string 1
, second string
BB
and third string 3
. There is no way to give a
string subargument containing a comma.
-fmelt-debug
-fplugin-arg-melt-debug |
This flag has no argument and asks for lot of debugging output. It is
only useful to debug MELT code and is unrelated to the -g
flag
asking GCC to output debug information.
-fmelt-debugskip=
-fplugin-arg-melt-debugskip= |
This flag (only useful with -fmelt-debug
) has an integer
argument. When -fmelt-debug
is given with
-fmelt-debugskip=1000
the first thousand debug messages are
skipped, so are not printed.
-fmelt-source-path=
-fplugin-arg-melt-source-path= |
This flag sets the path (colon separated list of directories) for
sources (i.e. ‘*.melt’ and ‘*.c’). Otherwise use the
GCCMELT_SOURCE_PATH
environment variable.
-fmelt-module-path=
-fplugin-arg-melt-module-path= |
This flag sets the path (colon separated list of directories) for
MELT binary modules (i.e. ‘*.so’). Otherwise use the
GCCMELT_MODULE_PATH
environment variable.
-fmelt-module-make-command=
-fplugin-arg-melt-module-make-command= |
This flag defines the make
command used to build MELT binary
modules (i.e. ‘*.so’). from a small set of generated C files. The
default is the GNU make utility used to build MELT, very often just
make
or perhaps gmake
.
-fmelt-module-makefile=
-fplugin-arg-melt-module-makefile= |
This flag defines the makefile used to build MELT binary modules (i.e. ‘*.so’). from a small set of generated C files. The default is a file ‘melt-module.mk’.
-fmelt-module-cflags=
-fplugin-arg-melt-module-cflags= |
This flag defines the CFLAGS
passed to make
to build
MELT binary modules. If not given, the environment variable
GCCMELT_MODULE_CFLAGS
is used if it was set.
-fmelt-init=
-fplugin-arg-melt-init= |
This flag sets the initial MELT modules. They are separated by
semi-colons or (on Unix only) colons. So -fmelt-init=foo:bar
or '-fmelt-init=foo;bar'
(quotes are useful for the shell
running GCC) load first the foo
module and then the bar
module. A module starting with an at sign @
is handled as a
module list file. The .modlis
extension is added, and then a
file is seeked by that name. This file is read line by line (with
empty or blank lines skipped, and comment lines starting with an hash
#
skipped). Each line is the name of a module do be load in
sequence. For example, -fmelt-init=@mylist:bar
with a file
‘mylist.modlis’ containing
# file mylist.modlis ; just a comment alpha beta |
would have the same effect as -fmelt-init=alpha:beta:bar
.
Notice that modules are seeked in several directories. The notation
@@
is a shorthand for the default module list called
‘melt-default-modules.modlis’ and is the default value of this
flag.
-fmelt-extra=
-fplugin-arg-melt-extra= |
This flag sets the extra MELT modules. They are separated by
semi-colons or (on Unix only) colons. Extra modules are also searched
in the current directory, and are loaded after processing of MELT
options. In practice, to use your own MELT module foo
you
should pass -fmelt-extra=foo
because your module needs the
default modules.
-fmelt-single-c-file
-fplugin-arg-melt-single-c-file=yes |
This flag (very rarely useful) forces the generation of a single C
file per each MELT module. Otherwise, and by default, MELT source
files like ‘foo.melt’ are translated into one primary C file
‘foo.c’ and some other secondary C files like ‘foo+1.c’
‘foo+2.c’ etc. If the GCCMELT_SINGLE_C_FILE
environment
variable is set to a value such as yes
or 1
which is not
0
, it forces the generation of a single C file.
-fmelt-tempdir=
-fplugin-arg-melt-tempdir= |
This flags sets the temporary MELT directory. If specified it is not cleaned. If it does not exist, it is mkdir-ed and cleaned. Avoid setting it to a non-empty directory which may contain files named like MELT modules (such as ‘warmelt-*.so’ etc.).
-fmelt-option=
-fplugin-arg-melt-option= |
This set some options for MELT. the argument is a comma separated
sequence of options settings, each being an option name possibly
followed by an equal sign and an option value. For example,
-fmelt-option=foo,bar=x
set the option foo
and the option
bar
to x
. An option name is case-insensitive and may
appear several times.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
As in all Lisps, parenthesis are important, so a
and (a)
do not mean the same thing. The first stuff after an opening
parenthesis has usually an operator or syntactic keyword role.
MELT is a Lisp dialect translated into (unreadable, or at least
unfriendly) C code. Some MELT constructs, and some MELT limitations
(e.g. lack of tail-recursion) are related to this C
translatability. The MELT translator is itself written in MELT (files
‘gcc/melt/warmelt-*.melt’) and is bootstrapped; the translated C
files are in ‘gcc/warmelt-*-0.c’; they are quite big and are
distributed with the GCC source code; use the upgrade-warmelt
target of ‘gcc/Makefile.in’ to regenerate these C translations.
MELT is closely related to GCC internal passes and internal middle-end
representations and runtime. Hence (in contrast to other LISP
dialects) MELT is dealing with both boxed values and unboxed
stuff (e.g. plain long
integers as in C, but also tree
s
and gimple
s, etc…, as inside GCC, separating them using their
ctype). Keep always in mind the boxed versus unboxed
distinction. Because of that, and because of GCC runtime (in
particular the GGC garbage collector), MELT is neither polymorphic
(you cannot deal with unboxed stuff like with boxed values) nor
polytopic (no variable arguments facility).
Some familiarity with other Lisp dialects and with GCC internals is required to code in MELT.
The MELT runtime contains a copying generational garbage collector -GC- implemented in ‘gcc/melt-runtime.c’, backed up by the previously existing GCC ordinary (precise, marking) garbage collector GGC. The MELT-specific copying GC is designed for efficiency (but requires a very specific C coding style, easy to achieve in generated C code, but uncumfortable for human C developers), and handles well quick allocation of many short-lived objects [which is not a goald of GGC]. Therefore, don’t be afraid of allocating a lot of values inside MELT code.
1.6.1 Reserved MELT syntax and symbols | ||
1.6.2 Primitives in MELT | ||
1.6.3 Citerators in MELT | ||
1.6.4 Functions in MELT |
This section has to be completed.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following symbols have specific MELT meaning. Use them only as
described here and avoid redefining them. and assert_msg
comment compile_warning cond cppif
current_module_environment_container debug_msg defciterator defclass
definstance defprimitive defselector defun exit export_class
export_macro export_values fetch_predefined forever get_field if instance lambda
let make_instance match multicall or parent_module_environment progn
put_fields quote return setq store_predefined
unsafe_get_field unsafe_put_fields
update_current_module_environment_container
Also avoid symbols starting with def
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A MELT primitive defines an operator by specifying how to translate
into C each of its invocation. As a simple example, the less-than
integer operator <i
is defined as
(defprimitive <i ; define the primitive (:long ; next formal arguments are longs a b) ; the two formal arguments :long ; the type of the result (also long) "((" a ") < (" b "))") ; how to expand into C code |
Later on, a MELT expression like (<i a b)
gets
translated into C code similar to ((curfnum[3]) < (curfnum[7]))
where curfun[3]
(1) is the translation of the normalized
form(2) of a, etc.
Note that the above primitive accepts raw long integers (exactly the C
long
type) and returns such a long integer [0 if
((a)<(b))
was false in the C sense, and non-zero, perhaps -1,
if it was true]. We say that such integers are unboxed stuff
(we don’t speak of values in that case). The symbol :long
represents the C type long
and we call it a ctype.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A MELT c-iterator or citerator is a construct which generalize
iterative loops (like the for
in C). As a trivial example, to
iterate on positive integers till a limit, define
(defciterator each-posint-till ; define each-posint-till citerator (:long lim) ; start formal argument is lim eachposint ; state symbol - uniquely substituted (:long cur) ; local formals ( ; start of before expansion "long " eachposint ";" " for (" eachposint"=0; " eachposint "<" lim ";" eachposint "++) {" cur " = " eachposint; ) ( ; start of after expansion "}" ) ) |
When used in a MELT expression like (each-posint-till (5) (:long
v) (print-long v))
-which has :void
ctype because citerators
are only useful for their side-effects- the C translation is vaguely
similar (assuming print-long
is a primitive expanding to
printf(``%d\n'',…)
to something looking like
curfnum[11] /*LIM*/ = 5; {long eachposint_24; for (eachposint_24=0; eachposint_24<curfnum[11]; eachposint_24++) { curfnum[3] /*V*/ = eachposint_24; printf("%d\n", curfnum[3] /*V*/); } } |
So the start formals is translated as some local variable in the MELT
frame, the state symbol eachposint
is only used to generate a C
identifier (unique to each occurrence of the citerator) and the local
formals are translated to local variables bound inside the iterators
body.
In practice, citerators are very useful for interfacing to the various iterating idioms in GCC. A more realistic example is
;;;; iterate on a gimpleseq (defciterator each_in_gimpleseq (:gimpleseq gseq) ;start formals eachgimplseq (:gimple g) ;local formals ( ;;; before expansion "gimple_stmt_iterator gsi_" eachgimplseq ";\n" ;; test that gseq is not null to be safe "if (" gseq ") for (gsi_" eachgimplseq " = gsi_start (" gseq "); !gsi_end_p (gsi_" eachgimplseq ");" " gsi_next (&gsi_" eachgimplseq ")) {\n" g " = gsi_stmt (gsi_" eachgimplseq ");" ) ( ;;; after expansion "}" ) ) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
As in many lisp dialect (e.g. Common Lisp) MELT functions are defined
using the defun
construct. The first argument (and the primary
result) of all MELT function should always be a value, so it is not
possible to give an unboxed gimple
stuff to a function; hence
we box it (pack it into a MELT value) before passing it as an
argument.
The following define a second-order function (actually defined in
‘ana-base.melt’) called do_each_gimpleseq
which gets two
arguments, the first being itself a MELT function and the second being
an unobxed gimple
stuff, and apply the first argument to boxes
packing each gimple
inside the given gimpleseq
.
;; apply a function to each boxed gimple in a gimple seq
(defun do_each_gimpleseq (f :gimpleseq gseq)
(each_in_gimpleseq
(gseq) (:gimple g)
(let ( (gplval (make_gimple discr_gimple g)) )
(f gplval)))
)
|
This function is only useful for its side effect (calling a function
for each member of a gimpleseq
). It returns the nil value.
The real translation to C of the above is a quite big and messy C function, actually:
static melt_ptr_t rout_9_DO_EACH_GIMPLESEQ (meltclosure_ptr_t closp_, melt_ptr_t firstargp_, const char xargdescr_[], union meltparam_un *xargtab_, const char xresdescr_[], union meltparam_un *xrestab_) { #if ENABLE_CHECKING static long call_counter__; long thiscallcounter__ ATTRIBUTE_UNUSED = ++call_counter__; #define callcount thiscallcounter__ #else #define callcount 0L #endif struct frame_rout_9_DO_EACH_GIMPLESEQ_st { unsigned nbvar; #if ENABLE_CHECKING const char *flocs; #endif struct meltclosure_st *clos; struct excepth_melt_st *exh; struct callframe_melt_st *prev; #define CURFRAM_NBVARPTR 5 void *varptr[5]; /*no varnum*/ #define CURFRAM_NBVARNUM /*none*/0 /*others*/ gimple_seq loc_CTYPE_GIMPLESEQ__o0; gimple loc_CTYPE_GIMPLE__o1; long _spare_; } curfram__; memset (&curfram__, 0, sizeof (curfram__)); curfram__.nbvar = 5; curfram__.clos = closp_; curfram__.prev = (struct callframe_melt_st *) melt_topframe; melt_topframe = (struct callframe_melt_st *) &curfram__; melt_trace_start ("DO_EACH_GIMPLESEQ", callcount);
The generated C function has a strange C formal arguments list (every
applicable routine has the same signature in C. All arguments except
the first are passed in an array of union, described by a short
constant string, one character per argument, encoding its
ctype. Secondary results are handled likewise). Some code is only
enabled with #if ENABLE_CHECKING
when GCC is configured for
debugging (not for release). The MELT call frame is declared
explicitly as a structure called curfram__
, and is properly
initialized, and set as the melt_topframe
. The
melt_trace_strart MELT_LOCATION callcount
C macros are
significant only when #if ENABLE_CHECKING
.
/*getarg#0 */ MELT_LOCATION ("ana-base.melt:436:/ getarg"); #ifndef MELTGCC_NOLINENUMBERING #line 436 "ana-base.melt" /**::getarg::**/ #endif /*MELTGCC_NOLINENUMBERING */ /*_.F__V2*/ curfptr[1] = (melt_ptr_t) firstargp_;
We start to fetch the first argument into the current frame, since
curfptr
is actually a C macro defined as
curfram__.varptr
. The MELT_LOCATION
macro call
(significant only when checking was enabled, and setting the
flocs
field of the current frame in that case) and the
#line
directive(3) refer to the MELT source
location. For clarity, we now skip them, but there are lots of
such positional information in the generated C code. Note that a
single MELT source line is producing many C code lines (hence the line
numbering seen in a debugger might be slightly wrong), and that some
comments are generated (notably explaining what each curfptr
occurrence means).
/*getarg#1 */ if (xargdescr_[0] != BPAR_GIMPLESEQ) goto lab_endgetargs; curfram__.loc_CTYPE_GIMPLESEQ__o0 = xargtab_[0].bp_gimpleseq; goto lab_endgetargs; lab_endgetargs:;
The second argument is likewise fetched, only if the actual argument
is of gimpleseq
ctype. The useless goto is optimized by any
serious C compiler (like gcc).
/*block*/ { /*citerblock EACH_IN_GIMPLESEQ */ { gimple_stmt_iterator gsi_cit1__EACHGIMPLSEQ; if ( /*_?*/ curfram__.loc_CTYPE_GIMPLESEQ__o0) for (gsi_cit1__EACHGIMPLSEQ = gsi_start ( /*_?*/ curfram__.loc_CTYPE_GIMPLESEQ__o0); !gsi_end_p (gsi_cit1__EACHGIMPLSEQ); gsi_next (&gsi_cit1__EACHGIMPLSEQ)) { /*_?*/ curfram__.loc_CTYPE_GIMPLE__o1 = gsi_stmt (gsi_cit1__EACHGIMPLSEQ); /*block */ { /*_.GPLVAL__V4*/ curfptr[3] = (meltgc_new_gimple ((meltobject_ptr_t) (( /*!DISCR_GIMPLE */ curfrout->tabval[0])), ( /*_?*/ curfram__.loc_CTYPE_GIMPLE__o1)));;
This is the beginning of a block generated by a citerator. It contains
the translation of the make_gimple
primitive use as a call to
the meltgc_new_gimple
C function.
/*apply */ { /*_.F__V5*/ curfptr[4] = melt_apply ((meltclosure_ptr_t) ( /*_.F__V2*/ curfptr[1]), (melt_ptr_t) ( /*_.GPLVAL__V4*/ curfptr[3]), "", (union meltparam_un *) 0, "", (union meltparam_un *) 0); };
This is the translation of the application of f
. Since there
only one argument and no secundary results, we pass null union
meltparam_un
pointers described by empty strings to follow the
pecular conventions required by
melt_apply
(4) and
respected by MELT generated C functions implementing MELT routines.
/*epilog */ /*clear *//*_.GPLVAL__V4*/ curfptr[3] = 0; /*clear *//*_.F__V5*/ curfptr[4] = 0; }; } /*citerepilog */ /*clear *//*_?*/ curfram__.loc_CTYPE_GIMPLE__o1 = 0; /*clear *//*_.LET___V3*/ curfptr[2] = 0; } /*endciterblock EACH_IN_GIMPLESEQ */
Some MELT local variables are explicitly cleared. This helps the MELT garbege collector. The block generated for the citerator is ended, again by clearing some locals.
/*epilog */ }; goto labend_rout; labend_rout: melt_trace_end ("DO_EACH_GIMPLESEQ", callcount); melt_topframe = (struct callframe_melt_st *) curfram__.prev; return (melt_ptr_t) ( /*noretval */ NULL); #undef callcount #undef CURFRAM_NBVARNUM #undef CURFRAM_NBVARPTR } /*end rout_9_DO_EACH_GIMPLESEQ */
This is the whole function epilog. The MELT top frame is popped, and the previous is reinstated.
Of course, nobody wants to read or understand the generated code above.
In practice, such second-order functions (second order because they
are functionals, consuming function arguments) are often used with
anonymous functions using the lambda
construct, eg
(do_each_gimpleseq
(lambda (boxgimp) ;anonymous function with argument boxgimp
(let ( (:long gimp
; fetch the content of the boxed gimple value as an unboxed stuff
(gimple_content boxgimp)) )
…. do something with |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
1.7.1 Lexical MELT conventions | ||
1.7.2 Main MELT syntax and features | ||
1.7.3 MELT modules and translation | ||
1.7.4 Writing GCC passes in MELT |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It is recommended to edit MELT files with a Lisp-aware editor (e.g. the GNU emacs Lisp mode).
As in Lisp dialects:
[a b]
is the same as (a b)
but both
[a b)
and (a b]
are incorrect.
;
) to the end of the line. This is the
prefered way to put comments in MELT file.
#|
), may take several lines, and end with
bar-hash (|#
). Don’t nest block comments.
\\
to represent a single backslash,
backslash doublequote \"
to represent a doublequote, backslash t
\t
for a tab, , and \xfe
to represent the character
coded 0xfe in hex, etc. In addition, a backslash-leftbrace \{
read verbatim all characters up to the first rightbrace }
. A string with the last doublequote followed by an underscore like
"do that"_
is localized using the gettext
host system
function; this could be useful for some user messages (to be
translated to other languages like french).
_+-*/<>=!?:%~&@$
. It is advised
to use these special characters sparingly. Symbols cannot start with
any of ?%
. Because symbols are related to their C translation,
is advised to avoid digits after underscores in symbols like
x_12
and to have each symbol contain at least one letter
(e.g. use <i
instead of <
).
'
is special. 'x
is parsed the same as (quote x)
.
`
is special. `x
means the same as (backquote x)
,
is special. So ,x
means (comma x)
and ,(a
b)
is (comma (a b))
?
is special when is is the first of a token (it may appear
inside a symbol otherwise). For instance, ?x
means
(question x)
but x?
is a symbol of two characters. So
?y?
is bad taste but means (question y?)
#
is special. In particular, #|
starts multiline
comments; #\space
is the integer code of the space character;
#b10
is a binary number (i.e. two), #o12
is octal (ie
ten), #xffff
is hexadecimal number (ie 65535). #{
starts macrostrings.
#{
and
ending with }#
possibly on a different line with $
escapes like in C. For example, the #{if ($A>0) printf("%s",
$B);}#
macrostring is parsed exactly as the 5-elements s-expression
("if (" A ">0) printf(\"%s\", " B ");")
. In a macrostring, all
caracters are taken as is, except the dollar sign $
; the
macro-string itself is always read as an S-expr. When a dollar is
followed by alphanumerical (or underscore) caracters like a C
identifier, it is parsed as a symbol. If it is followed by an hash
#
caracter, that hash-character is skipped and terminate the
symbol. The $.
sequence is skipped and ignored, the
double-dollar $$
is read as a single dollar, the $#
is
read as a single hash #
.
A macro-string starting with the four characters #{$'
is
expanded into a (quote ...)
expression and should
preferably not contain symbols like $symb
. This special
meaning of $'
is only relevant when appearing at the very start
of the macro-string.
{
and }
are special.
-123
or +22
or
33
. Notice that 1.2
is illegal; it is not a floating
point number.
:
) starts constant (lisp-like) keywords which always evaluate to themselves.
Contrarily to some or most other Lisp dialects:
(a b . c)
is not legal.
"example of international"_
) is localized by calling
gettext
at read time.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
We list each key symbol in alphabetical order and provide a short derscription. Familiarity with some Lisp or Scheme dialect is required.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A formal argument list is a possibly empty list (between
parenthesis). This list contains either ctype keywords or formal
names. A ctype keyword apply to all further formals (until another
ctype keyword, or end of formal arguments list. Ctypes have a keyword
and are each described by a predefined instance (of
CLASS_CTYPE
) with a name conventionnally starting with
ctype_
.
[For experts: to add a new ctype, define a BGLOB_CTYPE_*
predefined in ‘gcc/melt.h’ and an instance in
‘warmelt-first.melt’ using install_ctype_descr
, then
regenerate all the ‘gcc/warmelt-*.c’ files]
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
:value
(ctype instance ctype_value
)
This ctype is for MELT [boxed] values. It is the default ctype of arguments.
:long
(ctype instance ctype_long
)
This ctype is for unboxed long integers; it is also used for conditions and tests.
:tree
(ctype instance ctype_tree
)
This ctype is for GCC tree
raw pointers, as in ‘gcc/tree.h’.
:gimple
(ctype instance ctype_gimple
)
This ctype is for GCC gimple
raw tuple pointers, as in ‘gcc/gimple.h’.
:gimpleseq
(ctype instance ctype_gimple
)
This ctype is for GCC gimple_seq
raw pointers, representing
sequences of gimple instructions, as in ‘gcc/gimple.h’
:basicblock
(ctype instance ctype_basicblock
)
This ctype is for GCC basic_block
raw pointers, representing
basic blocks, as in ‘gcc/basic-block.h’
:edge
(ctype instance ctype_edge
)
This ctype is for GCC edge
raw pointers, representing edges of
the control flow graph, as in ‘gcc/basic-block.h’
:void
(ctype instance ctype_void
)
This ctype is the same as C void
type. It should not be the
type of formal arguments. It is only useful as the result type of
side-effecting primitives.
:cstring
(ctype instance ctype_cstring
)
This ctype is only for constant strings (like const char[]
in
C). It is not possible to build an unboxed :cstring
. Every
:cstring
variable may only be bound to constant strings (not to
something inside some heap).
MELT formal arguments appear in lambda defun defprimitive
defciterator multicall
forms. The first formal argument of
defun lambda multicall
constructs should -if given- be a
:value
. Ctype-s also appear in let
bindings. Each MELT
expression (or constant or variable) has a ctype (usually
:value
).
The :value
ctype is the only ctype for boxed values. Every
other ctype is for unboxed stuff.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Most data manipulated by MELT code are values. Values are allocated in the nursery generation of MELT heap, and are later (if alive) copied into GGC heap. A minor MELT garbage collection, which runs quickly and often, only copies live values (in particular, local variables of MELT functions) out of the nursery, into the GGC heap. A full MELT garbage collection also invokes the GGC collector, so scans the entire heap.
MELT boxed values can be one of:
NULL
pointer and noted ()
in MELT)
is a value. It is the initial or default value everywhere.
lambda
and defun
syntactic constructs.
CLASS_ROOT
.
location_t
indicating a location inside e.g. a MELT or C source
file).
gimple
etc..
:long :void :cstring
] has its boxed
map, an hash table associating (non-null) stuff of the given ctype
with arbitrary non-null MELT [boxed] values. For example, a gimple map
associate GCC gimple
s to arbitrary MELT non-null values
(usually MELT objects). This is very useful to represent a
relationship (conceptually an attribute) between gimple
s and
MELT values such as objects without having to enhance the definition
of the gimple
structure inside ‘gcc/gimple.h’
Notice that (contrarily to most other lisps) MELT symbols and MELT
s-expressions are both objects (respectively of class
CLASS_SYMBOL
and CLASS_SEXPR
). The reader function
(which is not as versatile as in CommonLisp) deals with them.
Adding additional MELT value types require enhancing the ‘gcc/melt.h’ and ‘gcc/melt.c’ files.
Each MELT [boxed] value starts with a discriminant. This
discriminant is a MELT object (it cannot be nil). The nil value has
conceptually its own discriminant DISCR_NULLRECV
, but is of
course represented by C NULL
pointer. Discriminants are used by
the garbage collector (precisely to discriminate various MELT boxed
data types using the object number of their discriminant), and by the
MELT message sending machinery (hence messages sent to the nil MELT
value are processed using the DISCR_NULLRECV
discriminant). Each kind of MELT value has its own discriminant, but
sometimes it is useful to have several discriminants possible for the
same kind of MELT value. For example, MELT strings can have
DISCR_STRING
or DISCR_VERBATIMSTRING
etc., and verbatim
strings are handled specially (in particular when printing them inside
generated C code). Every MELT [boxed] value has an immutable
discriminant, set at the time of the value’s creation.
Conventionally MELT non-object values have a primitive to test them
called like is_*
, a primitive to build them called like
make_*
[which takes a discriminant as the first argument], and
the accessing and modifying primitives share a common prefix. In
particular, object maps are tested with is_mapobject
, built
with make_mapobject
, accessed with mapobject_get
and
updated using the mapobject_put
and mapobject_remove
primitives. For more details, look into file
‘gcc/melt/warmelt-first.melt’.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
An important (and common) kind of MELT [boxed] values are MELT objects. A MELT object contains exactly
CLASS_ROOT
or has no direct or inherited fields), but this is
very unusual.
In practice, every object’s slot is described by a field object (of
class CLASS_FIELD
) inside the object’s class.
Every discriminant (in particular every class) is an object with the following fields (or slots):
prop_table
is the property object map associating objects to values, and usable as a P-list.
named_name
is the boxed string naming the discriminant.
disc_methodict
is an object map associating selectors to closures (method implementations).
disc_super
is the super-discriminant (or the super-class for objects)
The root discriminant is DISCR_ANYRECV
. The discriminant of the
nil value is DISCR_NULLRECV
. Other types of values have
discriminants like DISCR_ANYRECV DISCR_BASICBLOCK DISCR_BOX
DISCR_CHARINTEGER DISCR_CLOSURE DISCR_EDGE DISCR_GIMPLE
DISCR_GIMPLESEQ DISCR_INTEGER DISCR_LIST DISCR_MAPBASICBLOCKS
DISCR_MAPEDGES DISCR_MAPGIMPLES DISCR_MAPGIMPLESEQS DISCR_MAPOBJECTS
DISCR_MAPSTRINGS DISCR_MAPTREES DISCR_METHODMAP DISCR_MIXEDINT
DISCR_MIXEDLOC DISCR_MULTIPLE DISCR_NAMESTRING DISCR_NULLRECV
DISCR_PAIR DISCR_ROUTINE DISCR_SEQCLASS DISCR_SEQFIELD DISCR_STRBUF
DISCR_STRING DISCR_TREE DISCR_VERBATIMSTRING
. Some discriminants are
specialized by having a meaningful (i.e. not DISCR_ANYRECV
)
super-discriminant (i.e. the value inside the :disc_super
slot). For example, DISCR_METHODMAP
is used for object maps
which are method maps (mapping a selector to a function implementing a
method), instead of the plain DISCR_MAPOBJECTS
. [For experts:]
It is possible to make additional discriminants using
definstance
with CLASS_DISCR
as the class.
Classes are discriminants, but in addition have the following fields (or slots):
class_ancestors
is the multiple (of discriminant DISCR_SEQCLASS
) of the
classes’ ancestors. Testing that a given object has some given class
as its direct class or indirect ancestor is quick (is_a
primitive in MELT, melt_is_instance_of
function in C code).
class_fields
is the multiple (of DISCR_SEQFIELD
) of the classes’ fields
(both inherited from ancestors or own to the class).
class_objnumdescr
is usable for describing the objnum of instances.
class_data
is an additional slot for holding class data.
Fields are slot descriptors (objects of CLASS_FIELD
), they are
named (so inherit fields prop_table named_name
). Their objnum
is their index, their specific slots are
fld_ownclass
gives the class defining the field.
fld_typinfo
can be used for describing the field’s type in instances.
Beware that the structure of classes, fields and discriminants is described not only in ‘warmelt-first.melt’ but also “built-in” in files ‘melt.c’ and ‘melt.h’ so changing them is very tricky.
Fields should have a globally unique name. Conventionally, fields common to the same class share a common prefix for their name.
The defclass
construct builds and fills class and fields
objects. Don’t make instances of CLASS_CLASS
or
CLASS_FIELD
otherwise!
Objects are built using the make_instance
construct, or
statically using definstance
. In addition, defselector
defclass
also statically build objects (likes classes and fields).
Exporting a class means exporting the class object and its own fields.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Function applications are noted (fun args
…)
. There may be no arguments, e.g. just
(fun)
. If arguments are given, the first argument must be
a :value
. So (f 1 x)
is incorrect (because 1
is
an unboxed :long
); use (f x 1)
instead. Usually, the
function is just a variable bound to a function, but it may be a
more complex expression, like ((if (p x) f g) x y)
which,
depending on the test (p x)
applies either f
or g
to x y
.
The application of a non-function returns null. The
melt_apply
C function doing the application checks that the
applied function is indeed a function (ie a closure). Function
applications are never tail-recursive; they always consume some stack
space.
Named functions are defined using the defun
construct, using a
Common Lisp like syntax (not the Scheme define
). If the formal
arguments list is not empty, its first element (the first formal
argument of a named or anonymous function) should be a :value
.
Functions are not polytopic nor polymorphic; their signature is
essentially fixed. They should expect a fixed number of arguments
[there is no variable argument facility in MELT], each with a defined
ctype (the first argument should be a :value
), and return a
fixed number of results (the first result should be a :value
)
each with a defined ctype. An argument which has not the expected
ctype or is missing is initialized to null or 0. Likewise a secundary
result which has not the expected ctype is ignored or set to null or
0.
A function should [always] return a primary result of ctype
:value
and may also return secondary results (using the
return
construct). The only way of getting the secondary
results of a function call (or a message send) is thrue the
multicall
construct, which binds all the results of the call or
send to the formal arguments in the multicall
. Function
applications not done in a multicall
have all their secondary
results (if any) ignored.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Function abstraction (i.e. making anonymous functions) is done using
the lambda
construct. Only values can be closed, hence
it is not possible to close a non-boxed value, so (let ( (:long
one 1) ) (lambda (a) (f a one)))
is incorrect (and rejected by the
MELT translator).
Actually, every MELT function is really a closure, so defun
binds a name to the closure which is the named function.
Closures are :value
s. Use the is_closure
primitive to
test tha a given value is indeed a closure. The only way of building
closures is thru lambda
or defun
. Closures contain a
routine pointer (routines are also :values
) and closed
values. [For experts] the size of a closure is available thru the
closure_size
primitive. Its routine is available thru
closure_routine
primitive. To get its n-th closed value, use
the closure_nth
primitive. At MELT runtime, each MELT call
frame for MELT function application (or message sending) knows its
closure.
Routines correspond to MELT generated C functions (with their constant values).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A message invocation is done using the construct
(selector-name reciever args …)
. This
construct is syntactically the same as function (or primitive)
application, and is discriminated by the fact that the
selector-name has been previously defined with
defselector
or is imported as bound to an instance of
CLASS_SELECTOR
. The selector should be such a name and cannot
be an expression. The reciever can be any :value
(even
null). The args are optional and can have any ctype (but a
selector should have a fixed and well defined signature). Use
export_values
to export selectors.
A method is just a functional value, installed thru the
install_method
function. This function expects a discriminant
or class, a selector, and a function (the method). Method installation
is very dynamic and can be done at any time.
A message invocation (i.e. an expression starting with a selector) can
be done on any boxed value. If it is an object, its class is used;
otherwise its discriminant is used (so DISCR_NULLRECV
is used
when sending to nil). To send a message of selector sel (an
instance of CLASS_SELECTOR
) to a reciever recv of
discriminant (e.g. the class of an object) dis, the following
procedure is used:
CLASS_DISCR
, stop and do nothing.
discr_methodmap
slot of dis;
it should be an object map (i.e. a “dictionnary” of methods) that we
call md.
disc_super
) and repeat again. Hence, methods are also
looked in superclasses, etc… so are properly inherited.
Notice that message invocation is more dynamic (hence slower) than e.g. C++ virtual member functions, and that method maps can be upgraded at any time.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The table below gives MELT syntax constructs, in alphabetical order. [Experts can add new constructs using macros, and implementing appropriate methods in the MELT translator].
and
(and e1 e2 e3 …)
is (like in all
Lisps) used for sequential conjunction; it is the same as (if
e1 (if e2 e3))
etc… Any number (at least one) of
conjuncts are possible. All the conjuncts (e1 …) should
have the same ctype (usually :value
).
assert_msg
(assert_msg msg check)
aborts when check is
false (using the assert_failed
primitive, giving the source file
position) and displays the given msg, when GCC is built for
debugging with ENABLE_CHECK
. If GCC is not built for debugging,
neither operand is used. The entire assert_msg
expression
evaluates to nil.
comment
(comment msg)
evaluates to nil and output the msg
as a C comment in the C translation. Don’t use */
or */
in msg. When a comment
appears at the beginning of a MELT
compilation unit, it appears at the beginning of the generated C file;
this is useful for making copyright notices appear both in the MELT
source file and the generated C code.
compile_warning
(compile_warning msg exp)
evaluates like exp but also
emits a message at MELT compilation time. Intended use is similar to
#warning
in C.
cond
(cond condition1 condition2 …)
is -like in
all Lisps- a conditional evaluation. Each condition is
(test then1 then2 … thenk)
so
the test is evaluated. If it is true, all the thens are
evaluated in sequence, and the last is the result of the whole
cond
expression. The last condition can be (:else
else1 … elsek)
; if no previous test succeeded,
all the elses are sequentially evaluated, and the last of them
is the whole cond
result. Notice that (cond (test1
then1) (test2 then2a then2b) (:else
else1 else2 else3))
is the same as (if
test1 then1 (if test2 (progn then2a
then2b) (progn else1 else2)))
.
cppif
[for experts] (cppif name then-cpp else-cpp)
is translated
using a C directive #if name
to the translation of
then-cpp or else-cpp.
current_module_environment_container
[for experts] (current_module_environment_container)
evaluates
to an object of CLASS_CONTAINER
containing the current module
environment.
debug_msg
(debug_msg expv msg [count])
-where the
count expression (of ctype :long
) is usually ommitted- is
useful for debugging ouput of the value of expv (with the
-fmelt-debug
program option) to output, using the
debug_msg_fun
function. The entire debug_msg
expression
is somehow equivalent to (cppif ENABLE_CHECKING (debug_msg_fun
expv msg count filename lineno) ())
and evaluates to nil.
defciterator
The form (defciterator iter-name start-formals
state-symbol local-formals before-expansion
after-expansion)
defines a C-iterator named
iter-name. The start-formals is a [binding] list of formal
arguments [given to the C-iterator]. The state-symbol is usable
in the expansions, where it is expanded to a unique C identifier. The
local-formals is a [binding] list of variables local to the
expanded block. The before-expansion and after-expansion
are lists of items like strings (appearing as is in the C expansion)
or symbols (either from the start formals, or the local formals, or
the state symbol).
defclass
The form (defclass class-name [:predef predefined]
[:super superclass-name] :fields fields-list)
defines a
class named class-name of super-class named
superclass-name with the given fields-list (a list of
field names) and an optional predefined name (for predefined
classes [giving a predefined is for experts]).
defcmatcher
The form (defcmatcher cmatcher-name match&in-formals
out-formals state-sym test-expansion
fill-expansion oper-expansion)
defined a matching
construct by its C translation. The match&in-formals gives the
matched thing ctype (as the first formal argument, either a boxed
value or a raw stuff) and input arguments (rest of formals). The
out-formals are the signature of the deconstructed things. The
test-expansion expands (as a C boolean-like expression) to the
test part of the match. The fill-expansion expands (as a
sequence of C instructions) to the deconstructing part. The
oper-expansion is used, much like in primitives, when the
cmatcher-name appears as an operator in an expression context.
definstance
The form (definstance instance-name class-name
[:predef predefined] [:obj_num object-number]
:field-name field-value …)
statically defines an
instance of name instance-name of the class
class-name. [expert usage: a predefined name and an
object-number may also be given].
defprimitive
The form (defprimitive primitive-name
formals-arglist ctype expansion …)
statically defines a C primitive named primitive-name of a given
formals-list and given return ctype. The expansion-s
are either strings or formal names.
defselector
The form (defprimitive selector-name selector-class
:field-name field-value …)
defines a
selector. Usually selector-class is CLASS_SELECTOR
, and
no other fields are given. Once a name is bound to a selector,
every further occurrence of that name in operator position is
considered as a message invocation.
defun
The form (defun function-name formals-list
body …)
define a function named
function-name
. The ctype of the first (if any) formal argument
(in the formals-list) should be a :value
. The
function-name
can appear in the given body (for
recursion).
exit
The form (exit loop-label expr …)
, only
used inside forever
loops, causes the lexically enclosing
forever
loop named by loop-label to be exited, after
evaluation of the exprs. The last such value (or nil if no
expr is given) is the result returned by the forever
loop. exit
forms are similar to Ada’s exit
or C
break
(not to longjmp
). The exit
should be local
to the containing procedure: it cannot jump across lambda
s.
export_class
The form (export_class class-name …)
export all
the given class-names and their fields.
export_macro
[For experts] The form (export_macro macro-symbol
expander)
exports a macro binding for the given
macro-symbol with the expander function. The macro
macro-symbol
is defined in the environment exported by the
current module, so is available in other modules only (but not in the
current one).
export_patmacro
[For experts, not implemented] The form (export_patmacro
patmacro-symbol pat-expander mac-expander)
exports
a pattern macro binding for the given patmacro-symbol with the
pat-expander as a pattern expanding function (used in patterns)
and the mac-expander as a macro expanding function (used in
expressions).
export_values
The form (export_values exported-name …)
export
all the names, as values, given as arguments. For classes,
export_class
should be used, otherwise the fields are not
exported.
fetch_predefined
[For experts] (fetch_predefined predefined-name-or-number)
forever
(forever label-name body …)
when
evaluated, the bodies are evaluated in sequence, and indefinitely
re-evaluated again. The only way of getting out from a forever
loop is with exit
(using the given label-name, lexically
inside the body) or return
. Avoid using a bound variable name
as a label-name.
get_field
(unsafe_get_field :field-name expr)
retrieves the
field named :field-name from the object returned by expr
expression. If it is not an appropriate object (of the class owning
the :field-name) , gives nil.
if
(if test then-exp [else-exp])
. When
evaluated, the test is first evaluated. If it is true, the
then-exp is evaluated and is the result of the whole
if
. If it is false (either 0 if ctype-d :long
, or the
null pointer for :value
and other ctypes), the optional
else-exp is evaluated (or 0 or null) and is the result of the
whole if
. Both the then-exp and the else-exp (if
given) should have the same ctype.
instance
(instance class-name [:field-name field-value]
…)
is a constrctive expression for instances, where the
class-name is the name of a class (it cannot be a complex
expression but should be a class statically known) and where each
:field-name keyword (starting with a colon) is the name of some
field (direct or inherited) of the class and the following
field-value is an expression giving its initial value; the
result of instance
is a freshly built instance of the given
class-name initialized with the fields (fields which are not
mentionned are initialized with nil).
lambda
(lambda formal-args body …)
is a
constructive expression for function abstraction, it returns a
closure, the anonymous function taking formal-args as arguments
and evaluating sequentially the body expressions, returning the
value of the last one. The first argument of a function and the first
result that it is returning should be a :value
.
let
(let (let-binding …) body …) is a
sequential binding construct (closer to
. The first operand should be a list of
let-bindings. Others operands make the body, evaluated in
sequence with the new bindings applied with lexical scoping. A
let-binding is an optional ctype (let*
in other
Lisps):value
by
default) followed by a variable name (ie a symbol) followed by one
expression. Variables bound by previous let-bindings are visible
in the expression inside the current let-binding (so recursion
is not permitted like with flet
or letrec
in some
Lisps). Notice that a let-binding can bind a variable to unboxed
stuff (like a plain long integer). The result of the whole let
expression is the result of the evaluation of the last body
expression, done with the new bindings.
letrec
(let (letrec-binding …) body …)
is a
recursive binding construct. The letrec bindings should only bind
constructive expressions, that is lambda
-s, tuple
-s,
instance
-s and list
-s.
list
(list expr …)
is a constructive expressions
for lists. It returns a tuple
made of the arguments.
match
(match expr match-case … )
NOT
IMPLEMENTED YET Do a pattern match. Evaluate expr and for the
first maching match-case, do its body. There is no :else
clause, use the joker pattern ?_
for that purpose. A
match-case is a simple match case (pattern
body …)
where body is evaluated with the
pattern variables appearing in pattern bound. A match-cas
can be a when match case (:when pattern when-cond
body …)
where the body is done when that pattern
matches and the when-cond (evaluated with the pattern variables
bound) is a true condition.
multicall
(multicall (result-formals) call-expr body
…)
is the only way to retrieve multiple (one primary and
some secondary) results from a function application or a message
invocation call-expr (which should syntactically be an
application or an invocation, not anything else). The
result-formals are syntactically like formal arguments;
See section MELT formals. The first result formal should be of ctype
:value
. Secondary result formals which are not matching the
ctype of the actual secondary result are cleared. The bindings of the
result formals are local to the multicall
expression and usable
in the body sequence.
or
(or e1 e2 e3 …)
is the sequential
disjunction of e1 … (at least one disjunct). In
particular (or a b)
is the same as (if
a a b)
except that a is evaluated once. All
the disjuncts should have the same ctype (usually :value
).
parent_module_environment
[For experts] (parent_module_environment)
return the parent
module’s environment.
progn
(progn e1 e2 … en)
evaluates
successfully e1 then e2 and return the value of the last
en.
put_fields
(put_fields obj :field-name1 val1
…)
updates the object value of obj by changing its
field named :field-name1 to the value of val1 etc…
(all the fields are updated at once). It is safe, in the sense that if
obj is not an object of the appropriate class, nothing happens.
quote
(quote x)
is the same as 'x
and returns the symbol
x
itself (as an instance of CLASS_SYMBOL
). When applied
to an integer, like '1
, it gives a constant boxed integer value
(of DISCR_INTEGER
). When applied to a string, like
'"string"
, it gives a constant boxed string value (of
DISCR_STRING
). Therefore, when passed as an actual argument (to
a primitive, a function, ...) '1
(a boxed integer value) is not
the same as 1
(a raw integer stuff), and likewise '"abc"
is a boxed string value, different of "abc"
(a raw string
stuff). This is very different from other Lisps! Only symbols,
strings, integers can be quoted.
return
(return e1 …)
return from the entire containing
function (i.e. defun
or lambda
). The first expression
e1 should be of ctype :value
and is evaluated as the
primary result. Other expressions are evaluated (and can have
different ctypes) and returned as secondary results. A (return)
without argument is a convenience for returning the nil value. The
ctype of the return
is :value
even if the return
expression itself does not gives a value (because it breaks the
control flow), hence (or (return) 'x)
is acceptable but
tasteless.
setq
(setq var exp)
assigns to the local variable
var the value of exp (which is also the value of the
entire setq
expression). Both var and exp should
have the same ctype.
store_predefined
[Expert] (store_predefined predef-name-or-number
expr)
Don’t use it if you don’t understand.
tuple
(tuple expr …)
is a constructive expressions
for tuples (or multiples). It returns a tuple made of the arguments.
unsafe_get_field
(unsafe_get_field :field-name expr)
retrieves the
field named :field-name from the object returned by expr
expression (of ctype :value
). If expr does not evaluates
to an object instance (directly or indirectly) of the class defining
the :field-name the behavior is undefined, and unsafe (GCC
usually crashes).
unsafe_put_fields
(unsafe_put_fields obj :field-name1 val1
…)
updates the object value of obj by changing its
field named :field-name1 to the value of val1 etc… (all
the fields are updated at once). If obj is not an object of the
appropriate class for the fields, the behavior is undefined and unsafe
(usually GCC crashes).
update_current_module_environment_container
[Expert] (update_current_module_environment_container)
don’t
use it if you don’t understand.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[for experts mostly; familiarity with the notions of bindings and environments is expected.]
1.7.3.1 MELT environments and bindings | ||
1.7.3.2 translating a MELT module | ||
1.7.3.3 MELT module initialization and exports | ||
1.7.3.4 MELT translation steps |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A MELT module uses previously available bindings (imported values,
etc..) and provides its own bindings (exported values,
etc..). Bindings are objects (of superclass CLASS_ANY_BINDING
,
e.g. of some class like CLASS_VALUE_BINDING
CLASS_MACRO_BINDING
CLASS_PATMACRO_BINDING
CLASS_INSTANCE_BINDING
etc…). Bindings are grouped in
environments (themselves objects of class
CLASS_ENVIRONMENT
). Each environment is linked to its
parent. So a MELT module is initialized in its parent module
environment and gives its own module environment.
Hence MELT environments are objects with a env_bind
field (the
object map of bindings), a env_prev
field (the previous
environment), etc… All bindings are objects with a binder
field (the bound “name”, e.g. a symbol, used as the key in the
binding map of environments).
User MELT code is ordinarily not supposed to explicitly change environments and bindings (but they are changed implicitly at module initialization).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A MELT file ‘foo.melt’ [which can be viewed as defining the
foo MELT module] is translated into a C source
‘foo.c’ which is then compiled into a dynamically loadable
shared library - usually ‘foo.so’ on Linux. The translation
to C is done using cc1
(or gcc
, not implemented yet)
with the -fmelt-mode=translatefile -fmelt-arg=foo.melt
-fmelt-secondarg=foo.c
options. The generated file
foo.c is usually quite big (and only #include
-ing one
file, "run-melt.h"
which includes all the rest). It
essentially contains one static C function (of signature compatible
with melt_apply
) for each defun
or lambda
function in MELT, and one big exported start_module_melt
C
function which does all the initializations, and some other stuff. The
initialization code builds all the required data (quoted symbols,
closures, classes, fields, boxed strings, static instances defined
thru definstance
etc..); MELT modules have no data outside of
this start_module_melt
function.
The start function start_module_melt
(which is found by
dynamic loading of the module, usually thru dlopen
and
dlsym
or their equivalent, and called only once) expects a
parent environment and returns the newly filled module
environment(5).
To generate a MELT binary module from a MELT source file, use
-fmelt-mode=translatetomodule
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Names defined (as a function thru defun
, as a class thru
defclass
, as a field, etc…) are not visible outside their
module (to further MELT modules loaded afterwards) unless they are
exported. Most names (e.g. functions, selectors, instances) are
exported as values using the export_values
construct. Classes
are usually exported using export_class
(6), which also exports all the own
fields of the exported class (but inherited fields are not exported,
unless their class was export_class
-ed).
Advanced users can extend the MELT language by exporting macros using
the export_macro
construct, which gets a macro name and its
macro expander function, which takes as arguments the source
expression (of CLASS_SEXPR
), the environment (of
CLASS_ENVIRONMENT
), the current expander, and produces an
instance of a subclass of CLASS_SRC
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The generated C code is of much lower level than the MELT source. The MELT source code is usually in a file but can be elsewhere (a list or s-exprs in memory).
The generated C code interacts with MELT runtime and garbage
collector; in particular, every value -even temporary ones- should be
explicitly stored in MELT frames known by the GC. Hence, MELT
expressions are quickly normalized : (f (g x) y)
becomes
something similar to let gg = g x in f gg y(7) where gg is a fresh variable
(actually an instance of CLASS_CLONEDSYMBOL
).
The reader, or some other source, provides a list of
s-expressions to be translated. Each such s-expression is an instance
of CLASS_SEXPR
so has prop_table loca_location
sexp_contents
as fields. The :loca_location
field is a mixloc
giving the staring position and file of the s-expr. The
:sexp_contents
is a list value containing the s-expression
elements. Leafs are read specifically, e.g. boxed integers (of
DISCR_INTEGER
) for integers, or symbols (instances of
CLASS_SYMBOL
) or keywords (instances of CLASS_KEYWORD
,
etc. All these classes are defined in ‘warmelt-first.melt’.
Then s-expressions are macro-expanded into objects of
subclasses of CLASS_SRC
. Standard macros (in particular all the
constructs defined above, see section MELT syntax constructs.) are defined
in ‘warmelt-macro.melt’. For instance, the if
macro is
expanded by the mexpand_if
expander function (private to
‘warmelt-macro.melt’) which makes an instance of
CLASS_SRC_IFELSE
with fields :src_loc sif_test :sif_then
:sif_else
and this mexpand_if
expander is given to
export_macro
. Macro expanders might need some of
expand_apply lambda_arg_bindings macroexpand_1
…
functions defined in ‘warmelt-macro.melt’.
After macro-expansion, the expanded source code (instances of some
subclass of CLASS_SRC
) is normalized into instances of
subclasses of CLASS_NREP
(for normal representations,
i.e. nreps) by code in ‘warmelt-normal.melt’. Normal
expressions are not nested, so we separate simple nreps from complex
normal expressions (CLASS_NREP_SIMPLE
vs
CLASS_NREP_EXPR
). Normalization means not only adding extra
internal lets (i.e. instances of CLASS_NREP_LET
but sometimes
computing additional information, such as the ctype of many
expressions. Normalization is in particular done with the
normal_exp
selector (returning the nrep primarily and
secundarily a list of additional bindings), and other utilities such
as normalize_tuple get_ctype wrap_normal_letseq
etc… For
instance the normalization of if
constructs is done in the
normal_exp
method for CLASS_SRC_IF
, in a private
function called normexp_if
which returns an instance of
CLASS_NREP_IF
with fields :nrep_loc nif_test :nif_then
:nif_else :nif_ctyp
and a list of additional normal bindings (of
CLASS_NORMLET_BINDING
). Macro-expansion and normalization
sometimes give simpler representations; e.g. all of if and or
constructs get normalized as instances of CLASS_NREP_IF
.
After normalization, nreps (which are expression-like) are transformed
in the “code generation”(8) step
into instruction-like representations called objcodes .
instances of subclasses of CLASS_OBJCODE
. This happens in
‘warmelt-genobj.melt’ using the compile_obj
selector,
which, applied to nreps and a generation context (a merge of various
info), produce objcodes. Moving from nreps expressions to instructions
involve very often putting a destination on an nrep thru the
put_objdest
selector.
At last, the objcode is output, within the ‘warmelt-outobj.melt’
file, in two string-buffers (one for the header part, one for the body
part) using several selectors like output_c_code
output_c_declinit output_c_initfill output_c_initpredef
. Only once
all objcodes has been output in string buffers is it actually spilled
to the generated C file, all at once.
Advanced users can extend the MELT language by implementing extensions at various levels of the MELT translator.
Several important data or functions are available thru the
initial_system_data
instance (the only instance of
CLASS_SYSTEM_DATA
), including the exporting and importing
machinery, the fresh module environment maker, the symbols and
keywords dictionnaries and internizers.
All the MELT translation occur in ‘warmelt-*.melt’ files which
generate their ‘warmelt-*.c’ counterparts (these generated files
are distributed with GCC sources). Be careful to minimize the
interaction between these files and the rest of GCC (in particular,
avoid having a strong dependecies between GCC internal data
representations - like gimple
) to be able to regenerate the
translating and translated files ‘warmelt-*.c’ from
‘warmelt-*.melt’ even when GCC internal passes
evolve(9).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[For experts, knowing about GCC passes in general]
GCC passes can be written in MELT. See the ‘ana-*.melt’ files.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[For experts] Sometimes (i.e. to implement a new primitive) it may be necessary to write some C code for MELT. We describe here the coding conventions to follow, in particular because MELT has a copying generational garbage collector (which changes pointers when copying values out of the nursery).
Above all, avoid coding in C (a cumbersome task) and prefer writing MELT code when possible.
Remember that MELT pointers can move at every allocation and every MELT related call.
First, a real example. To box a long integer into a MELT value, MELT
code have to use the make_integerbox
defined in
‘warmelt-first.melt’ as
(defprimitive make_integerbox (discr :long n) :value #{(meltgc_new_int((meltobject_ptr_t)(" discr "), (" n ")))}# |
If the passed discr
is not a discriminant for boxed integers,
make_integerbox
gives nil.
To get the boxed integer’s content, use the getint
primitive in
MELT. To test if a value is a boxed integer, use the
is_integerbox
primitive.
The meltgc_new_int
routine is implemented in
‘melt.c’ with the following code. We give it entirely, with
additional comments
melt_ptr_t meltgc_new_int (meltobject_ptr_t discr_p, long num) { MELT_ENTERFRAME (2, NULL); #define newintv curfram__.varptr[0] #define discrv curfram__.varptr[1] #define object_discrv ((meltobject_ptr_t)(discrv)) #define int_newintv ((struct meltint_st*)(newintv))
We first create a MELT frame using the MELT_ENTERFRAME
macro
which creates, initialize the frame and install it at top. The first
argument is the number of local MELT values, the second argument is
the current MELT closure (so is NULL
for C code which is not
the code of a routine). Instead of writing curfram__.varptr[0]
we #define
some more descriptive names for readability. The
frame is initially filled with nil values. The value pointer arguments
(here discr_p
) of the C function are conventionally named with
a _p
suffix. Every local MELT value should be inside your
curfram__.varptr
array.
discrv = (void *) discr_p;
Every value passed as a C argument should be immediately copied into
the MELT frame (i.e. as a local value) and the C argument should not
be used directly afterwards. So never use _p
suffixed arguments
after have copied them inside the frame.
if (melt_magic_discr ((melt_ptr_t) (discrv)) != OBMAG_OBJECT) goto end; if (object_discrv->object_magic != OBMAG_INT) goto end;
We try to be safe, so we at least test that the discriminant is an
object. We could have tested that it is indeed an instance of
CLASS_DISCR
but that would be slower but safer. However we do
test that the discriminant’s magic is indeed
OBMAG_INT
(10). If either test fail, we return nil by
goto end
. We cannot code a direct return
statement,
because that would not pop the topmost MELT frame.
newintv = meltgc_allocate (sizeof (struct meltint_st), 0); int_newintv->discr = object_discrv; int_newintv->val = num;
We allocate space in the nursery with meltgc_allocate
. This
C function sometimes trigger MELT garbage collection, so may move any
pointer inside any MELT frames. The first argument to
meltgc_allocate
is the sizeof
of the fixed part of
the value, and the second is the size of its trailing variable
part. The allocated zone should be immediately filled to make a valid
MELT value.
end: MELT_EXITFRAME (); return (melt_ptr_t) newintv; #undef newintv #undef discrv #undef int_newintv #undef object_discrv }
We end by popping the current MELT frame and retuning. Popping the
frame should always be done, so conventionally we use an end:
label. To be good citizens for further C functions, we
#undef
-ing every C macro defined for readability.
More generally, every C function which may (directly or in any deeply called function) trigger the MELT garbage collector should follow these rules:
MELT_ENTERFRAME
macro (which expands to a C declaration
followed by some C statements, so should be the last “declaration”
like stuff in your function). For readability, you want to define C
macros (conventionally ending with v
) to access the local
values in your frame instead of curfram__.varptr[index]
.
curfram__
. In particular, nesting
function calls is prohibited; never code f(g(x))
if g
may trigger a MELT garbage collection; use a local value for
g(x)
instead, and avoid declaring any MELT value as a C local.
meltgc_touch
function (taking as argument the modified MELT
value) or the meltgc_touch_dest
(also given the new MELT
pointer inside). These functions has to be called just after writing
the MELT pointer into the data. They can call the MELT garbage
collector (which may change any local value in the MELT frame).
meltgc_allocate
, or preferably some existing allocating
function (like meltgc_new_*
) to allocate new MELT
values. Never forget that such an allocation may trigger the MELT GC
and change every local pointer in the current MELT frame
curfram__
. Most C functions which may directly or indirectly
trigger a MELT garbage collection are prefixed with meltgc
(but melt_apply
could also trigger that).
longjmp
won’t pop the MELT frames.
MELT_EXITFRAME()
macro, which usually is
the last statement of your function (so avoid return
-ing
before, hence always use a goto end
instead.
MELTGOB
or MELTG
macros. Adding additional MELT globals is tricky (edit files
‘melt.h’ and ‘warmelt-normal.melt’). Using existing MELT
globals is simpler, e.g. MELTGOB(DISCR_LIST)
to fetch the
predefined discriminant DISCR_LIST
.
melt_apply
and meltgc_send
with their
pecular calling conventions (constant string describing array of
unions).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If you want to have more free software a few years from now, it makes sense for you to help encourage people to contribute funds for its development. The most effective approach known is to encourage commercial redistributors to donate.
Users of free software systems can boost the pace of development by encouraging for-a-fee distributors to donate part of their selling price to free software developers—the Free Software Foundation, and others.
The way to convince distributors to do this is to demand it and expect it from them. So when you compare distributors, judge them partly by how much they give to free software development. Show distributors they must compete to be the one who gives the most.
To make this approach work, you must insist on numbers that you can compare, such as, “We will donate ten dollars to the Frobnitz project for each disk sold.” Don’t be satisfied with a vague promise, such as “A portion of the profits are donated,” since it doesn’t give a basis for comparison.
Even a precise fraction “of the profits from this disk” is not very meaningful, since creative accounting and unrelated business decisions can greatly alter what fraction of the sales price counts as profit. If the price you pay is $50, ten percent of the profit is probably less than a dollar; it might be a few cents, or nothing at all.
Some redistributors do development work themselves. This is useful too; but to keep everyone honest, you need to inquire how much they do, and what kind. Some kinds of development make much more long-term difference than others. For example, maintaining a separate version of a program contributes very little; maintaining the standard version of a program for the whole community contributes much. Easy new ports contribute little, since someone else would surely do them; difficult ports such as adding a new CPU to the GNU Compiler Collection contribute more; major new features or packages contribute the most.
By establishing the idea that supporting further development is “the proper thing to do” when distributing free software for a fee, we can assure a steady flow of resources into making more free software.
Copyright © 1994 Free Software Foundation, Inc. Verbatim copying and redistribution of this section is permitted without royalty; alteration is not permitted. |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Version 3, 29 June 2007
Copyright © 2007 Free Software Foundation, Inc. http://fsf.org/ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. |
The GNU General Public License is a free, copyleft license for software and other kinds of works.
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program–to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
For the developers’ and authors’ protection, the GPL clearly explains that there is no warranty for this free software. For both users’ and authors’ sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users’ freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and modification follow.
“This License” refers to version 3 of the GNU General Public License.
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
A “covered work” means either the unmodified Program or a work based on the Program.
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work’s System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same work.
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work’s users, your or third parties’ legal rights to forbid circumvention of technological measures.
You may convey verbatim copies of the Program’s source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation’s users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party’s predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor’s “contributor version”.
A contributor’s “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor’s essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient’s use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy’s public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
one line to give the program's name and a brief idea of what it does. Copyright (C) year name of author This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. |
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
program Copyright (C) year name of author This program comes with ABSOLUTELY NO WARRANTY; for details type ‘show w’. This is free software, and you are welcome to redistribute it under certain conditions; type ‘show c’ for details. |
The hypothetical commands ‘show w’ and ‘show c’ should show the appropriate parts of the General Public License. Of course, your program’s commands might be different; for a GUI interface, you would use an “about box”.
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see http://www.gnu.org/licenses/.
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read http://www.gnu.org/philosophy/why-not-lgpl.html.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Version 1.3, 3 November 2008
Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. http://fsf.org/ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. |
The purpose of this License is to make a manual, textbook, or other functional and useful document free in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.
This License is a kind of “copyleft”, which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.
We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.
This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The “Document”, below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as “you”. You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law.
A “Modified Version” of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.
A “Secondary Section” is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document’s overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.
The “Invariant Sections” are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none.
The “Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words.
A “Transparent” copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not “Transparent” is called “Opaque”.
Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only.
The “Title Page” means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, “Title Page” means the text near the most prominent appearance of the work’s title, preceding the beginning of the body of the text.
The “publisher” means any person or entity that distributes copies of the Document to the public.
A section “Entitled XYZ” means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) To “Preserve the Title” of such a section when you modify the Document means that it remains a section “Entitled XYZ” according to this definition.
The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License.
You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and you may publicly display copies.
If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document’s license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.
If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.
It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.
You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:
If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version’s license notice. These titles must be distinct from any other section titles.
You may add a section Entitled “Endorsements”, provided it contains nothing but endorsements of your Modified Version by various parties—for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.
You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.
You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled “History” in the various original documents, forming one section Entitled “History”; likewise combine any sections Entitled “Acknowledgements”, and any sections Entitled “Dedications”. You must delete all sections Entitled “Endorsements.”
You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.
A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an “aggregate” if the copyright resulting from the compilation is not used to limit the legal rights of the compilation’s users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document’s Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate.
Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail.
If a section in the Document is Entitled “Acknowledgements”, “Dedications”, or “History”, the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title.
You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License.
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it.
The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License “or any later version” applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy’s public statement of acceptance of a version permanently authorizes you to choose that version for the Document.
“Massive Multiauthor Collaboration Site” (or “MMC Site”) means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A “Massive Multiauthor Collaboration” (or “MMC”) contained in the site means any set of copyrightable works thus published on the MMC site.
“CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization.
“Incorporate” means to publish or republish a Document, in whole or in part, as part of another Document.
An MMC is “eligible for relicensing” if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008.
The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page:
Copyright (C) year your name. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. |
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the “with...Texts.” line with this:
with the Invariant Sections being list their titles, with the Front-Cover Texts being list, and with the Back-Cover Texts being list. |
If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation.
If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MELT plugin’s command line options are indexed here without any initial ‘-’ or ‘--’. Where an option has both positive and negative forms (such as ‘-foption’ and ‘-fno-option’), relevant entries in the manual are indexed under the most appropriate form; it may sometimes be useful to look up both forms. Each option has a plugin form ‘-fplugin-melt-arg-option’ and a MELT branch form ‘-fmelt-option’ which is used in the GCC experimental MELT branch.
Jump to: | F |
---|
Jump to: | F |
---|
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Jump to: | A B C D E F G I L M N O P Q R S T U V |
---|
Jump to: | A B C D E F G I L M N O P Q R S T U V |
---|
[Top] | [Contents] | [Index] | [ ? ] |
curfnum
is a C macro expanding
to curframe__.varnum
The C code for the normalization of a which
assigns curfnum[3]
occurs before, so translating MELT to C is
not a simple rewriting algorithm..
The #line
directive can be
disabled by compiling the generated C with
-DMELTGCC_NOLINENUMBERING
.
melt_apply
is a short inlined
function defined in ‘gcc/melt.h’ which checks that the applied
value is indeed a MELT function closure and calls its routine.
There is an ordered sequence of MELT modules, the
very first, warmelt-first
, being translated specially and gets
a nil parent.
If a class is
exported using export_value
-almost always a mistake-, its
fields are not visible outside.
We use ML like syntax to emphasize that this is only an internal MELT representation, not an s-expr!
this is not a proper term, since the generated code is only a representation of low level C code.
using the upgrade-warmelt
make target.
It is essential to ensure that every MELT value has the good magic numer in its discriminant. Violating that would crash GCC MELT.
[Top] | [Contents] | [Index] | [ ? ] |
[Top] | [Contents] | [Index] | [ ? ] |
[Top] | [Contents] | [Index] | [ ? ] |
This document was generated on June 22, 2011 using texi2html 1.82.
The buttons in the navigation panels have the following meaning:
Button | Name | Go to | From 1.2.3 go to |
---|---|---|---|
[ < ] | Back | Previous section in reading order | 1.2.2 |
[ > ] | Forward | Next section in reading order | 1.2.4 |
[ << ] | FastBack | Beginning of this chapter or previous chapter | 1 |
[ Up ] | Up | Up section | 1.2 |
[ >> ] | FastForward | Next chapter | 2 |
[Top] | Top | Cover (top) of document | |
[Contents] | Contents | Table of contents | |
[Index] | Index | Index | |
[ ? ] | About | About (help) |
where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:
This document was generated on June 22, 2011 using texi2html 1.82.