## LED Compiler for C

### Description

The LED compiler (ledc) generates a C module from one or more LED files. The C module exports only one function, which builds the IUP interface described in the LED files. Running this function is equivalent to calling the IupLoad function over the original LED files.

One advantage of using the compiler is that it allows the application to be independent from LED files during its execution. Since the interface description is inside the executable file, there is no need to worry about locating the configuration files.

Another advantage is that ledc performs a stricter verification than IUP’s internal parser. This makes error detection in LED files easier.

Finally, running the function generated by the compiler is faster than reading the corresponding LED file with IupLoad, since the parsing step of the LED file is transferred from execution to compilation. However, creating the IUP elements described in LED takes most of the execution time of the IupLoad function, so the gain in efficiency may not be very significant.

### Usage

ledc [-v] [-c] [-f funcname] [-o file] files

-v | shows ledc’s version number
-c | does not generate code, just checks for errors in the LED files
-f funcname | uses <funcname> as the name of the generated exported function (default: led_load)
-o file | uses <file> as the name of the generated file (default: led.c)

### Error Messages

Several warnings and error messages might be generated during compilation. Errors abort the compilation. The messages can be the following:

warning: undeclared control name (argument number)
The name name was used as an argument where a IUP element was expected, but no element with this name was previously declared.

warning: string expected (argument number)
A name (callback?) was passed as a parameter for a string-type argument.

warning: callback expected (argument number)
A string was passed as a parameter for a callback-type argument.

warning: unknown control name used
An unknown element, called name, was used. The compiler assumes the element’s creation function is called IupName, with name capitalized, and assumes the arguments’ types based on what was passed on LED.

warning: elem declared without a name
An elem-type element was declared without being associated to any name. This declaration creates the element, but it will not be accessible, so it cannot be used.

element name already used in line number
The name element was already used in line number. In IUP, the same element cannot have more than one parent.

too few arguments for name
The name element expects more arguments than those already passed.

too many arguments for name
The name element expects less arguments than those passed.

name is not a valid child
The name element cannot be used as a parameter in this case. This happens when trying to insert an image into a vbox, for instance.

control expected (argument number)
A string was passed as a parameter for an element-type argument.

string expected (argument number)
An element was passed as a parameter for a string-type argument.

number expected (argument number)
An element or a string was passed as a parameter for a number-type argument.

callback expected (argument number)
An element was passed as a parameter for a callback-type argument.

hotkeys not implemented
Even though it is a LED word reserved to an element, it is not implemented.