from __future__ import print_function import sys import maos if len(sys.argv)>2: srcdir=sys.argv[1]; fnout=sys.argv[2]; else: srcdir='/Users/lianqiw/work/programming/aos' fnout='../mex/maos2mex.h' simu_all=list(); headlist=['maos/parms.h','maos/types.h','lib/accphi.h','lib/cn2est.h','lib/kalman.h', 'lib/locfft.h','lib/muv.h','lib/servo.h','lib/stfun.h','lib/turbulence.h'] structs=maos.parse_structs(srcdir, headlist) simu=dict() simu_type=dict() simu=structs['SIM_T'] rdone=dict() todo=list() rdone['SIM_T']=1 for level in range(5): todo.append(list()) todo[0].append(simu) def replace_struct(struct, level): for key in struct: val0=struct[key] val=val0;
srcdir = sys.argv[1] fnout = sys.argv[2] else: srcdir = '/Users/lianqiw/work/programming/aos' fnout = '../mex/maos2mex.h' simu_all = list() headlist = [ 'maos/parms.h', 'maos/types.h', 'lib/accphi.h', 'lib/cn2est.h', 'lib/kalman.h', 'lib/locfft.h', 'lib/muv.h', 'lib/servo.h', 'lib/stfun.h', 'lib/turbulence.h', 'lib/mkdtf.h', 'math/chol.h', 'sys/scheduler.h' ] #Obtain the definition of all structs dictall = maos.parse_structs(srcdir, headlist) simu = dict() simu = dictall['sim_t'] def expand_struct(struct): for key in struct: val0 = struct[key] if type(val0) == type('') and val0[-1] == '*': val = val0[0:-1] ispointer = 1 else: val = val0 ispointer = 0
from pathlib import Path if len(sys.argv) > 2: srcdir = sys.argv[1] fnout = sys.argv[2] else: srcdir = str(Path.home()) + '/work/programming/aos' fnout = srcdir + '/mex/aolib.c' simu_all = list() headlist = [ 'maos/parms.h', 'maos/types.h', 'lib/accphi.h', 'lib/cn2est.h', 'lib/kalman.h', 'lib/locfft.h', 'lib/muv.h', 'lib/servo.h', 'lib/stfun.h', 'lib/turbulence.h', 'lib/mkdtf.h', 'lib/hyst.h' ] structs = maos.parse_structs(srcdir, headlist) funcs = maos.parse_func(srcdir, structs, ['mex/aolib.h']) fpout = open(fnout, 'w') print( '#ifdef __INTEL_COMPILER\n#undef _GNU_SOURCE\n#endif\n#include "interface.h"\n', file=fpout) def handle_type(argtype): if argtype == 'dmat*': mx2c = 'mx2d' c2mx = 'any2mx' free_c = 'dfree' elif argtype == 'cmat*':
import maos if len(sys.argv)>2: srcdir=sys.argv[1]; fnout=sys.argv[2]; else: srcdir='/Users/lianqiw/work/programming/aos' fnout='../mex/maos2mex.h' simu_all=list(); headlist=['maos/parms.h','maos/types.h','lib/accphi.h','lib/cn2est.h','lib/kalman.h', 'lib/locfft.h','lib/muv.h','lib/servo.h','lib/stfun.h','lib/turbulence.h', 'lib/mkdtf.h', 'math/chol.h','sys/scheduler.h'] #Obtain the definition of all structs dictall=maos.parse_structs(srcdir, headlist) simu=dict() simu=dictall['SIM_T'] def expand_struct(struct): for key in struct: val0=struct[key] if type(val0)==type('') and val0[-1]=='*': val=val0[0:-1] ispointer=1 else: val=val0 ispointer=0 if type(val)==type('') and dictall.get(val):