Commit | Line | Data |
---|---|---|
973c2be1 | 1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
7fd59977 | 2 | // |
973c2be1 | 3 | // This file is part of Open CASCADE Technology software library. |
b311480e | 4 | // |
d5f74e42 | 5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published | |
973c2be1 | 7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT | |
9 | // distribution for complete text of the license and disclaimer of any warranty. | |
7fd59977 | 10 | // |
973c2be1 | 11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. | |
b311480e | 13 | |
14 | // AdvApp2Var_SysBase.hxx | |
7fd59977 | 15 | #ifndef AdvApp2Var_SysBase_HeaderFile |
16 | #define AdvApp2Var_SysBase_HeaderFile | |
17 | ||
1bd04b5a | 18 | #include <Standard_TypeDef.hxx> |
7fd59977 | 19 | #include <AdvApp2Var_Data_f2c.hxx> |
20 | ||
7fd59977 | 21 | class AdvApp2Var_SysBase { |
1ef32e96 RL |
22 | public: |
23 | Standard_EXPORT AdvApp2Var_SysBase(); | |
24 | Standard_EXPORT ~AdvApp2Var_SysBase(); | |
25 | ||
7fd59977 | 26 | // |
1ef32e96 | 27 | Standard_EXPORT int mainial_(); |
7fd59977 | 28 | |
29 | Standard_EXPORT static int macinit_(int *, | |
30 | int *); | |
31 | // | |
1ef32e96 | 32 | Standard_EXPORT int mcrdelt_(integer *iunit, |
7fd59977 | 33 | integer *isize, |
fadcea2c RL |
34 | void *t, |
35 | intptr_t *iofset, | |
7fd59977 | 36 | integer *iercod); |
37 | ||
38 | Standard_EXPORT static int mcrfill_(integer *size, | |
fadcea2c RL |
39 | void *tin, |
40 | void *tout); | |
7fd59977 | 41 | |
1ef32e96 | 42 | Standard_EXPORT int mcrrqst_(integer *iunit, |
7fd59977 | 43 | integer *isize, |
fadcea2c RL |
44 | void *t, |
45 | intptr_t *iofset, | |
7fd59977 | 46 | integer *iercod); |
47 | Standard_EXPORT static integer mnfndeb_(); | |
48 | ||
7fd59977 | 49 | Standard_EXPORT static int do__fio(); |
50 | Standard_EXPORT static int do__lio (); | |
1ef32e96 | 51 | Standard_EXPORT int macrai4_(integer *nbelem, |
7fd59977 | 52 | integer *maxelm, |
53 | integer *itablo, | |
fadcea2c | 54 | intptr_t *iofset, |
7fd59977 | 55 | integer *iercod); |
1ef32e96 | 56 | Standard_EXPORT int macrar8_(integer *nbelem, |
7fd59977 | 57 | integer *maxelm, |
58 | doublereal *xtablo, | |
fadcea2c | 59 | intptr_t *iofset, |
7fd59977 | 60 | integer *iercod); |
1ef32e96 | 61 | Standard_EXPORT int macrdi4_(integer *nbelem, |
7fd59977 | 62 | integer *maxelm, |
63 | integer *itablo, | |
fadcea2c | 64 | intptr_t *iofset, |
7fd59977 | 65 | integer *iercod); |
66 | ||
1ef32e96 | 67 | Standard_EXPORT int macrdr8_(integer *nbelem, |
7fd59977 | 68 | integer *maxelm, |
69 | doublereal *xtablo, | |
fadcea2c | 70 | intptr_t *iofset, |
7fd59977 | 71 | integer *iercod); |
72 | Standard_EXPORT static int maermsg_(const char *cnompg, | |
73 | integer *icoder, | |
74 | ftnlen cnompg_len); | |
75 | Standard_EXPORT static int maitbr8_(integer *itaill, | |
76 | doublereal *xtab, | |
77 | doublereal *xval); | |
78 | Standard_EXPORT static int maovsr8_(integer *ivalcs); | |
79 | Standard_EXPORT static int mgenmsg_(const char *nomprg, | |
80 | ftnlen nomprg_len); | |
81 | ||
82 | Standard_EXPORT static int mgsomsg_(const char *nomprg, | |
83 | ftnlen nomprg_len); | |
84 | Standard_EXPORT static void miraz_(integer *taille, | |
fadcea2c | 85 | void *adt); |
7fd59977 | 86 | Standard_EXPORT static int msifill_(integer *nbintg, |
87 | integer *ivecin, | |
88 | integer *ivecou); | |
89 | Standard_EXPORT static int msrfill_(integer *nbreel, | |
90 | doublereal *vecent, | |
91 | doublereal * vecsor); | |
92 | Standard_EXPORT static int mswrdbg_(const char *ctexte, | |
93 | ftnlen ctexte_len); | |
94 | Standard_EXPORT static void mvriraz_(integer *taille, | |
fadcea2c | 95 | void*adt); |
7fd59977 | 96 | |
1ef32e96 RL |
97 | private: |
98 | int macrchk_(); | |
99 | int mcrlist_(integer *ier) const; | |
100 | ||
101 | /* Maximum number of allowed allocation requests. | |
102 | Currently the maximum known number of requests is 7 - see | |
103 | AdvApp2Var_MathBase::mmresol_(). So the current value is a safe margin and | |
104 | a reasonable balance to not provoke stack overflow (especially in | |
105 | multi-threaded execution). Previous number of 1000 was excessive but | |
106 | tolerable when used for static memory. | |
107 | */ | |
108 | static const int MAX_ALLOC_NB = 32; | |
109 | ||
110 | enum { | |
111 | static_allocation = 0, /* indicates static allocation, currently not used */ | |
112 | heap_allocation = 1 /* indicates heap allocation */ | |
113 | }; | |
114 | ||
115 | /* Describes an individual memory allocation request. | |
116 | See format description in the AdvApp2Var_SysBase.cxx. | |
117 | The field order is preserved and the sizes are chosen to minimize | |
118 | memory footprint. Fields containing address have the intptr_t type | |
119 | for easier arithmetic and to avoid casts in the source code. | |
120 | ||
121 | No initialization constructor should be provided to avoid wasting | |
122 | time when allocating a field mcrgene_. | |
123 | */ | |
124 | struct mitem { | |
125 | unsigned char prot; | |
126 | unsigned char unit; //unit of allocation: 1, 2, 4 or 8 | |
127 | integer reqsize; | |
128 | intptr_t loc; | |
129 | intptr_t offset; | |
130 | unsigned char alloctype; // static_allocation or heap_allocation | |
131 | integer size; | |
132 | intptr_t addr; | |
133 | integer userzone; //not used | |
134 | intptr_t startaddr; | |
135 | intptr_t endaddr; | |
136 | integer rank; | |
137 | }; | |
138 | ||
139 | struct { | |
140 | mitem icore[MAX_ALLOC_NB]; | |
141 | integer ncore; | |
142 | unsigned char lprot; | |
143 | } mcrgene_; | |
144 | ||
145 | /* Contains statistics on allocation requests. | |
146 | Index 0 corresponds to static_allocation, 1 - to heap allocation. | |
147 | nrqst - number of allocation requests; | |
148 | ndelt - number of deallocation requests; | |
149 | nbyte - current number of allocated bytes; | |
150 | mbyte - maximum number of ever allocated bytes. | |
151 | */ | |
152 | struct { | |
153 | integer nrqst[2], ndelt[2], nbyte[2], mbyte[2]; | |
154 | } mcrstac_; | |
7fd59977 | 155 | }; |
156 | ||
157 | #endif |