source: trunk/idl-compiler/c/printdata.c@ 321

Last change on this file since 321 was 321, checked in by cinc, 18 years ago

Removed GTK includes

File size: 6.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#include <os2.h>
35#include <stdio.h>
36#include <stdlib.h>
37#include <string.h>
38
39#include <io.h>
40#include <fcntl.h>
41#include <sys\stat.h>
42
43#include <glib/gprintf.h>
44
45#include "nom.h"
46#include "nomtk.h"
47
48#include "parser.h"
49
50/* The pointer array holding the interfaces we found */
51extern PPARSEINFO pParseInfo;
52
53static void printOverridenMethods(GPtrArray *pArray)
54{
55 int a;
56
57 for(a=0;a<pArray->len;a++)
58 {
59 POVERMETHOD pom=(POVERMETHOD)g_ptr_array_index(pArray, a);
60 g_printf("\t\tName:\t\t%s\n", pom->chrName);
61 }
62}
63
64static void printInstanceVars(GPtrArray *pArray)
65{
66 int a;
67
68 for(a=0;a<pArray->len;a++)
69 {
70 int b;
71 PMETHODPARAM piv=(PMETHODPARAM)g_ptr_array_index(pArray, a);
72 g_printf("\t\tType:\t\t%s", piv->chrType);
73 for(b=0;b<piv->uiStar;b++)
74 g_printf("*");
75 g_printf("\n\t\tName:\t\t%s\n\n", piv->chrName);
76 }
77}
78
79
80static void printMethodParams(GPtrArray *pArray)
81{
82 int a;
83
84 for(a=0;a<pArray->len;a++)
85 {
86 int b;
87 PMETHODPARAM pm=(PMETHODPARAM)g_ptr_array_index(pArray, a);
88 switch(pm->uiDirection)
89 {
90 case PARM_DIRECTION_IN:
91 g_printf("\t\t\tDirection:\t%s\n", "in");
92 break;
93 case PARM_DIRECTION_OUT:
94 g_printf("\t\t\tDirection:\t%s\n", "out");
95 break;
96 case PARM_DIRECTION_INOUT:
97 g_printf("\t\t\tDirection:\t%s\n", "inout");
98 break;
99 default:
100 break;
101 }
102 g_printf("\t\t\tType:\t\t%s", pm->chrType);
103 for(b=0;b<pm->uiStar;b++)
104 g_printf("*");
105 g_printf("\n\t\t\tName:\t\t%s\n", pm->chrName);
106 }
107}
108
109
110static void printMethods(GPtrArray *pArray)
111{
112 int a;
113
114 for(a=0;a<pArray->len;a++)
115 {
116 int b;
117 PMETHOD pm=(PMETHOD)g_ptr_array_index(pArray, a);
118 g_printf("\t\tReturn type:\t%s", pm->mpReturn.chrType);
119 for(b=0;b<pm->mpReturn.uiStar;b++)
120 g_printf("*");
121 g_printf("\n\t\tName:\t\t%s\n", pm->chrName);
122 if(pm->pParamArray->len)
123 {
124 g_printf("\t\tNum parameters:\t%d\n", pm->pParamArray->len);
125 printMethodParams(pm->pParamArray);
126 }
127 else
128 g_printf("\t\t(No parameters)\n\n");
129 }
130}
131
132void printAllInterfaces(void)
133{
134 int a;
135
136 for(a=0;a<pParseInfo->pInterfaceArray->len;a++)
137 {
138 PINTERFACE pif=g_ptr_array_index(pParseInfo->pInterfaceArray, a);
139 g_printf("Found Interface:\n");
140 g_printf("\tName:\t\t%s\n", pif->chrName);
141 g_printf("\tParent:\t\t%s\n", (pif->chrParent ? pif->chrParent : "No parent"));
142 g_printf("\tMajor:\t\t%ld\n", pif->ulMajor);
143 g_printf("\tMinor:\t\t%ld\n", pif->ulMinor);
144 g_printf("\tForward decl.:\t%s\n", (pif->fIsForwardDeclaration ? "Yes" : "No"));
145 g_printf("\tMetaclass:\t%s\n", (pif->chrMetaClass ? pif->chrMetaClass : "None"));
146 g_printf("\tSource file:\t%s\n", pif->chrSourceFileName);
147 if(pif->chrFileStem)
148 g_printf("\tFile stem:\t%s\n", pif->chrFileStem);
149 /* Print instance vars */
150 g_printf("\tInstance vars:\t%d\n", pif->pInstanceVarArray->len);
151 printInstanceVars(pif->pInstanceVarArray);
152 /* Print methods */
153 g_printf("\tNew methods:\t%d\n", pif->pMethodArray->len);
154 printMethods(pif->pMethodArray);
155 /* Print overriden methods */
156 g_printf("\tOverriden methods:\t%d\n", pif->pOverrideArray->len);
157 printOverridenMethods(pif->pOverrideArray);
158 }
159}
160
161void printInterface(PINTERFACE pif)
162{
163 g_printf("Found Interface:\n");
164 g_printf("\tName:\t\t%s\n", pif->chrName);
165 g_printf("\tParent:\t\t%s\n", (pif->chrParent ? pif->chrParent : "No parent"));
166 g_printf("\tMajor:\t\t%ld\n", pif->ulMajor);
167 g_printf("\tMinor:\t\t%ld\n", pif->ulMinor);
168 g_printf("\tForward decl.:\t%s\n", (pif->fIsForwardDeclaration ? "Yes" : "No"));
169 g_printf("\tMetaclass:\t%s\n", (pif->chrMetaClass ? pif->chrMetaClass : "None"));
170 g_printf("\tSource file:\t%s\n", pif->chrSourceFileName);
171 if(pif->chrFileStem)
172 g_printf("\tFile stem:\t%s\n", pif->chrFileStem);
173 /* Print instance vars */
174 g_printf("\tInstance vars:\t%d\n", pif->pInstanceVarArray->len);
175 printInstanceVars(pif->pInstanceVarArray);
176 /* Print methods */
177 g_printf("\tNew methods:\t%d\n", pif->pMethodArray->len);
178 printMethods(pif->pMethodArray);
179 /* Print overriden methods */
180 g_printf("\tOverriden methods:\t%d\n", pif->pOverrideArray->len);
181 printOverridenMethods(pif->pOverrideArray);
182}
Note: See TracBrowser for help on using the repository browser.