/usr/include/falcon/message_defs.h is in falconpl-dev 0.9.6.9-git20120606-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | /*
FALCON - The Falcon Programming Language.
FILE: message_defs.h
Definitions for messages.
-------------------------------------------------------------------
Author: Giancarlo Niccolai
Begin:
-------------------------------------------------------------------
(C) Copyright 2008: the FALCON developers (see list in AUTHORS file)
See LICENSE file for licensing details.
*/
/**
@page howto_modstrings How to use module string tables.
The module string table is useful to declare error descriptions,
error specific explanations and generically messages that the module
may display to its users.
Module message tables can be internationalized through the Falcon
Module Internationalization support.
Some macros are provided in module.h to help build module string tables,
and are meant to be used under a certain pattern.
Applying the module table to the module is a matter of four simple steps.
First, each module willing to create an internationalizable module table should
create two related files: \<modulename\>_st.h and \<modulename\>_st.c(pp)
Second, create the table declaring it in the header file using the FAL_MODSTR
macro, like in the following example:
\code
// My module string table mymod_st.h
// Message IDS (identifiers) must be unique.
#include \<falcon/message_defs.h\>
FAL_MODSTR( MSG0, "Message 0" );
FAL_MODSTR( MSG1, "Message 1" );
FAL_MODSTR( MSG2, "Message 2" );
\endcode
If the program is being compiled in c++ mode, it is possible to declare a
namespace around the FAL_MODSTR marcors for better encapsulation. The semicomma ";"
at the end of each macro are optional.
Second, write the C/C++ table implementation. This is only required to
declare the macro FALCON_REALIZE_STRTAB before including the string table definition:
\code
// Module string table realize file mymod_st.cpp
#define FALCON_REALIZE_STRTAB
#include "mymod_st.h"
\endcode
Third, the main module file (usually called something as \<modname\>.cpp) must
first include the string table at top level, and then realize it
by declaring FALCON_DECLARE_MODULE, setting it
to the local variable pointer used to instance the module, and then
include the string table:
\code
#include \<module.h\>
#include "mymod_st.h"
FALCON_MODULE_DECL( const Falcon::EngineData &data )
{
// setup DLL engine common data
data.set();
// Module declaration
Falcon::Module *self = new Falcon::Module();
// Declare "self" as the variable holding the module
#define FALCON_DECLARE_MODULE self
#include "mymod_st.h"
...
}
\endcode
Fourth, retreive the strings from the VM using the Falcon::VMachine::moduleString
method. That method actually peeks the current module for the desired string id.
In example:
\code
#include "mymod_st.h"
FALCON_FUNC aFuncIn_MyModule( Falcon::VMachine *vm )
{
const String *tlstring = vm->moduleString( MSG0 );
// do something with tlstring
}
\endcode
The same can be achieved with Module::getString provided it is possible to access
the module:
\code
#include "mymod_st.h"
// MyNewModule extends Falcon::Module
void MyNewModule::some_method(...)
{
const String *tlstring = this->getString( MSG0 );
// do something with tlstring
}
\endcode
The macro FAL_STR( id ), defined as "vm->moduleString( id )" can be used as a handy
shortcut for a standard compliant extension function.
*/
#ifndef FAL_STR
#define FAL_STR( id ) vm->moduleString( id )
#endif
// allow redefinition of this macros at each include.
#undef FAL_MODSTR
#ifdef FALCON_DECLARE_MODULE
#define FAL_MODSTR( str_id, text ) \
str_id = FALCON_DECLARE_MODULE->addStringID( text, true );
#else
#ifdef FALCON_REALIZE_STRTAB
#define FAL_MODSTR( id, text ) unsigned int id;
#else
#define FAL_MODSTR( id, text ) extern unsigned int id;
#endif
#endif
/* end of message_defs.h */
|