source: trunk/tests/c/test-nom.c@ 297

Last change on this file since 297 was 297, checked in by cinc, 19 years ago

Skeleton of a test suite.

File size: 4.0 KB
Line 
1/* ***** BEGIN LICENSE BLOCK *****
2* Version: CDDL 1.0/LGPL 2.1
3*
4* The contents of this file are subject to the COMMON DEVELOPMENT AND
5* DISTRIBUTION LICENSE (CDDL) Version 1.0 (the "License"); you may not use
6* this file except in compliance with the License. You may obtain a copy of
7* the License at http://www.sun.com/cddl/
8*
9* Software distributed under the License is distributed on an "AS IS" basis,
10* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11* for the specific language governing rights and limitations under the
12* License.
13*
14* The Original Code is "NOM" Netlabs Object Model
15*
16* The Initial Developer of the Original Code is
17* netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
18* Portions created by the Initial Developer are Copyright (C) 2007
19* the Initial Developer. All Rights Reserved.
20*
21* Contributor(s):
22*
23* Alternatively, the contents of this file may be used under the terms of
24* the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
25* case the provisions of the LGPL are applicable instead of those above. If
26* you wish to allow use of your version of this file only under the terms of
27* the LGPL, and not to allow others to use your version of this file under
28* the terms of the CDDL, indicate your decision by deleting the provisions
29* above and replace them with the notice and other provisions required by the
30* LGPL. If you do not delete the provisions above, a recipient may use your
31* version of this file under the terms of any one of the CDDL or the LGPL.
32*
33* ***** END LICENSE BLOCK ***** */
34#define INCL_DOSPROCESS
35#define INCL_DOS
36#define INCL_DOSPROFILE
37#define INCL_DOSERRORS
38
39#include <os2.h>
40#include <stdio.h>
41#include <stdlib.h>
42#include <string.h>
43
44#include <io.h>
45#include <fcntl.h>
46#include <sys\stat.h>
47
48#include <glib.h>
49#include <glib/gprintf.h>
50
51#include "nom.h"
52#include "nomtk.h"
53#include "nomgc.h"
54#include "aclass.h"
55
56void createAClass()
57{
58 AClass* aClass;
59
60 aClass=AClassNew();
61
62 if(nomIsObj(aClass))
63 g_message("AClass creationt\t\t\tOK");
64 else
65 g_message("AClass created\t\t\t\tFAILED");
66}
67
68/**
69 Main entry point for the idl compiler.
70 */
71int main(int argc, char **argv)
72{
73 APIRET rc;
74 NOMClassMgr *NOMClassMgrObject;
75 HREGDLL hReg=NULLHANDLE;
76 UCHAR uchrError[256];
77 HMODULE hModuleGC;
78#if 0
79 /* Preload the DLL otherwise it won't be found by the GC registering function */
80 if((rc=DosLoadModule(uchrError, sizeof(uchrError),"nobjtk.dll", &hModuleGC))!=NO_ERROR)
81 {
82 printf("DosLoadmodule for nobjtk.dll failed with rc=0x%x because of module %s.\n", (int)rc, uchrError);
83 return 1;
84 };
85 fprintf(stderr, "DLL handle for nobjtk.dll is: 0x%x\n", (int)hModuleGC);
86#endif
87 nomInitGarbageCollection(NULL);
88
89 /* Register DLLs with the garbage collector */
90 hReg=nomBeginRegisterDLLWithGC();
91 if(NULLHANDLE==hReg)
92 return 1;
93
94#if 0
95 //g_assert(nomRegisterDLLByName(hReg, "GLIB2.DLL" ));
96 //g_assert(nomRegisterDLLByName(hReg, "GOBJECT2.DLL"));
97 g_assert(nomRegisterDLLByName(hReg, "GMODULE2.DLL"));
98 g_assert(nomRegisterDLLByName(hReg, "GDK2.DLL"));
99 g_assert(nomRegisterDLLByName(hReg, "GDKPIX2.DLL"));
100 g_assert(nomRegisterDLLByName(hReg, "GTK2.DLL" ));
101 g_assert(nomRegisterDLLByName(hReg, "ATK.DLL" ));
102#endif
103 g_assert(nomRegisterDLLByName(hReg, "NOBJTK.DLL"));
104
105#if 0
106 // g_assert(nomRegisterDLLByName(hReg, "VDESKTOP.DLL"));
107 //g_assert(nomRegisterDLLByName(hReg, "VOYFCLS.DLL"));
108 //g_assert(nomRegisterDLLByName(hReg, "VOYWP.DLL"));
109 //g_assert(nomRegisterDLLByName(hReg, "VOYGUITK.DLL"));
110 // g_assert(nomRegisterDLLByName(hReg, "PBL-PNG.DLL"));
111 // g_assert(nomRegisterDLLByName(hReg, "BASIC-FC.DLL"));
112 /* Add Pango */
113 //g_assert(nomRegisterDLLByName(hReg, "PANGO.DLL"));
114#endif
115 nomEndRegisterDLLWithGC(hReg);
116
117 g_message("NOM test application started.\n");
118
119 /* Init NOM */
120 NOMClassMgrObject=nomEnvironmentNew();
121
122 NOMObjectNew();
123 createAClass();
124 //DosSleep(20000);
125 return 0;
126};
127
128
129
130
131
132
133
134
Note: See TracBrowser for help on using the repository browser.