summaryrefslogtreecommitdiff
path: root/include/libms
diff options
context:
space:
mode:
authorrobojumper <robojumper@gmail.com>2025-04-24 14:56:08 +0200
committerrobojumper <robojumper@gmail.com>2025-04-24 14:56:08 +0200
commit892059c2997f7cf2da1c21244ba8db0edbbc00da (patch)
treed38c4177423f44ec17109d64feb40f9db5423013 /include/libms
parent7fa483e8509e80725a4a6599eaf8c9e2308cfc19 (diff)
Most of LibMS OK
Diffstat (limited to 'include/libms')
-rw-r--r--include/libms/commonlib.h2
-rw-r--r--include/libms/flowfile.h8
-rw-r--r--include/libms/libms.h8
-rw-r--r--include/libms/msgfile.h10
4 files changed, 19 insertions, 9 deletions
diff --git a/include/libms/commonlib.h b/include/libms/commonlib.h
index 7a0680e4..6829f278 100644
--- a/include/libms/commonlib.h
+++ b/include/libms/commonlib.h
@@ -48,6 +48,8 @@ void LMSi_AnalyzeMessageBinary(struct MsbInfo *info, const char *type);
int LMSi_SearchBlockByName(struct MsbInfo *info, const char *name);
int LMSi_GetHashTableIndexFromLabel(const char *label, int tableSize);
+#define LMS_OFS_TO_PTR(ty, ptr, offset) (ty *)((char *)(ptr) + (offset))
+
#ifdef __cplusplus
}
#endif
diff --git a/include/libms/flowfile.h b/include/libms/flowfile.h
index edd1710f..dbd5be3d 100644
--- a/include/libms/flowfile.h
+++ b/include/libms/flowfile.h
@@ -10,23 +10,23 @@ extern "C" {
struct MsbfInfo;
struct MsbFlowInfo {
- /* 0x00 */ char type;
+ /* 0x00 */ unsigned char type;
/* 0x01 */ char subType;
/* 0x04 */ int params1n2;
/* 0x08 */ short next;
/* 0x0A */ short param3;
/* 0x0C */ short param4;
- /* 0x0E */ short param5;
+ /* 0x0E */ unsigned short param5;
};
// Func names are made up
struct MsbfInfo *LMS_InitFlow(void *data);
void LMS_CloseFlow(struct MsbfInfo *info);
-int LMS_GetFlow(struct MsbfInfo *info, int index);
+int LMS_GetFlow(struct MsbfInfo *info);
int LMS_GetEntrypoint(struct MsbfInfo *info, const char *label);
struct MsbFlowInfo *LMS_GetFlowElement(struct MsbfInfo *info, int index);
-const unsigned short *LMS_GetBranchPoints(struct MsbfInfo *info, int index);
+unsigned short *LMS_GetBranchPoints(struct MsbfInfo *info, int index);
#ifdef __cplusplus
}
diff --git a/include/libms/libms.h b/include/libms/libms.h
index 86345e16..6ad2fd22 100644
--- a/include/libms/libms.h
+++ b/include/libms/libms.h
@@ -7,6 +7,14 @@
extern "C" {
#endif
+// made up
+enum LMS_Error {
+ LMS_NOT_FOUND = -1,
+ LMS_MISSING_LBL1_DATA = -2,
+ LMS_MISSING_FLW3_DATA = -4,
+ LMS_MISSING_FEN1_DATA = -10,
+};
+
void LMS_SetMemFuncs(void *(*alloc)(size_t size), void (*free)(void *ptr));
// internal
diff --git a/include/libms/msgfile.h b/include/libms/msgfile.h
index bc6f2aaa..b9433f05 100644
--- a/include/libms/msgfile.h
+++ b/include/libms/msgfile.h
@@ -17,11 +17,11 @@ struct MsbtAttrInfo {
struct MsbtInfo *LMS_InitMessage(void *data);
void LMS_CloseMessage(struct MsbtInfo *info);
-int LMS_GetTextIndexByLabel(const struct MsbtInfo *info, const char *label);
-const wchar_t *LMS_GetText(const struct MsbtInfo *info, int index);
-const wchar_t *LMS_GetTextByLabel(const struct MsbtInfo *info, const char *label);
-const char *LMS_GetLabelByTextIndex(const struct MsbtInfo *info, int index);
-struct MsbtAttrInfo *LMS_GetAttribute(const struct MsbtInfo *info, int index);
+int LMS_GetTextIndexByLabel(struct MsbtInfo *info, const char *label);
+const wchar_t *LMS_GetText(struct MsbtInfo *info, int index);
+const wchar_t *LMS_GetTextByLabel(struct MsbtInfo *info, const char *label);
+int LMS_GetLabelByTextIndex(struct MsbtInfo *info, int index, char *outLabel);
+struct MsbtAttrInfo *LMS_GetAttribute(struct MsbtInfo *info, int index);
#ifdef __cplusplus
}