• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nasa / trick / 30556442809

30 Jul 2026 03:23PM UTC coverage: 56.125% (-0.002%) from 56.127%
30556442809

push

github

web-flow
Add a TMM all that returns the success or failure status of a performed checkpoint restore. (#2167)

* Add a TMM all that returns the success of failure statue of a performed checkpoint restore..

* clang-format

* clang-format

* Changed the return type from int to bool :-)

* clang-format

* clang-format

3 of 11 new or added lines in 4 files covered. (27.27%)

14693 of 26179 relevant lines covered (56.13%)

461983.27 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

26.25
/trick_source/sim_services/MemoryManager/MemoryManager_C_Intf.cpp
1
#include <string>
2
#include <iostream>
3
#include "trick/memorymanager_c_intf.h"
4
#include "trick/MemoryManager.hh"
5

6
/* Global singleton pointer to the memory manager. */
7
extern Trick::MemoryManager* trick_MM;
8

9
/**
10
 @relates Trick::MemoryManager
11
 This is the C Language version of the 6 argument version of Trick::MemoryManager::declare_var.
12
 The arguments and return value are the same except that std::string args are replaced with const char * args.
13
 */
14
extern "C" void* TMM_declare_var( TRICK_TYPE type, const char*class_name, int n_stars, const char* var_name, int n_cdims, int *cdims) {
20✔
15
    if (trick_MM != NULL) {
20✔
16
        std::string sclass_name = class_name;
40✔
17
        std::string svar_name = var_name;
20✔
18
        return ( trick_MM->declare_var( type, sclass_name, n_stars, svar_name, n_cdims, cdims));
20✔
19
    } else {
20✔
20
        Trick::MemoryManager::emitError("TMM_declare_var() called before MemoryManager instantiation. Returning NULL.") ;
×
21
        return ( (void*)NULL);
×
22
    }
23
}
24

25
/**
26
 @relates Trick::MemoryManager
27
 This is the C Language version of the 2 argument version of Trick::MemoryManager::declare_var.
28
 The arguments and return value are the same.
29
 */
30
extern "C" void* TMM_declare_var_1d( const char* enh_type_spec, int e_elems) {
726✔
31
    if (trick_MM != NULL) {
726✔
32
        return ( trick_MM->declare_var( enh_type_spec, e_elems));
726✔
33
    } else {
34
        Trick::MemoryManager::emitError("TMM_declare_var_1d() called before MemoryManager instantiation. Returning NULL.\n") ;
×
35
        return ( (void*)NULL);
×
36
    }
37
}
38

39
/**
40
 @relates Trick::MemoryManager
41
 This is the C Language version of the 1 argument version of Trick::MemoryManager::declare_var.
42
 The arguments and return value are the same.
43
 */
44
extern "C" void* TMM_declare_var_s( const char* declaration) {
3,182✔
45
    if (trick_MM != NULL) {
3,182✔
46
        return ( trick_MM->declare_var( declaration));
3,182✔
47
    } else {
48
        Trick::MemoryManager::emitError("TMM_declare_var_s() called before MemoryManager instantiation. Returning NULL.\n") ;
×
49
        return ( (void*)NULL);
×
50
    }
51
}
52

53
/**
54
 @relates Trick::MemoryManager
55
 This is a C Language interface to the 2 argument version of Trick::MemoryManager::declare_var.
56
 The arguments are the same but switched in order and the return value is the same.
57
 It's here because I caved to Alex's whine about backwards compatibility.
58

59
 */
60
extern "C" void* alloc_type( int e_elems, const char* enh_type_spec) {
99✔
61
    if (trick_MM != NULL) {
99✔
62
        return ( trick_MM->declare_var( enh_type_spec, e_elems));
99✔
63
    } else {
64
        Trick::MemoryManager::emitError("alloc_type() called before MemoryManager instantiation. Returning NULL.\n") ;
×
65
        return ( (void*)NULL);
×
66
    }
67
}
68

69
/**
70
 @relates Trick::MemoryManager
71
 This is the C Language version of the 6 argument version of Trick::MemoryManager::declare_var.
72
 The arguments and return value are the same except that std::string args are replaced with const char * args.
73
 */
74
extern "C" void* TMM_declare_operatornew_var( const char * class_name, unsigned int alloc_size , unsigned int element_size ) {
×
75
    if (trick_MM != NULL) {
×
76
        return trick_MM->declare_operatornew_var( std::string(class_name), alloc_size, element_size ) ;
×
77
    } else {
78
        Trick::MemoryManager::emitError("TMM_declare_var() called before MemoryManager instantiation. Returning NULL.\n") ;
×
79
        return (void*)NULL ;
×
80
    }
81
}
82

83
extern "C" void* TMM_declare_operatornew_var_with_name( const char * class_name, unsigned int alloc_size , unsigned int element_size, const char * alloc_name ) {
×
84
    if (trick_MM != NULL) {
×
85
        return trick_MM->declare_operatornew_var( std::string(class_name), alloc_size, element_size, std::string(alloc_name) ) ;
×
86
    } else {
87
        Trick::MemoryManager::emitError("TMM_declare_var() called before MemoryManager instantiation. Returning NULL.\n") ;
×
88
        return (void*)NULL ;
×
89
    }
90
}
91

92
/**
93
 @relates Trick::MemoryManager
94
 This is the C Language version of the 7 argument version of Trick::MemoryManager::declare_ext_var.
95
 The arguments and return value are the same except that std::string args are replaced with const char * args.
96
 */
97
extern "C" void* TMM_declare_ext_var( void* addr, TRICK_TYPE type, const char*class_name, int n_stars, const char* var_name, int n_cdims, int *cdims) {
4,875✔
98
    if (trick_MM != NULL) {
4,875✔
99
        std::string sclass_name = class_name;
9,750✔
100
        std::string svar_name = var_name;
4,875✔
101
        return ( trick_MM->declare_extern_var( addr, type, sclass_name, n_stars, svar_name, n_cdims, cdims));
4,875✔
102
    } else {
4,875✔
103
        Trick::MemoryManager::emitError("TMM_declare_ext_var() called before MemoryManager instantiation. Returning NULL.\n") ;
×
104
        return ( (void*)NULL);
×
105
    }
106
}
107

108
/**
109
 @relates Trick::MemoryManager
110
 This is the C Language version of the 4 argument version of Trick::MemoryManager::declare_var.
111
 The arguments and return value are the same.
112
 */
113
extern "C" void* TMM_declare_ext_var_1d( void* addr, const char* elem_decl, int n_elems) {
×
114
    if (trick_MM != NULL) {
×
115
        return ( trick_MM->declare_extern_var( addr, elem_decl, n_elems));
×
116
    } else {
117
        Trick::MemoryManager::emitError("TMM_declare_ext_var_1d() called before MemoryManager instantiation. Returning NULL.\n") ;
×
118
        return ( (void*)NULL);
×
119
    }
120
}
121

122
/**
123
 @relates Trick::MemoryManager
124
 This is the C Language version of the 1 argument version of Trick::MemoryManager::declare_extern_var.
125
 The arguments and return value are the same.
126
 */
127
extern "C" void* TMM_declare_ext_var_s( void* addr, const char* declaration) {
×
128
    if (trick_MM != NULL) {
×
129
        return ( trick_MM->declare_extern_var(addr, declaration));
×
130
    } else {
131
        Trick::MemoryManager::emitError("TMM_declare_ext_var_s() called before MemoryManager instantiation. Returning NULL.\n") ;
×
132
        return ( (void*)NULL);
×
133
    }
134
}
135

136
/**
137
 @relates Trick::MemoryManager
138
 This is the C Language, "identify the array by address", version of Trick::MemoryManager::resize_array.
139
 Resize each of the dimensions of the array at the given address. n_cdims specifies the number
140
 of dimensions and must match those of the array being resized. cdims specifies the new sizes
141
 for each of the dimensions.
142
 */
143
void* TMM_resize_array_a(void *address, int n_cdims, int *cdims){
×
144
    if (trick_MM != NULL) {
×
145
        return ( trick_MM->resize_array(address, n_cdims, cdims));
×
146
    } else {
147
        Trick::MemoryManager::emitError("TMM_resize_array_a() called before MemoryManager instantiation. Returning NULL.\n") ;
×
148
        return ( (void*)NULL);
×
149
    }
150
}
151

152
/**
153
 @relates Trick::MemoryManager
154
 This is the C Language, "identify the array by name", version of Trick::MemoryManager::resize_array.
155
 Resize each of the dimensions of the array whose name is given. n_cdims specifies the number
156
 of dimensions and must match those of the array being resized. cdims specifies the new sizes
157
 for each of the dimensions.
158
 */
159
void* TMM_resize_array_n(const char *name, int n_cdims, int *cdims){
×
160
    if (trick_MM != NULL) {
×
161
        return ( trick_MM->resize_array(name, n_cdims, cdims));
×
162
    } else {
163
        Trick::MemoryManager::emitError("TMM_resize_array_n() called before MemoryManager instantiation. Returning NULL.\n") ;
×
164
        return ( (void*)NULL);
×
165
    }
166
}
167

168
/**
169
 @relates Trick::MemoryManager
170
 This is the C Language version of Trick::MemoryManager::resize_array(address, num).
171
 Resize the one dimensional array at the given address.
172
 */
173
void* TMM_resize_array_1d_a(void* address, int num){
39✔
174
    if (trick_MM != NULL) {
39✔
175
        return ( trick_MM->resize_array(address, num));
39✔
176
    } else {
177
        Trick::MemoryManager::emitError("TMM_resize_array_1d_a() called before MemoryManager instantiation. Returning NULL.\n") ;
×
178
        return ( (void*)NULL);
×
179
    }
180
}
181

182
/**
183
 @relates Trick::MemoryManager
184
 This is the C Language version of Trick::MemoryManager::resize_array(name, num).
185
 Resize the one dimensional array whose name is given.
186
 */
187
void* TMM_resize_array_1d_n(const char *name, int num){
×
188
    if (trick_MM != NULL) {
×
189
        return ( trick_MM->resize_array(name, num));
×
190
    } else {
191
        Trick::MemoryManager::emitError("TMM_resize_array_1d_n() called before MemoryManager instantiation. Returning NULL.\n") ;
×
192
        return ( (void*)NULL);
×
193
    }
194
}
195

196
/**
197
 @relates Trick::MemoryManager
198
 This is the C Language version of Trick::MemoryManager::mm_strdup( str).
199
 Duplicate and catalog the given character string.
200
 */
201
extern "C" char* TMM_strdup(char *str) {
356✔
202
    if (trick_MM != NULL) {
356✔
203
        return ( trick_MM->mm_strdup( str));
356✔
204
    } else {
205
        Trick::MemoryManager::emitError("TMM_strdup called before MemoryManager instantiation. Returning NULL.\n") ;
×
206
        return( (char*)NULL);
×
207
    }
208
}
209

210
/**
211
 @relates Trick::MemoryManager
212
 This is the C Language version of Trick::MemoryManager::var_exists().
213
 Test whether the given variable_name is in use.
214
 */
215
extern "C" int TMM_var_exists( const char* var_name) {
44✔
216
    if (trick_MM != NULL) {
44✔
217
        std::string svar_name = var_name;
44✔
218
        return ( trick_MM->var_exists( svar_name));
44✔
219
    } else {
44✔
220
        Trick::MemoryManager::emitError("TMM_var_exists() called before MemoryManager instantiation.\n") ;
×
221
        return (0);
×
222
    }
223
}
224

225
/**
226
 @relates Trick::MemoryManager
227
 This is the C Language version of Trick::MemoryManager::var_exists().
228
 Test whether the given address is in Trick managed memory.  C interface to Trick::MemoryManager::is_alloced( addr).
229
 */
230
extern "C" int TMM_is_alloced(char *addr) {
399✔
231
    if (trick_MM != NULL) {
399✔
232
        return ( trick_MM->is_alloced( addr));
399✔
233
    } else {
234
        Trick::MemoryManager::emitError("TMM_is_alloced() called before MemoryManager instantiation.\n") ;
×
235
        return (0);
×
236
    }
237
}
238

239
/**
240
 @relates Trick::MemoryManager
241
 This is the C Language version of Trick::MemoryManager::set_debug_level(level).
242
 Set the verbosity of MemoryManager debug messages.  C interface to Trick::MemoryManager::set_debug_level( level).
243
 */
244
extern "C" void TMM_set_debug_level(int level) {
×
245
    if (trick_MM != NULL) {
×
246
        trick_MM->set_debug_level( level);
×
247
    } else {
248
        Trick::MemoryManager::emitError("TMM_set_debug_level() called before MemoryManager instantiation.\n") ;
×
249
    }
250
}
×
251

252
/**
253
 This is the C Language version of Trick::MemoryManager::set_reduced_checkpoint( yesno).
254
 @relates Trick::MemoryManager
255
 */
256
extern "C" void TMM_reduced_checkpoint(int yesno) {
×
257
    if (trick_MM != NULL) {
×
258
        trick_MM->set_reduced_checkpoint( yesno!=0 );
×
259
    } else {
260
        Trick::MemoryManager::emitError("TMM_reduced_checkpoint() called before MemoryManager instantiation.\n") ;
×
261
    }
262
}
×
263

264
/**
265
 @relates Trick::MemoryManager
266
 This is the C Language version of Trick::MemoryManager::set_hexfloat_checkpoint( yesno).
267
 */
268
extern "C" void TMM_hexfloat_checkpoint(int yesno) {
×
269
    if (trick_MM != NULL) {
×
270
        trick_MM->set_hexfloat_checkpoint( yesno!=0 );
×
271
    } else {
272
        Trick::MemoryManager::emitError("TMM_hexfloat_checkpoint() called before MemoryManager instantiation.\n") ;
×
273
    }
274
}
×
275

276
/**
277
 @relates Trick::MemoryManager
278
 This is the C Language version of Trick::MemoryManager::set_hexfloat_decimal_comment_checkpoint( yesno).
279
 */
280
extern "C" void TMM_hexfloat_decimal_comment_checkpoint(int yesno) {
×
281
    if (trick_MM != NULL) {
×
282
        trick_MM->set_hexfloat_decimal_comment_checkpoint( yesno!=0 );
×
283
    } else {
284
        Trick::MemoryManager::emitError("TMM_hexfloat_decimal_comment_checkpoint() called before MemoryManager instantiation.\n") ;
×
285
    }
286
}
×
287

288
/**
289
 @relates Trick::MemoryManager
290
 This is the C Language version of Trick::MemoryManager::clear_var( addr).
291
 */
292
extern "C" void TMM_clear_var_a(void *addr) {
×
293
    if (trick_MM != NULL) {
×
294
        trick_MM->clear_var( addr);
×
295
    } else {
296
        Trick::MemoryManager::emitError("TMM_clear_var_a() called before MemoryManager instantiation.\n") ;
×
297
        return;
×
298
    }
299
}
300

301
/**
302
 @relates Trick::MemoryManager
303
 This is the C Language version of Trick::MemoryManager::clear_var( name).
304
 */
305
extern "C" void TMM_clear_var_n( const char* name) {
×
306
    if (trick_MM != NULL) {
×
307
        trick_MM->clear_var( name);
×
308
    } else {
309
        Trick::MemoryManager::emitError("TMM_clear_var_n() called before MemoryManager instantiation.\n") ;
×
310
        return;
×
311
    }
312
}
313

314
/**
315
 @relates Trick::MemoryManager
316
 This is the C Language version of Trick::MemoryManager::delete_var( addr).
317
 */
318
extern "C" void TMM_delete_var_a(void *addr) {
390✔
319
    if (trick_MM != NULL) {
390✔
320
        trick_MM->delete_var( addr);
390✔
321
    } else {
322
        Trick::MemoryManager::emitError("TMM_delete_var_a() called before MemoryManager instantiation.\n") ;
×
323
        return;
×
324
    }
325
}
326

327
/**
328
 @relates Trick::MemoryManager
329
 This is the C Language version of Trick::MemoryManager::delete_var( name).
330
 */
331
extern "C" void TMM_delete_var_n( const char* name) {
2,064✔
332
    if (trick_MM != NULL) {
2,064✔
333
        trick_MM->delete_var( name);
6,192✔
334
    } else {
335
        Trick::MemoryManager::emitError("TMM_delete_var_n() called before MemoryManager instantiation.\n") ;
×
336
        return;
×
337
    }
338
}
339

340
/**
341
 @relates Trick::MemoryManager
342
 This is the C Language version of Trick::MemoryManager::delete_extern_var( addr).
343
 */
344
extern "C" void TMM_delete_extern_var_a(void *addr) {
×
345
    if (trick_MM != NULL) {
×
346
        trick_MM->delete_extern_var( addr);
×
347
    } else {
348
        Trick::MemoryManager::emitError("TMM_delete_extern_var_a() called before MemoryManager instantiation.\n") ;
×
349
        return;
×
350
    }
351
}
352

353
/**
354
 @relates Trick::MemoryManager
355
 This is the C Language version of Trick::MemoryManager::delete_extern_var( name).
356
 */
357
extern "C" void TMM_delete_extern_var_n( const char* name) {
×
358
    if (trick_MM != NULL) {
×
359
        trick_MM->delete_extern_var( name);
×
360
    } else {
361
        Trick::MemoryManager::emitError("TMM_delete_extern_var_n() called before MemoryManager instantiation.\n") ;
×
362
        return;
×
363
    }
364
}
365

366
/**
367
 @relates Trick::MemoryManager
368
 This is the C Language version of Trick::MemoryManager::write_checkpoint( filename).
369
 */
370
extern "C" void TMM_write_checkpoint(const char* filename) {
×
371
    if (trick_MM != NULL) {
×
372
        return ( trick_MM->write_checkpoint( filename));
×
373
    } else {
374
        Trick::MemoryManager::emitError("TMM_write_checkpoint_fn() called before MemoryManager instantiation.\n") ;
×
375
        return;
×
376
    }
377
}
378

379
/**
380
 @relates Trick::MemoryManager
381
 This is the C Language version of Trick::MemoryManager::read_checkpoint( filename).
382
 */
383
extern "C" int TMM_read_checkpoint(const char* filename) {
×
384
    if (trick_MM != NULL) {
×
385
        return ( trick_MM->read_checkpoint( filename ));
×
386
    } else {
387
        Trick::MemoryManager::emitError("TMM_read_checkpoint() called before MemoryManager instantiation.\n") ;
×
388
        return(1);
×
389
    }
390
}
391

392
/**
393
 @relates Trick::MemoryManager
394
 This is the C Language version of Trick::MemoryManager::read_checkpoint_from_string( str).
395
 */
396
extern "C" int TMM_read_checkpoint_from_string(const char* str) {
×
397
    if (trick_MM != NULL) {
×
398
        return ( trick_MM->read_checkpoint_from_string( str ));
×
399
    } else {
400
        Trick::MemoryManager::emitError("TMM_read_checkpoint_from_string() called before MemoryManager instantiation.\n") ;
×
401
        return(1);
×
402
    }
403
}
404

405
/**
406
 @relates Trick::MemoryManager
407
 This is the C Language version of Trick::MemoryManager::init_from_checkpoint( filename).
408
 */
409
extern "C" int TMM_init_from_checkpoint(const char* filename) {
×
410
    if (trick_MM != NULL) {
×
411
        return ( trick_MM->init_from_checkpoint( filename ));
×
412
    } else {
413
        Trick::MemoryManager::emitError("TMM_init_from_checkpoint() called before MemoryManager instantiation.\n") ;
×
414
        return(1);
×
415
    }
416
}
417

NEW
418
extern "C" bool TMM_get_checkpoint_restore_state(void)
×
419
{
NEW
420
    if (trick_MM != NULL)
×
421
    {
NEW
422
        return (trick_MM->get_checkpoint_restore_state());
×
423
    }
424
    else
425
    {
NEW
426
        Trick::MemoryManager::emitError(
×
427
            "TMM_get_checkpoint_restore_state() called before MemoryManager instantiation.\n");
NEW
428
        return (false);
×
429
    }
430
}
431

432
extern "C" int TMM_set_stl_restore (int on_off) {
×
433
    if (trick_MM != NULL) {
×
434
        return ( trick_MM->set_restore_stls_default( (bool) on_off ));
×
435
    } else {
436
        Trick::MemoryManager::emitError("TMM_set_stl_restore() called before MemoryManager instantiation.\n") ;
×
437
        return(1);
×
438
    }
439
}
440

441
/**
442
 @relates Trick::MemoryManager
443
 This is the C Language version of Trick::MemoryManager::add_shared_library_symbols( filename).
444
 */
445
extern "C" int TMM_add_shared_library_symbols(const char* filename) {
×
446
    if (trick_MM != NULL) {
×
447
        return ( trick_MM->add_shared_library_symbols( filename));
×
448
    } else {
449
        Trick::MemoryManager::emitError("TMM_add_shared_library_symbols() called before MemoryManager instantiation.\n") ;
×
450
        return(1);
×
451
    }
452
}
453

454
/**
455
 @relates Trick::MemoryManager
456
 This is the C Language version of Trick::MemoryManager::add_var( type, stype, var_declare, units).
457
 */
458
extern "C" void* add_var( TRICK_TYPE type, const char* stype, VAR_DECLARE* var_declare, char* units) {
×
459
    if (trick_MM != NULL) {
×
460
        return( trick_MM->add_var(type, stype, var_declare, units ));
×
461
    } else {
462
        Trick::MemoryManager::emitError("add_var() called before MemoryManager instantiation. Returning NULL.\n") ;
×
463
        return ((void*)NULL);
×
464
    }
465
}
466

467
/**
468
 @relates Trick::MemoryManager
469
 This is the C Language version of Trick::MemoryManager::add_vars( type, stype, var_list, units).
470
 */
471
extern "C" int add_vars( TRICK_TYPE type, const char* stype, VAR_LIST* var_list, char* units) {
×
472
    if (trick_MM != NULL) {
×
473
        return( trick_MM->add_vars(type, stype, var_list, units ));
×
474
    } else {
475
        Trick::MemoryManager::emitError("add_vars() called before MemoryManager instantiation.\n") ;
×
476
        return (1);
×
477
    }
478
}
479

480
/**
481
 @relates Trick::MemoryManager::ref_allocate
482
 This is the C Language version of Trick::MemoryManager::ref_allocate( R, num).
483
 */
484
extern "C" int ref_allocate(REF2 *R, int num) {
×
485
    if (trick_MM != NULL) {
×
486
        return( trick_MM->ref_allocate( R, num));
×
487
    } else {
488
        Trick::MemoryManager::emitError("ref_allocate() called before MemoryManager instantiation.\n") ;
×
489
        return (1);
×
490
    }
491
}
492

493
/**
494
 @relates Trick::MemoryManager
495
 This is the C Language version of Trick::MemoryManager::ref_attributes( name).
496
 */
497
extern "C" REF2* ref_attributes(const char* name) {
13,087✔
498
    if (trick_MM != NULL) {
13,087✔
499
        return( trick_MM->ref_attributes( name));
13,087✔
500
    } else {
501
        Trick::MemoryManager::emitError("ref_attributes() called before MemoryManager instantiation. Returning NULL.\n") ;
×
502
        return ( (REF2*)NULL);
×
503
    }
504
}
505

506
/**
507
 @relates Trick::MemoryManager
508
 This is the C Language version of Trick::MemoryManager::ref_assignment( REF2*, V_TREE*).
509
 */
510
extern "C" int ref_assignment(REF2* R, V_TREE* V) {
5✔
511
    if (trick_MM != NULL) {
5✔
512
        return( trick_MM->ref_assignment( R, V));
5✔
513
    } else {
514
        Trick::MemoryManager::emitError("ref_assignment() called before MemoryManager instantiation.\n") ;
×
515
        return (1);
×
516
    }
517
}
518

519
/**
520
 @relates Trick::MemoryManager
521
 This is the C Language version of Trick::MemoryManager::ref_var( REF2*, name).
522
 */
523
extern "C" int ref_var(REF2 *R, char* name) {
×
524
    if (trick_MM != NULL) {
×
525
        return( trick_MM->ref_var( R, name));
×
526
    } else {
527
        Trick::MemoryManager::emitError("ref_var() called before MemoryManager instantiation.\n") ;
×
528
        return (1);
×
529
    }
530
}
531

532
/**
533
 @relates Trick::MemoryManager
534
 This is the C Language version of Trick::MemoryManager::ref_var( REF2*, name).
535
 */
536
extern "C" int get_size(void *addr) {
1,727✔
537
    if (trick_MM != NULL) {
1,727✔
538
        return( trick_MM->get_size( addr));
1,727✔
539
    } else {
540
        Trick::MemoryManager::emitError("get_size() called before MemoryManager instantiation.\n") ;
×
541
        return (0);
×
542
    }
543
}
544

545
/**
546
 @relates Trick::MemoryManager
547
 This is the C Language version of Trick::MemoryManager::get_truncated_size( addr).
548
 */
549
extern "C" int get_truncated_size(void *addr) {
611✔
550
    if (trick_MM != NULL) {
611✔
551
        return( trick_MM->get_truncated_size( addr));
611✔
552
    } else {
553
        Trick::MemoryManager::emitError("get_truncated_size() called before MemoryManager instantiation.\n") ;
×
554
        return (0);
×
555
    }
556
}
557

558
/**
559
 @relates Trick::MemoryManager
560
 This is the C Language version of Trick::MemoryManager::get_truncated_size( ptr).
561
 */
562
extern "C" int io_get_fixed_truncated_size(char *ptr __attribute__ ((unused)),
×
563
                                           ATTRIBUTES * A __attribute__ ((unused)),
564
                                           char *str __attribute__ ((unused)),
565
                                           int dims __attribute__ ((unused)),
566
                                           ATTRIBUTES * left_type __attribute__ ((unused))) {
567
    Trick::MemoryManager::emitError("io_get_fixed_truncated_size() is not implemented yet.\n") ;
×
568
    return(0);
×
569
}
570

571
/**
572
 @relates Trick::MemoryManager
573
 This is the C Language version of Trick::MemoryManager::get_alloc_info_of( addr).
574
 */
575
extern "C" ALLOC_INFO* get_alloc_info_of(void * addr) {
169✔
576
    if (trick_MM != NULL) {
169✔
577
        return( trick_MM->get_alloc_info_of( addr));
169✔
578
    } else {
579
        Trick::MemoryManager::emitError("get_alloc_info_of() called before MemoryManager instantiation.\n") ;
×
580
        return ( (ALLOC_INFO*)NULL);
×
581
    }
582
}
583

584
/**
585
 @relates Trick::MemoryManager
586
 This is the C Language version of Trick::MemoryManager::get_alloc_info_at( addr).
587
 */
588
extern "C" ALLOC_INFO* get_alloc_info_at(void * addr) {
4,105✔
589
    if (trick_MM != NULL) {
4,105✔
590
        return( trick_MM->get_alloc_info_at( addr));
4,105✔
591
    } else {
592
        Trick::MemoryManager::emitError("get_alloc_info_at() called before MemoryManager instantiation.\n") ;
×
593
        return ( (ALLOC_INFO*)NULL);
×
594
    }
595
}
596

597
extern "C" int set_alloc_name_at(void * addr, const char * name ) {
×
598
    if (trick_MM != NULL) {
×
599
        return( trick_MM->set_name_at(addr, name));
×
600
    } else {
601
        Trick::MemoryManager::emitError("get_alloc_info_at() called before MemoryManager instantiation.\n") ;
×
602
        return ( -1 );
×
603
    }
604
}
605

606
/**
607
 @relates Trick::MemoryManager
608
 This is the C Language version of Trick::MemoryManager::get_enumerated(const char* name, V_DATA* v_data).
609
 */
610
extern "C" int get_enumerated(const char* name, V_DATA* v_data) {
×
611
    if (trick_MM != NULL) {
×
612
        return( trick_MM->get_enumerated(name, v_data ));
×
613
    } else {
614
        Trick::MemoryManager::emitError("get_enumerated() called before MemoryManager instantiation.\n") ;
×
615
        return 1 ;
×
616
    }
617
}
618

619
extern "C" void TMM_add_checkpoint_alloc_dependency(const char * name) {
2,820✔
620
    if (trick_MM != NULL) {
2,820✔
621
        trick_MM->add_checkpoint_alloc_dependency(name) ;
2,820✔
622
    }
623
    return ;
2,820✔
624
}
625

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc