home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 28
/
amigaformatcd28.iso
/
-seriously_amiga-
/
programming
/
e
/
catalogobj
/
catalog.readme
< prev
next >
Wrap
Text File
|
1998-04-23
|
2KB
|
49 lines
CatalogObj: OO class by Kyzer/CSG.
INSTALLATION: copy catalog.m to emodules:class/
This object allows you to use localized strings in the E language. It can
be easily used as a base for automatically generated catalog sources, and
can work with multiple instances of itself.
If you have not read the docs to locale.library, the docs of CatComp, or
the docs of FlexCat, then do so now.
Basically, all the static strings in your program are accessed not by just
writing them (the usual way), but by calling a function with an ID value,
usually a meaningfully-named constant. Note here that to function in the E
language, your ID names in a catalog must be uppercase in at least the
first two characters.
It is easiest to use this with the source-generator FlexCat. Make an E
source from your catalog, using the provided 'E.sd' file, then simply
compile it and use it in your program in the same way as the example
'helloworld_test.e'.
If you don't use FlexCat (more fool you), basically all you have to do is
create an instance of catalog_obj, open your catalog with it, and provide a
block of default id/string pairs - see the included autodocs. You don't
need to worry about using one catalog after closing another - each catalog
keeps its own copy of localebase.
To use more than one catalog, just use more than one object - here is a
basic and very silly example:
CONST MSG_MAGIC=100, MSG_POCKETS=999
DEF cat1:PTR TO catalog_obj,
cat2:PTR TO catalog_obj
PROC main()
NEW cat1.open('magic.catalog')
NEW cat2.open('pocket.catalog')
cat1.def([MSG_MAGIC, 'Magic'])
cat2.def([MSG_POCKETS, 'Pockets'])
WriteF('\s \s\n', cat1.get(MSG_MAGIC), cat2.get(MSG_POCKETS))
END cat1
END cat2
ENDPROC