On 2021-09-02 17:46, Adriano dos Santos Fernandes wrote:
We have still traces of the old error message processing that only
complicate things.

We define errors in .sql files (it was database) and then everything is
as before.

We have generated files in the tree, which frequently causes merge
conflicts, not very simple to fix, as generated files needs to be edited.

Utility that generate the files needs gpre and the engine previously
built, and ready to use database, which also requires isql.

Chicken and egg problem.

That makes no sense IMHO and I propose a change to make things simpler
and faster.

We define error messages (and all necessary things) in .h files and with help of the preprocessor (from the compiler) we use them (something like done in ini.epp), where macros could be changed for different result needs.

#define FB_MSG(...) ...
#include "message-file.h"
#undef FB_MSG

For case like gds_codes.pas, preprocessor (and maybe sed) is also used
to emit the generated file. And I propose to generate that file during
the build and put in the output, not storing it in the source tree.

So messages could be defined like this:

FB_MSG(sysf_invalid_null_empty, 0, 956, -901, "22", "023", "Empty or
NULL parameter @1 is not accepted")

(Note that I mixed messages2.sql and system_errrors2.sql and also
removed ROUTINE, MODULE and other unimportant things.)

The nice thing about the current solution is that it produces a database that is queryable, and I use that to generate the message and sqlstate files of Jaybird, and the list of error messages and codes in the language reference.

To be clear, I can adjust to a new world here and parse a source file to get the info, but maybe others rely on the database in a similar way, so this removal of msg.fdb may have more impact beyond the build itself.

Mark


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to