layerzero/libi0 — pull request #3 by GuillaumeLeclerc (2014-09-27 15:42:11+00:00)
Title: Dev gpoleclerc

## PRINTSTR function (in strsplitter)
The function PRINTSTR has been added (it has the same behaviour than PRINTLN but it does not add a new line at the end

## PRINTF function (in the printfParser file)
This function is an improved version of the functions PRINTLN and PRINTSTR. It works the same way as the others (each function call is replaced by functions from `stdio.h` before compilation)

This script is written in Perl 5 and require `/usr/bin/perl` to be executable

The signature is about the same as the standard C.
```void PRINTF(const char* format, ...)```
### Flags supported
* `%f` and `%F` for floating points numbers
* `%h` and `%H` : for hexadecimal numbers
* `%d` and `%i` : for integers numbers (only long)
* `%s` : for strings
* `%c` : for chars

### Example

#### Input :

```C
#include

void verySimpleMethod() {
long atta;
atta = 11;
if(atta == 11)
{
PRINTF("\t foo2 %i \" foo %u %h", (long)4, atta);
PRINTF("qwerty");
}
}

void main()
{
PRINTF("foo bar\n");
verySimpleMethod();
commit;
}
```
#### Output :
```C
#include

void verySimpleMethod() {
long atta;
atta = 11;
if(atta == 11)
{
put1('\t');put1(' ');put1('f');put1('o');put1('o');put1('2');put1(' ');output_q((long)4);put1(' ');put1(' ');put1('"');put1(' ');put1('f');put1('o');put1('o');put1(' ');put1('%');put1('u');put1(' ');put1('%');put1('h');

put1('q');put1('w');put1('e');put1('r');put1('t');put1('y');

}
}

void main()
{
put1('f');put1('o');put1('o');put1(' ');put1('b');put1('a');put1('r');put1('\n');

verySimpleMethod();
commit;
}
```