0022627: Change OCCT memory management defaults
[occt.git] / src / Xw / Xw_get_typemap_info.cxx
CommitLineData
7fd59977 1
2#include <Xw_Extension.h>
3
4 /* ifdef then trace on */
5#ifdef TRACE
6#define TRACE_GET_TYPEMAP_INFO
7#endif
8
9/*
10 XW_STATUS Xw_get_typemap_info (atypemap,mtype,utype,dtype,ftype):
11 XW_EXT_TYPEMAP *atypemap
12 int *mtype Return the maximum type number of the typemap
13 int *utype Return the User type number used in the typemap
14 int *dtype Return the User type number defined in the typemap
15 int *ftype Return the First Free type index in the typemap
16 NOTE than if ftype < 0 , No more Free type exist in the typemap
17
18 Returns XW_ERROR if the Extended Typemap is not defined
19 Returns XW_SUCCESS if successful
20
21*/
22
23#ifdef XW_PROTOTYPE
24XW_STATUS Xw_get_typemap_info (void *atypemap,int *mtype,int *utype,int *dtype,int *ftype)
25#else
26XW_STATUS Xw_get_typemap_info (atypemap,mtype,utype,dtype,ftype)
27void *atypemap;
28int *mtype,*utype,*dtype,*ftype ;
29#endif /*XW_PROTOTYPE*/
30{
31 XW_EXT_TYPEMAP *ptypemap = (XW_EXT_TYPEMAP*)atypemap;
32 int i ;
33
34 if( !Xw_isdefine_typemap(ptypemap) ) {
35 /*ERROR*Bad EXT_TYPEMAP Address*/
36 Xw_set_error(51,"Xw_get_typemap_info",ptypemap) ;
37 return (XW_ERROR) ;
38 }
39
40 *mtype = MAXTYPE ;
41 *utype = ptypemap->maxtype ;
42 *dtype = 1 ;
43 *ftype = -1 ;
44 for( i=0 ; i< *utype ; i++ ) {
45 if( ptypemap->types[i] ) (*dtype)++ ;
46 else if( i && *ftype < 0 ) *ftype = i ;
47 }
48
49#ifdef TRACE_GET_TYPEMAP_INFO
50if( Xw_get_trace() ) {
51 printf (" Xw_get_typemap_info(%lx,%d,%d,%d,%d)\n",
52 (long ) ptypemap,*mtype,*utype,*dtype,*ftype) ;
53}
54#endif
55
56 return (XW_SUCCESS);
57}