Skip to content

Instantly share code, notes, and snippets.

@meijeru
Created March 6, 2018 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meijeru/d00c4ab5efcd1ece1d19a61369aba48a to your computer and use it in GitHub Desktop.
Save meijeru/d00c4ab5efcd1ece1d19a61369aba48a to your computer and use it in GitHub Desktop.
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
structures-table: make block! 150
structures-grammar: [
thru 'cell!
some [
copy name set-word!
(insert tail structures-table to word! to-string name)
'alias 'struct! into
[
'header into ['integer!]
(insert/only tail structures-table make block! 3)
some [
copy field word! into [some word!]
(insert tail last structures-table field)
]
]
]
]
structures-def: load append copy red-sources %runtime/datatypes/structures.reds
unless parse structures-def structures-grammar [
print "error in structures table"
halt
]
foreach [type struct] types-table [
unless find structures-table struct [
print ["type data inconsistency" struct]
halt
]
]
series-def: fourth find load append copy red-sources %runtime/allocator.reds 'series-buffer!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment