- Sep 30, 2023
-
-
Jonathan Schöbel authored
Global attributes are represented by empty attributes. A global attribute is an attribute, that is accepted for any tag. It is refused to remove a specific tag for a global attribute, as this would mean to "localize" the tag, thus making it not global anymore. The method to do that and a predicate for globalness is missing yet.
-
- Sep 29, 2023
-
-
Jonathan Schöbel authored
-
Jonathan Schöbel authored
Some bug was found: realloc may return NULL, if size is 0. This should not be considered as if realloc has failed.
-
- Sep 07, 2023
-
-
Jonathan Schöbel authored
For a rationale, see commit 'Validator: removed ids for attrs'
-
- Sep 06, 2023
-
-
Jonathan Schöbel authored
The loops as they were written would overwrite the whole array with a single value.
-
Jonathan Schöbel authored
The Validator can check if a attribute is allowed in a tag. It does so by associating allowed tags with attributes. This is done in that way, to support also attributes which are allowed for every tag (global attributes), but this is not yet supported. So some functions allow for NULL to be passed and some will still crash. The predicate SH_Validator_check_attr returns whether an attribute is allowed for a specific tag. If tag is NULL, it returns whether an attr is allowed at all, not whether it is allowed for every tag. For this another predicate will be provided, when this is to be implemented. The method SH_Validator_register_attr registers an tag-attr combination. Note, that it will automatically call SH_Validator_register_tag, if the tag doesn't exist. Later it will be possible, to set tag to NULL to register a global attribute, but for now the method will crash. The method SH_Validator_deregister_attr removes a tag-attr combination registered earlier. Note, that deregistering a non existent combination will result in an error. This behaviour is arguable and might be subject to change. When setting only tag to NULL, all tags for this attribute are deregistered. When setting only attr to NULL, all attrs for this tag are deregistered. This might suffer from problems, if this involves some attrs, that are global. Also this will use the internal method remove_tag_for_all_attrs, which has the problem, that it might fail partially. Normally when failing all functions revert the program to the same state, as it was before the call. This function however is different, as if it fails there might be some combinations, that haven't been removed, but others are already. Nevertheless, the validator is still in a valid state, so it is possible to call this function a second time, but it is not sure, which combinations are already deregistered. As the attrs also use the internal strings of the tags, it must be ensured, when a tag is deregistered, that all remaining references are removed, otherwise there would be dangling pointers. Note, that for this also remove_tag_for_all_attrs is used, so the method SH_Validator_deregister_tag suffers from the same problems listed above. Also if this internal method fails, the tag won't be removed at all. Furthermore, the tests for deregistering a tag are still missing.
-
- Nov 16, 2022
-
-
Jonathan Schöbel authored
The Validator saves the tags as an array. Now also another information is added, which slots aren't used currently to spare expensive calls to realloc. This led to a mere reimplementation of the functions. Tags can't be deleted by now, but the adding function supports reusing empty slots. Also the reading functions have to determine, whether a slot can be read or is empty. The tests were adjusted, but are buggy, so they should be rewritten in the future. Additionaly some annotations for splint were added.
-
- Nov 15, 2022
-
-
Jonathan Schöbel authored
Instead of the trivial structure SH_Error, SH_Status is used. The name was chosen, because error/status is set independently whether an error has occurred. Beside the error type, it also contains the associated errno and an error message. The error message is also printed, when it is set. Generating error messages with variadic arguments is now also supported. There are also macros to check for a set status. The exception handling was removed for the *_free methods, because they can't fail predictably during runtime. Unfortunately the compiler reports, that inside the macro set_status printf may be called with NULL [printf (NULL)], although, this is explicitly debarred.
-
- Jun 21, 2022
-
-
Jonathan Schöbel authored
On initialization (of data), the Validator's knowledge is filled with some common tags. This is of course to be replaced later, by some dynamic handling.
-
- Jun 20, 2022
-
-
Jonathan Schöbel authored
-