Reject overlong host type and field names
Some checks failed
akbasic CI Build / cmake_build (push) Successful in 3m26s
akbasic CI Build / sanitizers (push) Successful in 4m54s
akbasic CI Build / coverage (push) Successful in 4m0s
akbasic CI Build / akgl_build (push) Has been cancelled
akbasic CI Build / mutation_test (push) Has been cancelled

Co-authored-by: Andrew Kesterson <andrew@starfort.tech>
This commit is contained in:
2026-08-05 18:37:55 -04:00
committed by Starfort Source Vault
parent ed6f463897
commit 7c3e4e3081
3 changed files with 74 additions and 12 deletions

View File

@@ -105,6 +105,8 @@ typedef struct
* Registering before the script is loaded is the normal case. A host type and a
* `TYPE` the script declares share one namespace, so a script cannot declare a
* type the host already registered -- and would be refused if it tried.
* Host type and field names are limited to 31 characters, matching
* script-declared types and fields.
*
* @param obj Object to initialize, inspect, or modify.
* @param type The host's description of its own struct.
@@ -112,6 +114,7 @@ typedef struct
* @throws AKERR_NULLPOINTER When either argument is NULL.
* @throws AKBASIC_ERR_VALUE When a field name carries no type suffix, a nested
* type is not registered, or the name is already taken.
* @throws AKERR_OUTOFBOUNDS When a type or field name exceeds 31 characters.
* @throws AKBASIC_ERR_BOUNDS When the type table or a field list is full.
*/
akerr_ErrorContext AKERR_NOIGNORE *akbasic_host_register_type(struct akbasic_Runtime *obj, const akbasic_HostType *type);