Menu

Tree [555bae] master /
 History

HTTPS access


File Date Author Commit
 Edit 2025-02-10 timon37 Tomasz Borowik timon37 Tomasz Borowik [89432d] SC: various helpers and some fixes
 clang-c2sc 2025-01-10 timon37 Tomasz Borowik timon37 Tomasz Borowik [6c166a] clang-c2sc: more revive
 dep-src 2023-03-02 timon37 Tomasz Borowik timon37 Tomasz Borowik [e16696] update: deps, setup instructions, default.nix
 inc 2025-02-10 timon37 Tomasz Borowik timon37 Tomasz Borowik [89432d] SC: various helpers and some fixes
 include_def_64bit 2023-10-12 timon37 Tomasz Borowik timon37 Tomasz Borowik [fe318f] FC: trans (split into multiple due to FUCKING d...
 libsc 2025-06-04 timon37 Tomasz Borowik timon37 Tomasz Borowik [348b53] SCP: fix array typedef
 mgr 2013-07-02 timon37 timon37 [6fc3ae] Some preliminary keyboard movement
 scgcc 2013-06-23 timon37 timon37 [941cf3] Brand new and awesome tree of CellInfo
 test 2025-06-29 timon37 Tomasz Borowik timon37 Tomasz Borowik [555bae] test_profile
 .gitattributes 2014-07-26 timon37 timon37 [cdb6ab] Make room for merging in tSC_Sym_Pair
 .gitignore 2025-01-10 timon37 Tomasz Borowik timon37 Tomasz Borowik [20f5a0] clang-c2sc: split SCT.cpp into more files, mino...
 .gitmodules 2017-07-13 timon37 timon37 [3cb35f] libconfuse as submodule
 CMakeLists.txt 2025-06-27 timon37 Tomasz Borowik timon37 Tomasz Borowik [350a08] cmake: improve build speed by instructing cmake...
 CMake_Normal.cmake 2023-04-21 timon37 Tomasz Borowik timon37 Tomasz Borowik [cb17da] cmake: move all SC_proc_manual for SCE.sc together
 CMake_SC-tools.cmake 2025-06-27 timon37 Tomasz Borowik timon37 Tomasz Borowik [350a08] cmake: improve build speed by instructing cmake...
 CMake_Test-tools.cmake 2018-06-28 timon37 timon37 [4d8295] CMake: rename files (for test/ autocomplete;p)
 README 2023-11-17 timon37 Tomasz Borowik timon37 Tomasz Borowik [5ae618] minor readme
 README_FC 2023-03-30 timon37 Tomasz Borowik timon37 Tomasz Borowik [0bc1a9] sctrans: improve scripts and add README_FC
 SCP.c 2025-01-05 timon37 Tomasz Borowik timon37 Tomasz Borowik [26be2a] gcc-14 "fixes"
 add_sci.c 2012-09-01 timon37 timon37 [bd4fdb] Comment a lot of printfs
 clang.nix 2025-04-06 timon37 Tomasz Borowik timon37 Tomasz Borowik [d2a86c] default.nix improve QT_QPA_PLATFORM_PLUGIN_PATH
 comp_s 2017-11-04 timon37 timon37 [1f0e3e] change #!/bin/bash to #!/usr/bin/env bash, beca...
 comp_splitc 2017-11-04 timon37 timon37 [1f0e3e] change #!/bin/bash to #!/usr/bin/env bash, beca...
 comp_trans 2023-03-30 timon37 Tomasz Borowik timon37 Tomasz Borowik [0bc1a9] sctrans: improve scripts and add README_FC
 default.nix 2025-04-06 timon37 Tomasz Borowik timon37 Tomasz Borowik [d2a86c] default.nix improve QT_QPA_PLATFORM_PLUGIN_PATH
 e 2018-02-10 timon37 timon37 [360611] add SC_CONF= in PS1
 gen_include 2017-11-04 timon37 timon37 [1f0e3e] change #!/bin/bash to #!/usr/bin/env bash, beca...
 gen_trans 2023-03-25 timon37 Tomasz Borowik timon37 Tomasz Borowik [827c1d] sctrans: fixup
 gen_transF 2023-03-25 timon37 Tomasz Borowik timon37 Tomasz Borowik [827c1d] sctrans: fixup
 obj2fnc 2023-01-31 timon37 timon37 [4a443f] whoops
 run_conflict 2023-02-03 timon37 timon37 [406473] DPM: don't recursively pair N_Enum from T_Enum,...
 s2fnc.awk 2017-01-26 timon37 timon37 [6ecf01] rework s2fnc and add sdiff (not too useful though)
 sc.c 2025-02-10 timon37 Tomasz Borowik timon37 Tomasz Borowik [34405b] minor sc & proc improvements
 sccomp 2025-01-17 timon37 Tomasz Borowik timon37 Tomasz Borowik [aa71e4] fix sccomp not detecting compile errors after a...
 scmerge 2018-06-30 timon37 timon37 [132eff] merge: improve file copies on conflict
 scproc.c 2025-02-10 timon37 Tomasz Borowik timon37 Tomasz Borowik [34405b] minor sc & proc improvements
 sctrans 2023-03-30 timon37 Tomasz Borowik timon37 Tomasz Borowik [0bc1a9] sctrans: improve scripts and add README_FC
 sdiff 2017-01-26 timon37 timon37 [6ecf01] rework s2fnc and add sdiff (not too useful though)
 setup_full 2025-02-08 timon37 Tomasz Borowik timon37 Tomasz Borowik [fa7309] oops
 tdiff_file 2017-01-26 timon37 timon37 [6ecf01] rework s2fnc and add sdiff (not too useful though)
 tdiff_git 2017-01-26 timon37 timon37 [6ecf01] rework s2fnc and add sdiff (not too useful though)
 todo_ideas 2023-12-09 timon37 Tomasz Borowik timon37 Tomasz Borowik [d4e411] SCM: fix FCall_Ass not being correctly duplicat...

Read Me

######### Major parts:

##### Main binaries/plugins/scripts:
scedit_v2		the SC source code editor (also can be used as a processor)
scproc		the SC source code processor, used for running meta-code on files
SCP			the SC to C printer, used for compiling and for diff visualization in git
sccomp		a bash script that facilitates compilation (uses SCP)
scdiff		diff SC source code
scpatch		patch SC source code
clang-c2sc		plugin to clang, for translating C to SC (mainly used for headers)

scmerge		bash script which uses scdiff & scpatch to optimistically merge (things will fail horribly and potentially silently on any conflicts)


######### Compiling stuff from nothing

git submodule init
git submodule update

###### libjit dependency
nix-shell # if running on nixos
cd dep-src/libjit
./bootstrap
./configure --prefix="$(realpath "$PWD/../../dep")"
make -j12 install

###### libconfuse dependency
nix-shell # if running on nixos
cd dep-src/libconfuse
#potentially also below libtoolize command:
#	libtoolize --force
./autogen.sh
./configure --prefix="$(realpath "$PWD/../../dep")"
make -j12 install

###### 64bit linux full dev setup

### Update:
### Instead of the instructions below you can use the setup_full script
### However it is advised to ispect it first in case of stupid mistakes etc...

There are two relevant install paths: "local" and "system/global" (except I keep it in my ~/bin/sc where ~/bin/sc/bin/ is added to my PATH env)
I use these 5 build folders (to play around with the editor you only need the first step):
build-boot	for bootstrapping to the "system/global" path
build-sys	for installing to the "system/global" path
build		for installing to the local dst folder (subdir of SC repo)
build-dst	same as above but using the tools from dst instead of system
build-bootdst	for bootstrapping into the dst folder

### build-boot
# so first decide on a "global/system" install prefix, I use:
PREFIX="$HOME/bin/sc"
COMMON="-GNinja -DCMAKE_BUILD_TYPE:string=RELWITHDEBINFO -DKeyMap:string=dvorakqwerty -DOPT_GIT2:bool=1 -DOPT_HEAVY_TESTS:bool=1 -DOPT_OBSTACK:bool=1"

mkdir build-boot
cd build-boot
cmake .. $COMMON -DCMAKE_INSTALL_PREFIX:path=$PREFIX -DOPT_BOOTSTRAP:bool=1
ninja install

# now you should have the tools and headers installed, but to open libsc/SCE.sc
# you'll still need to set some extra environment variables
# if you used the same PREFIX as me just do the following from the repository folder
source e
# if not just modify SC_ROOT in that file to your PREFIX
# then you can do:
scedit_v2 libsc/SCE.sc


### build-sys
# note: ehm I'm not sure but if you run into trouble try this from a terminal that doesn't have the variables from e set
mkdir build-sys
cd build-sys
cmake .. $COMMON -DCMAKE_INSTALL_PREFIX:path=$PREFIX -DSC_ROOT:path=$PREFIX
ninja install

# now you're self-hosted, but in a somewhat dangerous way which is why for developing SC you'll want two more folders

mkdir build
cd build
cmake .. $COMMON -DCMAKE_INSTALL_PREFIX:path=../dst -DSC_ROOT:path=$PREFIX
ninja install
cd ..

mkdir build-dst
cd build-dst
cmake .. $COMMON -DCMAKE_INSTALL_PREFIX:path=../dst -DSC_ROOT:path="$(readlink -f ../dst)"
ninja install


###### 32bit linux or other OSes
sorry out of luck for now


###### howto compile sc files
# theres's a few ways actually, the simplest is just print the file to .c and compile that
SCP file.sc > file.sc.c
gcc file.sc.c

# for big files you cane use the script below to print the file into smaller chunks detect changes and recompile as needed
sccomp -- file.sc -I/home/bin/sc/include


###### generate SC system-headers
./gen_include /usr/include/stdio.h


##### git SC integration

#add to .git/config:
[diff "sc"]
	textconv = sc print -v
[merge "sc"]
	name = scmerge
	driver = sc merge %O %B %A %P
	recursive = binary

#add to .gitattributes:
*.sc	diff=sc merge=sc
*.sh	diff=sc merge=sc
*.scp	diff=sc merge=sc
*.shp	diff=sc merge=sc

###### clang-c2sc (for translating C to SC)
most likely clang versions to work is 3.8 (maybe 3.1, 2.8, or others just try and see)
note: you'll quickly come to hate this, i'm doin it on an as needed basis so you might have to add support for some more AST classes

#on nixos make sure to do this in: nom-shell clang.nix
cd clang-c2sc
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=RELWITHDEBINFO
make

# now you have the plugin c2sc.so in clang-c2sc/build/lib
# and you can run it like this:

clang -cc1   -load clang-c2sc/build/lib/c2sc.so   -plugin c2sc   file.c   &> out_log

the SC output is written into OUT.sc
if the out_log contains any "error:" then expect the OUT.sc file to be broken
usually the errors will be missing .h files
so you will probably have to add flags and paths like -I/usr/include
look into the gen_include script for hints of what to do

you can give additional c2sc specific options like -fnc-imp or -type-imp like this: -plugin-arg-c2sc -fnc-imp   -plugin-arg-c2sc -type-imp
these options control if the translator will include everything or just the stuff that originates from the source file

Alternatively it may be necessary to run e.g. more like this:
clang++ -Xclang -load -Xclang clang-c2sc/build/lib/c2sc.so  -Xclang -plugin -Xclang c2sc file.cpp
clang++ -Xclang -load -Xclang clang-c2sc/build/lib/c2sc.so  -Xclang -plugin -Xclang c2sc -Xclang -plugin-arg-c2sc -Xclang -fnc-imp  -Xclang -plugin-arg-c2sc -Xclang -type-imp file.cpp
#btw I think clang is a bit stupid... and seriously lacks docs (not that gcc is much better;p)

###### gcc sc frontend ## DEPRECATED
I've only used 4.4.3 for now no idea if other versions are compatible 

ln -s ../../scgcc gcc-4.4.3/gcc/sc
mkdir gcc-build
cd gcc-build
../gcc-4.4.3/configure --prefix=~/bin/sc/ --enable-languages=c,sc
i generally add a lot more options based on my default system gcc -v, though some stuff like cloog tends to fail,
you should not include all the prefix modifiers, and it's best to compile just c and sc

then run make, you can use -j6 or whatever but it can fail at some point if it does just run make without -j for a moment
after 10 seconds or more you can ctrl+c it and run make -j6 again

make install

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.