Skip to content

Commit

Permalink
Fixed 0AB1 input argument count verification for string arrays. (#50)
Browse files Browse the repository at this point in the history
* Fixed 0AB1 input argument count verification for string arrays.�Enabled using string array argument as module name in 0AB1.

* Added function comments.

* Updated parameter type checks.
  • Loading branch information
MiranDMC authored Nov 19, 2023
1 parent 7558faf commit 5035fda
Show file tree
Hide file tree
Showing 2 changed files with 270 additions and 375 deletions.
118 changes: 86 additions & 32 deletions cleo_sdk/CLEO.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,42 +97,96 @@ static const char* ToStr(eDataType type)
default: return "corrupted";
}
}
static bool IsImmInteger(eDataType type) // immediate/literal integer in code like 42
{
switch (type)
{
case DT_BYTE:
case DT_WORD:
case DT_DWORD:
return true;
}
return false;
}
static bool IsImmFloat(eDataType type) // immediate/literal float in code like 42.0
{
return type == DT_FLOAT;
}
static bool IsImmString(eDataType type) // immediate/literal string in code like "text"
{
switch (type)
{
case DT_STRING:
case DT_TEXTLABEL:
case DT_VARLEN_STRING:
return true;
}
return false;
}
static bool IsVarString(eDataType type) // string variable
{
switch (type)
{
case DT_LVAR_TEXTLABEL:
case DT_LVAR_TEXTLABEL_ARRAY:
case DT_LVAR_STRING:
case DT_LVAR_STRING_ARRAY:
case DT_VAR_TEXTLABEL:
case DT_VAR_TEXTLABEL_ARRAY:
case DT_VAR_STRING:
case DT_VAR_STRING_ARRAY:
return true;
}
return false;
}
static bool IsVariable(eDataType type) // can carry int, float, pointer to text
{
switch (type)
{
case DT_VAR:
case DT_VAR_ARRAY:
case DT_LVAR:
case DT_LVAR_ARRAY:
return true;
}
return false;
}
static const char* ToKindStr(eDataType type)
{
switch (type)
{
case DT_BYTE:
case DT_WORD:
case DT_DWORD:
return "int"; break;

case DT_FLOAT:
return "float"; break;

case DT_STRING:
case DT_TEXTLABEL:
case DT_LVAR_TEXTLABEL:
case DT_LVAR_TEXTLABEL_ARRAY:
case DT_LVAR_STRING:
case DT_LVAR_STRING_ARRAY:
case DT_VAR_TEXTLABEL:
case DT_VAR_TEXTLABEL_ARRAY:
case DT_VAR_STRING:
case DT_VAR_STRING_ARRAY:
case DT_VARLEN_STRING:
return "string"; break;

case DT_VAR:
case DT_VAR_ARRAY:
case DT_LVAR:
case DT_LVAR_ARRAY:
return "variable"; break;

case DT_END:
return "varArgEnd"; break;

default:
return "corrupted"; break;
case DT_BYTE:
case DT_WORD:
case DT_DWORD:
return "int"; break;

case DT_FLOAT:
return "float"; break;

case DT_STRING:
case DT_TEXTLABEL:
case DT_LVAR_TEXTLABEL:
case DT_LVAR_TEXTLABEL_ARRAY:
case DT_LVAR_STRING:
case DT_LVAR_STRING_ARRAY:
case DT_VAR_TEXTLABEL:
case DT_VAR_TEXTLABEL_ARRAY:
case DT_VAR_STRING:
case DT_VAR_STRING_ARRAY:
case DT_VARLEN_STRING:
return "string"; break;

case DT_VAR:
case DT_VAR_ARRAY:
case DT_LVAR:
case DT_LVAR_ARRAY:
return "variable"; break;

case DT_END:
return "varArgEnd"; break;

default:
return "corrupted"; break;
}
}

Expand Down
Loading

0 comments on commit 5035fda

Please sign in to comment.