uCBQN/build/src/clangd.bqn
dzaima 0b6c5189d8 move arithdDispatch declarations to a header
+ rename some things to make more sense
2023-07-31 20:26:05 +03:00

95 lines
3.6 KiB
BQN
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

AtRoot •args
Esc{
in (@+091013)"'""" # Null, Tab, LF, CR, and quotes
out "0tnr" # Whitespace characters changed to letters
i in𝕩
𝕩 i out((i<out)/) 𝕩 # Replace
(i<in) /"\"¨ 𝕩 # Insert \
}
n@+10
JStr {"""",Esc 𝕩,""""}
JArr {'['']'˜2𝕨¨ 𝕩}
JObj {'{',n,¯2(JStr¨𝕨) {" ",𝕨,": ",𝕩,',',n}¨ 𝕩, n,'}'}
Files {
res
{'d'=•file.Type AtRoot 𝕩? 𝕊¨ 𝕩•file.At¨ •file.List AtRoot 𝕩; res <𝕩} 𝕩
{(<¯2𝕩)".c"".h"}¨/ res
}
ModifyCBQNFlags {
filenames 4¨ ¨ 𝕩
flagK
flagV
WantsFlags {
𝕨 •file.At # ⋄ •Out 𝕨∾" wants flags "∾JArr JStr¨ 𝕩
flagK <𝕨
flagV <𝕩
}
WantsIncludes {
𝕨 WantsFlags ("-include""src"•file.At)¨ 𝕩
}
FilterPrefix {𝕨{𝕨(𝕨)𝕩}¨/ 𝕩}
# main core.h sequence, assuming MM==1
coreIncludes "h.h","core/stuff.h","core/heap.h","opt/mm_buddy.h","core/gstack.h","core/harr.h","core/numarr.h","core/chrarr.h","core/fillarr.h","core/derv.h","core/arrFns.h"
{(¯1𝕩) WantsIncludes ¯1𝕩}¨ 2 coreIncludes
CoreTil {coreIncludes˜coreIncludes<𝕩}
# MM==0 and MM==2
coreTilMM CoreTil "opt/mm_buddy.h"
{𝕩 WantsIncludes coreTilMM}¨ "opt/mm_2buddy.h""opt/mm_malloc.h"
# non-'utils/' headers & optional .c files
{𝕩 WantsIncludes "core.h"}¨
"ns.h", "vm.h", "builtins.h"
"opt/mm_malloc.c", "opt/mm_buddy.c", "opt/mm_2buddy.c", "opt/mm_buddyTemplate.c", "opt/mm_buddyTemplate.h", "opt/gc.c", "opt/gc.h"
"builtins/radix.h", "singeli/c/arithdDispatch.h"
"jit/nvm.h"
# and all the utils/ onces
{𝕩 WantsIncludes "core.h"}¨ "utils/" FilterPrefix filenames
# and some other things
"core/tyarrTemplate.h" WantsIncludes CoreTil "core/chrarr.h"
"core/tyarrTemplate.c" WantsIncludes "core/tyarr.c"
"builtins/grade.h" WantsIncludes "builtins/sort.c"
"singeli/c/arithdDispatch.c" WantsIncludes "builtins/arithd.c"
"singeli/c/cmp.c" WantsIncludes "builtins/cmp.c"
"utils/hashmapTemplate.h" WantsIncludes "utils/hash.h"
# give the expected environment for configuration-specific files
"opt/mm_2buddy.c" WantsFlags "-DMM=2"
"opt/mm_malloc.c" WantsFlags "-DMM=0"
"utils/valgrind.h" WantsFlags "-DUSE_VALGRIND"
"core/heap.h" WantsFlags "-DHEAP_VERIFY"
{𝕩 WantsFlags "-DSINGELI"}¨ "singeli/c/" FilterPrefix filenames
# template files
"builtins/sortTemplate.h" WantsIncludes "core.h", "utils/talloc.h"
"builtins/sortTemplate.h" WantsFlags "-DSORT_NAME=", "-DSORT_TYPE=B", "-DSORT_CMP=compare"
# deduplicate flag files
gfk flagK
gfv ¨ (flagK) flagV
# resolve flags to actual files
𝕩 {nf 𝕊 f2: n, f"-Wno-undefined-internal", "-DCLANGD"f2}¨ (gfk•file.At¨ filenames)gfv <
}
objects
Finish { 𝕊:
objects ModifyCBQNFlags(({"src/"4𝕩}¨ objects)/)
FileObj { nameflags:
"file""directory""arguments" JObj JStr name, JStr AtRoot "", ", " JArr JStr¨ flags
}
res (","n) JArr FileObj¨ objects
resPath AtRoot "compile_commands.json"
resPath •FChars res
•Out "Wrote clangd compile commands to "•file.At resPath
}
_add {objects <𝕩, (𝔽@)<𝕩}