2002-08-16 20:15:10 +00:00
|
|
|
#ifndef __ruamoko_cbuf_h
|
|
|
|
#define __ruamoko_cbuf_h
|
|
|
|
|
[qfcc] Add a handle type for engine resources
I never liked the various hacks I had come up with for representing
resource handles in Ruamoko. Structs with an int were awkward to test,
pointers and ints could be modified, etc etc. The new @handle keyword (@
used to keep handle free for use) works just like struct, union and
enum in syntax, but creates an opaque type suitable for a 32-bit handle.
The backing type is a function so v6 progs can use it without (all the
necessary opcodes exist) and no modifications were needed for
type-checking in binary expressions, but only assignment and comparisons
are supported, and (of course) nil. Tested using cbuf_t and QFile: seems
to work as desired.
I had considered 64-bit handles, but really, if more than 4G resource
objects are needed, I'm not sure QF can handle the game. However, that
limit is per resource manager, not total.
2023-05-25 01:41:28 +00:00
|
|
|
typedef @handle cbuf_h cbuf_t;
|
2023-05-24 11:58:33 +00:00
|
|
|
|
[qfcc] Add a handle type for engine resources
I never liked the various hacks I had come up with for representing
resource handles in Ruamoko. Structs with an int were awkward to test,
pointers and ints could be modified, etc etc. The new @handle keyword (@
used to keep handle free for use) works just like struct, union and
enum in syntax, but creates an opaque type suitable for a 32-bit handle.
The backing type is a function so v6 progs can use it without (all the
necessary opcodes exist) and no modifications were needed for
type-checking in binary expressions, but only assignment and comparisons
are supported, and (of course) nil. Tested using cbuf_t and QFile: seems
to work as desired.
I had considered 64-bit handles, but really, if more than 4G resource
objects are needed, I'm not sure QF can handle the game. However, that
limit is per resource manager, not total.
2023-05-25 01:41:28 +00:00
|
|
|
@extern void Cbuf_AddText (cbuf_t cbuf, string text);
|
|
|
|
@extern void Cbuf_InsertText (cbuf_t cbuf, string text);
|
|
|
|
@extern void Cbuf_Execute (cbuf_t cbuf);
|
|
|
|
@extern void Cbuf_Execute_Sets (cbuf_t cbuf);
|
2002-08-16 20:15:10 +00:00
|
|
|
|
|
|
|
#endif//__ruamoko_cbuf_h
|