gitea
include_toc
none
true
Official URL of this project: https://codeberg.org/hiiamboris/red-common
A collection of my Red mezzanines & macros
Some of these are trivial. Some may look simple in code, but are a result long design process. Some are only emerging experiments. See headers of each file for usage, info, design info!
Notes:
I try to keep dependencies at minimum for simpler until it stops making sense
mostly untested for compileability so far; optimized for the interpreted use
use #include %everything.red
to include all the scripts at once and play
Source file
Description
setters
Contains ONCE, DEFAULT, MAYBE, QUIETLY, ANONYMIZE value assignment wrappers, and IMPORT/EXPORT to expose some object's words globally
with
A convenient/readable BIND variant
#hide macro
Automatic set-word and loop counter hiding
stepwise-macro and stepwise-func
Allows you write long compound expressions as a sequence of steps
trace
Step-by-step evaluation of a block of expressions with a callback
trace-deep
Step-by-step evaluation of each sub-expression with a callback
selective-catch
Catch break
/continue
/etc. - for use in building custom loops
reshape
Advanced code construction dialect to replace compose
and build
. Read more
without-GC
Evaluate code with GC temporarily turned off (brings massive speedup when used wisely)
scoping
Primitive experimental support for scope-based resource lifetime management
Design extensions and fixes
Source file
Description
#include macro
Smart replacement for #include directive that includes every file only once
## macro
Macro for arbitrary load-time evaluation, to be able to save and load any kind of value
bind-only
Selectively bind a word or a few only
catchers
TRAP - enhanced TRY, FCATCH - Filtered catch, PCATCH - Pattern-matched catch, FOLLOWING - guaranteed cleanup
classy object
Object 'class' support that adds type checks and per-word on-change functions to objects
typed object
Simple per-object type checks support
advanced function
Support for value checks and defaults in FUNCTION's spec argument
Source file
Description
step
Increment & decrement function useful for code readability
clip
Contain a value within given range
exponent-of
Compute exponent of a number (i.e. how many digits it has)
quantize
Quantize a float sequence into rounded bits (e.g. to get an integer vector)
extrema
Find minimum and maximum points over a series
median
Find median value of a sample
count
Count occurences of an item in the series
modulo
Working modulo implementation with tests
timestamp
Ready-to-use and simple timestamp formatter for naming files
Source file
Description
split
Generalized series splitter
join
Join a list as a string
delimit
Insert a delimiter between all list items
match
Mask based pattern matching for strings (used by GLOB)
keep-type
Filter list using accepted type or typeset
sift & locate
High level dialected series filter and finder Read more
collect-set-words
Deeply collect set-words from a block of code
morph
Dialect for persistent local series mapping. Read more
These functions mainly help one follow design-by-contract guidelines in one's code.
Source file
Description
debug
Simple macro to include some debug-mode-only code/data
assert
Allow embedding sanity checks into the code, to limit error propagation and simplify debugging. Read more
typecheck
Mini-DSL for type checking and constraint validity insurance
expect
Test a condition, showing full backtrace when it fails
show-trace
Example TRACE wrapper that just prints the evaluation log to console
show-deep-trace
Example TRACE-DEEP wrapper that just prints the evaluation log to console
shallow-trace
Basic step by step expression evaluator
parsee
Parse visual debugger. Read more
Source file
Description
profiling
Inline profiling macros and functions (documented in the header)
Source file
Description
entab & detab
Tabs to spaces conversion and back
format-number
Simple number formatter with the ability to control integer & fractional parts size
format-readable
Experimental advanced number formatter targeted at human reader (used by the profiler). For a better design see the Format module
prettify
Automatically fill some (possibly flat) code with new-line markers for readability
Source file
Description
glob
Allows you to recursively list files. Read more . Run tests
data-store context
Standardized zero-fuss loading and saving of data, config and other state (documented in the header)
Source file
Description
relativity
Face coordinate systems translation mezzanines
color-models
Reliable statistically neutral conversion between common color models
contrast-with
Pick a color that would contrast with the given one
is-face?
Reliable replacement for FACE? which doesn't work on user-defined faces
do-queued-events
Flush the View event queue
do-atomic
Atomically execute a piece of code that triggers reactions
do-unseen
Disable View redraws from triggering during given code evaluation
reactor92
A higher level on-deep-change*
replacement based on REP 92
embed-image
Macro to compile images into exe
explore & image-explorer style
Show UI to explore an image in detail (TODO: support any Red value)
scrollpanel style
Automatic scrolling capability to a panel, until such is available out of the box. Read more
tabbing support
Simpler and extensible replacement for native tabbing support (extended when using Spaces )
table style
Old experiment on VID-based table construction
Implementations not yet incorporated into the whole