Debian Codegraph @

src/intl/utils/dtest2.c

raw
1 /*
2 * Test tool for Language Drivers.
3 *
4 * This tool loads up a language driver using the dynamic link
5 * (or shared object) method and interrogates it's ID function.
6 * This tool is used to quickly verify the dynamic load ability
7 * of a newly created language driver.
8 * The contents of this file are subject to the Interbase Public
9 * License Version 1.0 (the "License"); you may not use this file
10 * except in compliance with the License. You may obtain a copy
11 * of the License at http://www.Inprise.com/IPL.html
12 *
13 * Software distributed under the License is distributed on an
14 * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
15 * or implied. See the License for the specific language governing
16 * rights and limitations under the License.
17 *
18 * The Original Code was created by Inprise Corporation
19 * and its predecessors. Portions created by Inprise Corporation are
20 * Copyright (C) Inprise Corporation.
21 *
22 * All Rights Reserved.
23 * Contributor(s): ______________________________________.
24 */
25
26 #include "firebird.h"
27 #include <stdio.h>
28
29 static int full_debug = 0;
30 #define FULL_DEBUG if (full_debug) printf
31
32
33 #define DEBUG_INTL
34 #include "../jrd/intl.c"
35
36
37 /*
38 void try_fc(char* c, FUN_PTR f)
39 {
40 unsigned char buffer[200];
41 const int res = (*f) (strlen(c), c, sizeof(buffer), buffer);
42 printf("%s => ", c);
43 for (int i = 0; i < res; i++)
44 printf("%d ", buffer[i]);
45 printf("\n");
46 }
47 */
48
49 void my_err()
50 {
51 printf("Error routine called!\n");
52 }
53
54 int main(int argc, char** argv)
55 {
56 if (argc <= 1) {
57 printf("usage: dtest Intl_module_name\n");
58 return (1);
59 }
60 char** vector = argv;
61
62 struct texttype this_textobj;
63 for (int i = 1; i < argc; i++) {
64 const int t_type = atoi(vector[i]);
65 INTL_fn_init(t_type, &this_textobj, my_err);
66 }
67 return (0);
68 }
69