diff --git a/src/jrd/functions.cpp b/src/jrd/functions.cpp index efc26dfd3d..39a3717af1 100644 --- a/src/jrd/functions.cpp +++ b/src/jrd/functions.cpp @@ -81,11 +81,15 @@ static const char #define FUNCTION_ARGUMENT(MECHANISM, TYPE, SCALE, LENGTH, SUB_TYPE, CHARSET, PRECISION, CHAR_LENGTH) static const FN isc_functions[] = { - {"test_module", "test_function", (FPTR_INT) test}, +#ifndef DECLARE_EXAMPLE_IUDF_AUTOMATICALLY + {"test_module", "test_function", (FPTR_INT) test}, // see functions.h +#endif {"test_module", "ni", (FPTR_INT) ni}, {"test_module", "ns", (FPTR_INT) ni}, {"test_module", "nn", (FPTR_INT) ni}, - {"test_module", "byte_len", (FPTR_INT) byteLen}, +#ifndef DECLARE_EXAMPLE_IUDF_AUTOMATICALLY + {"test_module", "byte_len", (FPTR_INT) byteLen}, // see functions.h +#endif #include "../jrd/functions.h" diff --git a/src/jrd/functions.h b/src/jrd/functions.h index c28fa55bb0..e828d87836 100644 --- a/src/jrd/functions.h +++ b/src/jrd/functions.h @@ -28,6 +28,22 @@ // FUNCTION(, "", "", "", ) // FUNCTION_ARGUMENT(, , , , , , , ) +// Uncomment this to have the two example functions registered automatically in system tables. +//#define DECLARE_EXAMPLE_IUDF_AUTOMATICALLY +// CVC: Starting demonstration code to register IUDF automatically. +#ifdef DECLARE_EXAMPLE_IUDF_AUTOMATICALLY +FUNCTION(byteLen, "SYS_BYTE_LEN", "test_module", "byte_len", 0) + FUNCTION_ARGUMENT(-FUN_reference, (int) blr_long, 0, 4, 0, 0, 0, 0) + FUNCTION_ARGUMENT(FUN_descriptor, (int) blr_long, 0, 4, 0, 0, 0, 0) +END_FUNCTION + +FUNCTION(test, "TEST", "test_module", "test_function", 2) + FUNCTION_ARGUMENT(FUN_ref_with_null, (int) blr_long, 0, 4, 0, 0, 0, 0) + FUNCTION_ARGUMENT(FUN_reference, (int) blr_text, 0, 20, 0, 0, 0, 20) +#endif +// CVC: Finishing demonstration code to register IUDF automatically. + + FUNCTION(get_context, "RDB$GET_CONTEXT", "system_module", "get_context", 0) // Result, variable value FUNCTION_ARGUMENT(-FUN_reference, blr_varying, 0, 255, 0, 0, 0, 255) @@ -47,3 +63,4 @@ FUNCTION(set_context, "RDB$SET_CONTEXT", "system_module", "set_context", 0) // Variable, value FUNCTION_ARGUMENT(FUN_ref_with_null, blr_varying, 0, 255, 0, 0, 0, 255) END_FUNCTION + diff --git a/src/jrd/ini.epp b/src/jrd/ini.epp index 834d48d0e9..29b6fac714 100644 --- a/src/jrd/ini.epp +++ b/src/jrd/ini.epp @@ -414,6 +414,7 @@ void INI_format(const TEXT* owner, const TEXT* charset) CMP_release(tdbb, handle1); // Store IUDFs declared automatically as system functions. +// CVC: Demonstration code to register IUDF automatically moved to functions.h store_functions(tdbb, dbb);