2016-10-21 12:05:29 -07:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
2017-03-12 13:34:21 -07:00
|
|
|
// Copyright © 2016-2017 Project Golan
|
2016-10-21 12:05:29 -07:00
|
|
|
//
|
2017-03-12 13:34:21 -07:00
|
|
|
// See "LICENSE.lithos3" for more information.
|
2016-10-21 12:05:29 -07:00
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Resource manifests.
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2017-03-12 13:55:50 -07:00
|
|
|
#include "Lth_libinfo.h"
|
|
|
|
|
|
|
|
#if !defined(lithos3__Lth_manifest_h) && !LITHOS3_NO_MANIFEST
|
2016-10-21 12:05:29 -07:00
|
|
|
#define lithos3__Lth_manifest_h
|
|
|
|
|
2017-03-12 13:34:21 -07:00
|
|
|
#include "Lth_types.h"
|
|
|
|
#include "Lth_hashmap.h"
|
|
|
|
|
|
|
|
#include <stdfix.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
|
2016-10-21 12:05:29 -07:00
|
|
|
#define Lth_ManifestNew(...) \
|
|
|
|
((Lth_Manifest[]){ \
|
|
|
|
__VA_ARGS__, \
|
|
|
|
Lth_Resource(NULL, 0) \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define Lth_Resource(name, val) \
|
|
|
|
_Generic((val)+0, \
|
|
|
|
int: Lth_ManifestNew_Integ, \
|
2017-03-12 13:34:21 -07:00
|
|
|
accum: Lth_ManifestNew_Fixed, \
|
2016-10-23 18:22:44 -07:00
|
|
|
char *: Lth_ManifestNew_Strng, \
|
|
|
|
char const *: Lth_ManifestNew_Strng)((name), (val))
|
2016-10-21 12:05:29 -07:00
|
|
|
|
|
|
|
|
|
|
|
// Type Definitions ----------------------------------------------------------|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Lth_ResourceType
|
|
|
|
//
|
|
|
|
typedef enum Lth_ResourceType
|
|
|
|
{
|
|
|
|
Lth_ResourceType_Integ,
|
|
|
|
Lth_ResourceType_Fixed,
|
|
|
|
Lth_ResourceType_Strng,
|
|
|
|
Lth_ResourceType_Max
|
|
|
|
} Lth_ResourceType;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Lth_Manifest
|
|
|
|
//
|
|
|
|
typedef struct Lth_Manifest
|
|
|
|
{
|
2017-03-12 13:34:21 -07:00
|
|
|
int type;
|
2016-10-21 12:05:29 -07:00
|
|
|
size_t keyhash;
|
2017-03-12 13:34:21 -07:00
|
|
|
|
2016-10-21 12:05:29 -07:00
|
|
|
union
|
|
|
|
{
|
2017-03-12 13:34:21 -07:00
|
|
|
int integ;
|
|
|
|
accum fxval;
|
|
|
|
char *strng;
|
2016-10-21 12:05:29 -07:00
|
|
|
};
|
|
|
|
} Lth_Manifest;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Lth_ResourceMap
|
|
|
|
//
|
|
|
|
typedef struct Lth_ResourceMap
|
|
|
|
{
|
|
|
|
Lth_Vector(int) vecInteg;
|
2017-03-12 13:34:21 -07:00
|
|
|
Lth_Vector(accum) vecFixed;
|
2016-10-21 12:05:29 -07:00
|
|
|
Lth_Vector(char *) vecStrng;
|
|
|
|
Lth_HashMap map;
|
|
|
|
} Lth_ResourceMap;
|
|
|
|
|
|
|
|
|
|
|
|
// Extern Functions ----------------------------------------------------------|
|
|
|
|
|
|
|
|
void Lth_ResourceMapDestroy(Lth_ResourceMap *rsrc);
|
|
|
|
|
|
|
|
Lth_ScriptCall Lth_ResourceMap *Lth_ManifestLoad_extern(char const *fname);
|
|
|
|
Lth_ScriptCall Lth_ResourceMap *Lth_ManifestLoad_static(Lth_Manifest *manifest);
|
|
|
|
|
|
|
|
Lth_Manifest Lth_ManifestNew_Integ(char const *key, int value);
|
2017-03-12 13:34:21 -07:00
|
|
|
Lth_Manifest Lth_ManifestNew_Fixed(char const *key, accum value);
|
2016-10-21 12:05:29 -07:00
|
|
|
Lth_Manifest Lth_ManifestNew_Strng(char const *key, char const *value);
|
|
|
|
|
|
|
|
#endif//lithos3__Lth_manifest_h
|