Skip to content
Snippets Groups Projects
  1. Oct 15, 2022
    • Jonathan Schöbel's avatar
      reimplemented SH_Text as single linked list of strings · 0a62ebe6
      Jonathan Schöbel authored
      The (intern) implementation of SH_Text was changed from an array of
      char, to a single linked list of arrays of char. This allows an easier
      implementation of (further) text manipulation.
      The API hasn't changed much, but SH_Text_join can't yield an error
      anymore, so it now doesn't support passing an error and returns nothing.
      
      The source has been adapted to splint, which still tells about some
      errors, but they are all checked to be false-positives.
      0a62ebe6
    • Jonathan Schöbel's avatar
      return char * · 51de2c6f
      Jonathan Schöbel authored
      A method was added, that returns the generated text.
      51de2c6f
    • Jonathan Schöbel's avatar
      Text: added constructor with initialization · aeca7dd7
      Jonathan Schöbel authored
      The constructor SH_Text_new_from_string accepts a string, with that the
      text is initialized. This can replace the so far needed two calls
      SH_Text_new and SH_Text_append_string.
      
      When writing the test, it was neccessary to simulate an overflow.
      Thereby a bug was detected regarding another overflow test. The bug was,
      that when SIZE_MAX % CHUNK_SIZE == 0 (which is normally true, if 2^n is
      taken as the value for CHUNK_SIZE) there can't be an overflow, so the
      test for an overflow fails. Actually there wasn't a neccesity to check
      for an overflow, as this could easily be bypassed by just allocating the
      requested size instead of the next chunk size, if this would be greater
      then SIZE_MAX.
      aeca7dd7
  2. Sep 21, 2022
  3. Sep 11, 2022
  4. Sep 08, 2022
    • Jonathan Schöbel's avatar
      added "wrap mode" for html generation · f027c56d
      Jonathan Schöbel authored
      When the wrap mode is used, after each tag a newline is started. Also the
      html is indented, which can be configured by the parameters indent_base,
      indent_base, indent_char. The parameter indent_base specifies the width
      the first tag should be indented with, while indent_step specifies the
      increment of the indent when switching to a child tag. The character,
      that is used for indenting is taken from indent_char. (It could also be
      a string longer than a single character).
      This aguments can't be set by the user, but are hardcoded (by now).
      f027c56d
    • Jonathan Schöbel's avatar
      added copy methods (Fragment) · ce4fcf29
      Jonathan Schöbel authored
      Fragment can be copied, either recursive (copying also all childs) or
      nonrecursive (ignoring the childs, thus the copy has always no childs).
      Adding the same element twice in the tree (graph) isn't possible, as
      this leads to problems e.g. double free or similars.
      ce4fcf29
  5. Sep 05, 2022
  6. Sep 04, 2022
    • Jonathan Schöbel's avatar
      child for Fragment · c57027bc
      Jonathan Schöbel authored
      A Fragment can contain childs. When building the html, the childs html
      is generated where appropiate.
      c57027bc
  7. Sep 01, 2022
    • Jonathan Schöbel's avatar
      append/join Text · 0378698a
      Jonathan Schöbel authored
      SH_Text_append_string can be used to append a string to the text,
      SH_Text_append_text can be used to append another text to the text.
      SH_Text_join is a wrapper for SH_Text_append_text, but also frees the
      second text, thus joining the texts to a single one.
      0378698a
    • Jonathan Schöbel's avatar
      to_html for Fragment · 08dc6d5f
      Jonathan Schöbel authored
      A Fragment can output it's html. If there is an error the method aborts
      and returns NULL.
      08dc6d5f
    • Jonathan Schöbel's avatar
      improve Validator test (memory leaks) · 12400d8f
      Jonathan Schöbel authored
      Changing sefht_validator_test so that no memory leaks occur.
      12400d8f
  8. Jun 23, 2022
    • Jonathan Schöbel's avatar
      enlarge Text · 537069d3
      Jonathan Schöbel authored
      The space a Text has for saving the string is allocated in chunks. To
      request additional space SH_Text_enlarge is called. If the requestad
      size fits inside the already allocated space or is even smaller than the
      current size, nothing is done. Otherwise a multiple of chunk size is
      allocated beeing equal or greater than the requested size. The chunk
      size can be changed by changing the macro CHUNK_SIZE in src/text.h. The
      default is 64.
      This adjustment is done automatically when a string is added.
      537069d3
    • Jonathan Schöbel's avatar
      mapped Log::error to printf · 252f968f
      Jonathan Schöbel authored
      It is useful for debugging to actually see the error messages.
      252f968f
  9. Jun 22, 2022
  10. Jun 21, 2022
    • Jonathan Schöbel's avatar
      added Text · a71ce13c
      Jonathan Schöbel authored
      This is a data type to deal with frequently appending to a string.
      a71ce13c
    • Jonathan Schöbel's avatar
      look for duplicate tags in Validator · 47407f2d
      Jonathan Schöbel authored
      When a tag is made known to the Validator, which it already knows, the
      old id is returned and nothing is added.
      As this has to be checked by iterating over all known tags, a new helper
      function is written for both SH_Validator_check_tag and
      SH_Validator_register_tag: SH_Validator_get_tag.
      
      Because we want also to test this function, we have to include
      validator.c in the test file and override the static keyword by an empty
      macro. It isn't possible any more to check for correct overflowdetection
      by setting the index to UINT_MAX, because it will be iterated over all
      data, thus raising an SIGSEGV when doing so. This is solved by filling
      garbage unil UINT_MAX is really reached. As there would be an timeout
      and it would fill RAM with around 40 GB of garbage, UINT_MAX is
      overriden prior to inclusion of validator.c .
      47407f2d
  11. Aug 31, 2022
  12. Jun 21, 2022
  13. Jun 20, 2022
  14. Jun 21, 2022
    • Jonathan Schöbel's avatar
      error handling added · 6a592b8d
      Jonathan Schöbel authored
      Error handling is done by passing an Error structure as inout parameter
      to functions that can fail on runtime predictable. This parameter is
      always the last one. Methods, where this is not the case, doesn't have an
      error parameter.
      When an Error is detected, also an ERROR is passed to the log. Because
      this isn't implemented yet, it is replaced by a nop.
      The macro EXIT becomes now useless. It was used earlier in case of an
      error, to terminate the program in the first place. This behaviour is not
      userfriendly, but it can't be decided on the library's side, whether
      there is an option to inform the user, something must be cleaned up or
      even that recovering is possible at all.
      Often these recognized errors are a non-working malloc or an over-/underflow.
      
      Error handling can be ignored by the caller by passing NULL to the Error
      parameter. Whether an error had occured, is also always possible to be
      determined, by examining the return value. If the error occours in a
      function returning a pointer, NULL will be returned. If it returns an value,
      a special error value of that type is returned, i.e. PAGE_ERR in
      SH_Data_register_page. If the return type would be void, a boolean is returned,
      which tells, whether the method has succeeded.
      (False means, that an error has occured.)
      
      The error may have occured in an intern method and is passed upwards (the stack).
      Internally errors are handled by an enum, but this must be considered an
      implementation detail and can be changed in later versions.
      It is in the responsibility of the caller to recover gracefully. It has
      to be assumed that the requested operation have neither worked, nor
      actually took place. Those the operation can be retried (hopefully).
      6a592b8d
  15. Jun 20, 2022
Loading