From 1ce8c47bcce9206e2bee30fd1cad0d8b20c60d70 Mon Sep 17 00:00:00 2001 From: "sigonasr2, Sig, Sigo" Date: Mon, 25 Jul 2022 13:46:34 -0500 Subject: [PATCH] Initial commit --- C/scripts/build.sh | 7 ++ C/scripts/commit.sh | 20 +++++ C/scripts/filelist | 2 + C/scripts/md5 | 2 + CProjectTemplate | Bin 0 -> 16696 bytes README.md | 19 +++++ install | 15 ++++ main | Bin 0 -> 18152 bytes main.c | 173 +++++++++++++++++++++++++++++++++++++++ project/extras.c | 6 ++ project/extras.h | 1 + project/utils/utils.h | 4 + sig | 9 ++ utils/.coauthors | 1 + utils/.updateDirectories | 4 + utils/define.sh | 26 ++++++ utils/filelist | 5 ++ utils/main.sh | 28 +++++++ utils/md5 | 4 + utils/search.sh | 103 +++++++++++++++++++++++ 20 files changed, 429 insertions(+) create mode 100755 C/scripts/build.sh create mode 100755 C/scripts/commit.sh create mode 100644 C/scripts/filelist create mode 100644 C/scripts/md5 create mode 100755 CProjectTemplate create mode 100644 README.md create mode 100755 install create mode 100755 main create mode 100644 main.c create mode 100644 project/extras.c create mode 100644 project/extras.h create mode 100644 project/utils/utils.h create mode 100755 sig create mode 100644 utils/.coauthors create mode 100644 utils/.updateDirectories create mode 100755 utils/define.sh create mode 100644 utils/filelist create mode 100644 utils/main.sh create mode 100644 utils/md5 create mode 100644 utils/search.sh diff --git a/C/scripts/build.sh b/C/scripts/build.sh new file mode 100755 index 0000000..3cbcb64 --- /dev/null +++ b/C/scripts/build.sh @@ -0,0 +1,7 @@ +#Compiles the entire program then runs it, producing an executable. +#C +printf "Running program...\n\n\n" +if gcc $(find . -type f -name "*.c") ${CUSTOM_PARAMS} -o ${PROJECT_NAME}; then + ./${PROJECT_NAME} "$@" +fi +printf "\n\n" diff --git a/C/scripts/commit.sh b/C/scripts/commit.sh new file mode 100755 index 0000000..0f56a8f --- /dev/null +++ b/C/scripts/commit.sh @@ -0,0 +1,20 @@ +#Adds a commit message and pushes project to github repository. +#C +COMMIT_MESSAGE="$*" +FIRST_LINE=true +while IFS= read -r line +do +if [ "$FIRST_LINE" = true ]; then + COMMIT_MESSAGE+=" + +Co-authored-by: $line" +FIRST_LINE=false +else + COMMIT_MESSAGE+=" +Co-authored-by: $line" +fi +done < utils/.coauthors +git add -u +git add * +git commit -m "$COMMIT_MESSAGE" +git push \ No newline at end of file diff --git a/C/scripts/filelist b/C/scripts/filelist new file mode 100644 index 0000000..e0fa154 --- /dev/null +++ b/C/scripts/filelist @@ -0,0 +1,2 @@ +build.sh +commit.sh diff --git a/C/scripts/md5 b/C/scripts/md5 new file mode 100644 index 0000000..2749234 --- /dev/null +++ b/C/scripts/md5 @@ -0,0 +1,2 @@ +build.sh:fcbd8c14fe2a608d11166cf5aa7dba02 - +commit.sh:89783d2e6a165aa9612c79cfbd804a35 - diff --git a/CProjectTemplate b/CProjectTemplate new file mode 100755 index 0000000000000000000000000000000000000000..deadea398858006a6c816b2cd5e892b6f935c76e GIT binary patch literal 16696 zcmeHOZ)_Y#6`%9j@ujiPm(-z7QsNB_C?WC2P95VEOz!+Id)4I+iA{`}baVEt?SuPc z?)F-{f?{x6_0$@yN~jf7Y9k?mR4ReQhwuS#2$Uevs`&ziQV|NFE=r3NQWT)c@!srv z=iT)=NQF{HIdAU9XjUg%WyNoAM0TQF#4x4bgMHY+GT}~XL`c4wE9g1joj_l5n9pfU^$H?)- znBb?A;^{^O$}lPNTL`z^5ZSr0m-HF24opWcnu+&P-(j+ARHPf>My`jE>-z-Q@sL`U zH~;2gK0@`aG!7cYpOL~VcBPWT9qqePiI!9{Q1>89bxXCPA~vgvqRg@O3H)2SJrp)3SEJUQ)CazP`ML?OwF>6x z`ea@Z9|&9J%(MIo4hSS1ORSI61sl(E2+J01JYNgQFWPu{UqceoH5+fgUS1}?7Ie7J z(!l%jBH%^9i+~paF9Kc!ya;#^_`iz4UmG_6Lz}r2&>pM#^)4Z_hv&_z(#zV+PXcFU z97=n>2K1HE2fq%`&@51Y980de`TJ6-G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-?Y^s{_?pMwrmiRIUYANX|;pGEqe;@_29fmgUP8-7Oe%jd~1;6q}= zvUySu{JN^;*F^{NHou&`dj&p8{@wEvcQz?(Y{Q3vUt6_7@O_qxo|CqItm>mzt#BM+xF5?OsLl^u?!^n{ts<@I=BQjBEN z6Dh+q5^85_M_XkjJS&pai;%P%q6w>J_FtJHGXqpaHJW&Eo()Io$ zkpq2t-@#rTj*2+-5<>6&)WOJsXpgf*o=E`;&g$rW8hOxqj|hE#>`-?krXT9>KiW5- z4@A0Sedtx5WEsg9WQ%WpcEw1<%{U#235Oj=Ufc&_+{I{VoqB;Pokw8wL_VvJ$1@2$ z9uqwTT8U&vFXRpA;!^7{NFWdA^W;VzyU}$xUBdywV>cDg(l}4=IGZNa{8ZYE4+EMx z3&%MJM}LgmgiteC(@@7U1$82qoiK9dl#LoLB;ov3GC@?NJKAE#$AnZLkLSmQnwZK! z6&9K~tK>c-mrrIh4nc>qoRNy70p%uArchv{%rb}Q3Kgbz8m6rKT6qsL{?fsv2lr4b@j8o<*XvX) zbvciC2Yhgi%=Ww=k+4vx2Rt1BgUES`FSA;9Cn%Qd0ol)5R};y`mm?Z zf`HEuY|raYMqGzr;`Xy15;x+aX<-;Z4Oyv}E==Y|uyd_8XH{(E>Zjo3l>46 literal 0 HcmV?d00001 diff --git a/README.md b/README.md new file mode 100644 index 0000000..cc55afb --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +This repository provides a template for starting a new C project using Sig's build system! Updates are automatically propogated. Run `./sig` for a list of commands and then use follow the instructions given to invoke them. Adjust variables as necessary in the `sig` command file. + +``` +@sigonasr2 ➜ /workspaces/CProjectTemplate (main) $ ./sig +Dev build, no checks required. + + Usage: ./sig {args} + +==== Current Configuration ===================== + PROJECT_NAME CProjectTemplate + BUILD_OPTIONS -lncurses + LANGUAGE C +===================================================== + + Command List: + + build Compiles the entire program then runs it, producing an executable. + commit Adds a commit message and pushes project to github repository. +'`` \ No newline at end of file diff --git a/install b/install new file mode 100755 index 0000000..cf8dc5d --- /dev/null +++ b/install @@ -0,0 +1,15 @@ +echo "Initializing..." +FILES=$(ls -dA */) +LANGUAGES=() +for f in $FILES +do + if [ "$f" != "scripts/" ] && [ "$f" != "utils/" ]; + then + LANGUAGES+=(""${f::-1}"") + fi +done +echo "Languages Detected:" +for f in "${LANGUAGES[@]}" +do + printf "\t%-15s\n" $f +done \ No newline at end of file diff --git a/main b/main new file mode 100755 index 0000000000000000000000000000000000000000..0abb25ce04b3c6256573f5ed33b30a2ab70e664a GIT binary patch literal 18152 zcmeHP4|G)3nZJ_|2m+a)WI?QCbfE>2F<7J^MQ1`DytD~KAcdY5haodbW=&?|{4s{jTYCLh1Qs&jS9^EzWe9p z&0}7>XHWN>J$rI>-gm#>_vhaG-TUr+@8(?|(CRi8IUG!-Vs-~3ZuDw_c%)$IoiYRB zVQbhNTr1fkHXZyljtRL(5J*KDDaxm%5-$cNy9JafKtCp6rl_hRQL?j3{j-EbQC2Q^ zvMZsi1*^Xi}akH?S_;fy1?Owwx1(~cDxg)#M6+*vs zeLgLhP?@Ad ziR@(;8~j4#NJq5)!D80KT!g86W9ODvuYV=@v-a1P?^h7FHDBHVBX4Ol%zk8p&js$v z(-cfMNFhJpx4{>o;)V1BHu^uc!M|&RKV*ads}24;8~h#{{C1oAFSfzywsqlWO>qE) z;_x{eyu`-;aU1=98~h(^@Le`IO;axXtm#nzh3Y>W^_ER4;4kCH z^{a(Y%|i_LTev9^jRj+LldWdH+U@neKrk9?3B}^U==S;zZIN(ryMIqxkokNq?UArA z7WYTvKA%u6s2B*gb%w&M(;o;lwX$#|*wh*U7mr7MkuYn&uOk`?$2(bPOE3<3`+c1X z5Gu{htSQnKiTau%;dn3{XPwbtb2J!hWt~lJL4TBmgPq)ed*r?#3xz{*Uxz;w<+)f> zl!*#*7u3FZDBK(otqVs`HGdboC)m~D4?r-xTw;`#Z>_NvJoqMVjtm zP5w4ew7zMt-`5-p``beMC>W$CgVF9sb2ru1R&Vg#>b})|8{530aq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A;%VcJ0{hnA% zwuB$J$~z=xXVpoE#B7E9gqoey=fm+gH3iVQxPph>^3R3kM_+bmbF*C$%pL1$kNfw4 z#-oC^svOS91*09z9gf6 z2fD&2LeO|rNbUu!mFrA#c?#N2VrmCQ|Z zF0>>3{&ojjd_}9Iy4u&W*53~~?P)1{weO|qVJV= zx>FG{ zqG+37jjOf%UqE8EA8-j(MV}&}DOt;Z3o_bUk+;3EZ>0WR2CKf}6@3@BPLsW{FR=n3 zlF}30B(LyG5YX6F<*WS*_3v!ZdoLxr|0pRt)sKG%jGCzI)qd3i`J$8|BU4iLicW{I z*`9f%a+RQ}9OXjUDW3K}2vg;|JVH{g>{Z7~1DB+V%$4O!bpMNm-vd +#include +#include +#include +#include "project/utils/utils.h" + +void drawBorder(WINDOW*box) { + int rows=getmaxy(box)+1; + int cols=getmaxx(box)+2; + int x=getbegx(box); + int y=getbegy(box); + //mvwprintw(box,3,1,"%d %d %d %d",x,y,rows,cols); + move(y-1,x-1); + for (int yy=0;yy=0)?currentcol-1:7); + }break; + } + } + if (clock()-lastTime>FRAMETIME) { + if (resizeOccured) { + resizeOccured=false; + clear(); + delwin(messageBox); + messageBox=newwin(4,cols-2,rows-5,1); + } + //mvprintw(5,7,"There are %dx%d squares. (%d)",cols,rows,frameCount++); + drawBackground(¤tcol,0,0,0,cols-1,rows); + if (messageBox!=NULL) { + drawBorder(messageBox); + mvwprintw(messageBox,0,0,"There are %dx%d squares. (%d) It is good!",cols,rows,frameCount); + } + for (int i=0;i<25;i++) { + if (keyLog[i]>0) { + mvprintw(6+i,2,"Key %d was pressed.",keyLog[i]); + short r,g,b; + color_content(currentcol,&r,&g,&b); + mvprintw(6+i,30,"%d %d %d",r,g,b); + } + } + refresh(); + wrefresh(messageBox); + lastTime=clock(); + frameCount++; + } + } + free(keyLog); + endwin(); + return 0; +} diff --git a/project/extras.c b/project/extras.c new file mode 100644 index 0000000..e70a274 --- /dev/null +++ b/project/extras.c @@ -0,0 +1,6 @@ +#include +#include "extras.h" + +void writeExtras(){ + addch(ACS_PI); +} \ No newline at end of file diff --git a/project/extras.h b/project/extras.h new file mode 100644 index 0000000..bcd992e --- /dev/null +++ b/project/extras.h @@ -0,0 +1 @@ +void writeExtras(); \ No newline at end of file diff --git a/project/utils/utils.h b/project/utils/utils.h new file mode 100644 index 0000000..fb07948 --- /dev/null +++ b/project/utils/utils.h @@ -0,0 +1,4 @@ +#define true 1 +#define false 0 +#define boolean char +#define byte char \ No newline at end of file diff --git a/sig b/sig new file mode 100755 index 0000000..92f6cdb --- /dev/null +++ b/sig @@ -0,0 +1,9 @@ +export AUTO_UPDATE=true + +source utils/define.sh + +define PROJECT_NAME "main" +define CUSTOM_PARAMS "-lncurses" +define LANGUAGE "C" + +source utils/main.sh \ No newline at end of file diff --git a/utils/.coauthors b/utils/.coauthors new file mode 100644 index 0000000..b904d0f --- /dev/null +++ b/utils/.coauthors @@ -0,0 +1 @@ +sigonasr2 diff --git a/utils/.updateDirectories b/utils/.updateDirectories new file mode 100644 index 0000000..0c078d1 --- /dev/null +++ b/utils/.updateDirectories @@ -0,0 +1,4 @@ +Java/ +C/ +scripts/ +utils/ \ No newline at end of file diff --git a/utils/define.sh b/utils/define.sh new file mode 100755 index 0000000..214fc50 --- /dev/null +++ b/utils/define.sh @@ -0,0 +1,26 @@ +export VARS=("") + +export LANGUAGE="" + +function define() { + VARS+=("$1") + value="${*:2}" + eval export "$1"='$value' +} + +if [[ $(pwd) != *"SigScript" && $AUTO_UPDATE = "true" && $1 != "update" ]]; then + source utils/search.sh + + find . -type f -name md5 -delete + find . -type f -name filelist -delete + + #Check for hashes + FILES=$(cat utils/.updateDirectories) + for f in $FILES + do + search $f + check $f + done +else + echo "Dev build, no checks required." +fi \ No newline at end of file diff --git a/utils/filelist b/utils/filelist new file mode 100644 index 0000000..95ad5ff --- /dev/null +++ b/utils/filelist @@ -0,0 +1,5 @@ +.coauthors +define.sh +main.sh +search.sh +.updateDirectories diff --git a/utils/main.sh b/utils/main.sh new file mode 100644 index 0000000..0a4c92a --- /dev/null +++ b/utils/main.sh @@ -0,0 +1,28 @@ +if [ -z "$1" ] + then + echo "" + echo " Usage: ./sig {args}" + echo "" + printf "====\tCurrent Configuration" + printf "\t=====================" + for t in ${VARS[@]} + do + printf "\n\t%-15s%20s" $t ${!t} + done + printf "\n=====================================================" + echo "" + echo "" + echo " Command List:" + FILES=$(ls -1A ./$LANGUAGE/scripts 2>/dev/null | sed -e 's/\.sh$//' | sed -e 's/^/ /') + for f in $FILES + do + if [ -f "./$LANGUAGE/scripts/$f.sh" ]; then + DESC="$(head -n1 ./$LANGUAGE/scripts/$f.sh)" + printf "\n\t%-15s%-65s" $f "${DESC:1}" + fi + done + echo "" + exit +fi + +./$LANGUAGE/scripts/$1.sh "${@:2}" \ No newline at end of file diff --git a/utils/md5 b/utils/md5 new file mode 100644 index 0000000..b8c2ada --- /dev/null +++ b/utils/md5 @@ -0,0 +1,4 @@ +define.sh:3ecab0dffe2adfb950f3eb7c7061b750 - +main.sh:4e6e9f0650ec790ce2c4364db94f0caa - +search.sh:81d08f5ff48e8a44b5f68387d426da05 - +.updateDirectories:fa5e95db12be22ae8aed7ecbc560e38c - diff --git a/utils/search.sh b/utils/search.sh new file mode 100644 index 0000000..99a69b3 --- /dev/null +++ b/utils/search.sh @@ -0,0 +1,103 @@ +function search() { + FILES2=$(ls -A $1 2>/dev/null) + for g in $FILES2 + do + if [ -d $1$g ]; + then + echo "$1$g is a directory" + search $1$g/ + else + echo "$1$g is a file" + if [ $g != "md5" ] && [ $g != "filelist" ] && [ $g != ".package.files" ]; then + if [ $g != ".coauthors" ] && [ $g != "version_info" ]; then + SUM=$(md5sum < $1$g) + echo "$g:$SUM" >> $1md5 + fi + echo "$g" >> $1filelist + else + echo " ignoring $g..." + fi + fi + done +} + +function check() { + echo "Check $1" + FILES2=$(ls -A $1 2>/dev/null) + if [ -f "$1/md5" ]; + then + echo " md5: https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1md5" + curl -H 'Cache-Control: no-cache, no-store' -s "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1md5" --output /tmp/out + cmp -s $1/md5 /tmp/out + if [ "$?" -ne 0 ] + then + echo " Differences detected!" + cat /tmp/out + while IFS= read -r line + do + IFS=':' read -ra split <<< $line + g="${split[0]}" + echo "LINE -- $g" + if [ "$g" != "md5" ] && [ "$g" != "filelist" ] && [ "$g" != ".package.files" ]; then + if [ -f $1$g ]; + then + if [ "$g" != ".coauthors" ] && [ "$g" != "version_info" ]; then + echo "++Redownload $1$g..." + if [ -f "$1$g" ]; then + curl -H 'Cache-Control: no-cache, no-store' "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g" --output $1$g + else + echo "===Could not find directory, assuming regular scripts directory exists." + curl -H 'Cache-Control: no-cache, no-store' "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g" --output $LANGUAGE/scripts/$g + fi + fi + else + echo "++==Downloading $1$g..." + curl -H 'Cache-Control: no-cache, no-store' "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g" --output $1$g + fi + fi + done < /tmp/out + fi + fi + if [ -f "$1/filelist" ]; + then + echo " filelist: https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1filelist" + curl -H 'Cache-Control: no-cache, no-store' -s "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1filelist" --output /tmp/out + cmp -s $1/filelist /tmp/out + if [ "$?" -ne 0 ] + then + echo " Differences detected!" + cat /tmp/out + while IFS= read -r line + do + IFS=':' read -ra split <<< $line + g="${split[0]}" + echo "LINE -- $g" + if [ "$g" != "md5" ] && [ "$g" != "filelist" ] && [ "$g" != ".package.files" ]; then + if [ -f $1$g ]; + then + if [ "$g" != ".coauthors" ] && [ "$g" != "version_info" ]; then + echo "++Redownload $1$g..." + if [ -f "$1$g" ]; then + curl -H 'Cache-Control: no-cache, no-store' "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g" --output $1$g + else + echo "===Could not find directory, assuming regular scripts directory exists." + curl -H 'Cache-Control: no-cache, no-store' "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g" --output $LANGUAGE/scripts/$g + fi + fi + else + echo "++==Downloading $1$g..." + curl -H 'Cache-Control: no-cache, no-store' "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g" --output $1$g + fi + fi + done < /tmp/out + fi + fi + for g in $FILES2 + do + if [ -d $1$g ]; + then + echo "$1$g is a directory" + check $1$g/ + fi + done +}