[BUG] Repaired types on some parameters.
[FEAT] Implemented struct, still testing. [FEAT] Implemented var, still testing.
This commit is contained in:
16
types.cpp
16
types.cpp
@@ -32,7 +32,7 @@ const int types_get_length(const uint32_t type) {
|
||||
return types[type].size;
|
||||
}
|
||||
|
||||
const int types_add_variable(const uint32_t type, const std::string name, const int var_type, const int length) {
|
||||
const int types_add_member(const uint32_t type, const std::string name, const uint32_t var_type, const uint32_t length) {
|
||||
if (type >= types.size()) return -1; // ERROR INTERN: No deuria donar-se mai
|
||||
for (auto m : types[type].members) if (m.name == name) return -1;
|
||||
const t_variable new_var {name, var_type, length};
|
||||
@@ -41,20 +41,20 @@ const int types_add_variable(const uint32_t type, const std::string name, const
|
||||
return types[type].members.size()-1;
|
||||
}
|
||||
|
||||
const int types_variable_exists(const uint32_t type, const std::string name) {
|
||||
const int types_member_exists(const uint32_t type, const std::string name) {
|
||||
if (type >= types.size()) return -1; // ERROR INTERN: No deuria donar-se mai
|
||||
for (int i = 0; i < types[type].members.size(); i++) if (types[type].members[i].name == name) return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
const int types_get_variable_type(const uint32_t type, const uint32_t variable) {
|
||||
const int types_get_member_type(const uint32_t type, const uint32_t member) {
|
||||
if (type >= types.size()) return -1; // ERROR INTERN: No deuria donar-se mai
|
||||
if (variable >= types[type].members.size()) return -1; // ERROR INTERN: No deuria donar-se mai
|
||||
return types[type].members[variable].type;
|
||||
if (member >= types[type].members.size()) return -1; // ERROR INTERN: No deuria donar-se mai
|
||||
return types[type].members[member].type;
|
||||
}
|
||||
|
||||
const int types_get_variable_length(const uint32_t type, const uint32_t variable) {
|
||||
const int types_get_member_length(const uint32_t type, const uint32_t member) {
|
||||
if (type >= types.size()) return -1; // ERROR INTERN: No deuria donar-se mai
|
||||
if (variable >= types[type].members.size()) return -1; // ERROR INTERN: No deuria donar-se mai
|
||||
return types[type].members[variable].length;
|
||||
if (member >= types[type].members.size()) return -1; // ERROR INTERN: No deuria donar-se mai
|
||||
return types[type].members[member].length;
|
||||
}
|
||||
Reference in New Issue
Block a user