Kevin Day [Sun, 6 Dec 2020 04:48:43 +0000 (22:48 -0600)]
Progress: controller program.
Change "timeout" property to the more generic "number".
This can then be used for types "timeout" and "item", whereas the "item" number represents the location within the items list.
This is not known until all entry items are loaded and is therefore updated during the pre-process phase.
This implements the pre-process phase after the load phase.
The pre-process will perform additional checks, such as determining if "ready" is set somewhere in the active chain.
This makes sure recursion to an item already on the stack is not allowed.
Do some cleanups, reducing the if/then nesting by adding "do nothing" comment and letting the "else" condition handle the case appropriately.
Internally, line counting starts at 0, but when dealing with presenting the lines to users, the lines start at 1.
Change the behavior to increase the line number appropriately for entries.
The same will likely need to be done for rules.
Kevin Day [Fri, 4 Dec 2020 05:08:59 +0000 (23:08 -0600)]
Cleanup: _F_types_h should be _F_type_h and some macros have misplaces the "s".
The f_type project is singular, so do not use an "s" in the name.
Some of the macros in the type_array.h file were not converted from having the "s" after the _t to more accurately matching the type name.
For example uint8s_t should have macros using uint8s_t instead of uint8_ts.
Kevin Day [Thu, 3 Dec 2020 02:55:54 +0000 (20:55 -0600)]
Cleanup: move "macro_" prefix to after program name.
With the macro_ being defined after f_, fl_, and fll_, it makes more sense to follow the same logic with programs.
For example, macro_iki_read_X() is now iki_read_macro_X().
This more accurately associates the macro with the program via styling practices.
Kevin Day [Thu, 3 Dec 2020 01:01:29 +0000 (19:01 -0600)]
Update: memory changes, memory bugfixes, and minor controller program fixes.
Do some minor cleanup with the allocation functions.
The *_delete_simple() and *_destroy_simple() macros need to always set size to 0, because they are always ignoring the return status.
Also move the relating check outside of the for loop for performance reasons.
Minor cleanups in memory functions.
Add additional parameter checks to the memory create functions.
Add additional size and length checks in the memory delete and destroy functions.
Fix bug in f_macro_memory_structure_macro_increment() where if condition is obviously wrong (two '>' checks are used against each other!).
Change behavior to increment against "used" instead of "size", more consistently.
Rewrite the *_increase() and *_increase_by() functions due to bugs and inconsistencies.
Only use variables when needed for performance and resource reasons.
Get rid of the F_array_too_large on success behavior as the current design doesn't handle the cases where both F_array_too_large and an error occurs afterwards.
Fix mistake in controller program where I forgot to actually set the allocated sizes.
Use counter instead of pointer for entry item in controller program.
In some cases, use fl_string_dynamic_terminate_after() instead of fl_string_dynamic_terminate() (there will likely be more of these changes).
Kevin Day [Tue, 1 Dec 2020 03:48:15 +0000 (21:48 -0600)]
Update: provide file mode macros in f_file.
I would rather provide static constant strings, but the Posix file string functions that use this expect a non-constant string.
This is unsafe, so just stick with macros.
Kevin Day [Tue, 1 Dec 2020 02:21:57 +0000 (20:21 -0600)]
Update: status code changes, adding "_not" in more places.
I am not a fan of having so many "_not".
I believe I even made efforts to reduce its usage in the past.
Having said that, there ended up being too many different cases where "_not" makes sense.
I want things to be consistent, so this commit introduces "_not" more thoroughly unless it makes sense not to.
There are also cases where I have prefixes, such as "un" in unknown.
Change this to be consistent with the "_not" logic.
This results in changes like F_unknown -> F_known_not.
Other minor cleanups exist, such as F_interrupted -> F_interrupt.
I expect down the road there will be changes where these "_not" are used in functions where the "_not" is not used.
(Example: it may be that a function returns F_number (with error bit set) on invalid number, but it may be better to now use F_number_not.)
Kevin Day [Mon, 30 Nov 2020 03:38:36 +0000 (21:38 -0600)]
Bugfix: provide static variable "fll_error_string_null_s".
When using the fl_color_print functions, the context before and after pointers may safely be NULL.
When using the printf functions, the context before and after pointers cannot safely be NULL.
In the second case, a global static is now provided that is essentially a NULL string of a compatible type.
Kevin Day [Sun, 29 Nov 2020 06:58:58 +0000 (00:58 -0600)]
Bugfix: featureless make is not copying settings directory.
The contents of the directory are being copied instead of the directory itself.
Change the behavior to instead copy the entire directory and not just its contents.
Also move the directory check into its own line instead of inline inside of an if condition.
The signal check is moved with it.
Kevin Day [Mon, 23 Nov 2020 03:56:11 +0000 (21:56 -0600)]
Progress: controller program.
Wrap up some of the existing rules code.
Begin writing the entry code.
This seems like a good time to start using and referencing my unit of time called "Time".
Use MegaTime (aka: milliseconds) to handle the time, which will be stored in a 64bit unsigned integer as units of Time.
Kevin Day [Mon, 23 Nov 2020 03:54:32 +0000 (21:54 -0600)]
Cleanup: fix comment in featureless make program.
Add a @fixme for UTF-8 because I noticed that I was not using UTF-8 character support.
If environment variables should only be ASCII, update the documentation to better reflect this.
Kevin Day [Thu, 19 Nov 2020 04:30:45 +0000 (22:30 -0600)]
Progress: controller program.
Wrap up the current implementation of the rule read functions.
Utilize a (private) cache, reducing the parameters and reducing the amount of allocations.
How I am using the cache changed as I went and I need to come back and review it again before completing this program.
Kevin Day [Sun, 15 Nov 2020 23:36:55 +0000 (17:36 -0600)]
Bugfix: Embedded List is not properly handling delimits on write.
This is hard to observe because of how bash handles newlines.
For example:
echo "$(echo -e " To {\n World\n \\\\\\\\\\\\\\{\n")"
Would produce a string where the slashes after world actually represent a total of 4 slashes.
The problem with bash is that it "guesses" the number of slashes.
Another concern is that there are two quotes, so a slash has to be escaped twice for such a string in bash.
As a more complex example, see:
# echo "$(echo -e "\\\\\\\\\\\\\\")" | byte_dump -tcw 5
Once past the confusing behavior of backslash escaping in Bash, one can then observe that this project is incorrectly escaping backslashes.
In the case of Embedded List close character (the close brace '}') only the first backslash needs to be escaped.
In the case of Embedded List open character (the open brace '{') every even backslash must be escaped (and there should only be a single unescaped odd backslash).
The problem is that the code is treating the close brace as an open brace, resulting in too many backslashes.
There is also an ends of EOL boolean that appears to be being incorrectly set.
The EOL is detected at range->start position, but the position is being reset to the saved "start" position.
Kevin Day [Sun, 15 Nov 2020 22:16:17 +0000 (16:16 -0600)]
Update: FSS Extended List should be non-recursive.
Update specification to make this more clear.
The Extended List read functions are updated to handle this.
The Extended List read program is essentially copied from the Basic List read program and then updated accordingly.
The Extended List write functions and programs need to not escape the opening brace inside a content.
Kevin Day [Sat, 14 Nov 2020 05:33:15 +0000 (23:33 -0600)]
Update: create FSS Embedded List and other minor fixes.
The FSS-0008 Embedded List is just copied from FSS-0003 Extended List.
Fix some minor problems observed during this transition.
I will need to follow up with rewriting the FSS-0003 Extended List code.
I will probably just use FSS-0002 Basic List as a fresh starting point given that list is not recursive.
Kevin Day [Sat, 14 Nov 2020 05:03:51 +0000 (23:03 -0600)]
Progress: controller.
Begin prototyping and writing the controller code.
While working on this I suddenly realized that I accidentally treated FSS-0003 (Extended List) as FSS-0008 (Embedded List)!
This needs to be fixed so I am saving the progress as-is with all the note and other mess and will correct the FSS-0003 accident.
Kevin Day [Tue, 10 Nov 2020 02:21:04 +0000 (20:21 -0600)]
Progress: init.
Begin preparations for implementing this.
After review, I suspect this will be more complex than the control and controller programs.
To that end, I am switching focus to those two programs.
Kevin Day [Thu, 5 Nov 2020 03:12:05 +0000 (21:12 -0600)]
Feature: Stub out the Control program.
This is a part of the traditional "init" process, such as those done in sysvinit or initng.
Unlike those, this only communicates with the "Controller" program to give the "Controller" program commands.
For the booting part of the process, see the "Init" program.
This is also intended to be control from service "Controller" program.
Kevin Day [Thu, 5 Nov 2020 03:10:06 +0000 (21:10 -0600)]
Feature: Stub out the Controller program.
This is a part of the traditional "init" process, such as those done in sysvinit or initng.
Unlike those, this only performs tasks and manages services.
For the booting part of the process, see the "Init" program.
This is also intended to be controlled from user space via the "Control" program.
Kevin Day [Thu, 5 Nov 2020 02:22:19 +0000 (20:22 -0600)]
Update: Re-create Init program with barebones source structure.
The Init program will instead be developed as an init-only program.
The goal will be to not implement any service management.
This means that another progrram will be written for that purpose (which will be called something like "control" and/or "controller").
Kevin Day [Thu, 5 Nov 2020 02:05:07 +0000 (20:05 -0600)]
Bugfix: color print is bleeding into GCC messages.
When GCC has an error or warning, the print messages end up discolored.
This seems to be an artifact of how streams work and the newline.
Move all final newlines out of the color context printing and print the newlines in a separate command.
This appears to avoid the mentioned problem.
Kevin Day [Wed, 4 Nov 2020 06:32:04 +0000 (00:32 -0600)]
Bugfix: Fake building monolithic FLL is not compiling due to header directory structure problems.
The header directory structure is being preserved by the bootstrap.sh but not by Fake.
Introduce a new setting, 'path_headers_preserve' as a yes/no boolean.
This designates that the path for headers should be preserved or not.
In the case of the monolithic build, path_headers_preserve must be 'yes'.
Provide a new function fl_directory_create() to make it easy to create an entire directory tree.
Fake is now aware of this new 'path_headers_preserve', setting.
When supplied, it will make sure to preserve the directory tree, such as 'level_0/' in the monolithic build header file 'level_0/color.h'.
Both Fake and the bootstrap script should now behave the same in this respect.
The changes in this commit have been quickly thrown together.
This will need additional reviewing.
The NULL terminating character is not appended after each new header name.
This resulted in garbled header names due to existing content in the buffer.
Kevin Day [Wed, 4 Nov 2020 02:17:28 +0000 (20:17 -0600)]
Cleanup: default to monolithic build.
For simplicity purposes, I am just building and releasing the monolothic build of FLL.
It makes more sense to me then to change the default to use this monolithic build.
Kevin Day [Tue, 3 Nov 2020 05:40:16 +0000 (23:40 -0600)]
Bugfix: contents_delimits is supposed to be optional.
I probably accidentally "fixed" this thinking the parameter was not being checked by accident.
In reality, the parameter shouldn't be checked if the pointer is NULL because it is supposed to be optional.
This resulted in the fake program from not working as of release 0.5.1.
Kevin Day [Sat, 31 Oct 2020 02:32:19 +0000 (21:32 -0500)]
Bugfix: dependency generation is incorrect.
The recent rewrite of the dependencies resulted in the higher level files being after the lower level files.
Normally this is not a problem, but when it comes to compiling static programs depending on this, the linking fails.
This becomes more confusing in that, in my case the GNU Linker, says that functions do not exist when you can see that they, in fact, do exist.
By changing the order, with the higher levels before the lower levels, static compilation works without any such issues.
Kevin Day [Sat, 31 Oct 2020 01:01:49 +0000 (20:01 -0500)]
Update: FSS Extended List should now support multiple depth parameters.
Recursively parses the parameters determining what data should or should not be processed.
For example, take the following file "example.fss":
a {
a.0 {
a.0.0 {
a's final content.
}
}
}
b {
b.0 {
b's first final content.
}
b.1 {
b's second final content.
}
}
TO only display "b's first final content.", the following is done:
fss_extended_list_read example.fss -n 'b ' -d 1 -a 0
Which works by at depth 0, looks for the list name 'b ', then at depth 1, looks at position 0.
The --at and --name parameters are using the wrong variable in their logic (using 'j' when it should be 'i').
This resulted in an incorrect parsing of the parameters.
Kevin Day [Wed, 28 Oct 2020 23:16:50 +0000 (18:16 -0500)]
Update: redesign Extended List Read --at, --depth, and --name parameter handling.
Make the program aware of the order in which these are applied.
Such that, for example:
--at 0 --name 'my_list' would first select list index 0 and then try to match the list name against 'my_list'.
Whereas, for example:
--name 'my_list' --at 0 would try to match the list name against 'my_list', and then from that matching result set, select index 0.
This supports the ability to also do the following:
--depth 0 --at 0 --depth 1 --at 2
Such that this will traverse, at depth 0, the list at index 0 then within that result, at depth 1, get the list at index 2.
This however, while supported, is not currently implemented with this commit.
A commit will follow to ideally focus exclusively on this behavior.
These changes in design also conveniently resulted in smaller (and hopefully simpler) code.
Kevin Day [Wed, 28 Oct 2020 23:14:18 +0000 (18:14 -0500)]
Bugfix: trinned string compare functions incorrectly match different strings.
This is happening due to an accidental treatment of the 'last' positions as exclusive stops instead of as inclusive stops.
When they are setup, they are set as the last valid character before whitespace at the end.
Change the logic to make last1 and last2 inclusive stop positions.
Kevin Day [Mon, 26 Oct 2020 00:18:41 +0000 (19:18 -0500)]
Update: Better handle comments in FSS and fix problems.
Comments may exist inside of an FSS Basic List and FSS Extended List.
Handle the comments.
The FSS Basic List Read and FSS Extended List read both need to print the ignore character around content in pipe mode.
The FSS Extended List needs to specifically not do this for individual nested objects.
Fix problems in the FSS Basic List read content handling when an object is found such that content is empty.
Clean up some of the code, doing some basic code simplification.
The FSS Basic List Read should always return a range and should not exclusively end always at an EOL.
Fix a case where not enough memory is allocated for delimits in FSS Basic List.
Kevin Day [Sun, 25 Oct 2020 00:26:53 +0000 (19:26 -0500)]
Update: todo.txt.
I noticed that I haven't looked at this in a while.
These changes are just at glance, this todo needs to be cleaned out and refreshed more.
But that is for another time.
Kevin Day [Sat, 24 Oct 2020 16:55:14 +0000 (11:55 -0500)]
Feature: add suppot for specifying delimits via -D/--delimit to FSS read programs.
The -D/--delimit parameter accepts multiple types of values:
- "all": apply all delimits.
- "none": do not apply delimits.
- 1: apply limits at depth 1 (this can be any supported whole number and not just 1).
- 1-: apply limits at depth 1 or lesser (this can be any supported whole number and not just 1).
- 1+: apply limits at depth 1 or greater (this can be any supported whole number and not just 1).
The appropriate FSS functions need to be updated to not auto-apply delimits.
Instead, these now pass the delimits array back to the caller.
The FSS Extended List Read program delimits support is currently incomplete.
- A considerable amount of changes are needed to adequately support this.
- A follow up commit will address this issue.
Kevin Day [Sat, 24 Oct 2020 13:36:54 +0000 (08:36 -0500)]
Feature: provide string "except" functions.
The FSS Read functions utilize matching and printing on potentially delimited data.
If the delimits are not applied, then the matches and prints will be incorrect.
To avoid this, it seems that I need some way to not print the delimited data.
Provide "except" functions that accept and "except" array of strings representing locations within some string that are to be ignored.
The printing functions and comparison functions now have "except" equivalents.
The level_1 fl_print project appears outdated and needed updating anyway.
Restructure this project to use the private function practice, hopefully reducing the code size (and ideally binary size).
The "_string" part can be removed from the fl_print function names.
The parameter checks are loosened and now more closely match the approaches used in level_0 f_print.
Kevin Day [Fri, 23 Oct 2020 03:05:17 +0000 (22:05 -0500)]
Update: level_0 print functions.
Relax the parameter checks and have them return F_data_not when length is 0 or string is unavailable.
- Based on existing documentation, it seems this behavior was intended at some point anyway.
- The range is capped to buffer.used now.
The f_print_to* functions are rewritten to print as much of the string in as few calls to write() as possible.
- It is likely possible to utilize more complicated logic to further reduce the calls to write() but this is good enough for now.
- Reducing the calls to write(), in theory, should improve performance.
Add checks to f_print_to* functions to do nothing if the id is -1 (aka: an invalid/closed file descriptor).
Add *_except* print functions to print all characters except those specified in the "except" variable as well as not printing NULLs.
Kevin Day [Fri, 23 Oct 2020 01:28:41 +0000 (20:28 -0500)]
Bugfix: consistently use the data.output file for standard output printing.
There are still places that need to be converted from f_type_output and printf() to use this data.output file.
With this change, the data.output will be used and can more readily be updated to point to some file other than standard output.
The fss_*_read programs are not updated with this commit due to having additional changes.
These changes will also be applied to those programs in another commit.
It seems that I forgot to check the other programs and update them to work with the new delimit handling behavior in the appropriate FSS processing functions.
Kevin Day [Tue, 20 Oct 2020 04:55:53 +0000 (23:55 -0500)]
Update: FSS should allow caller to determine when to apply delimits.
Instead of automatically applying the delimits, pass the delimits to the caller.
Let the caller decide when or when not to apply the delimits.
Provide functions to help in this regard.
The FSS read programs will need a new parameter to allow for designating to or not to apply delimits.
This is particularly complex when it comes to FSS-0003 (Extended List) due to the nesting.
This change gave me the opportunity to review the FSS read functions, to a certain extent.
Code cleanup changes are included in this commit.
Also add status codes: F_rrange, F_range_not, and F_utf_not.
Kevin Day [Fri, 16 Oct 2020 01:58:13 +0000 (20:58 -0500)]
Update: provide f_string_lengthss_t and f_string_quantityss_t.
Ensure that array of an array typedefs exist for:
- f_string_length_t
- f_string_quantity_t
The following already exist:
- f_string_range_t
There are some additional structures that this should also have an array of an array for:
- f_string_static_t
- f_string_dynamic_t
- f_string_map_t
- f_string_map_multi_t
But they are more complicated so I will get to them later.
Kevin Day [Thu, 15 Oct 2020 04:29:21 +0000 (23:29 -0500)]
Bugfix: trimming in FSS extended write does not always work.
A boolean is used to designate when the Object has no space at the end.
If this boolean is FALSE, then a space is added before the '{'.
The problem is that the addition of this space happens after trimming.
If trimming is performed, just lie and set the boolean to TRUE to prevent the addition of an (unwanted) space.
Kevin Day [Thu, 15 Oct 2020 02:44:20 +0000 (21:44 -0500)]
Progress: FSS read and write programs.
Use \b (backspace character) instead of \0 (NULL character).
- The bash programs and functions like "echo" automatically strip NULL characters.
- This defeats the purpose of providing these functions for manipulating FSS files using these programs.
Add an ignore range list.
- The pipes represent the start and stop of an ignore range using the \v (vertical tab character).
- Only the FSS-0003 (Extended List) utilize the ignore range.
- This ignore range list provides a simple way to manage nested lists without having to write complex recursive parsers.
- For consistency, all FSS write programs utilize the -I/--ignore parameter, but for the standards that do not support ignore range lists then that parameter is essentially ignored.
- The ignore lists only applies to Content.
Fix bug in the fll_error where the wrong variable is being used (should be printing a newline).
Kevin Day [Wed, 14 Oct 2020 03:53:47 +0000 (22:53 -0500)]
Progress: FSS basic list and extended list.
Move some common and repeated code into private functions.
Be sure to allow and handle whitespace after a valid object close that is being delimited within content.
Begin adding support for nested in the extended list content write.
- The idea here is to have a whitelist of ranges to ignore.
- This offloads the possible complex logic to a higher level.
The basic and extended list level 2 write functions should both accept a single content instead of an array of content.
Rename the fss write functions, appending _string.
- These functions accept a string instead of an appropriate object/content structure.
- I will need to write the functions that accept the appropriate object/content structures to perform the same tasks.
Make the prepend a constant pointer to make it easier to not specify it (no variable needs to be defined, just pass 0).
Kevin Day [Tue, 13 Oct 2020 22:55:04 +0000 (17:55 -0500)]
Feature: add support for trimming FSS Object names for FSS write operations.
I believe it is important for the command line tools to easily cleanup object names in case spaces aren't desired.
This provides the functionality to ensure trimming of spaces before and after the object name.
This further allows for preventing the cleanup behavior done in object writes, such as in FSS-0003 (Extended List) where it is cleaner to have a space between the object name and the brace '{'.
If this is undesired, the function can then be configured to not do this.
This further makes the FSS write functions more consistent with the FSS read functions where object name trimming is already supported.
Kevin Day [Tue, 13 Oct 2020 01:07:50 +0000 (20:07 -0500)]
Progress: FSS write programs.
Add prepend functionality to all write programs.
- for FSS-0000 (Basic) and FSS-0001 (Extended), this does nothing.
- for FSS-0002 (Basic List) and FSS-0003 (Extended List), this prepends the start of multi-line content with some whitespace.
Begin working on the FSS-0003 (Extended List) write functions and programs.
- At this time, the extended list write is only implemented partially.
- I will focus on the recursive aspects later.
Add the "complete" processing to the basic list content (and now extended list content) write functions.
- Includes updates to the newline handling as appropriate.
Kevin Day [Mon, 12 Oct 2020 03:46:06 +0000 (22:46 -0500)]
Update: basic list fixes and cleanups, including some other cleanups.
The EOL handling in FSS Basic List is incorrect/incomplete.
Slashes at the end of an Object must be delimited to avoid escaping the object close character.
Be sure to return an error when a newline is provided in an Object name on basic list object write.
The standard states that controlling character, such as a basic list open, must use ASCII character codes for simplicity and safety.
Therefore, a UTF-8 buffer increment is not necessary.
Use the simpler, more performant C math operator increment.
Cleanup coding strategy in basic list content write to be more consistent with more recent approaches.
Cleanup some comments.
Also cleanup incorrect loop comment in fss_basic.c.
Kevin Day [Fri, 9 Oct 2020 02:59:36 +0000 (21:59 -0500)]
Progress: basic list write, with minor basic list read and extended list read changes.
The basic list object write should only handle escaping slashes when it would be escaped.
Make sure to return an error when a newline is found.
Note that the stop point designates the end of the object so if the end of the object ends in slashes, then these must be escaped.
Perform some cleanups that I felt like doing while working on this.
Kevin Day [Fri, 9 Oct 2020 00:28:11 +0000 (19:28 -0500)]
Cleanup: fix help parameter spacing and add additional information.
The basic list standard does not support quotes.
Leave the quote parameters for consistency between the write programs, but add a note to the help explaining this.
Kevin Day [Thu, 8 Oct 2020 05:05:58 +0000 (00:05 -0500)]
Bugfix: FSS basic list read newline handling needs improvement.
The last newline is not being preserved in the content read.
The *_print_set_* functions end up printing an extra newline.
This behavior is inconsistent and invalid.
Instead, preserve the newlines, which are valid parts of the content.
Then, do not print newlines via *_print_set_*.
The empty list needs to have at least one newline when -e/--empty is passed.
Kevin Day [Wed, 7 Oct 2020 04:11:16 +0000 (23:11 -0500)]
Progress: continue working on FSS read/write programs and related.
Get comment delimitation working in FSS read/write functions.
- Comments are now escaped on read/write as appropriate.
- Rename appropriate private fl_fss functions.
- Add object_as boolean to designate whether or not this function is meant to read an object or content.
- This ends up fixing a bug in the fl_fss_extended read function where a comment character before a content is incorrectly treated as an actual comment (this behavior is not allowed).
- Add similar behavior to the write functions.
- The basic list and especially the extended list may not be complete in this regard.
Do some cleanup in the fss read programs that is related to the changes in this commit.
- There is still room for cleanups but that is not my focus at this time.
Add a -p/--pipe parameter to the FSS read functions to provide a way of returning data in the pipe-friendly format used by the FSS write programs.