Kevin Day [Wed, 29 Jun 2022 22:10:19 +0000 (17:10 -0500)]
Update: The featureless make should default to 'make' mode.
This makes the fake program closer to how make operations.
With this changed, just type 'fake' and it operates as if 'fake make' was the command given.
Kevin Day [Sat, 25 Jun 2022 15:49:30 +0000 (10:49 -0500)]
Update: White space function changes.
Make the is white space functions accept "strict" to be more consistent with how other functions operation.
For the next development release I want to consider separate functions to avoid passing a boolean as a parameter to do this (for performance reasons).
This changes behavior in some cases and if I did something wrong then there will be a regression.
Look out for white space regressions specifically in the FSS programs.
Kevin Day [Sat, 25 Jun 2022 05:00:37 +0000 (00:00 -0500)]
Update: Use "decimal" instead of "digit".
The unit tests are failing because the function no longer exists.
The use if "digit" is probably the result of an over zealous refactor.
Rename the affected functions back to "decimal".
Kevin Day [Sat, 25 Jun 2022 04:09:26 +0000 (23:09 -0500)]
Bugfix: Problems in f_utf exposed by unit tests.
The is alphabetic needs to perform the is valid check because its default catch-all is returning F_true.
Ideally at some point (probably distant point) in the future, the literal codes for alphabetic will be matched rather than calling all of the other functions.
In this situation the is valid check can be removed.
Several of the is digit test value assignments are not checking if the value (the pointer) is NULL.
Kevin Day [Thu, 23 Jun 2022 23:52:19 +0000 (18:52 -0500)]
Update: The fake program should check file existence when clean is combined with another command like build or make.
When the make or build command is specified after a clean command, the clean command should do an appropriate file dependency check.
This acts as a safety measure such that if the make or build command could not normally be run due to the missing required files, then the clean operation should not be run.
Kevin Day [Wed, 22 Jun 2022 04:19:36 +0000 (23:19 -0500)]
Progress: f_utf unit tests and make significant change Unicode digit/decimal functions.
The controller program is using f_utf_is_alphabetic_decimal().
The previous functionality of that function is now handled by f_utf_is_alphabetic_digit().
I reconsidered some of the design I implemented in the previous commit (e696e3941592c6910f2f8ecc87a698d4f618c3b4).
The design of reading the value for the variable "value" and then saving to it is too much complexity.
Simplify the design and just expect the caller to read the "value" and decide if it is or is not in range.
Get rid of the "*_is_decimal()" functions.
The "*_is_digit()" functions work like the "*_is_decimal()" functions did.
I am avoiding the term "decimal" because it refers to base-10.
The term "digit" is a bit more general.
The only downside is that fractions might fall under "digit" (really they are two digits), which this function currently does not handle.
The "*_is_numeric()" functions will recognize fractions.
I didn't get as far as I wanted to.
The number of Unicode values to assign has worn me down.
The tests processing is not complete and I haven't gone back and done my normal review.
I tried to keep the "value" as small as possible, but unsurprisingly some language out there has a digit that represents billions.
I am forced to use a 64-bit data type for this.
Kevin Day [Tue, 21 Jun 2022 00:26:53 +0000 (19:26 -0500)]
Update: The f_utf project regarding digits and perform other clean ups follow up.
I had not gotten around to testing the programs after the previous commit.
I did not get to writing the function f_utf_is_alphabetic_digit() (and then forgot about this important part).
The controller program is using f_utf_is_alphabetic_decimal().
The previous functionality of that function is now handled by f_utf_is_alphabetic_digit().
Kevin Day [Mon, 20 Jun 2022 04:42:18 +0000 (23:42 -0500)]
Update: The f_utf project regarding digits and perform other clean ups.
Redesign the digit and decimal behavior.
The is digit functions now refers to base-10 but does not attempt to return the identified digit.
The is decimal functions now refers to base-10 and supports providing the identified digit.
The is decimal functions also support other base units than just base-10.
The alphabetic digit/numeric functions now also have a alphebetic decimal function.
Clean up more places in the code using "sequence" rather than "character" or "characters".
Functions like f_utf_character_is_alpha_digit() are now like f_utf_character_is_alphabetic_digit().
Add related unit tests.
The is digit functions have unit tests that tests if the digit returned is correct.
I have not reviewed all of the "numeric" Unicode digits to confirm/deny that my is decimal functions are complete.
I observed what looks like bugs in the alphabetic functions.
In these cases the final return statement is returning F_false when they instead should be returning F_true.
Kevin Day [Sun, 19 Jun 2022 00:22:56 +0000 (19:22 -0500)]
Security: Floating point exception due to incorrect number type used in conversion function.
The power is being used as the entire value.
To do this it must be capable of holding the entire supported digits of f_number_unsigned_t.
Using int results in a floating point exception.
Kevin Day [Sat, 18 Jun 2022 23:50:38 +0000 (18:50 -0500)]
Bugfix: The byte_dump --first and --last are not always working as expected.
The problem is due to a calculation resulting in a negative value.
The code "width_utf == -1 ? 0 : width_utf - width_count" does not account for when width_count > width_utf.
Refactor the use of "characters" with "sequence" to reflect recent changes in terminology usage.
Kevin Day [Sat, 18 Jun 2022 22:28:32 +0000 (17:28 -0500)]
Update: Follow up previous Unicode changes.
The previous commit changed a significant amount of behavior.
That commit noted that follow up changes would be necessary.
First things first.
I noticed that when I simplified the is valid checks I ended up over simplifying them.
There are several byte sequences that are not valid UTF-8 sequences.
I previously added surrogates and it turns out that UTF-8 specifically does not support Unicode surrogates.
Remove all related code.
The f_utf_char_t is supposed to be in big-endian format.
The macros are fixed to properly handle this.
This fix exposed problems in the conversion functions.
The conversion functions lack the proper big-endian and little-endian support.
Introduce a new structure and parameters to support designating the big-endian and little-endian.
Support a default order to host byte order.
The utf8 program needs to properly handle the endianness in a different way.
The bytes are in left-to-right format but when converted are converted in a left-to-right format but shifted to the right.
Swapping between little-endian to big-endian would be incorrect because the byte order is aleady correct.
The byte position is what is incorrect.
That is 0x0000c280 should be shifted to 0xc2800000.
Swapping the endianness would instead yield 0x80c20000 (which is incorrect).
The use of the word "character" as a variable name and in documentation can be confusing.
I have recently defined a "byte sequence", a "code point", and a "unicode" as specific types.
Change the word "character" to the appropriate name to make the code less confusing and more specific.
There are also other words used in place of "character" that might not be the ones listed above.
Some of the tests, particularly the emoji tests, have incorrect data.
I discovered that many sources out on the internet violate the standard and call code points an emoji that are not official recognized as an emoji by the standard.
I'm going with wikipedia on the new and updated emoji list.
The f_char_t is available so update old code that still uses uint8_t to instead use f_char_t for character related data.
Changes to the is valid code resulted in identifying invalid byte sequences that were previously considered valid.
Kevin Day [Fri, 17 Jun 2022 03:56:34 +0000 (22:56 -0500)]
Update: Unit tests for f_utf and relating changes or bug fixes.
Fix several problems exposed by unit tests.
Fix several unit tests to work as expected due to problems with the data files.
At some point I seem to have diverged from always ensuring that the f_utf_char_t is always big-endian.
I probably got lost in ensuring the differences between big and little endian that I ended up making the f_utf_char_t act little-endian in cases where host is little-endian.
The f_utf_char_t must always be big-endian.
However, there are cases where the big and little endian behavior must be processed.
Break up the macros into having "_be" and "_le" to make this possible.
The iscntrl() check return value needs to be explicitly handled to ensure that only F_false or F_true is returned.
This is already fixed in one function already.
Apply the existing fix to the other function.
The f_utf_char_t should be seen as a single character rather than a stream of bytes.
Unit tests now treat any non-zero value after the designated width as invalid.
The is valid checking code now tests for this invalid case.
The unit tests are improved.
Test for F_true and F_false rather than calling assert_true() and assert_false().
Error bits and other status codes were previously passing when they should fail due to the use of assert_true() and assert_false().
This commit changes the byte order of the f_utf_char_t.
This will break code such as the code used in the utf8 program.
A follow up commit is necessary to fix any byte order problems.
Kevin Day [Tue, 14 Jun 2022 12:25:18 +0000 (07:25 -0500)]
Update: Add unit tests in f_utf project.
These tests are created based on the comments in the code.
Unlike previous tests, I reviewed the Unicode database separate of my code.
This approach is faster but will not expose any Unicode Codepoints that I missed when writing the code.
This adds tests for the following:
- combining
- phonetic
- subscript
- superscript
- wide
Kevin Day [Tue, 14 Jun 2022 00:02:51 +0000 (19:02 -0500)]
Update: Add some unit tests for f_utf.
Add the structure for the remaining tests.
The (currently) unused tests are just copy and pastes and may need changes.
With the exception of the "valid" tests, these unit tests use statically generated data files containing bytesequences (unsigned 32-bit) in base-10 format.
The base-10 format representation of the bytesequence is used for easy reading using standard libc functions.
These static data files are generated using a combination of the Unicode database codepoints, a script I wrote, and the "unicode" program.
The Unicode codepoints used for each generated bytesequence set are also provided.
This implements the following tests:
- control
- digit
- emoji
- symbol
- valid
The intent of this is to test the entire spectrum of valid codepoints (except for the "valid" tests which tests every single possible value).
Due to every single value being tested by "valid" tests for both f_utf_is_valid() and f_utf_character_is_valid() results in a long running test.
Kevin Day [Sun, 12 Jun 2022 04:23:37 +0000 (23:23 -0500)]
Update: Add script for generating Unicode Codepoints from integers.
A simple script that I am using for generating a range of Unicode Codepoints in the format needed by the generate_unicode.sh script.
The private use area is represented by multiple sets of all values within some range.
These ranges are a massive list.
This script generates these.
The only thing I need to do is use a calculator program to convert hex to integer.
These integers are then passed to the script as an inclusive range.
Kevin Day [Sun, 12 Jun 2022 03:52:52 +0000 (22:52 -0500)]
Update: Generate Unicode script to support generating test data.
The test data is generated from a line separate Unicude Codepoint file.
The generated test data is in base-10 format rather than hexidecimal to make it easier for standard libc functions like atoll() to be used.
Kevin Day [Sat, 11 Jun 2022 19:09:39 +0000 (14:09 -0500)]
Bugfix: Last character of file after conversion from code point is not printed by utf8 program.
The algorithm doesn't print the character until it knows when the character is complete.
There are no checks for when end of file is reached.
This results in the last character not being printed, even if the code is complete.
Be sure to return the status rather than always returning F_none under certain circumstances in utf8_detect_codepoint().
Update documentation about return value in utf8_detect_codepoint().
Initialize the character.used to 0 rather than 4 (because it has no data!).
For better practice, compare using >= rather than ==.
Remove unnecessary i = 0 assignment.
Kevin Day [Fri, 10 Jun 2022 05:16:07 +0000 (00:16 -0500)]
Update: Finish adding Unicode symbol handling code.
I used a script that I wrote to assist.
Additional tweaks were still necessary.
There is a lot of room for error, but this saved me an enormous amount of time.
Kevin Day [Wed, 8 Jun 2022 04:38:07 +0000 (23:38 -0500)]
Bugfix: Problems exposed by unit tests for f_signal.
Fix ordering of functions.
Compare using "== -1" rather than "< 0" because the POSIX standard says "-1" rather than "less than zero".
The f_signal_read() function has several problems:
- Should be passing a pointer rather than an array to poll().
- Needs to check data_poll.revents.
- Missing the parameter checking.
Kevin Day [Tue, 7 Jun 2022 03:39:30 +0000 (22:39 -0500)]
Bugfix: Problems exposed by unit tests in f_conversion.
The unit tests were disabled due to previous problems that are not no longer a problem.
This exposed a few areas that could be improved.
Rename "output" to "stream".
Make sure to call ferror_unlocked() to test for error.
Add loops to handle when fwrite_unlocked() doesn't write all the data but also doesn't throw an error.
Use "negative_or_zero" instead of "negative" to be more verbose and less confusing.
Kevin Day [Sun, 5 Jun 2022 22:57:27 +0000 (17:57 -0500)]
Cleanup: Fully remove stale/unused variables.
I simply assumed the compiler warnings meant that the variables were not used at all.
Looks like this is an incorrect assumption.
The compilers appear to more intelligent than I expected and can detect that even though the variables are modified later on, they still are not used.
This is good news.
The bad news is that means I have bad code resulting from an incomplete clean up that need to be fixed.
This bad code is now fixed.
Kevin Day [Sun, 5 Jun 2022 22:40:11 +0000 (17:40 -0500)]
Bugfix: Fix problems exposed by unit tests in f_status.
The signal bit can be confused with the error and warning bits.
The tests for checking if the signal bit is set need to test exclusively for the signal bit being set.
The tests for the error and warning bits do not care if this is a signal.
This is done to simplify some of the logic.
In the cases where the signal bit is to be tested, first check the signal bit and then check for the othr bits.
Kevin Day [Sun, 5 Jun 2022 21:03:14 +0000 (16:03 -0500)]
Update: Improve the logic in the string comparison tests.
Several of the F_parameter errors do not need to be returned.
This logic is already handled by the called functions as not matched.
Make sure the stop range is not longer than the buffer used.
When the buffer used is smaller than the requested range stop, then use the buffer used rather than the stop point.
Kevin Day [Sat, 4 Jun 2022 03:40:29 +0000 (22:40 -0500)]
Update: Handle more cases of combining characters following white space.
The way UTF-8 combining characters works continues to give me a headache.
This is a pass at resolving the case, but the logic is unfortunate.
I have a strong feeling that there is a regression from this.
At this point I feel unit tests are necessary.
Perform the combining check after checking white space.
Make the code more flexible by not returning on any invalid character.
An invalid character cannot be a white space, so treat it as not a white space and continue.
The resulting code should be more robust.
Kevin Day [Sat, 4 Jun 2022 01:17:40 +0000 (20:17 -0500)]
Bugfix: The print functions are not printing the last letter in certain cases.
The overflow check is testing against >= stop or length.
The equal sign is the problem here.
If the character ends on the stop point or the length, then a whole character would have been printed.
This is not an error and should not result in a return.
Changing >= to > fixes the problem.
Because of this, the additional width check is unnecessary.
Kevin Day [Fri, 3 Jun 2022 03:46:36 +0000 (22:46 -0500)]
Bugfix: Finish addressing trimmed printing is not working as expected.
The previous commit c8c59e16bb4cb7936142bff4815b302ad57138de is incomplete.
Finish addressing the todos and also catch other cases where trimmed printing is not working as expected.
The addition of the combining character checks introduces additional complexity.
This complexity is stronger reason to write unit tests for fl_print.
There is a lot of room for error as a result of this additional logic.
Kevin Day [Fri, 3 Jun 2022 01:09:30 +0000 (20:09 -0500)]
Cleanup: Rename "output" to "stream".
Using the word "stream" is a better and more precise term.
The word "stream" is already in use elsewhere and using this makes the project more consistent.
Kevin Day [Thu, 2 Jun 2022 04:44:06 +0000 (23:44 -0500)]
Update: Unit tests, fixing minor problems and adding missing functionality.
Many of the testfile files have "tests" when they instead should have "test".
The f_print must have a clang specific define passed to work-around a clang problem.
I noticed that I forgot to implement several "returns_data_not" unit test while writing the f_fss unit tests.
Provide these missing unit tests for the f_type_array project unit tests.
This project is my de-facto standard for basing all of my standard data type unit tests and needs to be as correct and up to date as possible.
Kevin Day [Thu, 2 Jun 2022 04:07:33 +0000 (23:07 -0500)]
Update: Fixes and changes resulting from f_fss unit tests.
After reviewing the code I found that the logic is outdated.
The logic was written at the time when I was still far less familiar with Unicode.
The zero-width is being processed in the same way as combining characters.
This needs to change.
After reviewing the combining character logic, I realized that there are bigger problems.
The combining characters, for whatever reason, are processed from right to left.
This breaks normal streaming logic and requires post checks on all variables.
I am amazed that they let such a horrible idea get into the standard and I do not know why.
Regardless, the logic on many of these functions needs to change.
The logic is changed to more properly handle the combining characters and additional more explicit code comment documentation is added.
There will likely need to be follow up changes in the processing code but I am going to leave that for another time.
Change the code to be more consistent with how F_data_not is returned.
Rename functions to more consistently follow the naming strategy used (such as changing "_between" to "_range").
Add f_fss_is_combining() function.
Remove unused and unnecessary f_fss_shift_delimit() function.
Remove unused and unnecessary f_fss_skip_past_non_graph() function.
Update the FSS specifications to better clarify the combining character situation.
The combining character logic implies that I need to return status codes to designate that the return is happening at the start of some processing.
Create several "_start" status codes to address this need.
Fix a bug from a previous commit that is the result of a misplaced regex replace ("alphabeticbetic" should instead be "alphabetic").
Fix a bug where some files where missed when refactoring is_alpha() into is_alphabetic().
Kevin Day [Sun, 29 May 2022 03:04:46 +0000 (22:04 -0500)]
Bugfix: Fix problems exposed by unit tests in f_print.
Swap the length a string checks, the length has priority over string.
When performing the character safely prints, the F_utf should only be returned for UTF-8 characters whose width is greater than 1.
The ASCII characters are now no longer returning F_utf.
Some functions are missing the clearerr_unlocked() and ferror_unlocked() calls that are needed for proper fwrite_unlocked() error checks.
Update the documentation comments, adding missing information.
Some of the *_to* functions are not checking if the counter "i" exceeds the length before checking for NULL.
The *_to* functions for *_raw_safely* do not exist and should to be consistent with the regular print functions.
Add the missing *_to*_raw_safely* functions.
Several of the *_to_except* functions are missing the offset parameter which should be passed for consistency with the regular print functions.
Random functions are missing the final print that should exist outside of the loop.
The "total" needs to be checked and if it represents that unprinted data is present, then print that data.
One problem is a copy & paste mistake in the declaration of fake_make_parameter_variable_option_build_s where the wrong define is used.
Make sure to conditionally allocate the arguments array before operating on the "used" position.
The used_content variable should not be needed because the arguments.used should be 0.
After conditional allocation, ensure that the arguments.used is 0 before operation and remove the no longer needed used_content.
When the reserved IKI variables that represent program parameters are used and exist in isolation for their argument, then they should expand as separate variables.
Consider these four examples:
print 1 parameter:"build"
print 2 parameter:"build".
print 3 "parameter:"build""
print 4 "parameter:"build\" between parameter:"build""
Lets say fake is called with the following "fake make -b /tmp/".
The "print 1" example would have the following parameters:
1) 1
2) -b
3) /tmp/
The "print 2" example would have the following parameters:
1) 2
2) -b /tmp/.
The "print 3" example would have the following parameters:
1) 3
2) -b /tmp/
The "print 4" example would have the following parameters:
1) 3
2) -b /tmp/ between -b /tmp/
The "print 1" expands into 3 parameters because the IKI variable is by itself for that given argument.
The "print 2" expands into 2 parameters because the IKI variable is not by itself for the given argument (It has a period '.' at the end).
The "print 3" expands into 2 parameters because it is quoted and is treated as a single argument.
The "print 4" expands into 2 parameters because it is quoted and is treated as a single argument and the "between" should still be between the two substitutions.
A break is added at the end of one of the loops because that part of the loop is only reached after a match.
When a match is identified, the loop no longer needs further iterations.
Kevin Day [Wed, 25 May 2022 03:15:41 +0000 (22:15 -0500)]
Update: Additional test settings and add initial coverage support.
The goal of the coverage is to support gcov.
I am very unfamiliar with gcov at this time.
The settings are experimental at best.
There will likely be numerous changes relating to gcov in the future as I learn the tool and devised a process to build coverage reports.
Kevin Day [Wed, 25 May 2022 02:11:44 +0000 (21:11 -0500)]
Update: The fake "build" fakefile Object needs to support modes and fix a related bug.
The fakefile needs to be able to support being passed custom modes.
The default behavior is preserved with this change.
This requires supporting that an empty string is passed as Content.
It turns out that the quoted empty string is incorrectly being skipped.
Make sure the quoted empty strings are not skipped.
Kevin Day [Tue, 24 May 2022 04:31:37 +0000 (23:31 -0500)]
Cleanup: Existing unit tests, adjust status check behavior.
I was lazy with the previous behavior and always cleared the error bits when performing the comparison checks.
Change the behavior to properly check the status code for when the error bit is expected and when it is not.
Kevin Day [Mon, 23 May 2022 02:39:27 +0000 (21:39 -0500)]
Bugfix: Combining and Width detection for utf8 are not properly printing.
The wrong data is being passed to utf8_print_combining_or_width().
Change the behavior to send the correct string to the function.
Move the error printing to a single function and use this function in all such cases.
Kevin Day [Mon, 23 May 2022 02:07:07 +0000 (21:07 -0500)]
Cleanup: Rename bytecode to bytesequence.
The term "bytecode" already exists and is used for a slighty different purpoe (representing compiled or partially compiled data).
This is a different context.
To avoid using the term improperly, switch to a more proper term "bytesequence" (as one word).
A byte sequence is a term representing a sequence of bytes.
This is more specific than binary and effectively emphasis that this is in regards to bytes.
Avoiding the term binary, however correct or not the term may be, helps avoid confusion due to "binary" and "text" data being considered two separate things.
Kevin Day [Mon, 23 May 2022 01:51:29 +0000 (20:51 -0500)]
Cleanup: Use macro_f_string_static_t_initialize2() with macro_f_string_static_t_initialize().
Using macro_f_string_static_t_initialize2() was the old way and is now deemed incorrect.
The macro_f_string_static_t_initialize2() applies the length parameter to both the used and size.
For static strings the size is always 0 because nothing is dynamically allocated.
Therefore, using macro_f_string_static_t_initialize2() for static string initialization is incorrect.
Kevin Day [Mon, 23 May 2022 01:47:53 +0000 (20:47 -0500)]
Update: Tweak endiannes for f_utf_char_t.
I continue to forget that the f_utf_char_t is a big-endian format regardless of the host endiannes.
I then end up comparing the endiannes logic to normal operations and find discrepancies.
I waste a good bit of time to ultimately realize that the f_utf_char_t is not in host byte order.
Update the comments to better represent this situation.
I also noticed that the big endian bitwise operations are going in the wrong directory.
I could be wrong, but I think I need to do a left shift rather than a right shift.
Or perhaps, this only needs to be done on a big-endian system?
I need to test this logic on a big endian system.