From e94e1c73fc7726927e4410efcffc16286084696b Mon Sep 17 00:00:00 2001 From: czjstmax Date: Thu, 18 Dec 2025 22:12:16 +0100 Subject: Added skeletons and styling guidelines for the project. - Added initial rbc.c (skeleton), contains styling guidelines and a brief project explanation. - Added .exrc for Vim/Neovim users to auto-apply the project's styling guidelines. --- .exrc | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .exrc (limited to '.exrc') diff --git a/.exrc b/.exrc new file mode 100644 index 0000000..f5963dd --- /dev/null +++ b/.exrc @@ -0,0 +1,44 @@ +if exists('g:crbc_compile_loaded') + finish +endif +let g:crbc_compile_loaded = 1 + +let s:cc = 'gcc' +let s:cflags = '-std=c23 -Wall -Wextra -pedantic' +let s:dbgflags = '-g -O0 -fsanitize=address,undefined' +let s:optflags = '-O2' + +function! s:Compile(debug) + if &filetype !=# 'c' && &filetype !=# 'cpp' + echoerr ">>> not a C/++ file!" + return + endif + + let l:src = expand('%') + "let l:out = expand('%:r') + let l:out = 'crbc' + + if a:debug + let l:cmd = printf( + \ '%s %s %s "%s" -o "%sDbg"', + \ s:cc, s:cflags, s:dbgflags, l:src, l:out + \ ) + echo ">>> compiling debug build .." + else + let l:cmd = printf( + \ '%s %s %s "%s" -o "%s"', + \ s:cc, s:cflags, s:optflags, l:src, l:out + \ ) + echo ">>> compiling release build .." + endif + + execute '!' . l:cmd +endfunction + +" user commands +command! Compn call s:Compile(0) +command! Cn call s:Compile(0) + +command! Compd call s:Compile(1) +command! Cd call s:Compile(1) + -- cgit v1.3.1