1
0
forked from 0ad/0ad

Linux compatibility in test converter. Fixed O(n^2) bottleneck.

This was SVN commit r4684.
This commit is contained in:
Ykkrosh 2006-12-06 17:42:07 +00:00
parent da266ebcb8
commit 1480c57446

View File

@ -13,7 +13,12 @@ if not os.path.exists(input_filename):
print "Cannot find input file '%s'" % input_filename
sys.exit(-1)
library = cdll.LoadLibrary('Collada.dll')
dll_filename = {
'posix': './libCollada_dbg.so',
'nt': 'Collada.dll',
}[os.name]
library = cdll.LoadLibrary(dll_filename)
def log(severity, message):
print '[%s] %s' % (('INFO', 'WARNING', 'ERROR')[severity], message)
@ -23,14 +28,14 @@ clog = CFUNCTYPE(None, c_int, c_char_p)(log)
library.set_logger(clog)
def convert_dae_to_pmd(filename):
output = ['']
output = []
def cb(str, len):
output[0] += string_at(str, len)
output.append(string_at(str, len))
cbtype = CFUNCTYPE(None, POINTER(c_char), c_uint)
status = library.convert_dae_to_pmd(filename, cbtype(cb))
assert(status == 0)
return output[0]
return ''.join(output)
input = open(input_filename).read()
output = convert_dae_to_pmd(input)