Skip to content
Snippets Groups Projects
  1. Sep 07, 2023
  2. Sep 06, 2023
    • Jonathan Schöbel's avatar
      Validator: removed ids for attrs · 5e304a27
      Jonathan Schöbel authored
      Originally the ids were intended to be useful for linking different
      information together internally, and for providing references
      externally. However, they weren't used internally, for this, pointers
      seamed to be more useful, as they also allow to directly access the data
      and also have a relation defined.
      Regarding reference purposes, they aren't really needed, and it is more
      convenient to directly use some strings, and they aren't more
      performant, as there still have to be internal checks and looking for an
      int isn't more performant, then looking for a pointer.
      Also, they have to be stored, so they need more memory and also some
      code, to be handled.
      5e304a27
    • Jonathan Schöbel's avatar
      Validator: fix: wrong loop condition · 808b1557
      Jonathan Schöbel authored
      The loops as they were written would overwrite the whole array with a
      single value.
      808b1557
    • Jonathan Schöbel's avatar
      Validator: implemented allowed tag-attribute combinations · 6be0d112
      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.
      6be0d112
  3. Aug 16, 2023
    • Jonathan Schöbel's avatar
      Validator: deregister attr · 706f0d94
      Jonathan Schöbel authored
      A attribute can be deregistered by calling SH_Validator_deregister_attr.
      Note that deregistering an attr, that was never registered is considered
      an error, but this may change, as technically it is not registered
      afterwards and sometimes (i.e. for a blacklist) it might be preferable
      to ensure, that a specific attr is not registered, but it is not clear
      whether there should be an error or not.
      Also the deallocating of the data used for an attr was moved to an extra
      method, as this is needed in several locations and it might be subject
      to change.
      706f0d94
  4. Jul 27, 2023
  5. Jul 26, 2023
  6. Jul 24, 2023
    • Jonathan Schöbel's avatar
      Validator: added attrs · 6c391521
      Jonathan Schöbel authored
      The Validator also contains information about supported attrs. Currently
      they can't be initialized by a spec. Also it can only be queried whether
      an attr does exist at all and not whether it is supported in combination
      with a specific tag. The tests are missing.
      6c391521
  7. Jul 08, 2023
    • Jonathan Schöbel's avatar
      Validator: add initializer · 875cd8a3
      Jonathan Schöbel authored
      There is a method to add a set of tags to a validator on initialisation.
      First this removes a user application from the burden of maintaining the
      html spec and also is more performant, as a lot of tags are to be
      inserted at once, so there aren't multiple allocation calls.
      As the validator needs the tags to be in order, the tags must be sorted
      on insertion. Of course it would be easier for the code, if the tags
      were already in order, but first there could be easily a mistake and
      second sorting the tags by an algorithm allows the tags to be specified
      in a logically grouped and those more maintainable order.
      For the sorting, insertion sort is used. Of course it has a worse
      quadratic time complexity, but in a constructor, I wouldn't introduce
      the overhead of memory managment a heap- or mergesort would introduce
      and in-place sorting is also out, because the data lies in ro-memory.
      Thus I choose an algorithm with constant space complexity. Also the
      'long' running time is not so important, as the initilization only runs
      at startup once and the tags are not likely to exceed a few hundred so
      even a quadratic time isn't that bad.
      875cd8a3
  8. Jul 07, 2023
  9. Jul 05, 2023
  10. Jul 04, 2023
    • Jonathan Schöbel's avatar
      Validator: simplified internal structure · b6e769bb
      Jonathan Schöbel authored
      While it was very clever, the complex data structure of the tag array
      introduced in 'Validator: restructured internal data (a0c9bb25)' comes
      with a lot of runtime overhead. It reduces the calls to free and
      realloc, when a lot of tags are deleted and inserted subsequently, but
      burdens each call with a loop over the linked list of free blocks.
      
      This is even more important, as validator must be fast in checking, as
      this is done everytime something is inserted into the DOM-tree, but has
      not so tight requirements for registering new tags, as this is merely
      done at startup time.
      b6e769bb
    • Jonathan Schöbel's avatar
      61190a3a
    • Jonathan Schöbel's avatar
      Validator: reenabled tests · 6ce78f4e
      Jonathan Schöbel authored
      To test static functions, static haven't to be declared as empty.
      6ce78f4e
  11. Jul 02, 2023
    • Jonathan Schöbel's avatar
      TextFragment: insert html-newline and indent on newline · 482e1dcc
      Jonathan Schöbel authored
      When a newline is encountered in the text, a <br /> is inserted and for
      wrap mode also a newline and an indent is inserted. Note that the indent
      is still missing at the front where it can't be inserted yet as SH_Text
      is still lacking basic functionality.
      482e1dcc
    • Jonathan Schöbel's avatar
      Text: added stupid replacement function · 52573589
      Jonathan Schöbel authored
      The copy_and_replace function replaces a single character with a string,
      while copying. This may be replaced by an elaborate function as
      manipulating a text normally means that manipulating is deferred until
      needed, which this function contradicts to.
      52573589
  12. Jul 01, 2023
  13. Jun 29, 2023
  14. Jun 24, 2023
  15. Jun 21, 2023
  16. Jun 20, 2023
  17. Jun 19, 2023
    • Jonathan Schöbel's avatar
      Fragment (base): added tests · 9acc29b4
      Jonathan Schöbel authored
      The html generation for both TextFragment and NodeFragment combined is
      tested. As the encoding semantics of the TextFragments are neither
      defined nor implemented, some tests are marked as XFAIL.
      9acc29b4
    • Jonathan Schöbel's avatar
      TextFragment: added text wrapper methods · 20b53be3
      Jonathan Schöbel authored
      Some basic text functionality is now directly supported via wrapper
      functions.
      
      Note that wrapper functions aren't tested in unit tests.
      20b53be3
    • Jonathan Schöbel's avatar
      TextFragment: added direct getter for text · 585b596a
      Jonathan Schöbel authored
      While this method is neccessary to manipulate the content of a
      TextFragment, the TextFragment should abstract the semantics of Text.
      While simple wrapper functions for appending are to be added, methods
      purely manipulating the text, i.e. relying on the text's contents, wont
      get wrapper functions. Thus this method is still needed until a more
      sophisticated approach is implemented.
      585b596a
    • Jonathan Schöbel's avatar
      ci: make jobs interruptible · d7c1c9fc
      Jonathan Schöbel authored
      d7c1c9fc
    • Jonathan Schöbel's avatar
      created ci rules to build and create a package on gitlab · a6528ca1
      Jonathan Schöbel authored
      There are seperate build, test and release stages. Also the resulting
      package is uploaded. To do that a special script was written to get the
      real name of the package, which autoconf inserts into the scripts on
      configure-time.
      a6528ca1
  18. Jun 10, 2023
  19. Jun 09, 2023
    • Jonathan Schöbel's avatar
      Text: set a single char · 4e6efa24
      Jonathan Schöbel authored
      The function SH_Text_set_char allows to write a single character to a
      position, that already exists in the text. Thus overwriting another
      character. If the index is out of range, a value error is set and FALSE
      is returned.
      4e6efa24
Loading