Kevin Day [Sat, 19 Sep 2020 22:06:43 +0000 (17:06 -0500)]
Refactor: color management system.
Change the behavior so that fewer arguments are needed for color printing.
This introduces a structure where the color codes are now in sets of "before" and "after".
This set of two color codes are now passed to the color print functions, thereby reducing the number of arguments needed.
Kevin Day [Sat, 19 Sep 2020 04:28:20 +0000 (23:28 -0500)]
Cleanup: add -fdiagnostics-color=always to GCC flags in build settings files.
This forces colors to be enabled.
GCC thinks colors should be disabled when Featureless Make runs it in a shell.
By setting this, the color is forced enabled and error messages become more readable.
Kevin Day [Sat, 19 Sep 2020 03:20:27 +0000 (22:20 -0500)]
Cleanup: add -c/--content for consistency to iki_read.
The -c/--content is the default behavior.
This adds a literal parameter to reflect this.
No new functionality is added other than validation on the -c/--content parameter.
Kevin Day [Sat, 19 Sep 2020 00:37:12 +0000 (19:37 -0500)]
Update: f_file, f_fss, fl_fss, fl_utf, level_3.
f_file:
- Fix some function ordering.
- Do not use "0" to represent closed files, instead use "-1".
- "0" is used for standard input, which treating this as file closed prevents piped data from being read.
f_fss:
- The f_string_range_t should have _t in its macros.
- Updating all related code.
fl_string:
- Fix some function ordering.
- Add fl_string_dynamic_sink_line().
- Rewrite function parameter ordering to have constants on the left and editable pointers on the right.
- While I also like the logical flow of the previous behavior, during my development the practice of separating first by constants and then editable pointers won out.
- Updating all related code.
fl_utf:
- Rewrite function parameter ordering to have constants on the left and editable pointers on the right.
- While I also like the logical flow of the previous behavior, during my development the practice of separating first by constants and then editable pointers won out.
- Updating all related code.
level_3:
- Make f_console_parameter_ids_t and f_console_parameters_t constants, where possible.
More of the project will need reviewing of function parameter ordering.
Kevin Day [Tue, 15 Sep 2020 01:05:03 +0000 (20:05 -0500)]
Update: use *_size_increase() functions, improve logic, and return F_string_too_large.
Use the *_size_increase() functions more.
Anything declared inside of a loop is destroyed at the end of the loop and created at the beginning.
This is an easily avoidable performance concern.
When the max size is reached but allocation is still possible (but at a smaller than requested length) return F_string_too_large without the error bit set.
This is useful for when only 1 unit is needed but the resize is say 4.
In the cases where the resize must exactly match the given length, then treat F_string_too_large without the error bit as if it does have an error bit.
Kevin Day [Fri, 11 Sep 2020 03:32:47 +0000 (22:32 -0500)]
Update: Improve execution functions to use fewer allocations.
While the project is allocation heavy, I do try to avoid allocations where I reasonably can without breaking the design.
In this case, I can see no reason for allocation this memory in this way.
All that needs to be done here is just to point to the existing strings!
Kevin Day [Fri, 11 Sep 2020 03:08:12 +0000 (22:08 -0500)]
Bugfix: featureless make parameter substitution is incorrect.
The "return" code is appearing when the IKI "parameter" is used.
The reserved word check is operating on the wrong variables and is incorrectly injecting itself into the arguments list.
Kevin Day [Fri, 11 Sep 2020 01:57:30 +0000 (20:57 -0500)]
Update: Improve featureless make parameter processing.
Implement a better approach for addressing multiple operations.
For example, one can now (for whatever reason) do "fake clean make clean clean make".
Then the program should operate by running clean, then make, then clean, then clean again, and finally make again.
Kevin Day [Thu, 10 Sep 2020 05:13:05 +0000 (00:13 -0500)]
Progress: featureless make.
Fix refactor mistakes where some dependencies files accidentally had the type suffix '_t' appended in a previous commit.
Re-execute the dependencies script, refreshing all existing dependencies.
Begin adding a new parameter to specific a specific fakefile.
This part is incomplete.
Begin updating how the settings parameter works in regards to how the path to the fakefile is handled.
This part is incomplete.
Add example custom fakefile for the bzip-1.0.8 source.
Fix problems observed while trying to make these changes:
- The build process needs to store stage files per settings file so that multiple different settings may be built.
- The wrong path was accidentally used for loading the fakefile.
- The fake fakefile needs to use 'indexer' now instead of 'linker'.
Note: the fakefile stage files should also behave the same way as the build stage files, but this isn't implemented just yet.
Kevin Day [Thu, 10 Sep 2020 02:39:03 +0000 (21:39 -0500)]
Update: rename f_file_move to f_file_rename, add fll_file_move, and address printf().
The move function should operate as a move would expect, which includes cross-filesystem.
Rename the f_file_move() to f_file_rename() and ensure the limitations are documented.
The fll_file_move() calls f_file_rename() and if that fails due to being across filesystems, then call the appropriate clone and remove functions depending on whether or not the source is a file or directory.
I try to avoid having any output strings in the project that is below level 3 (but level 2 may have exceptions).
Rewrite parts of the directory copy and clone functions to use passed functions instead of directly printing.
Kevin Day [Wed, 9 Sep 2020 04:09:06 +0000 (23:09 -0500)]
Progress: featureless make.
Implement file move functions.
- There will need to be future changes to allow for moving across filesystems.
- This move across filesystems may need to be an fll_file_move() so that it can either do a directory clone or a file clone.
Fix a typo 'perforrm', which should instead be 'perform'.
Kevin Day [Tue, 8 Sep 2020 02:33:51 +0000 (21:33 -0500)]
Update: recursive functions, fix 'const const', don't error on max recurse depth.
Rewrite the fl_directory_* recursive functions, simplifying their design.
Add a max recursion depth.
I have a toleration limit on the number of arguments in a function and this just reached a limit.
Given that many of the parameters can be logically grouped and are also are also passed to other functions, implement a new structure.
While this simply changes where the complexity/problems happen, this does alleviate the number of arguments concerns.
Fix an accidental 'const const' declaration.
Don't error on max recurse depth.
This should just stop recursing for that directory and not generated an error.
Kevin Day [Mon, 7 Sep 2020 05:20:55 +0000 (00:20 -0500)]
Progress: featureless make.
Implement recursive change owner, change groups, and change modes functions.
These are implemented in the fll_file project.
Then utilize these for the recursive owners, groups, and modes section operations.
Fix specification where I forgot to rename "archiver" to "indexer".
In documentation it is "indexer" and not "index" for the indexer program whereas "index" is a section operation name.
Fix documentation where I forgot to rename "archive" to "index".
A bug in fl_directory_list() was discovered where the parameter check for path is incorrect.
Kevin Day [Sun, 6 Sep 2020 22:35:23 +0000 (17:35 -0500)]
Cleanup: rename linker/archiver to indexer in featureless make and tweak bootstrap.sh.
The linker program 'ar' creates an archive which is essentially an index.
By switching the words from linker and archiver to indexer, I believe that I can avoid terminology conflicts.
This avoids conflicting the 'linker' in terms of 'ar' and the 'linker' in terms of 'ln'.
This avoids conflicting the 'archiver' in terms of 'ar' and the 'archiver' in terms of 'bzip2'.
Kevin Day [Sat, 5 Sep 2020 04:59:47 +0000 (23:59 -0500)]
Cleanup: featureless make example bzip2 build data settings files.
The shortcomings have been addressed.
Simplify the example build data settings files by removing unnecessary settings.
This should further emphasize how simply and easy the featureless make build operation can potentially be.
Add simple documentation to the bzip2 example build data setting files.
Kevin Day [Sat, 5 Sep 2020 04:44:45 +0000 (23:44 -0500)]
Feature: featureless make should support custom source paths in data/build/settings.
The standard path is used by the featureless linux library.
If any other project, such as bzip2, has its own directory structure provide a way to more likely support that when using the build operation.
This is not intended to handle all possible cases.
This is only intended to handle simple cases such as with bzip2.
For more complex builds the fakefile and the make operation should instead be used.
This adds a path_standard setting that is a yes/no boolean for designating if/when to follow the standard source path structure or not.
When this is 'yes', then the standard sources path such as 'sources/c/' is used or when -S/--sources is supplied then the path would be 'XXX/c/' when using "-S xxx/" as an example.
When this is 'no', then the sources path specified by a new setting 'path_sources' is used but when -S/--sources is supplied then the path would be 'XXX/' when using "-S xxx/" as an example.
The result of this change moves the "sources/" directory from required to optional.
This directory is no longer checked for during the check required directories process.
The bootstrap.sh script is exclusively intended to be used for compiling the featureless linux library.
Therefore, the 'path_standard' and 'path_sources' are unimplemented within that script (beyond being defined in the variable list).
Kevin Day [Sat, 5 Sep 2020 03:01:06 +0000 (22:01 -0500)]
Bugfix: featureless make should not attempt to link to non-existent library.
When the no library sources are specified then the library is not built.
The problem is that the code is still trying to link against this library that was not built when compiling the static program.
Kevin Day [Sat, 5 Sep 2020 02:10:47 +0000 (21:10 -0500)]
Update: featureless make should not autp-prepend "-D".
Having this does simplify the configuration.
The downside is that it limits the flexibility and requires compiler-specific code to be added and potentially added.
Removing the auto-prepend "-D" will reduce the amount of language or compiler specific code in featureless make.
If another C compiler exists but uses something other than "-D" for defines, then only the settings file need be updated.
Kevin Day [Sat, 5 Sep 2020 01:58:08 +0000 (20:58 -0500)]
Bugfix: fake settings parameter is ignored.
The default value is always being used.
Change the behavior to use the loaded settings that was processed based off of the parameter -s/--settings instead.
Kevin Day [Fri, 4 Sep 2020 04:40:32 +0000 (23:40 -0500)]
Update: Add some example build settings for featureless make for bzip2.
The bzip2 project has a relatively simple and small makefile and does not get updated often.
This makes bzip2 an ideal example of how to build a build settings file.
There are a few shortcomings that I believe I need to address after creating these in the fake project.
These have been documented in the example settings until I can get around to change them.
I would also like to create fakefile examples for bzip2 as well.
Kevin Day [Fri, 4 Sep 2020 03:59:40 +0000 (22:59 -0500)]
Progress: featureless make.
Finish writing if conditions for number operations like >, <=, etc...
There still needs to be work where numbers such as 1.2 or arbitrarily large numbers are supported.
This only provides support for integers, positive or negative, that have a max value of uint64_t, which is generally ~2^64.
Kevin Day [Tue, 1 Sep 2020 01:14:23 +0000 (20:14 -0500)]
Refactor: Append '_t' to all types and related macros.
After using uint8_t and similar, I have decided to adopt the '_t' notation for types.
This helps further reduce the possibility of naming conflicts.
With this change a function, for example, for file mode could be 'f_file_mode' whereas a type for file mode would be 'f_file_mode_t'.
This further allows me to change the design of the *int*_t types used as an array.
Such as renaming 'f_uint8_tss' to 'f_uint8ss_t'.
Kevin Day [Sat, 29 Aug 2020 03:19:21 +0000 (22:19 -0500)]
Progress: featureless make.
Begin working on "if" operation logic.
Make sure the return states are handled by adding a "success" boolean.
Uncomment the code where I was confused by the logic.
What seems to have caused the confusion was that the "if" condition should have been an "else if" condition.
With this change, the logic makes more sense because it is no longer checking against a modified status variable.
Kevin Day [Tue, 25 Aug 2020 02:44:13 +0000 (21:44 -0500)]
Feature: provide common string related memory increment functions.
There are a lot of string functions.
In this case, it seems worth more to use functions instead of relying on macros, given how common this is.
This does not update most of the existing code that may want to use this.
Future consideration will likely be made in regards to the array of array string types.
There is no intention to expand this process to other types.
Kevin Day [Mon, 24 Aug 2020 01:55:03 +0000 (20:55 -0500)]
Progress: featureless make.
I forgot to finish converting the fake_print_error() and fake_print_error_file() functions to fake_print_message() and fake_print_message_file() for the private-fake.c code.
Fix the messages with fake_print_message_section_operation_path_stack_max().
Kevin Day [Mon, 24 Aug 2020 01:01:37 +0000 (20:01 -0500)]
Update: header includes should be local.
I noticed that I have been, perhaps habitually, using the system include path logic for including headers in the local source.
This is dangerous.
Avoid the possibility of including headers from the system when the headers provided by the project itself should be used.
Kevin Day [Sun, 23 Aug 2020 01:31:05 +0000 (20:31 -0500)]
Progress: featureless make.
Begin adding support for more complicated section operations.
Add break/exit to allow for manually exiting or breaking.
The error/warning systems needed to be rewritten to handle additional situations where "fail" mode is set to "warn" or "ignore" instead of "exit".
Errors may need to be warnings or not printed at all.
I noticed that I have been, perhaps habitually, using the system include path logic for including headers in the local source.
This is dangerous.
Avoid the possibility of including headers from the system that are actually headers provided by the project itself.
Kevin Day [Fri, 21 Aug 2020 03:36:23 +0000 (22:36 -0500)]
Progress: featureless make.
Process environment variable names, enabling support for the "define" section operation.
The function isascii() is incorrectly used when isalpha() should be used for identifying a valid first character for an environment variable name.
When calling execution section operations like "run" and "shell" make sure environment variables are passed to the environment.
Fix mistake where "group" is used when "groups" and similar mistakes with other words.
Add more output when in verbose mode on completion of certain operations.
For now, just avoid color output in these cases.
Fix minor mistakes in status variable when calling error handlers.
Actually set the fail type when the fail section operation is specified.
Fix the relating error message when the fail type is invalid.
Kevin Day [Thu, 20 Aug 2020 02:59:55 +0000 (21:59 -0500)]
Progress: featureless make.
Remove the 'create' section operation, it is effectively redundant with the 'touch' section operation.
There is still potential for having both because 'touch' section operation has additional actions that could be undesired.
For keeping it simple, I have decided to not support both 'create' and 'touch' at the same time.
Implement 'delete' section operatin and update validation.
Implement 'link' section operation and update validation.
Add 'deletes' section operation that performs a "recursive" delete which allows for deleting non-empty directories.
Kevin Day [Fri, 14 Aug 2020 02:11:20 +0000 (21:11 -0500)]
Progress: get the change file mode functions in an acceptable state.
Finish writing the file change mode and related functions.
Due to significant gaps in development and the notable complexity of the ugo+rwxXst modes, this is implemented in what appears to be good enough for now.
There are likely hidden logic flaws or incomplete/missing logic.
This adds an @fixme to more thoroughly review this and possible fix this at a later date.
For now, this allows moving forward to avoid spending too much time on this one area.
Kevin Day [Thu, 13 Aug 2020 03:41:31 +0000 (22:41 -0500)]
Progress: continue work on mode changes
The functions were renamed and re-organized to be more consistent with the project practices.
This changeset focused on getting the number-only changes done within the time allowed.
This adds a new function for converting the f_file_mode into a mode_t for the libc chmod compatibility.
Kevin Day [Thu, 30 Jul 2020 03:26:14 +0000 (22:26 -0500)]
Progress: featureless make and related
It turns out I need custom functions for processing the mode like the chmod program works.
During the process of writing this I discovered several different ways chmod accepts arguments that I wasn't aware.
As a result I changed my logic repeatedly and this code is in a very much incomplete state.
This is being committed primarily to avoid losing any data (more so than usual).
There will be a lot of clean up when I get back to completing this.
Kevin Day [Sun, 26 Jul 2020 05:45:15 +0000 (00:45 -0500)]
Update: rename f_file_change_owner() to f_file_change_role().
Change owner implies changing the owner.
This is not strictly true, due to how the chown() and similar POSIX functions works.
Instead, these change owner and/or group.
To avoid confusion with thinking this function exclusively changes owner, use a completely different word.
The chosen word is "role".
Kevin Day [Fri, 24 Jul 2020 02:26:42 +0000 (21:26 -0500)]
Update: print the canonical path, if available, but fallback to the provided path if not.
The line number is printed on error, so a person can always look at the source settings to determine what the provided path is.
Providing the generated canonical path makes it clear what the generated path is.
Kevin Day [Fri, 24 Jul 2020 02:26:19 +0000 (21:26 -0500)]
Bugfix: logic errors in fll_path_canonical().
Make sure not to include the '/' when incrementing the size_chunk.
The code starts with '/', so be sure to designate the previous_1 as '/' at the start.
Kevin Day [Thu, 23 Jul 2020 01:57:02 +0000 (20:57 -0500)]
Update: provide fll_path and fl_environment while providing an alternative to f_path_real.
The realpath() function does not work on non-existent paths.
Provide an alternative, fll_path_canonical(), that works on paths without concern for some paths existence.
The f_environment_path* functions need f_path, so move them to a new fl_environment project.
Kevin Day [Mon, 20 Jul 2020 04:09:44 +0000 (23:09 -0500)]
Progress: featureless make.
The return code 0 should not trigger an error (I forgot to explicitly return from the function).
Implement the environment variable handling.
Now that it is implemented, do not manage the custom environment variables via the "define" mapping.
Instead, let the environment variables be the data storage.
This now updates the environment variables and reads from the environment variables as requested.
The parameter values are supposed to load from the build settings if not defined.
When the build settings are loaded, then allow loading from the build settings.
Kevin Day [Mon, 20 Jul 2020 04:06:16 +0000 (23:06 -0500)]
Bugfix: IKI read is not identifying cases with leading characters.
An IKI read string that begins with text that is potentially valid, followed by non-IKI name characters, and finally followed by a valid IKI variable name is not detected.
Example:
Should=define:"value".
The above didn't resolve, but with this fix should now find the full IKI variable: 'define:"value"'.
Kevin Day [Sat, 18 Jul 2020 05:08:58 +0000 (00:08 -0500)]
Progress: featureless make.
Finish implementing the return code processing.
Allow the return failure strategy to be tweaked via the setting 'fail' which can have one of the following:
- exit: exit program on failure.
- warn: do not exit and if in verbose mode, print warning.
- ignore: do nothing.
The reserved parameter variable "return" is populated with the return result value.
For example, you can see the return result by adding the following after a run, shell, or similar operation:
print Return Code is parameter:"return"
Add some additional warnings when loading settings.
Kevin Day [Sat, 18 Jul 2020 05:08:58 +0000 (00:08 -0500)]
Update: start counting line at 1.
The fss files may start at 0, but report the starting line at 1 for friendliness with other programs.
I may very well need to update the fss project to consider lines starting at 1 instead of 0 for consistency.
Kevin Day [Sat, 18 Jul 2020 05:08:58 +0000 (00:08 -0500)]
Progress: featureless make.
I flip-flopped on how I wanted to handle the print functions and need to update/rewrite them again after this commit.
The end of an operation always prints the section, line number, etc.., so I do not need as many custom print functions as I ended up doing in this commit.
This begins processing the stack path.
The pre-process idea just will not work because the argument length is not known until after expansion.
This throws away the idea of having a pre-process validation on the operation rules, unfortunately.
There are some mistakes in the expand function when handling arguments that need to be fixed.