Commit | Line | Data |
---|---|---|
b311480e | 1 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
7fd59977 | 2 | // |
b311480e | 3 | // The content of this file is subject to the Open CASCADE Technology Public |
4 | // License Version 6.5 (the "License"). You may not use the content of this file | |
5 | // except in compliance with the License. Please obtain a copy of the License | |
6 | // at http://www.opencascade.org and read it completely before using this file. | |
7 | // | |
8 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its | |
9 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. | |
7fd59977 | 10 | // |
b311480e | 11 | // The Original Code and all software distributed under the License is |
12 | // distributed on an "AS IS" basis, without warranty of any kind, and the | |
13 | // Initial Developer hereby disclaims all such warranties, including without | |
14 | // limitation, any warranties of merchantability, fitness for a particular | |
15 | // purpose or non-infringement. Please see the License for the specific terms | |
16 | // and conditions governing the rights and limitations under the License. | |
17 | ||
18 | // AdvApp2Var_SysBase.hxx | |
7fd59977 | 19 | #ifndef AdvApp2Var_SysBase_HeaderFile |
20 | #define AdvApp2Var_SysBase_HeaderFile | |
21 | ||
22 | #include <Standard_Macro.hxx> | |
23 | #include <AdvApp2Var_Data_f2c.hxx> | |
fadcea2c RL |
24 | #if _MSC_VER |
25 | #include <stddef.h> | |
26 | #else | |
27 | #include <stdint.h> | |
28 | #endif | |
7fd59977 | 29 | |
7fd59977 | 30 | class AdvApp2Var_SysBase { |
1ef32e96 RL |
31 | public: |
32 | Standard_EXPORT AdvApp2Var_SysBase(); | |
33 | Standard_EXPORT ~AdvApp2Var_SysBase(); | |
34 | ||
7fd59977 | 35 | // |
1ef32e96 | 36 | Standard_EXPORT int mainial_(); |
7fd59977 | 37 | |
38 | Standard_EXPORT static int macinit_(int *, | |
39 | int *); | |
40 | // | |
1ef32e96 | 41 | Standard_EXPORT int mcrdelt_(integer *iunit, |
7fd59977 | 42 | integer *isize, |
fadcea2c RL |
43 | void *t, |
44 | intptr_t *iofset, | |
7fd59977 | 45 | integer *iercod); |
46 | ||
47 | Standard_EXPORT static int mcrfill_(integer *size, | |
fadcea2c RL |
48 | void *tin, |
49 | void *tout); | |
7fd59977 | 50 | |
1ef32e96 | 51 | Standard_EXPORT int mcrrqst_(integer *iunit, |
7fd59977 | 52 | integer *isize, |
fadcea2c RL |
53 | void *t, |
54 | intptr_t *iofset, | |
7fd59977 | 55 | integer *iercod); |
56 | Standard_EXPORT static integer mnfndeb_(); | |
57 | ||
58 | Standard_EXPORT static integer mnfnimp_(); | |
59 | Standard_EXPORT static int do__fio(); | |
60 | Standard_EXPORT static int do__lio (); | |
61 | Standard_EXPORT static int e__wsfe (); | |
62 | Standard_EXPORT static int e__wsle (); | |
63 | Standard_EXPORT static int s__wsfe (); | |
64 | Standard_EXPORT static int s__wsle (); | |
1ef32e96 | 65 | Standard_EXPORT int macrai4_(integer *nbelem, |
7fd59977 | 66 | integer *maxelm, |
67 | integer *itablo, | |
fadcea2c | 68 | intptr_t *iofset, |
7fd59977 | 69 | integer *iercod); |
1ef32e96 | 70 | Standard_EXPORT int macrar8_(integer *nbelem, |
7fd59977 | 71 | integer *maxelm, |
72 | doublereal *xtablo, | |
fadcea2c | 73 | intptr_t *iofset, |
7fd59977 | 74 | integer *iercod); |
1ef32e96 | 75 | Standard_EXPORT int macrdi4_(integer *nbelem, |
7fd59977 | 76 | integer *maxelm, |
77 | integer *itablo, | |
fadcea2c | 78 | intptr_t *iofset, |
7fd59977 | 79 | integer *iercod); |
80 | ||
1ef32e96 | 81 | Standard_EXPORT int macrdr8_(integer *nbelem, |
7fd59977 | 82 | integer *maxelm, |
83 | doublereal *xtablo, | |
fadcea2c | 84 | intptr_t *iofset, |
7fd59977 | 85 | integer *iercod); |
86 | Standard_EXPORT static int maermsg_(const char *cnompg, | |
87 | integer *icoder, | |
88 | ftnlen cnompg_len); | |
89 | Standard_EXPORT static int maitbr8_(integer *itaill, | |
90 | doublereal *xtab, | |
91 | doublereal *xval); | |
92 | Standard_EXPORT static int maovsr8_(integer *ivalcs); | |
93 | Standard_EXPORT static int mgenmsg_(const char *nomprg, | |
94 | ftnlen nomprg_len); | |
95 | ||
96 | Standard_EXPORT static int mgsomsg_(const char *nomprg, | |
97 | ftnlen nomprg_len); | |
98 | Standard_EXPORT static void miraz_(integer *taille, | |
fadcea2c | 99 | void *adt); |
7fd59977 | 100 | Standard_EXPORT static int msifill_(integer *nbintg, |
101 | integer *ivecin, | |
102 | integer *ivecou); | |
103 | Standard_EXPORT static int msrfill_(integer *nbreel, | |
104 | doublereal *vecent, | |
105 | doublereal * vecsor); | |
106 | Standard_EXPORT static int mswrdbg_(const char *ctexte, | |
107 | ftnlen ctexte_len); | |
108 | Standard_EXPORT static void mvriraz_(integer *taille, | |
fadcea2c | 109 | void*adt); |
7fd59977 | 110 | |
1ef32e96 RL |
111 | private: |
112 | int macrchk_(); | |
113 | int mcrlist_(integer *ier) const; | |
114 | ||
115 | /* Maximum number of allowed allocation requests. | |
116 | Currently the maximum known number of requests is 7 - see | |
117 | AdvApp2Var_MathBase::mmresol_(). So the current value is a safe margin and | |
118 | a reasonable balance to not provoke stack overflow (especially in | |
119 | multi-threaded execution). Previous number of 1000 was excessive but | |
120 | tolerable when used for static memory. | |
121 | */ | |
122 | static const int MAX_ALLOC_NB = 32; | |
123 | ||
124 | enum { | |
125 | static_allocation = 0, /* indicates static allocation, currently not used */ | |
126 | heap_allocation = 1 /* indicates heap allocation */ | |
127 | }; | |
128 | ||
129 | /* Describes an individual memory allocation request. | |
130 | See format description in the AdvApp2Var_SysBase.cxx. | |
131 | The field order is preserved and the sizes are chosen to minimize | |
132 | memory footprint. Fields containing address have the intptr_t type | |
133 | for easier arithmetic and to avoid casts in the source code. | |
134 | ||
135 | No initialization constructor should be provided to avoid wasting | |
136 | time when allocating a field mcrgene_. | |
137 | */ | |
138 | struct mitem { | |
139 | unsigned char prot; | |
140 | unsigned char unit; //unit of allocation: 1, 2, 4 or 8 | |
141 | integer reqsize; | |
142 | intptr_t loc; | |
143 | intptr_t offset; | |
144 | unsigned char alloctype; // static_allocation or heap_allocation | |
145 | integer size; | |
146 | intptr_t addr; | |
147 | integer userzone; //not used | |
148 | intptr_t startaddr; | |
149 | intptr_t endaddr; | |
150 | integer rank; | |
151 | }; | |
152 | ||
153 | struct { | |
154 | mitem icore[MAX_ALLOC_NB]; | |
155 | integer ncore; | |
156 | unsigned char lprot; | |
157 | } mcrgene_; | |
158 | ||
159 | /* Contains statistics on allocation requests. | |
160 | Index 0 corresponds to static_allocation, 1 - to heap allocation. | |
161 | nrqst - number of allocation requests; | |
162 | ndelt - number of deallocation requests; | |
163 | nbyte - current number of allocated bytes; | |
164 | mbyte - maximum number of ever allocated bytes. | |
165 | */ | |
166 | struct { | |
167 | integer nrqst[2], ndelt[2], nbyte[2], mbyte[2]; | |
168 | } mcrstac_; | |
7fd59977 | 169 | }; |
170 | ||
171 | #endif |