2016-10-17 08:57:44 -07:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
2017-03-12 13:34:21 -07:00
|
|
|
// Copyright © 2016-2017 Project Golan
|
2016-10-17 08:57:44 -07:00
|
|
|
//
|
2017-03-12 13:34:21 -07:00
|
|
|
// See "LICENSE.lithos3" for more information.
|
2016-10-17 08:57:44 -07:00
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
2017-03-12 13:34:21 -07:00
|
|
|
// Basic types and convenience macros.
|
2016-10-17 08:57:44 -07:00
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#ifndef lithos3__Lth_types_h
|
|
|
|
#define lithos3__Lth_types_h
|
|
|
|
|
2016-10-20 16:55:35 -07:00
|
|
|
#define Lth_ScriptCall [[__call("ScriptS")]]
|
2016-10-23 18:24:40 -07:00
|
|
|
#define Lth_OptArgs(n) [[__optional_args(n)]]
|
2016-10-20 16:55:35 -07:00
|
|
|
|
2016-10-17 08:57:44 -07:00
|
|
|
#define Lth_Inherits(name) [[__anonymous]] name _super
|
2017-03-12 13:34:21 -07:00
|
|
|
#define Lth_Mixin(name) [[__anonymous]] name _##name
|
2016-10-17 08:57:44 -07:00
|
|
|
|
2016-10-21 11:45:07 -07:00
|
|
|
#define Lth_Vector(type) struct { type *data; size_t size, bufsz; }
|
|
|
|
#define Lth_VectorForEach(type, vec) \
|
|
|
|
for(type itr = (vec).data; itr != (vec).data + (vec).size; itr++)
|
2016-11-20 22:02:56 -08:00
|
|
|
#define Lth_VectorAlloc(type, vec) \
|
|
|
|
(vec).data = calloc((vec).size, sizeof(type))
|
2016-10-21 11:45:07 -07:00
|
|
|
|
|
|
|
#define Lth_Pair(typef, types) struct { typef first; types second; }
|
2016-10-19 07:00:41 -07:00
|
|
|
|
2016-10-23 18:20:09 -07:00
|
|
|
#define Lth_WithMbState() \
|
|
|
|
__with(mbstate_t state; memset(&state, 0, sizeof(state));)
|
|
|
|
|
2016-11-20 22:02:56 -08:00
|
|
|
#define Lth_pfor(cond, expr) while((cond) && ((expr), true))
|
|
|
|
|
2016-10-17 08:57:44 -07:00
|
|
|
|
2016-10-18 14:20:32 -07:00
|
|
|
// Type Definitions ----------------------------------------------------------|
|
2016-10-17 08:57:44 -07:00
|
|
|
|
|
|
|
typedef int Lth_HID;
|
2016-10-23 18:20:09 -07:00
|
|
|
typedef char __str_ars const Lth__strchar;
|
2016-10-17 08:57:44 -07:00
|
|
|
|
2016-10-18 02:49:47 -07:00
|
|
|
//
|
|
|
|
// Lth_Rect
|
|
|
|
//
|
|
|
|
typedef struct Lth_Rect
|
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
int w, h;
|
|
|
|
} Lth_Rect;
|
|
|
|
|
2016-10-18 16:39:30 -07:00
|
|
|
//
|
|
|
|
// Lth_IVec2
|
|
|
|
//
|
|
|
|
typedef struct Lth_IVec2
|
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
} Lth_IVec2;
|
|
|
|
|
2016-10-18 02:49:47 -07:00
|
|
|
//
|
|
|
|
// Lth_HIDRange
|
|
|
|
//
|
|
|
|
// read-only
|
|
|
|
// base: beginning of HID range (must be more than end)
|
|
|
|
// end: end of HID range (must be less than base)
|
|
|
|
//
|
|
|
|
// read-write
|
|
|
|
// cur: current HID
|
|
|
|
//
|
|
|
|
typedef struct Lth_HIDRange
|
|
|
|
{
|
|
|
|
Lth_HID base;
|
|
|
|
Lth_HID end;
|
|
|
|
Lth_HID cur;
|
|
|
|
} Lth_HIDRange;
|
|
|
|
|
2016-10-17 08:57:44 -07:00
|
|
|
#endif//lithos3__Lth_types_h
|