Skip to content

Instantly share code, notes, and snippets.

Red [
Title: "Red value inspector"
Author: "Rudolf W. MEIJER"
File: %value-inspector.red
Rights: {Copyright (c) Rudolf W. Meijer 2018}
Purpose: {To expose implementation information}
Comment: {This program shows, for a given Red value, the implementation
at hardware memory level; it is aware of the various Red/System
structures that implement value slots, and of the storage
schemes for series values, symbols, and contexts.}
Red [
Title: "Red value slot implementation dump for Red inspector"
]
;---|----1----|----2----|----3----|----4----|----5----|----6----|----7----|-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; auxiliary functions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Red [
Title: "Data structure information for Red inspector"
]
;---|----1----|----2----|----3----|----4----|----5----|----6----|----7----|-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; construct the structures table consisting of pairs of
; structure name (alias struct!) and block of entries [field name]
; the header field is not stored as it is the same for every structure
flatten: func [
"Remove new-line markers from block, paren or hash"
blk [any-list!]
/deep "remove the markers also from sub-blocks etc."
][
new-line/all blk off
if deep [
forall blk [
if block? blk/1 [flatten/deep blk/1]
]
to-local-time: func [
"adjusts a time given as UTC, or a date containing a time, to the local timezone"
d [time! date!]
][
either time? d
[
d + now/zone
][
if d/timezone [
d/timezone: now/zone
@meijeru
meijeru / form-explorer.red
Last active June 10, 2018 19:51
Red program to show application of to-string, form and mold(/all) on values of all types
Red [
Title: "String conversion explorer"
Purpose: {Show application of to-string, form and mold(/all) on all types}
Author: "Rudolf W. MEIJER"
File: %form-explorer.red
Date: 8-Jun-2018
Notes: {Baed on earlier attempt for Rebol}
Language: 'English
Tabs: 4
]
@meijeru
meijeru / form.html
Last active November 21, 2019 20:30
string-conversion table
<h3>String conversions</h3>
<table border=0 cellspacing=1 cellpadding=5 bgcolor=gray>
<tr>
<th>type</th>
<th>expression</th>
<th>to-string</th>
<th>form</th>
<th>mold</th>
<th>mold/all</th>
</tr>
Red [
Title: "Case folding table converter"
Purpose: {Transform Unicode data file into Red/System literal array}
Author: "Rudolf W. MEIJER"
File: %convert.red
Version: 0.1
Rights: Copyright (c) 2018 Rudolf W. Meijer
History: [
[0.1 2-Jul-2018 {Start of project}]
]
@meijeru
meijeru / check-structure.red
Last active February 1, 2019 16:22
Check if brackets/parens are matching in a Red source and give errors with indication of line number
Red [
Title: "Red program structure checker"
Purpose: {Check if brackets/parens are matching in a Red file
and give errors with indication of line number}
Author: "Rudolf W. MEIJER"
File: %check-structure.red
History: [
[0.0 04-Jan-2019 {Start of project}]
[0.5 05-Jan-2019 {First working version}]
[0.6 01-Feb-2019 {Added %" "}]
@meijeru
meijeru / word-finder.red
Last active April 6, 2020 09:06
Word-finder: find occurrences of any word in the toolchain source files
Red [
Title: "Word finder"
Purpose: {Find occurrences of words in the source files
of the Red toolchain and display them}
Author: "Rudolf W. MEIJER"
File: %word-finder.red
Needs: 'View
Rights: "Copyright (c) 2019 Rudolf W. MEIJER"
History: [
[0.0 23-Jan-2019 {Start of project}]