Server Help

ASSS Custom Projects - <py> optparser

D1st0rt - Wed Feb 18, 2009 12:23 pm
Post subject: <py> optparser
I've bundled a wrapper to Python's optparse library in with hgcore to simplify command parsing. Examples on the wiki page, or you can see it in action in the zombies game.
Initrd.gz - Wed Feb 18, 2009 8:23 pm
Post subject:
That will certainly be useful. Bout time this was made.
Initrd.gz - Sun Apr 26, 2009 7:12 pm
Post subject:
Doesn't seem to be working:
Code: Show/Hide

python ../scripts/pymod-process.py ../build/ hostedgame/hgcore.h hostedgame/optparser.h hs_util/ast.h hs_util/formula.h hs_util/kill.h hs_util/menu.h hs_util/parser.h hs_util/selfpos.h include/app.h include/arenaman.h include/asss.h include/balls.h include/banners.h include/billing.h include/bricks.h include/brickwriter.h include/bwlimit.h include/capman.h include/cfghelp.h include/chat.h include/chatnet.h include/clientset.h include/cmdman.h include/cmod.h include/config.h include/core.h include/db_layout.h include/defs.h include/encrypt.h include/fake.h include/fg_turf.h include/fg_wz.h include/filetrans.h include/flagcore.h include/game.h include/idle.h include/jackpot.h include/koth.h include/lagdata.h include/log_file.h include/logman.h include/mainloop.h include/mapdata.h include/mapnewsdl.h include/md5.h include/module.h include/net-client.h include/net.h include/objects.h include/obscene.h include/param.h include/pathutil.h include/periodic.h include/persist.h include/player.h include/prng.h include/protutil.h include/pwcache.h include/redirect.h include/reldb.h include/rwlock.h include/sizes.h include/statcodes.h include/stats.h include/util.h include/watchdamage.h include/win32compat.h packets/balls.h packets/banners.h packets/billing.h packets/brick.h packets/chat.h packets/clientset.h packets/flags.h packets/goarena.h packets/green.h packets/kill.h packets/koth.h packets/login.h packets/loginresp.h packets/mapfname.h packets/objects.h packets/pdata.h packets/ppk.h packets/reliable.h packets/scoreupd.h packets/shipchange.h packets/simple.h packets/speed.h packets/timesync.h packets/types.h packets/watchdamage.h turf/turf_reward.h
Traceback (most recent call last):
  File "../scripts/pymod-process.py", line 1519, in <module>
    apply(func, m.groups())
  File "../scripts/pymod-process.py", line 1276, in finish
    code.extend(generate_getset_code(tp))
  File "../scripts/pymod-process.py", line 1229, in generate_getset_code
    """ % typ.to_obj('*ptr')
AttributeError: type_void instance has no attribute 'to_obj'
make: *** [../build/py_types.inc] Error 1
bash$ make
gcc -std=gnu99 -pipe -I. -Iinclude -I../build  -Ihs_util -D_REENTRANT -D_GNU_SOURCE -fPIC -g -Wall   -I/usr/include/python2.6 -c -o ../build/pymod.o pymod/pymod.c
pymod/pymod.c: In function 'mthd_call_callback':
pymod/pymod.c:803: error: 'py_cb_caller' undeclared (first use in this function)
pymod/pymod.c:803: error: (Each undeclared identifier is reported only once
pymod/pymod.c:803: error: for each function it appears in.)
pymod/pymod.c:803: error: expected ';' before 'func'
pymod/pymod.c:815: error: 'func' undeclared (first use in this function)
pymod/pymod.c:815: error: 'py_cb_callers' undeclared (first use in this function)
pymod/pymod.c:821: warning: implicit declaration of function 'func'
pymod/pymod.c:821: warning: assignment makes pointer from integer without a cast
pymod/pymod.c: In function 'mthd_get_interface':
pymod/pymod.c:864: error: 'pyint_ints' undeclared (first use in this function)
pymod/pymod.c: In function 'mthd_reg_interface':
pymod/pymod.c:950: error: 'pyint_impl_ints' undeclared (first use in this function)
pymod/pymod.c: In function 'init_asss_module':
pymod/pymod.c:1598: warning: implicit declaration of function 'ready_generated_types'
pymod/pymod.c:1608: warning: implicit declaration of function 'add_type_objects_to_module'
pymod/pymod.c: In function 'MM_pymod':
pymod/pymod.c:1776: warning: implicit declaration of function 'init_py_callbacks'
pymod/pymod.c:1777: warning: implicit declaration of function 'init_py_interfaces'
pymod/pymod.c:1836: warning: implicit declaration of function 'deinit_py_interfaces'
pymod/pymod.c:1837: warning: implicit declaration of function 'deinit_py_callbacks'
make: *** [../build/pymod.o] Error 1

D1st0rt - Sun May 03, 2009 5:45 pm
Post subject:
oh right, your pymod_process.py needs to have this added to type_void
Code: Show/Hide
class type_void(type_gen):
   def decl(me, s):
        return 'void ' + s
   def to_obj(me, s):
      return 'PyCObject_FromVoidPtr(ptr, NULL)'
   def from_obj(me, s):
      return '*(int *)PyCObject_AsVoidPtr(%s)' % s

Initrd.gz - Fri May 08, 2009 11:24 pm
Post subject:
Now I get a ton of errors with pymod.c.

Heres the log
D1st0rt - Tue May 12, 2009 8:27 am
Post subject:
Ah yes, until the pyinclude directive makes it downstream you'll need to
Code: Show/Hide
#include "hosted/hgcore.h"
in pymod.c
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group