]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commit
Implement experimental hook-like system, with working example.
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 28 May 2020 13:53:30 +0000 (13:53 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 28 May 2020 13:53:30 +0000 (13:53 +0000)
commit2faff26f69150bd8b672cb96556c4028a292cdd5
tree394400786ebd2d781b0b3ead52fd0b82dc935e4f
parent164b42b3df6fdf87fc37926f23cddb933642d2b6
Implement experimental hook-like system, with working example.

This system allows you to call functions that may or may not exist at runtime
and compile-time. You create hook_t pointers and register them during
initialization, and point them to a function. If they're not registered,
no problem. This could potentially allow different subsystems to function
independently of each other, such as the client and server.

It's using a union to allow functions to have any return type they want.
However, for obvious reasons, functions cannot have any parameters they want
and must accept a pointer to the union type where the actual args are stored.

This is experimental and there may be bugs, but the current working example
should be stable.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12603 d7cf8633-e32d-0410-b094-e92efae38249
cmd.c
csprogs.c
csprogs.h
hook.c [new file with mode: 0644]
hook.h [new file with mode: 0644]
host.c
makefile.inc
qtypes.h
quakedef.h