Kevin Day [Mon, 12 Dec 2022 00:40:30 +0000 (18:40 -0600)]
Feature: Add 'import' Object to fakefile and settings specifications.
This is important for building complex project structures and reducing the code redundancy.
To keep the logic and design simple, recursion is not allowed.
One can now create a base settings file that is imported by other settings files.
The same is true for fakefile files.
Kevin Day [Sun, 11 Dec 2022 03:58:49 +0000 (21:58 -0600)]
Feature: Add support for printing partial data with or without closing data in fss_write.
The "complete" "partial" FSS write enumaration settings still prints the end of Object or Content data.
This "partial" simply does not print the end of line characters.
Change the behavior to act like the newly added feature regarting "complete" "trim".
Provide parameters to toggle on printing of the closing data.
Kevin Day [Sun, 11 Dec 2022 00:00:03 +0000 (18:00 -0600)]
Update: Redesign project structure to follow the "main" design used in fss_write.
This makes the program structure more consistent.
The structure being followed easily allows for a more object-oriented directory structure and design.
This design is more accurately closer to "progam-oriented" than "object-oriented" due to the structure revolving around a program.
The design of the code itself in fss_write is object-oriented like.
Use this code design for fss_status_code and status_code.
The other programs do not need to do this and have everything under the "main".
Kevin Day [Sat, 10 Dec 2022 22:36:27 +0000 (16:36 -0600)]
Update: Centralize the error print function names.
This reduces repeated strings in the code.
A helper macro is used so that the individual code never needs to be changed if there are any changes to the array and the enumeration.
Kevin Day [Sat, 10 Dec 2022 17:28:35 +0000 (11:28 -0600)]
Update: Finish updating fss_write.
Remove the unused files.
Simplify the processing callbacks using ternary operators.
Resolve the void_setting to the specific setting for easier to read code at the cost of allocation more memory (1 memory address variable per function).
Implement the ignore functionality.
Make sure the multiple Content is supported where appropriate.
The flags must not be reset at the start of the setting load so that main.c programs can pre-fill the flags.
Add all of the supported write program setting files.
Other miscellaneous changes and fixes.
The pipe data is lacking and will need future reviews and probably will need fixes.
The original fss_*_write pipe data is also lacking so I feel that it is fine to leave it alone for now to be addressed later on.
Kevin Day [Sat, 10 Dec 2022 16:28:24 +0000 (10:28 -0600)]
Security: Invalid write in FSS functions and ensure a reset used length on error.
The command that triggers this is "fss_basic_write -oc hi there".
An invalid write is happening due to not always performing the array size increase operations.
Update all FSS write functions with more thorough checks.
This problem is being obfuscated by the lossy allocation.
When errors happen the destination->used needs to be consistently reset to the original value on return.
Use the lossy allocation as well for allocation shwere the increase by is a raw digit.
In these specific cases use state.step_small rather than state.step_large.
Rename used_start to destination_used for improved consistency.
Kevin Day [Fri, 9 Dec 2022 03:51:03 +0000 (21:51 -0600)]
Bugfix: Some of the level checking defines have an "s" that should not be there.
Fix incorrect _di_level_0_parameters_checking_, replacing it with _di_level_0_parameter_checking_.
Fix incorrect _di_level_2_parameters_checking_, replacing it with _di_level_2_parameter_checking_.
Kevin Day [Thu, 8 Dec 2022 06:09:56 +0000 (00:09 -0600)]
Update: More consistently follow the recent clarifications of the style guide for defines.
I discovered that the "_s" type of notation to be incredibly helpful while working on the stand alone projects.
I also noticed some inconsistency in the naming structure to some extent.
I updated and clarified the style guide and then updated the defines where needed.
This turned out to be more work than expect and has been rushed a little.
Look out for mistakes.
Kevin Day [Tue, 6 Dec 2022 03:59:24 +0000 (21:59 -0600)]
Update: Add support for backtick quoting for IKI.
Comply with the recent addition to the IKI specification that designates backticks as a quote alternative to single and double quotes.
Fix several inconsistencies observed, such as "quoted" vs "quote".
The code is inconsistently using a type code and a literal character for passing the desired quote.
This is probably a long lost incomplete refactor.
Change all of the FSS code to accept the character as a uint8_t.
Get rid of the f_fss_quote_t and related, replacing them with uint8_t.
Get rid of the f_fss_delimit_* macros.
These are redundant and it is simpler just to use the f_fss_* variants.
Rename F_fss_delimit_placeholder_s to F_string_placeholder_s (and similar).
The flags for single and double quotes are not needed when the charaacter is being explicitly set.
Perform a trivial cleanup/optimization where inverse of bytes is being checked for.
This is pointless when there is an else block.
Reverse the order and remove the "not" operator.
Kevin Day [Mon, 5 Dec 2022 01:02:32 +0000 (19:02 -0600)]
Progress: Continue program related work, updating fss_write.
Rename F_supported to F_supported and F_supported_not to F_support_not to avoid past tense.
Add a static empty range to make initialization assignment even easier.
For fss_write:
- Add most of the ignore range handling.
- Add support for the multiple Content per Object and handle errors for standards that do not support this.
- Lost of clean up and simplifications.
- Add a lot of fixme and todo comments for things not yet completed.
There is still a lot to do with fss_write.
The common write functionality is mostly done.
The standard specific functionality is not written for anything except FSS Payload.
Kevin Day [Fri, 2 Dec 2022 04:29:36 +0000 (22:29 -0600)]
Progress: Continue program related work, updating fss_write.
Fix minor spacing problem where the color context should be closed near non-whitespace whenever possible.
Add missing word "error" in some comments.
Continue working in fss_write.
This gets the fss_payload_write program compiling.
The installer by default doesn't handle all of the programs.
Where before './install.sh -w /tmp/fll/' used to work now the following are all needed:
- ./install.sh -w /tmp/fll/
- ./install.sh -w /tmp/fll/ -s data/build/settings.main
- ./install.sh -w /tmp/fll/ -s data/build/settings.payload
Kevin Day [Tue, 29 Nov 2022 03:38:03 +0000 (21:38 -0600)]
Progress: Continue program related work, updating fss_write.
The work continues, focusing on preparing fss_write for handling all currently written fss_*_write programs.
This should also pave the way for supporting other fss-???? standards than are currently directly represented.
The individual write programs will be linked to the same library fss_write is.
These individual write programs will act as if they were passed the "--as XXXX".
For example, fss_basic_list would operate the same as "fss_write -a fss-0002".
Some of the programs may have vastly different functionality than others.
In any case that code can be shared that code will be shared.
Kevin Day [Fri, 25 Nov 2022 01:11:29 +0000 (19:11 -0600)]
Update: Fix and improve FSS unit test regarding zero-width.
Recent changes to the Unicode functions regarding zero-width improved or changed how what is designated as a zero-width character.
The test is failing due to this change.
Update the test to treat the tested character as zero-width.
Add an additional test condition to test the stop range.
Kevin Day [Wed, 23 Nov 2022 03:16:20 +0000 (21:16 -0600)]
Progress: Stub out the fss_write program.
The fss_write program is going to replace all of the other fss_X_write programs.
This is the initial setup and may not be the final structure.
I still have some fiddlign to do to figure out how I want them to share code.
The final result is intended to have the fss_write being capable of compiling all of the fss_X_write programs as well as the fss_write program.
Kevin Day [Wed, 23 Nov 2022 02:03:31 +0000 (20:03 -0600)]
Regression: Improper execution when no arguments and no pipe are passed to fake.
At some point in time the default for executing without a "clean", "make", or "build" stopped working.
This probably happened when I fixed the empty pipe bug.
Kevin Day [Wed, 23 Nov 2022 01:43:16 +0000 (19:43 -0600)]
Security: Invalid access when calling fake without 'make' or 'build'.
This is caused by the F_data_not return result not being processed in some of the fl_fss functions.
Additional changes:
- Make the return status constant.
- The status is being returned regardless in some cases so remove the effectively redundant lines of code.
- Combined the additional if condition blocks together.
Kevin Day [Tue, 22 Nov 2022 03:14:44 +0000 (21:14 -0600)]
Update: All projects should have fakefiles.
This is an oversight and neither a bug nor a feature.
The FLL is designed to be built using the build settings.
The flagship program fake, should still be directly supported and fakefiles should be available.
Most of these fakefiles just trigger the build settings.
Kevin Day [Thu, 17 Nov 2022 03:23:27 +0000 (21:23 -0600)]
Update: Finish program related work for fss_payload_write.
This appears to be done now.
The next step for fss_payload_write is to use it as the starting point for the fss_write program that is intended to provide all of the fss_*_write programs.
I will likely make improvements to the lazy approach I took regarding loading the entire file when processing.
I found two bugs regarding the pipe processing.
1) The first character never gets printed for payload Content.
2) An end-of-content character must be printed after the Content if printing partial Objects or if the "payload" Content is not yet printed.
Kevin Day [Fri, 11 Nov 2022 04:57:04 +0000 (22:57 -0600)]
Cleanup: Improve organization in f_utf, using addtional files.
Create more files to better organize structures and their accompanying functions.
Structures like f_utf_string_dynamic_t, f_utf_string_dynamics_t, and f_utf_string_dynamicss_t now each have their own files.
Kevin Day [Fri, 11 Nov 2022 03:25:05 +0000 (21:25 -0600)]
Cleanup: Improve organization in f_string, using addtional files.
Create more files to better organize structures and their accompanying functions.
Structures like f_string_dynamic_t, f_string_dynamics_t, and f_string_dynamicss_t now each have their own files.
Kevin Day [Tue, 8 Nov 2022 04:05:54 +0000 (22:05 -0600)]
Bugfix: Output stream is not properly unlocked on signal.
The output stream is locked during some loops.
When an appropriate signal is received while in one of these loops, the program exits.
The output stream must be unlocked before returning.
Kevin Day [Sun, 6 Nov 2022 22:03:36 +0000 (16:03 -0600)]
Feature: Add support for additional dependencies and settings files in level_3.
The package.sh build system helper script now supports additional dependencies and settings files.
This allows for special build modes, such as how the controller program has support for "controller" and "init" programs.
Kevin Day [Sat, 5 Nov 2022 01:24:38 +0000 (20:24 -0500)]
Bugfix: Incomplete UTF-8 zero-width detection, particularly for combining characters.
The zero-width calculations should be and are not including zero-width and most control characters.
The combining characters and most of the control characters are now considered zero-width.
Kevin Day [Sat, 29 Oct 2022 03:57:02 +0000 (22:57 -0500)]
Update: Slight improvement in UTF unassigned detection and add or correct some ranges.
Change "character" to "sequence" to be consistent with the rest of the private functions.
Add several additional checks to ideally reduce the number of checks.
This is only a cursory pass and not much effort is put into fine-tuned optimization.
There is huge room for improvement.
I discovered some ranges that needed to be added as unassined and added them.
Include the invalid ranges as unassigned.
Kevin Day [Sat, 29 Oct 2022 01:49:15 +0000 (20:49 -0500)]
Bugfix: Two 0's are printed when --total is used and there are no matching Objects.
There is an optimization used that immediately prints 0 and returns if there is no matching data on load.
The problem is that the caller isn't told that it should stop processing because F_none is returned.
Remove the optimization rather than implementing a custom return code and changing the code to handle this.
The normal code is still run and still correctly determines that there are 0 Objects.
Kevin Day [Fri, 28 Oct 2022 04:54:58 +0000 (23:54 -0500)]
Feature: Add support for ZSH in addition to BASH.
Some systems have started provided ZSH for license reasons (they don't want to agree to the license of BASH).
I experimented with and found that I can make my scripts ZSH friendly.
There is no way to "detect" that ZSH is being used as far as I can tell so I defined a new environment variable SHELL_ENGINE.
Set this to "zsh" and then run the script via the "zsh" program.
Enable emulation mode of "ksh" when using ZSH to be BASH friendly.
The ZSH doesn't support "${!i}" substitution.
I found a separate way to do this in ZSH via "${(P)i}".
It is a shame that they cannot simply replace "(P)" with "!".
There are several cases where "bash" is being directly called.
Replace this with a "shell_command" environment variable.
In some cases, directly calling "bash" may cause a loss of needed environment settings and so "bash" is not directly called when using BASH but "zsh" is still directly called when using ZSH.
The ZSH does not automatically handle arrays as well as BASH does.
Explicitly define arra with "-A" and explicitly set the initial value to "()".
Doing this may introduce problems with older versions of BASH that do not support "-A".
The ZSH cannot expand parameters as intelligently as BASH.
Parameters followed by certain characters, such as a bracket, that are not encases in braces result in ZSH errors.
Mass change many of the parameter uses to always be in braces.
Not all cases are changed and there may be some areas where I intended to make such a change and missed.
The ZSH appears not to handle output redirection from shell functions.
This behavior is used heavily in the project for building and using the variables array.
Change the behavior (at the cost of making the code a bit ugglier and harder to read in some cases) to assign a variable defined at a higher scope (such as "key").
The ZSH also appears to utilize "path" as a variable for "PATH" or is case insensitive when it comes to environment variables and shell variables.
This is a serious problem.
The variable "path" is defined so rename that to "path_" to avoid conflicts (and I'll just have to suffer cringing every time I see that trailing underscore).
I stumbled onto some bugs as well while making changes.
The necessary changes change the code that is buggy so I am allowing it to be in the same commit.
One of the bugs is a typo where errror is used rather than error.
Another bug is where the c_warning is used and then c_error is used within the same string (should be consistently using c_warning in this case).
It turns out "has-build_compiler" is not defined but conveniently a space for it is missing in bootstrap.sh (must be an accidental delete given the coincidence).
Some of the "mode" properties are incorrectly being assigned the non-mode value when a mode value exists in bootstrap.sh.
Kevin Day [Fri, 28 Oct 2022 01:07:00 +0000 (20:07 -0500)]
Cleanup: Rename and relocate private is_unassigned files.
The private-is_unassigned.c and private-is_unassigned.h are in incorrect locations and have incorrect names.
Relocate and rename to make these private files consistent with other private files.
Kevin Day [Fri, 28 Oct 2022 00:53:39 +0000 (19:53 -0500)]
Update: Support Unicode 15.0.
I couldn't easily find what Unicode version I am trying to suppot so I added a unicode.txt document.
The initial work was done for Unicode 12.1 and later switched to 14.0.
I was still in the initial stages of learning Unicode and so I expect there to be notable incompleteness or incorrectness.
With the release of Unicode 15.0 I am able to determine a distinct set of changes and I have applied the changes.
Add a private_inline_f_utf_character_handle_digit_offset() inline function to simplify some of the redundant code.
Kevin Day [Sun, 23 Oct 2022 21:31:53 +0000 (16:31 -0500)]
Progress: The iki_read should also support the previous "--substitute" behavior via "--reassign".
A "--substitute" bug is now fixed where the "--wrap" is applied.
It seems to me that the old behavior of "--substitute" should still exist.
Introduce a new parameter called "--reassign" that provides the old substitute behavior.
Kevin Day [Sun, 23 Oct 2022 02:58:16 +0000 (21:58 -0500)]
Progress: Fix problems in iki_read.
As I suspected, the interruptions resulted in incomplete and problematic code.
Fix copy and paste problems where modulus should instead be a slash (divide).
Use _increase_by functions rather than _resize functions to be more memory recycling friendly.
When processing parameters the index relative to the argv should be used.
Change the logic in the loops to increment "i" across all parameter values rather than the total sets.
Fix copy and paste mistakes where "wrap" is being incremented for non-wrap data.
The "--whole" parameter is not being processed and having the appropriate flag set.
The print function has incorrect ordering and structure of some of the functions called.
The print function is further simplified now that settings is passing the flag along.
The "wrap" append functions are not comparing against the correct variable (I swapped them by accident).
Do not do "register" types of optimizations at this point in time (this can be done far in the future when things are stable-ish).
Be sure to clear the lengths using memset().
The variable "k" can be moved inside the if condition following its assignment.