# init2env

## Description

`init2env` is a tool to convert the resource data for the ENV library written in INIT format to the source file format in C.

## Using the Library

### Start Command

    % init2env RESOURCE_FILE
                      [-o OUTPUT_FILE]

The resource data written in the INIT format specified by `RESOURCE_FILE` is changed to the C source file format and is output with the name `result.c`.

With the `-o` option, the output file name can be changed from `result.c` to `OUTPUT_FILE`.

Description example of the resource data for the ENV library in INIT format.

INIT formatted resource data before being changed.

>     <environment1>
>           [myClass11]
>           str1    STRING mario
>           bin1    BINARY 12345678
>           bin2    BINARY "testbin"
>     <environment2>
>           [myClass21]
>           str1    STRING mario
>           bin1    BINARY abcd123
>           bin2    BINARY "test.txt"
>           [myClass22]
>           data1   S32    -500
>           data2   U16    0x8000

C Source File formatted Resource Data after being changed.

>     ENVResource myResource1[] = {
>           "myClass11.str1",    ENV_STRING( "mario" ),
>           "myClass11.bin1",    ENV_BINARY( "12345678" ),
>           "myClass11.bin2",    ENV_BINARY( "testbin file contents" ),
>           ENV_RESOUCE_END
>     };

>     ENVResource myResource2[] = {
>           "myClass21.str1",    ENV_STRING( "mario" ),
>           "myClass21.bin1",    ENV_BINARY( "abcd123" ),
>           "myClass21.bin2",    ENV_BINARY( "test.txt file contents" ),
>           "myClass22.data1",   ENV_S32( -500 ),
>           "myClass22.data2",   ENV_U16( 0x8000 ),
>           ENV_RESOUCE_END
>     };

>     ENVResource* resourceArray[]={ myResource1, myResource2, NULL };

When the resource type is BINARY, data within `""` is seen as file names and it is possible to make the file contents into data automatically.

Resource data can be used as is by compiling the generated C source file and the program using ENV together.

## Location

`$NitroSDK/tools/bin/init2env.exe`

## See Also

`ENV`

## Revision History

10/20/2005 Initial version.

CONFIDENTIAL