From: Toby C. <th...@us...> - 2007-12-17 18:10:50
|
Update of /cvsroot/playerstage/code/player/libplayerxdr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7260/libplayerxdr Modified Files: playerxdrgen.py Log Message: fixes to for pluggable interfaces modified python tools to allow easier pluggable interface definition change example to generate more files automatically Index: playerxdrgen.py =================================================================== RCS file: /cvsroot/playerstage/code/player/libplayerxdr/playerxdrgen.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** playerxdrgen.py 21 Sep 2007 03:31:50 -0000 1.16 --- playerxdrgen.py 18 Dec 2007 02:10:42 -0000 1.17 *************** *** 9,12 **** --- 9,13 ---- import string import sys + import os USAGE = 'USAGE: playerxdrgen.y [-distro] <interface-spec.h> [<extra_interface-spec.h>] <pack.c> <pack.h>' *************** *** 524,538 **** """ % {"headerfilename":headerfilename}) else: ! ifndefsymbol = '_' ! for i in range(0,len(string.split(infilenames[0],'.')[0])): ! ifndefsymbol += string.capitalize(infilenames[0][i]) ! ifndefsymbol += '_' ! headerfile.write('#ifndef ' + ifndefsymbol + '\n\n') headerfile.write('#include <libplayerxdr/playerxdr.h>\n\n') ! headerfile.write('#include "' + infilenames[0] + '"\n\n') headerfile.write('#ifdef __cplusplus\nextern "C" {\n#endif\n\n') sourcefile.write('#include <rpc/types.h>\n') sourcefile.write('#include <rpc/xdr.h>\n\n') ! sourcefile.write('#include "' + headerfilename + '"\n') sourcefile.write('#include <string.h>\n') sourcefile.write('#include <stdlib.h>\n\n') --- 525,538 ---- """ % {"headerfilename":headerfilename}) else: ! ifndefsymbol = '_' + infilenames[0].replace('.','_').replace('/','_').upper() + '_XDR_' ! headerfile.write('#ifndef ' + ifndefsymbol + '\n') ! headerfile.write('#define ' + ifndefsymbol + '\n\n') headerfile.write('#include <libplayerxdr/playerxdr.h>\n\n') ! headerfile.write('#include "' + os.path.split(infilenames[0])[-1] + '"\n\n') headerfile.write('#ifdef __cplusplus\nextern "C" {\n#endif\n\n') + sourcefile.write('#include <rpc/types.h>\n') sourcefile.write('#include <rpc/xdr.h>\n\n') ! sourcefile.write('#include "' + os.path.split(headerfilename)[-1] + '"\n') sourcefile.write('#include <string.h>\n') sourcefile.write('#include <stdlib.h>\n\n') |