| 1 |
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
| 2 |
// vi: set et ts=4 sw=2 sts=2: |
| 3 |
// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root |
| 4 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 5 |
/****************************************************************************/ |
| 6 |
/* */ |
| 7 |
/* File: dddi.h */ |
| 8 |
/* */ |
| 9 |
/* Purpose: internal header file for ddd module */ |
| 10 |
/* */ |
| 11 |
/* Author: Klaus Birken */ |
| 12 |
/* Rechenzentrum Uni Stuttgart */ |
| 13 |
/* Universitaet Stuttgart */ |
| 14 |
/* Allmandring 30 */ |
| 15 |
/* 70550 Stuttgart */ |
| 16 |
/* internet: [email protected] */ |
| 17 |
/* */ |
| 18 |
/* */ |
| 19 |
/* History: 93/11/22 kb begin */ |
| 20 |
/* 95/10/05 kb added casts to mem-management macros */ |
| 21 |
/* */ |
| 22 |
/* Remarks: */ |
| 23 |
/* */ |
| 24 |
/****************************************************************************/ |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
/* |
| 29 |
#define CheckIFMEM |
| 30 |
#define CheckPMEM |
| 31 |
#define CheckCplMEM |
| 32 |
#define CheckMsgMEM |
| 33 |
#define CheckTmpMEM |
| 34 |
#define CheckHeapMem |
| 35 |
*/ |
| 36 |
|
| 37 |
|
| 38 |
/****************************************************************************/ |
| 39 |
/* */ |
| 40 |
/* auto include mechanism and other include files */ |
| 41 |
/* */ |
| 42 |
/****************************************************************************/ |
| 43 |
|
| 44 |
#ifndef __DDDI_H__ |
| 45 |
#define __DDDI_H__ |
| 46 |
|
| 47 |
#include <climits> |
| 48 |
#include <memory> |
| 49 |
#include <vector> |
| 50 |
|
| 51 |
#include <cassert> |
| 52 |
|
| 53 |
#include <dune/uggrid/parallel/ddd/dddcontext.hh> |
| 54 |
|
| 55 |
#include <dune/uggrid/low/architecture.h> |
| 56 |
#include <dune/uggrid/low/ugtypes.h> |
| 57 |
|
| 58 |
#include <dune/uggrid/parallel/ppif/ppif.h> |
| 59 |
#include <dune/uggrid/parallel/ddd/ctrl/stat.h> |
| 60 |
#include <dune/uggrid/parallel/ddd/include/ddd.h> |
| 61 |
#include <dune/uggrid/parallel/ddd/include/dddio.h> |
| 62 |
#include <dune/uggrid/parallel/ddd/include/memmgr.h> |
| 63 |
|
| 64 |
START_UGDIM_NAMESPACE |
| 65 |
|
| 66 |
using namespace DDD; |
| 67 |
|
| 68 |
/* |
| 69 |
macro for exiting program in case of a severe error condition |
| 70 |
*/ |
| 71 |
#define HARD_EXIT assert(0) |
| 72 |
/* #define HARD_EXIT exit(1) */ |
| 73 |
|
| 74 |
|
| 75 |
/* |
| 76 |
macros for correct return or premature abort of a procedure |
| 77 |
*/ |
| 78 |
#define RET_ON_OK return (true) |
| 79 |
#define RET_ON_ERROR return (false) |
| 80 |
#define IS_OK(p) ((p)==true) |
| 81 |
|
| 82 |
|
| 83 |
/****************************************************************************/ |
| 84 |
/* */ |
| 85 |
/* defines in the following order */ |
| 86 |
/* */ |
| 87 |
/* compile time constants defining static data size (i.e. arrays) */ |
| 88 |
/* other constants */ |
| 89 |
/* macros */ |
| 90 |
/* */ |
| 91 |
/****************************************************************************/ |
| 92 |
|
| 93 |
/*** DDD internal parameters ***/ |
| 94 |
|
| 95 |
#define MAX_PRIO 32 /* max. number of DDD_PRIO */ |
| 96 |
#define MAX_CPL_START 65536 /* max. number of local objects with coupling */ |
| 97 |
|
| 98 |
#ifdef WithFullObjectTable |
| 99 |
#define MAX_OBJ_START 262144 /* max. number of locally registered objects */ |
| 100 |
#else |
| 101 |
#define MAX_OBJ_START MAX_CPL_START |
| 102 |
#endif |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
#define MAX_TRIES 50000000 /* max. number of tries until timeout in IF-comm */ |
| 107 |
|
| 108 |
#ifdef DDD_MAX_PROCBITS_IN_GID |
| 109 |
#define MAX_PROCBITS_IN_GID DDD_MAX_PROCBITS_IN_GID |
| 110 |
#else |
| 111 |
#define MAX_PROCBITS_IN_GID 24 /* this allows 2^24 procs and 2^40 objects */ |
| 112 |
#endif |
| 113 |
|
| 114 |
/* use maximum as default, if no Priomerge-matrix is available */ |
| 115 |
#define PRIOMERGE_DEFAULT PRIOMERGE_MAXIMUM |
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
/*** DDD internal constants ***/ |
| 120 |
|
| 121 |
/* maximum number of procs allowed (limited by GID construction) */ |
| 122 |
#define MAX_PROCS (1<<MAX_PROCBITS_IN_GID) |
| 123 |
|
| 124 |
|
| 125 |
#define GID_INVALID -1 /* invalid global id */ |
| 126 |
#define PRIO_INVALID (MAX_PRIO+1) /* invalid priority */ |
| 127 |
#define PROC_INVALID (MAX_PROCS+1) /* invalid processor number */ |
| 128 |
#define ERROR -1 /* standard error indicator */ |
| 129 |
|
| 130 |
|
| 131 |
/* types of virtual channels (for ppif interface) */ |
| 132 |
enum VChanType { |
| 133 |
VC_IDENT = 15, /* channels used for identification module */ |
| 134 |
VC_IFCOMM = 16, /* channels used for interface module */ |
| 135 |
VC_TOPO = 17 /* channels used for xfer module (topology) */ |
| 136 |
}; |
| 137 |
|
| 138 |
|
| 139 |
/* results of an prio-merge operation. see mgr/prio.c for more details. */ |
| 140 |
enum PrioMergeVals { |
| 141 |
PRIO_ERROR = -1, |
| 142 |
PRIO_UNKNOWN, |
| 143 |
PRIO_FIRST, |
| 144 |
PRIO_SECOND |
| 145 |
}; |
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
/****************************************************************************/ |
| 150 |
|
| 151 |
/* string constants */ |
| 152 |
#define STR_NOMEM "out of memory" |
| 153 |
|
| 154 |
|
| 155 |
/****************************************************************************/ |
| 156 |
/* */ |
| 157 |
/* data structures exported by the corresponding source file */ |
| 158 |
/* */ |
| 159 |
/****************************************************************************/ |
| 160 |
|
| 161 |
/* macros for accessing COUPLING */ |
| 162 |
#define CPL_NEXT(cpl) ((cpl)->_next) |
| 163 |
#define CPL_PROC(cpl) ((cpl)->_proc) |
| 164 |
|
| 165 |
/* macros for accessing ELEM_DESC */ |
| 166 |
#define EDESC_REFTYPE(ed) ((ed)->_reftype) |
| 167 |
#define EDESC_SET_REFTYPE(ed,rt) (ed)->_reftype=(rt) |
| 168 |
|
| 169 |
/****************************************************************************/ |
| 170 |
/* */ |
| 171 |
/* definitions previously hold in misc.h */ |
| 172 |
/* */ |
| 173 |
/****************************************************************************/ |
| 174 |
|
| 175 |
#ifndef MIN |
| 176 |
#define MIN(x,y) (((x)<(y)) ? (x) : (y)) |
| 177 |
#endif |
| 178 |
|
| 179 |
#ifndef MAX |
| 180 |
#define MAX(x,y) (((x)>(y)) ? (x) : (y)) |
| 181 |
#endif |
| 182 |
|
| 183 |
|
| 184 |
/* round up to next alignment border */ |
| 185 |
#ifndef CEIL |
| 186 |
#define CEIL(n) ((n)+((ALIGNMENT-((n)&(ALIGNMENT-1)))&(ALIGNMENT-1))) |
| 187 |
#endif |
| 188 |
|
| 189 |
/* round down to next alignment border */ |
| 190 |
#ifndef FLOOR |
| 191 |
#define FLOOR(n) ((n)&ALIGNMASK) |
| 192 |
#endif |
| 193 |
|
| 194 |
#define YES 1 |
| 195 |
#define ON 1 |
| 196 |
|
| 197 |
#define NO 0 |
| 198 |
#define OFF 0 |
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
/****************************************************************************/ |
| 203 |
/* */ |
| 204 |
/* macros */ |
| 205 |
/* */ |
| 206 |
/****************************************************************************/ |
| 207 |
|
| 208 |
|
| 209 |
/* internal access of DDD_HEADER members */ |
| 210 |
#define ACCESS_HDR(o,c) ((o)->c) |
| 211 |
|
| 212 |
/* type of object */ |
| 213 |
#define OBJ_TYPE(o) ACCESS_HDR(o,typ) |
| 214 |
|
| 215 |
/* priority of object */ |
| 216 |
#define OBJ_PRIO(o) ACCESS_HDR(o,prio) |
| 217 |
|
| 218 |
/* attr of object */ |
| 219 |
#define OBJ_ATTR(o) ACCESS_HDR(o,attr) |
| 220 |
|
| 221 |
/* global id of object */ |
| 222 |
#define OBJ_GID(o) ACCESS_HDR(o,gid) |
| 223 |
#define OBJ_GID_FMT DDD_GID_FMT |
| 224 |
|
| 225 |
/* get index into global object table */ |
| 226 |
#define OBJ_INDEX(o) ACCESS_HDR(o,myIndex) |
| 227 |
|
| 228 |
/* internal flags of object */ |
| 229 |
#define OBJ_FLAGS(o) ACCESS_HDR(o,flags) |
| 230 |
|
| 231 |
|
| 232 |
/****************************************************************************/ |
| 233 |
|
| 234 |
/* usage of flags in DDD_HEADER */ |
| 235 |
#define MASK_OBJ_PRUNED 0x00000001 |
| 236 |
#define OBJ_PRUNED(c) (((int)(OBJ_FLAGS(c)))&MASK_OBJ_PRUNED) |
| 237 |
#define SET_OBJ_PRUNED(c,d) (OBJ_FLAGS(c)) = ((OBJ_FLAGS(c))&(~MASK_OBJ_PRUNED))|((d)&MASK_OBJ_PRUNED) |
| 238 |
|
| 239 |
#define MASK_OBJ_RESENT 0x00000002 |
| 240 |
#define SHIFT_OBJ_RESENT 1 |
| 241 |
#define OBJ_RESENT(c) ((((int)(OBJ_FLAGS(c)))&MASK_OBJ_RESENT)>>SHIFT_OBJ_RESENT) |
| 242 |
#define SET_OBJ_RESENT(c,d) (OBJ_FLAGS(c)) = ((OBJ_FLAGS(c))&(~MASK_OBJ_RESENT))|(((d)<<SHIFT_OBJ_RESENT)&MASK_OBJ_RESENT) |
| 243 |
|
| 244 |
|
| 245 |
/* usage of flags in COUPLING */ |
| 246 |
/* usage of 0x03 while interface-building, temporarily */ |
| 247 |
#define MASKCPLDIR 0x00000003 |
| 248 |
#define CPLDIR(c) (((int)((c)->_flags))&MASKCPLDIR) |
| 249 |
#define SETCPLDIR(c,d) ((c)->_flags) = (((c)->_flags)&(~MASKCPLDIR))|((d)&MASKCPLDIR) |
| 250 |
|
| 251 |
/* usage of 0x10 for remembering the memory origin for the COUPLING struct */ |
| 252 |
#define MASKCPLMEM 0x00000010 |
| 253 |
#define CPLMEM_EXTERNAL 0x00 |
| 254 |
#define CPLMEM_FREELIST 0x10 |
| 255 |
#define CPLMEM(c) (((int)((c)->_flags))&MASKCPLMEM) |
| 256 |
#define SETCPLMEM_EXTERNAL(c) ((c)->_flags) = (((c)->_flags)&(~MASKCPLMEM))|(CPLMEM_EXTERNAL) |
| 257 |
#define SETCPLMEM_FREELIST(c) ((c)->_flags) = (((c)->_flags)&(~MASKCPLMEM))|(CPLMEM_FREELIST) |
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
/* convert DDD_OBJ to DDD_HDR and vice versa */ |
| 262 |
|
| 263 |
#define OBJ2HDR(obj,desc) ((DDD_HDR)(((char *)obj)+((desc)->offsetHeader))) |
| 264 |
#define HDR2OBJ(hdr,desc) ((DDD_OBJ)(((char *)hdr)-((desc)->offsetHeader))) |
| 265 |
#define OBJ_OBJ(context, hdr) ((DDD_OBJ)(((char *)hdr)- \ |
| 266 |
(context.typeDefs()[OBJ_TYPE(hdr)].offsetHeader))) |
| 267 |
|
| 268 |
|
| 269 |
/****************************************************************************/ |
| 270 |
|
| 271 |
/* |
| 272 |
macros for access of coupling tables |
| 273 |
*/ |
| 274 |
|
| 275 |
/* get boolean: does object have couplings? */ |
| 276 |
#define ObjHasCpl(context, o) (OBJ_INDEX(o) < context.couplingContext().nCpls) |
| 277 |
|
| 278 |
/* get #couplings per object */ |
| 279 |
#define ObjNCpl(context, o) (ObjHasCpl(context, o) ? context.couplingContext().nCplTable[OBJ_INDEX(o)] : 0) |
| 280 |
#define IdxNCpl(context, i) (context.couplingContext().nCplTable[i]) |
| 281 |
|
| 282 |
/* get pointer to object's coupling list */ |
| 283 |
#define ObjCplList(context, o) (ObjHasCpl(context, o) ? context.couplingContext().cplTable[OBJ_INDEX(o)] : nullptr) |
| 284 |
#define IdxCplList(context, i) (context.couplingContext().cplTable[i]) |
| 285 |
|
| 286 |
|
| 287 |
/* DDD_HDR may be invalid */ |
| 288 |
#define MarkHdrInvalid(hdr) OBJ_INDEX(hdr)=(INT_MAX-1) |
| 289 |
#define IsHdrInvalid(hdr) OBJ_INDEX(hdr)==(INT_MAX-1) |
| 290 |
|
| 291 |
#ifndef WithFullObjectTable |
| 292 |
#define MarkHdrLocal(hdr) OBJ_INDEX(hdr)=(INT_MAX) |
| 293 |
#define IsHdrLocal(hdr) OBJ_INDEX(hdr)==(INT_MAX) |
| 294 |
#endif |
| 295 |
|
| 296 |
/****************************************************************************/ |
| 297 |
|
| 298 |
/** get default VChan to processor p */ |
| 299 |
inline |
| 300 |
const VChannelPtr VCHAN_TO(const DDD::DDDContext& context, DDD_PROC p) |
| 301 |
{ |
| 302 |
return context.topoContext().theTopology[p]; |
| 303 |
} |
| 304 |
|
| 305 |
|
| 306 |
/****************************************************************************/ |
| 307 |
|
| 308 |
/* types for StdIf-communication functions (see if/ifstd.ct) */ |
| 309 |
typedef int (*ExecProcHdrPtr)(DDD::DDDContext& context, DDD_HDR); |
| 310 |
typedef int (*ExecProcHdrXPtr)(DDD::DDDContext& context, DDD_HDR, DDD_PROC, DDD_PRIO); |
| 311 |
typedef int (*ComProcHdrPtr)(DDD::DDDContext& context, DDD_HDR, void *); |
| 312 |
typedef int (*ComProcHdrXPtr)(DDD::DDDContext& context, DDD_HDR, void *, DDD_PROC, DDD_PRIO); |
| 313 |
|
| 314 |
|
| 315 |
/****************************************************************************/ |
| 316 |
/* */ |
| 317 |
/* memory management */ |
| 318 |
/* */ |
| 319 |
/****************************************************************************/ |
| 320 |
|
| 321 |
|
| 322 |
#if defined(CheckPMEM) || defined(CheckIFMEM) || defined(CheckCplMEM) || defined(CheckMsgMEM) || defined(CheckTmpMEM) || defined(CheckHeapMem) |
| 323 |
|
| 324 |
static void *dummy_ptr; |
| 325 |
static char *mem_ptr; |
| 326 |
|
| 327 |
#ifndef SST |
| 328 |
#define SST (CEIL(sizeof(size_t))) |
| 329 |
#define GET_SSTVAL(adr) *(size_t *)(((char *)adr)-SST) |
| 330 |
#endif |
| 331 |
|
| 332 |
#endif |
| 333 |
|
| 334 |
|
| 335 |
/*** mapping memory allocation calls to memmgr_ calls ***/ |
| 336 |
|
| 337 |
#define AllocObj(s,t,p,a) memmgr_AllocOMEM((size_t)s,(int)t,(int)p,(int)a) |
| 338 |
|
| 339 |
|
| 340 |
#ifdef CheckPMEM |
| 341 |
#define AllocFix(s) \ |
| 342 |
(dummy_ptr = (mem_ptr=(char *)memmgr_AllocPMEM(SST+(size_t)s)) != NULL ? \ |
| 343 |
mem_ptr+SST : NULL); \ |
| 344 |
if (mem_ptr!=NULL) GET_SSTVAL(dummy_ptr) = s; \ |
| 345 |
printf("MALL PFix adr=%08x size=%ld file=%s line=%d\n", \ |
| 346 |
dummy_ptr,s,__FILE__,__LINE__) |
| 347 |
#else |
| 348 |
#define AllocFix(s) memmgr_AllocPMEM((size_t)s) |
| 349 |
#endif |
| 350 |
|
| 351 |
|
| 352 |
#ifdef CheckMsgMEM |
| 353 |
#define AllocMsg(s) \ |
| 354 |
(dummy_ptr = (mem_ptr=(char *)memmgr_AllocTMEM(SST+(size_t)s, TMEM_MSG)) \ |
| 355 |
!= NULL ? \ |
| 356 |
mem_ptr+SST : NULL); \ |
| 357 |
if (mem_ptr!=NULL) GET_SSTVAL(dummy_ptr) = s; \ |
| 358 |
printf("MALL TMsg adr=%08x size=%ld file=%s line=%d\n", \ |
| 359 |
dummy_ptr,s,__FILE__,__LINE__) |
| 360 |
#else |
| 361 |
#define AllocMsg(s) memmgr_AllocTMEM((size_t)s, TMEM_MSG) |
| 362 |
#endif |
| 363 |
|
| 364 |
|
| 365 |
#ifdef CheckTmpMEM |
| 366 |
#define AllocTmp(s) \ |
| 367 |
(dummy_ptr = (mem_ptr=(char *)memmgr_AllocTMEM(SST+(size_t)s, TMEM_ANY)) \ |
| 368 |
!= NULL ? \ |
| 369 |
mem_ptr+SST : NULL); \ |
| 370 |
if (mem_ptr!=NULL) GET_SSTVAL(dummy_ptr) = s; \ |
| 371 |
printf("MALL TTmp adr=%08x size=%ld file=%s line=%d\n", \ |
| 372 |
dummy_ptr,s,__FILE__,__LINE__) |
| 373 |
|
| 374 |
#define AllocTmpReq(s,r) \ |
| 375 |
(dummy_ptr = (mem_ptr=(char *)memmgr_AllocTMEM(SST+(size_t)s, r)) \ |
| 376 |
!= NULL ? \ |
| 377 |
mem_ptr+SST : NULL); \ |
| 378 |
if (mem_ptr!=NULL) GET_SSTVAL(dummy_ptr) = s; \ |
| 379 |
printf("MALL TTmp adr=%08x size=%ld kind=%d file=%s line=%d\n", \ |
| 380 |
dummy_ptr,s,r,__FILE__,__LINE__) |
| 381 |
#else |
| 382 |
#define AllocTmp(s) memmgr_AllocTMEM((size_t)s, TMEM_ANY) |
| 383 |
#define AllocTmpReq(s,r) memmgr_AllocTMEM((size_t)s, r) |
| 384 |
#endif |
| 385 |
|
| 386 |
|
| 387 |
#ifdef CheckCplMEM |
| 388 |
#define AllocCpl(s) \ |
| 389 |
(dummy_ptr = (mem_ptr=(char *)memmgr_AllocAMEM(SST+(size_t)s)) != NULL ? \ |
| 390 |
mem_ptr+SST : NULL); \ |
| 391 |
if (mem_ptr!=NULL) GET_SSTVAL(dummy_ptr) = s; \ |
| 392 |
printf("MALL ACpl adr=%08x size=%ld file=%s line=%d\n", \ |
| 393 |
dummy_ptr,s,__FILE__,__LINE__) |
| 394 |
#else |
| 395 |
#define AllocCpl(s) memmgr_AllocAMEM((size_t)s) |
| 396 |
#endif |
| 397 |
|
| 398 |
#ifdef CheckIFMEM |
| 399 |
#define AllocIF(s) \ |
| 400 |
(dummy_ptr = (mem_ptr=(char *)memmgr_AllocAMEM(SST+(size_t)s)) != NULL ? \ |
| 401 |
mem_ptr+SST : NULL); \ |
| 402 |
if (mem_ptr!=NULL) GET_SSTVAL(dummy_ptr) = s; \ |
| 403 |
printf("MALL AIF adr=%08x size=%ld file=%s line=%d\n", \ |
| 404 |
dummy_ptr,s,__FILE__,__LINE__) |
| 405 |
#else |
| 406 |
#define AllocIF(s) memmgr_AllocAMEM((size_t)s) |
| 407 |
#endif |
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
/*** mapping memory free calls to memmgr calls ***/ |
| 412 |
|
| 413 |
#define FreeObj(mem,s,t) memmgr_FreeOMEM(mem,(size_t)s,(int)t) |
| 414 |
|
| 415 |
|
| 416 |
|
| 417 |
#ifdef CheckPMEM |
| 418 |
#define FreeFix(mem) { \ |
| 419 |
size_t s=GET_SSTVAL(mem); \ |
| 420 |
memmgr_FreePMEM(((char *)mem)-SST); \ |
| 421 |
printf("FREE PFix adr=%08x size=%ld file=%s line=%d\n",\ |
| 422 |
mem,s,__FILE__,__LINE__); } |
| 423 |
#else |
| 424 |
#define FreeFix(mem) memmgr_FreePMEM(mem) |
| 425 |
#endif |
| 426 |
|
| 427 |
#ifdef CheckMsgMEM |
| 428 |
#define FreeMsg(mem,size) { \ |
| 429 |
size_t s=GET_SSTVAL(mem); \ |
| 430 |
memmgr_FreeTMEM(((char *)mem)-SST, TMEM_MSG); \ |
| 431 |
printf("FREE TMsg adr=%08x size=%ld file=%s line=%d\n",\ |
| 432 |
mem,s,__FILE__,__LINE__); } |
| 433 |
#else |
| 434 |
#define FreeMsg(mem,size) memmgr_FreeTMEM(mem, TMEM_MSG) |
| 435 |
#endif |
| 436 |
|
| 437 |
|
| 438 |
#ifdef CheckTmpMEM |
| 439 |
#define FreeTmp(mem,size) { \ |
| 440 |
size_t s=GET_SSTVAL(mem); \ |
| 441 |
memmgr_FreeTMEM(((char *)mem)-SST,TMEM_ANY); \ |
| 442 |
printf("FREE TTmp adr=%08x size=%ld file=%s line=%d\n",\ |
| 443 |
mem,s,__FILE__,__LINE__); } |
| 444 |
#define FreeTmpReq(mem,size,r) { \ |
| 445 |
size_t s=GET_SSTVAL(mem); \ |
| 446 |
memmgr_FreeTMEM(((char *)mem)-SST,r); \ |
| 447 |
printf("FREE TTmp adr=%08x size=%ld kind=%d file=%s line=%d\n",\ |
| 448 |
mem,s,r,__FILE__,__LINE__); } |
| 449 |
#else |
| 450 |
#define FreeTmp(mem,size) memmgr_FreeTMEM(mem,TMEM_ANY) |
| 451 |
#define FreeTmpReq(mem,size,r) memmgr_FreeTMEM(mem,r) |
| 452 |
#endif |
| 453 |
|
| 454 |
|
| 455 |
#ifdef CheckCplMEM |
| 456 |
#define FreeCpl(mem) { \ |
| 457 |
size_t s=GET_SSTVAL(mem); \ |
| 458 |
memmgr_FreeAMEM(((char *)mem)-SST); \ |
| 459 |
printf("FREE ACpl adr=%08x size=%ld file=%s line=%d\n",\ |
| 460 |
mem,s,__FILE__,__LINE__); } |
| 461 |
#else |
| 462 |
#define FreeCpl(mem) memmgr_FreeAMEM(mem) |
| 463 |
#endif |
| 464 |
|
| 465 |
#ifdef CheckIFMEM |
| 466 |
#define FreeIF(mem) { \ |
| 467 |
size_t s=GET_SSTVAL(mem); \ |
| 468 |
memmgr_FreeAMEM(((char *)mem)-SST); \ |
| 469 |
printf("FREE AIF adr=%08x size=%ld file=%s line=%d\n",\ |
| 470 |
mem,s,__FILE__,__LINE__); } |
| 471 |
#else |
| 472 |
#define FreeIF(mem) memmgr_FreeAMEM(mem) |
| 473 |
#endif |
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
/****************************************************************************/ |
| 478 |
/* */ |
| 479 |
/* function declarations */ |
| 480 |
/* */ |
| 481 |
/****************************************************************************/ |
| 482 |
|
| 483 |
/* ddd.c */ |
| 484 |
int DDD_GetOption(const DDD::DDDContext& context, DDD_OPTION); |
| 485 |
|
| 486 |
|
| 487 |
/* typemgr.c */ |
| 488 |
void ddd_TypeMgrInit(DDD::DDDContext& context); |
| 489 |
void ddd_TypeMgrExit(DDD::DDDContext& context); |
| 490 |
int ddd_TypeDefined (TYPE_DESC *); |
| 491 |
|
| 492 |
|
| 493 |
/* objmgr.c */ |
| 494 |
void ddd_ObjMgrInit(DDD::DDDContext& context); |
| 495 |
void ddd_ObjMgrExit(DDD::DDDContext& context); |
| 496 |
void ddd_EnsureObjTabSize(DDD::DDDContext& context, int); |
| 497 |
|
| 498 |
|
| 499 |
/* cplmgr.c */ |
| 500 |
void ddd_CplMgrInit(DDD::DDDContext& context); |
| 501 |
void ddd_CplMgrExit(DDD::DDDContext& context); |
| 502 |
COUPLING *AddCoupling(DDD::DDDContext& context, DDD_HDR, DDD_PROC, DDD_PRIO); |
| 503 |
COUPLING *ModCoupling(DDD::DDDContext& context, DDD_HDR, DDD_PROC, DDD_PRIO); |
| 504 |
void DelCoupling(DDD::DDDContext& context, DDD_HDR, DDD_PROC); |
| 505 |
void DisposeCouplingList(DDD::DDDContext& context, COUPLING *); |
| 506 |
void DDD_InfoCoupling(const DDD::DDDContext& context, DDD_HDR); |
| 507 |
|
| 508 |
|
| 509 |
/* mgr/prio.c */ |
| 510 |
enum PrioMergeVals PriorityMerge (const TYPE_DESC*, DDD_PRIO, DDD_PRIO, DDD_PRIO *); |
| 511 |
|
| 512 |
|
| 513 |
/* if/if.c */ |
| 514 |
void ddd_IFInit(DDD::DDDContext& context); |
| 515 |
void ddd_IFExit(DDD::DDDContext& context); |
| 516 |
void IFAllFromScratch(DDD::DDDContext&); |
| 517 |
void DDD_InfoIFImpl(DDD::DDDContext& context, DDD_IF); |
| 518 |
void IFInvalidateShortcuts(DDD::DDDContext& context, DDD_TYPE); |
| 519 |
int DDD_CheckInterfaces(DDD::DDDContext& context); |
| 520 |
|
| 521 |
/* if/ifcmds.c */ |
| 522 |
void ddd_StdIFExchange (DDD::DDDContext& context, size_t, ComProcHdrPtr,ComProcHdrPtr); |
| 523 |
void ddd_StdIFExecLocal (DDD::DDDContext& context, ExecProcHdrPtr); |
| 524 |
void ddd_StdIFExchangeX (DDD::DDDContext& context, size_t, ComProcHdrXPtr,ComProcHdrXPtr); |
| 525 |
void ddd_StdIFExecLocalX (DDD::DDDContext& context, ExecProcHdrXPtr); |
| 526 |
|
| 527 |
|
| 528 |
|
| 529 |
/* xfer/xfer.c */ |
| 530 |
void ddd_XferInit(DDD::DDDContext& context); |
| 531 |
void ddd_XferExit(DDD::DDDContext& context); |
| 532 |
int ddd_XferActive(const DDD::DDDContext& context); |
| 533 |
void ddd_XferRegisterDelete(DDD::DDDContext& context, DDD_HDR); |
| 534 |
|
| 535 |
|
| 536 |
/* xfer/cmds.c */ |
| 537 |
void DDD_XferPrioChange(DDD::DDDContext& context, DDD_HDR, DDD_PRIO); |
| 538 |
|
| 539 |
|
| 540 |
/* prio/pcmds.c */ |
| 541 |
void ddd_PrioInit(DDD::DDDContext& context); |
| 542 |
void ddd_PrioExit(DDD::DDDContext& context); |
| 543 |
bool ddd_PrioActive(const DDD::DDDContext& context); |
| 544 |
|
| 545 |
|
| 546 |
/* join/join.c */ |
| 547 |
void ddd_JoinInit(DDD::DDDContext& context); |
| 548 |
void ddd_JoinExit(DDD::DDDContext& context); |
| 549 |
bool ddd_JoinActive(const DDD::DDDContext& context); |
| 550 |
|
| 551 |
|
| 552 |
/* ident/ident.c */ |
| 553 |
void ddd_IdentInit(DDD::DDDContext& context); |
| 554 |
void ddd_IdentExit(DDD::DDDContext& context); |
| 555 |
|
| 556 |
|
| 557 |
/* basic/cons.c */ |
| 558 |
void ddd_ConsInit(DDD::DDDContext& context); |
| 559 |
void ddd_ConsExit(DDD::DDDContext& context); |
| 560 |
|
| 561 |
END_UGDIM_NAMESPACE |
| 562 |
namespace DDD { |
| 563 |
/* basic/topo.c */ |
| 564 |
void ddd_TopoInit(DDD::DDDContext& context); |
| 565 |
void ddd_TopoExit(DDD::DDDContext& context); |
| 566 |
DDD_PROC* DDD_ProcArray(DDD::DDDContext& context); |
| 567 |
RETCODE DDD_GetChannels(DDD::DDDContext& context, int); |
| 568 |
void DDD_DisplayTopo(const DDD::DDDContext& context); |
| 569 |
} /* namespace DDD */ |
| 570 |
START_UGDIM_NAMESPACE |
| 571 |
|
| 572 |
|
| 573 |
/* mgr/objmgr.c */ |
| 574 |
void DDD_HdrConstructorCopy(DDD::DDDContext& context, DDD_HDR, DDD_PRIO); |
| 575 |
void ObjCopyGlobalData (TYPE_DESC *, DDD_OBJ, DDD_OBJ, size_t); |
| 576 |
std::vector<DDD_HDR> LocalObjectsList(const DDD::DDDContext& context); |
| 577 |
std::vector<DDD_HDR> LocalCoupledObjectsList(const DDD::DDDContext& context); |
| 578 |
|
| 579 |
END_UGDIM_NAMESPACE |
| 580 |
namespace DDD { |
| 581 |
/* basic/reduct.c */ |
| 582 |
int ddd_GlobalSumInt(const DDD::DDDContext& context, int); |
| 583 |
int ddd_GlobalMaxInt(const DDD::DDDContext& context, int); |
| 584 |
int ddd_GlobalMinInt(const DDD::DDDContext& context, int); |
| 585 |
} /* namespace DDD */ |
| 586 |
START_UGDIM_NAMESPACE |
| 587 |
|
| 588 |
|
| 589 |
/* ctrl/stat.c */ |
| 590 |
void ddd_StatInit (void); |
| 591 |
void ddd_StatExit (void); |
| 592 |
|
| 593 |
|
| 594 |
END_UGDIM_NAMESPACE |
| 595 |
|
| 596 |
#endif |