File: medfile_module.i

package info (click to toggle)
med-fichier 4.0.0+repack-7
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 55,660 kB
  • sloc: cpp: 679,525; ansic: 72,977; python: 37,983; fortran: 12,925; sh: 6,821; f90: 5,531; makefile: 5,136; tcl: 216; xml: 173
file content (84 lines) | stat: -rw-r--r-- 2,790 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# -*- coding:utf-8 -*-
%module (package="med") medfile

//A inclure avant toute déclaration à SWIG
%include "med_881.i"
%SwigPyIteratorDef(medfile)

%include "med_common.i"
%ignore MEDmemFileOpen;

%{
#include "medfile.h"
%}

%apply int *OUTPUT { med_int *const major, med_int* const minor, med_int* const release };
//Pour éviter le mapping sur le freearg de la macro med_array_typemaps (med_common.i)
%typemap(freearg) (med_int * const ) {}

// Définir les tableaux de chaînes agrégées avant les définitions d'un typemap char *
// Définition des typemaps char * :
%med_char_typemaps(medmesh,\           ,MED_NAME_SIZE)
%med_char_typemaps(medmesh,comment ,MED_COMMENT_SIZE)

// SWIG SPECIFIQUE A MEDfileName : 
// Seule fonction n'utilisant pas une chaïne fixe.
// Réflechir à une solution plus générique sur la base du couple char * const filename, med_int filenamesize
%typemap(in,noblock=1,numinputs=1)  (med_idt fid, char * const filename, med_int filenamesize) ( med_idt arg=0 ,long val=0, int ecode = 0 ) {
  ecode = SWIG_AsVal_long($input, &val);
  if (!SWIG_IsOK(ecode)) {
    SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "MEDfileName" "', argument " "1"" of type '" "med_idt""'");
  } 
  $1 = static_cast< med_idt >(val);
  $3 = MEDfileName($1,NULL,0);
  $2 = (char *) malloc(sizeof(char)*$3);
}
%typemap(freearg,noblock=1)  (med_idt fid, char * const filename, med_int filenamesize) {
  free($2);
}
%typemap(out,noblock=1)  (med_idt fid, char * const filename, med_int filenamesize) {
}
%typemap(argout,noblock=1)  (med_idt fid, char * const filename, med_int filenamesize) {
  $result = SWIG_FromCharPtrAndSize($2,$3);
}
%typemap(out,noblock=1) med_int MEDfileName {}
  
%feature("autodoc", "MEDfileName(fid) -> str") MEDfileName;
// FIN SPECIFIQUE MEDfileName


/* %cstring_bounded_output(char* const version,MED_NAME_SIZE); */
/* %cstring_bounded_output(char* const comment,MED_COMMENT_SIZE); */
/* //%cstring_bounded_output(char* const filename,MED_PATHNAME_SIZE); */
/* %cstring_bounded_mutable(const char * const comment,MED_COMMENT_SIZE); */

//TODO : MED_MAX_CHFID_PATH
//%cstring_bounded_mutable(const char * const chpath  ,MED_PATHNAME_SIZE);

%include "medfile_exception.i"

%include "medfile.h"

// Fin Du Mapping.

// Liste des arguments apparaissant dans medfile.h
//char* const comment
//char* const version
//char* const filename
//const char * const chpath
//const char* const comment
//const char* const filename
//const char* const objectname,
//const med_access_mode accessmode
//const med_class medclass
//const med_idt chfid
//const med_idt fid
//const med_idt mid
//med_bool* const hdfok
//med_bool* const medok
//med_bool* const objectexist 
//med_idt fid
//med_int* const major
//med_int* const minor
//med_int* const release
//