Usage of dfrmstr

DFRM proproses basic functions to load from a text file all strings used in your interface. An utility, dfrmstr, facilitates the developpement of these string files.

dfrmstr is a very small program (see rscstr.c) creating from a string file an index to include in your source files. The string file has a (simple) format:

# ignored line
NAME a string whose all spaces are taken into account
...

Empty lines or lines begining with a '#' character are ignored. Each line stands for a string. The first word is a symbolic constant identifying the string in your source file. All characters following the symbolic name stand for the string up to the end of line except the first space character after the symbolic name (which is the delimitor).

The call of dfrmstr is :

    dfrmstr file.str file.h

If any file is specified, dfrmstr reads from stdin and writes to stdout.

The result of drmstr is a C-header file containing the index of each string in the string-file. In your program, loading of strings is performed by dfrm_load_str(). Memory is released by dfrm_free_str().

Your project will have the following structure. The source file looks like :

/* ---- myprog.c ---- */
#include <windom.h>
#include <dfrm.h>
#include "myprog.h"

char **strs;    /* Global variable */

int main( void) {
    ApplInit();
    strs = dfrm_load_str( "myprog.str");
    if( !strs) {
        FormAlert( 1, "[1][File myprog.str|not found.][Fatal]");
        ApplExit();
        return -1;
    }
    /* Displaying an alert for information */
    FormAlert( 1, strs[ALRT1]);
    /* ... */
    ApplExit();
    return 0;
}

The file containing external strings is :

# ---- myprog.str ----
ALRT1 [1][Example of MultiLanguage][OK]

and finaly, the header file which will be included by source file, created by dfrmstr, looks like :

/*
 * Generated by dfrmstr on Tue Sep 03 11:37:08 2002
 */
#define ALRT1 0

The makefile to generate the application looks like :

# Makefile for compile DFRM application with 
# support of multi language

# Compilation switches
CC=gcc
CFLAGS=-O2
LDFLAGS=-lmgem -lwindom -ldfrm

# Dependances
myproc.o: myproc.c myproc.h
myproc.h: myproc.str; dfrmstr $< $@

Generated on Thu Dec 23 18:55:34 2010 for Dynamic Forms by  doxygen 1.5.8