Kevin Day [Mon, 15 Jun 2020 04:58:02 +0000 (23:58 -0500)]
Feature: add fss_named and fss_set structures and re-organize the fss headers
Provide fss_named and fss_set structures (and their respective array structures).
These are useful when using FSS types nested within another set (not to be confused with fss_nest which is for a single type with recursion).
There are just too many things in fss.h.
Break it out into multiple headers that are auto-included.
Kevin Day [Mon, 15 Jun 2020 04:54:58 +0000 (23:54 -0500)]
Feature: add macro initializers for static string and string ranges
Creating defines with present lengths and them using these in static strings, sometimes with ranges, has become more common.
Provide the macros to make this simpler and ever be more usable for creating constant static strings and constant string ranges.
Kevin Day [Fri, 12 Jun 2020 02:49:46 +0000 (21:49 -0500)]
Progress: UTF-8 file write should handle case where expanded character is larger than write max
When the 4-byte wide UTF-8 character is expanded into potentally 4 1-byte wide UTF-8 characters, the available bytes being expanded need to fit in the output buffer.
Kevin Day [Mon, 8 Jun 2020 23:29:15 +0000 (18:29 -0500)]
Update: fl_serialized to f_serialize, renaming f_serialized to f_serialize
There is nothing forcing the current functions in fl_serialized from being in f_serialize.
Renamed f_serialized to f_serialize to be more consistent with the function names.
To that end, I have renamed the functions like f_unserialize* to f_serialize_un.
I have been unable to come up with a better name that is also reasonably short.
Kevin Day [Mon, 8 Jun 2020 04:34:49 +0000 (23:34 -0500)]
Update: documentation cleanups, fix observed problems, retun F_data_not without error bit
Organize the return codes.
Fix any probles in the commend documentation that I happened to notice.
This is not complete, there will be follow up commits to address more cleanups.
I noticed that there were some public directory functions incorrectly have 'private_' in their name.
The conversion functions should no longer consider no data an error.
Just report that there was nothing to do.
Kevin Day [Mon, 8 Jun 2020 02:16:51 +0000 (21:16 -0500)]
Update: documentation, also use fss-0002
Fix the documentation to clarify that the --work paramter is, in fact, more different than --prefix parameter.
Update the tree examples to show both the build directory tree and work directory tree.
Switch to using the fss-0002 format for all of the documentation files and specification files.
Kevin Day [Sun, 7 Jun 2020 21:40:24 +0000 (16:40 -0500)]
Update: implement --process parameter
Looks like I forgot to implement this.
The --process parameter is a process name that is prepended to stage file names for the purpose of granting the caller additional flexibility.
Kevin Day [Sun, 7 Jun 2020 19:05:29 +0000 (14:05 -0500)]
Update: bootstrap dependency functionality, fix missing dependencies, also ensure level and monolithic
It seems I wrote a dependency generator to make my life easier and then I went and forgot about it.
Update this to work with the more recent changes to the build settings structure.
While I am at it, generate all of the dependencies and save the generated dependencies.
This exposed a typoe in the dependencies file, now fixed.
Might as well make sure the level and monolithic dependencies are generated as well.
Kevin Day [Sun, 7 Jun 2020 14:07:06 +0000 (09:07 -0500)]
Update: support copying documents, licenses, and specifications per project and do some cleanups
Individual projects, specifically programs (level_3), may have custom documentation, licenses, and specifications.
(With custom licenses being least likely because this project in its entirety is under lgpl.)
Add support to all projects just for good practice.
Cleanup ordering of function names and add spaces before function instantiation open brace.
Kevin Day [Sun, 7 Jun 2020 03:30:17 +0000 (22:30 -0500)]
Update: Featureless Make needs to handle the -d/--define parameter
Rename the parameter from defines to define, because it acts on only a single parameter at a time.
The -d must be specified multiple times to get multiple defines.
When -d/--define is specified, the defines provided by the settings file get ignored.
Continue to pass the defines from the console parameters to the process scripts.
Kevin Day [Sun, 7 Jun 2020 02:32:27 +0000 (21:32 -0500)]
Bugfix: shared library link names are incorrect
The standard link names are:
libfake.so -> libfake.so.0
libfake.so.0 -> libfake.so.0.5.0
Instead, I had:
libfake.so.0 -> libfake.so.0.5
libfake.so.0.5 -> libfake.so.0.5.0
While I am at it, make these links reflect the version_target setting.
If target is major, then standard link names above are followed.
If target is minor, then:
libfake.so -> libfake.so.0.5
libfake.so.0.5 -> libfake.so.0.5.0
If target is micro, then:
libfake.so -> libfake.so.0.5.0
Kevin Day [Sun, 7 Jun 2020 01:21:26 +0000 (20:21 -0500)]
Feature: add version_target setting to Featureless Make and FLL generate script
I noticed that I had a different linker version string between Featureless Make and the FLL generate script.
After reviewing and fixing, I decided to make this a customizable option now called version_target.
The default, traditional behavior, is to use only the major version.
A major version target would link like "-Wl,-soname,libfake.so.0".
A minor version target would link like "-Wl,-soname,libfake.so.0.5".
A micro version target would link like "-Wl,-soname,libfake.so.0.5.0".
Kevin Day [Sun, 7 Jun 2020 00:41:06 +0000 (19:41 -0500)]
Update: change settings structure to follow the Featureless Make structure
The existing design is based on the bootstrap scripts.
The bootstrap script is now updated to the new design so these scripts can now be updated to the new design.
Kevin Day [Sun, 7 Jun 2020 00:38:06 +0000 (19:38 -0500)]
Update: redesign to follow the Featureless Make design
Use the setting names specified by Featureless Make, which are a bit more generalized than the current generate.sh design.
This does not fully follow all of the Featureless Make functions.
Only what is necessary (or already implemented) to bootstrap the entire FLL project is done.
Kevin Day [Sat, 6 Jun 2020 21:46:26 +0000 (16:46 -0500)]
Bugfix: do not consider a non-existent build directory an error during clean operation
The clean only cares about deleting all of the files in the build directory.
If that directory does not exist, then there is no issue.
When in verbose mode, print a message about the directory not existing.
Kevin Day [Sat, 6 Jun 2020 19:46:02 +0000 (14:46 -0500)]
Bugfix: filename without extension not terminated and compiled objects need subdirectories
When generating the filename without the file extension, terminate the string.
When library sources are specified using subdirectory paths, object files should have the same subdirectory structure.
This only applies to object files because they are compiled using the same naming structure as the sources.
The rest of the compiled code is compiled into a new structure, which is generally a single library or program.
Kevin Day [Sat, 6 Jun 2020 16:43:39 +0000 (11:43 -0500)]
Bugfix: invalid memory access and only process if not empty
If the path_headers is not defined, an invalid memory read was triggered.
This happens because I was only assigning path_headers variable when path_heades setting was defined but I was still attempting to copy that path regardless.
Make sure to not bother attempting any copy or compile build operations if that setting has not properties (such as build_sources_program being empty).
Kevin Day [Fri, 5 Jun 2020 00:21:30 +0000 (19:21 -0500)]
Progress: featureless make
This gets the shared library and shared program compiling working.
The fake program can compile the fake binary and that fake binary can do the same.
This is great progress.
Kevin Day [Fri, 5 Jun 2020 00:18:50 +0000 (19:18 -0500)]
Bugfix: do not embed libraries into program
The generate.sh script design seems to be adding the library sources into the program.
This effectively makes the linked library.
This is a bad compiling and linking design and a waste of space.
Instead, add a link option to the project name so that the library gets linked to by the program.
Kevin Day [Tue, 2 Jun 2020 04:43:08 +0000 (23:43 -0500)]
Progress: featureless make
Handle the script sources differently than the bash sources.
The bash sources, a scrript, is for generated/processed (and the how is yet to be defined).
The more general scripts are meant for already prepared scripts not modified by this program (unless modified by some pre-process or post-process script).
The more general scripts does not care what the file is, it just gets copied over into the build scripts program path.
Add build_script yes/no setting to conditional include the general scripts when building.
Slightly rework the logic when processing the build operation functions.
Add the planned functions as stubs, to be completed in a future commit.
Kevin Day [Sun, 31 May 2020 04:41:33 +0000 (23:41 -0500)]
Progress: featureless make
Fix a mistake in the naming conflict for with the language enum and language defines.
Implement a more generic build copy function.
Improve file copying support.
Add verbose copy messages.
Copy the C and C++ header files.
Rename fake_build_settings to fake_build_setting to properly follow this projects naming convention.
Add missing dependency for fl_directory.
Language-specific support setting "build_language" is implemented and provides a way to specific which language to use.
This will default to C.
Kevin Day [Sun, 31 May 2020 04:37:30 +0000 (23:37 -0500)]
Update: ensure string parameter tests exist and add f_file_name_base() and f_file_name_directory() functions
I seem to have forgotten that f_string is a char * and should be checked to not be NULL.
I think I removed these during a cleanup process, so add them back.
The basename() and dirname() functions need to be suppoted.
They require extra effort because as per the POSIX standard, parameters are modified.
This is undesirable so protect the parameters when calling.
Kevin Day [Sat, 30 May 2020 22:42:26 +0000 (17:42 -0500)]
Cleanup: make f_string_eol and f_string_placeholder a string instead of a char
In the back of my mind I keep reading f_string_eol as a string.
It is not.
Instead, it is a character.
To prevent this potential confusion, just make it a string and require the use of f_string_eol[0].
Make the same kind of change to f_string_placeholder as well.
Kevin Day [Sat, 30 May 2020 22:36:40 +0000 (17:36 -0500)]
Progress: featureless make
Move the print functions to their own private files (private-print.c and private-print.h).
Have the build operation create the build directory skeleton.
Have the build operation copy the settings files over, if specified in the build settings.
Update the code to be in sync with recent FLL changes.
Kevin Day [Sat, 30 May 2020 22:33:09 +0000 (17:33 -0500)]
Update: pipe and fifo, replace f_directory_mode with f_mode, f_file_copy()
Stick to only using fifo terminology in file types.
Replace f_directory_mode with f_mode, a global type to be shared between f_file, f_directory, and anything else.
Update f_file_copy() to use f_mode instead of mode_t.
This allows the caller to just send the mode.
The copy function already stats the file and processes it per file type, so it can make the decision on which mode to use.
This alleviates the need for the caller to also perform a file type stat check.
Kevin Day [Sat, 30 May 2020 01:00:41 +0000 (20:00 -0500)]
Update: todo documentation, directory copy and clone functions, update comment documentation
Update the todo.txt documentation.
There needs to be directory copy and clone functions for copy the contents of a source directory and not the directory itself.
To that end, add new *_contents() copy functions.
The comment documentation for clone was never updated and is incorrect.
Kevin Day [Fri, 29 May 2020 00:23:59 +0000 (19:23 -0500)]
Progress: add more directory and file related functions, other changes
This was started with the intention of providing all of the *_at() functions.
However, the POSIX spec seems to fall short in many areas making this more difficult than this should be.
I partially rolled back some of the planned changes and this changeset is the result.
I have observed that the function return documentation needs to be updated, but this will be done at a later time.
There will need to be some intensive testing later on but for now I am committing and moving forward.
Kevin Day [Wed, 27 May 2020 04:45:31 +0000 (23:45 -0500)]
Update: file and directory improvements, finish writing directory copy
Organize directory header structure, adding directory_type.h.
Add additional directory structures.
Directory copy needs to report what fails, so provide a structure for reporting each failure.
(There needs to be a verbose function for printing success/failure.)
Remove de-reference from numerous file functions.
POSIX denies certain operations of symlinks.
During copy operations, do not apply mode to symlink as it would now apply mode changes to the de-referenced link.
Allow block size to use default block size if set to 0 (convenience).
Add missing return statement to file copy (without it socket file types would incorrectly report F_unsupported).
Add link read functions so that symlink information may be obtained so that it can then be copied.
Add comments about poorly written umask() as per POSIX standard (at least according to manpages).
Kevin Day [Sun, 24 May 2020 03:54:53 +0000 (22:54 -0500)]
Update: minor improvements, finish f_file_copy(), add fifo file type
Finish implementing the f_file_copy(), adding support for all file types (except unknown).
The documentation for block, character, and FIFO is unclear to me at this time and my attempts to copy using mknod(2) is an educated guess.
Attempt to prevent file type from being passed via the mode_t when doing a copy (currently untested).
Add the appropriate file create functions to implement the copy operations.
Have the copy file copy only the directory itself and not the contents (to copy contents, the fl_directory_copy() function should be used).
The added fifo type is pretty much the same as pipe.
Mixing fifo with pipe terminology ended up being confusing so I opted to create redundant FIFO types to simplify the readability.
Use the word "regular" for a regular file instead of "file".
Using "regular" is a less confusing than using "file" (i.e. Regular File Type vs File File Type).
Kevin Day [Sat, 23 May 2020 20:46:19 +0000 (15:46 -0500)]
Cleanup: Replace F_file_open_not with F_file_closed, add additional status codes for consistencies
Socket was not fully converted into basic status codes (not having connect).
I can see future work in sockets whee I may actually add connect codes back, but I won't know until I spend dedicate time on it.
Add additional status codes that should probably exist for consistency purposes.
With F_file_open_not removed, split behavior into two checks:
- F_file for file descriptor errors.
- F_file_closed for file not open errors.
Kevin Day [Sat, 23 May 2020 20:13:59 +0000 (15:13 -0500)]
Cleanup: update all status codes in line with recent refactor and fix issues
This primarily puts all of the status code handling in alphabetic order.
The length sizes are updated accordingly.
Be consistent with S at the end of things, whereas S is not the traditional grammatical use but instead implies a set of.
Use the base F_* disable defines instead of using new ones for each level when they are specific to the F_* status codes.
Add additional comment documentation.
Any issues observed resulting from the refactor were also fixed during this change.
Kevin Day [Sat, 23 May 2020 15:36:05 +0000 (10:36 -0500)]
Refactor: use capital F, FL, and FLL for status codes to avoid potential conflicts
By only using the first part, the annoyance of all uppercase can be avoided.
This then allows shortening the names and removing words like "_error".
Also restructure where the "_not" are placed (placing them immediately after what they apply to).
This will be followed up by a restructuring commit.
Kevin Day [Sat, 23 May 2020 05:35:03 +0000 (00:35 -0500)]
Update: get the level_3 / programs working after major file / directory changes
This required making some fixes in the files related code.
This puts the UTF-8 file (utf_file) project notably behind an additional work is necessary to get that working correctly as well as having it be consistent with f_file.
I've decided that when written pointer is 0, then the caller is requesting to not get back the written size.
I am very likely going to do similar behavior with null pointers in other uses, which will help further simplify the design.
Other minor changes.
Of particular note is moving flags into the f_file structure.
This was effectively how the pre-file redesign worked, but it uses flags now instead of the "r", "rw", "a", etc.. string modes used by fopen.
Make sure an append flag is available.
Kevin Day [Fri, 22 May 2020 02:42:18 +0000 (21:42 -0500)]
Progress: continue redesign of file and directoy structure
This gets the code in a state where I can focus on updating all of the programs (level_3 files).
The UTF-8 related types have @todo and @fixme as I intend to come back later and finish them.
Kevin Day [Thu, 21 May 2020 05:08:09 +0000 (00:08 -0500)]
Progress: major redesigns with file and directory handling, this changeset is incomplete
In the process of writing the directory copy, I realized I needed to improve the file and directory management.
This triggered me to rethink how I was handling files and directories to some extend.
If memory serves me correctly, the POSIX 2008 was either too new or non-existent when I first wrote some of this.
Updating to use the newer POSIX functionality and changes seems worth this major change.
Add additional file functionality.
Lots of re-organization and redesign.
I still haven't finished this and would rather commit now, with incomplete code randomly throughout, than risk losing any changes.
In particular, the fl_utf_file is where I need to resume.
I need to then update all of the level 3 programs to use the new file/directory handling code.
After that I need to finish writing the directory copy, which should include investigating and implementing file copy operations for more than regular files and symbolic links.
I also need to remember to investigate copying hard links as a hard link instead of as a duplicate file.
Kevin Day [Sun, 17 May 2020 23:05:50 +0000 (18:05 -0500)]
Progress: featureless make
Add and validate modes from the build settings files.
This provides some data integrity support.
If a mode is not defined in the modes property of the build settings, then that mode is not valid and the build process is stopped.
Kevin Day [Sun, 17 May 2020 17:05:59 +0000 (12:05 -0500)]
Progress: featureless make
Snatch apart the settings strings instead of mashing them together.
Process the environment build setting to enable selecting additional environment variable to expose to the process scripts.
Kevin Day [Sun, 17 May 2020 02:56:52 +0000 (21:56 -0500)]
Update: numerous changes, most notably path and vfork to fork changes
Replace vfork() calls with fork().
- I have determined that vfork() is not safe.
- When calling clearenv() inside a vfork() child process, the parent process' environment ends up getting cleared as well!
- The child can alter the parents memory according to manpages, so stop using vfork() entirely.
Add path processing functions and related defines.
Enable path processing to allow for execvpe()-like behavior can be implemented.
- The execvpe() function is not used because it is not POSIX.
- Manually process the PATH environment to determine what to execute, even when PATH enviornment gets cleared.
Some consistency improvements in defines, such as f_console_max_size to f_console_length_size.
Fix mistake in memcpy usage, dynamic strings use char * for their string so passing & is incorrect.
The f_file_exists() is using access().
- This is misleading and incorect.
- Use stat() to determine if file exists because it doesn't require access to the file (aside from directory access) to check existence.
- Add a new function f_file_access() as the old implementation of f_file_exists().
The fll_execute programs now support additional functions for clearing environment variables.
- This effectively sandboxes the environment variables before calling the program.
Kevin Day [Fri, 15 May 2020 02:52:28 +0000 (21:52 -0500)]
Cleanup: remove f_string_eos, use 0 instead
I originally created f_string_eos, so that it could be potentially changed.
In the case of basic strings, using 0 is simpler, more consistent, and safer.