Skip to content

μCBoost-* are a family of single file amalgamations from SACK that provide common, useful extensions for C

License

Notifications You must be signed in to change notification settings

d3x0r/micro-C-Boost-Types

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Micro C-Boost (no relation)

This is a family of amalgamated products from SACK.
Tried to host this as a gist; but that didn't work out so well.
https://gist.github.com/d3x0r/3ce9cced42446b8f39c081e7425ea6d8

Types

This is the smallest subset. It includes most things

This is a C file, but if the .h is included as C++ then namespaces will be used, and the .c file should be renamed as .cc/.cpp/... or compiler option otherwise forced to C++.

Other amalgamations

Source List

@set SRCS= %SRCS%   ../../src/typelib/typecode.c 
@set SRCS= %SRCS%   ../../src/typelib/text.c 
@set SRCS= %SRCS%   ../../src/typelib/input.c
@set SRCS= %SRCS%   ../../src/typelib/sets.c
@set SRCS= %SRCS%   ../../src/typelib/binarylist.c 
@set SRCS= %SRCS%   ../../src/typelib/url.c
@set SRCS= %SRCS%   ../../src/fractionlib/fractions.c
@set SRCS= %SRCS%   ../../src/memlib/sharemem.c 
@set SRCS= %SRCS%   ../../src/memlib/memory_operations.c 
@set SRCS= %SRCS%   ../../src/deadstart/deadstart_core.c 

// this requires file system fixes 
@set SRCS= %SRCS%   ../../src/vectlib/vectlib.c

: These only required core containers and memory. 
: JSON Parser (no extensions)
@set SRCS= %SRCS%   ../../src/netlib/html5.websocket/json/json.c
: JSON6 Parser (JSON compatible parser plus additional keywords, quoting options, comments,... )
@set SRCS= %SRCS%   ../../src/netlib/html5.websocket/json/json6.c
: JSOX Parser (JSON/JSON6 compatible parser plus better typed data transport and revive with a class constructor)
@set SRCS= %SRCS%   ../../src/netlib/html5.websocket/json/jsox.c


An old build of the documentation (there haven't been a LOT of updates) http://sack.sf.net containers

  • General

  • Memory

  • containers - threadsafe

    • list - items tracked by dynamic sized array of pointers to userdata
    • data list - Items are tracked by a dynamic sized array of structs
    • Queue - tracks a queue of pointers to userdata.
    • Data QUeue - Tracks a queue with a dynamic array of structures.
    • Link Stack - stack using a dynamic array of pointers to userdata
    • Data Stack - Stack using dynamic array of structs.
    • sets - A fixed length slab of data structure which are tracked by a bit field of allocated/free members in the set.
    • Binary tree - binary tree using 'set's of nodes that contain pointers to userdata and userkey information.
    • Text - a type abstraction for tracking strings as linked list of segments... include language text parser for getting phrases and words from other text.
      • JSON/JSON6 Parsers
      • JSOX
      • Sample Code
      • json_ and json6_ libraries work similarly to jsox_, only the prefixes are changed; and the enum used for the value_container type.
    • Url parsing and building (something like github.com/d3x0r/sack/include/url.h)
  • text

  • Math

Build Flags

Some platforms/permutations need flags defined to compile 'correctly'. The CMake build system for SACK takes care of these typically...

Flag Usage
__LINUX__ compile for posix type system. This should be defaulted if not _WIN32
_WIN32 compile for windows platform
__ARM__ compile targeting arm (some assembly otherwise available is replaced
__MAC__ comppile targeting Mac; minor differences in SockAddr structure
__NO_LOGGING__ Disable any internal logging; compiles to (0);
__64__ This should have a good default set; but this sets 64 bit platform target
__ANDROID__ certain changes for android system

Behavior

The default allocator is malloc/free. There is, additionally, an option added to disable mmap. There is a custom allocator which offers additonal protection on blocks, including scanning all blocks for over/underflow. A list of all blocks may be dumped (see memory document above), options can be enabled either way to allow memory allocation logging. This tracks back to the original sources' (if _DEBUG or _DEBUG_INFO are defined) file and line number.

This uses a single locking primitive that's a lock: xchg; if compiled with GCC prefers the comipler intrinsics for these operations. Uses windows InterlockedExchanged() function.

PLIST, PLINKQUEUE are strongly threadsafe by default. All other containers are also thread safe, but are not worthy of comment. The actual point is that PLIST and PLINKQUEUE types are optimally thread safe even when interacting on the same list or queue.

Compile Time Options

To Be Documented.

The default options for the above are conservative, but there may be more suitable options available at the low levels.

About

μCBoost-* are a family of single file amalgamations from SACK that provide common, useful extensions for C

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages