Our server costs ~$56 per month to run. Please consider donating or becoming a Patron to help keep the site running. Help us gain new members by following us on Twitter and liking our page on Facebook!
Current time: November 15, 2024, 4:33 am

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Writing scripts for UNIX-like operating systems
#1
Writing scripts for UNIX-like operating systems
I've tried to write a as-portable-as-possible script for downloading the source code and building the Analog Clock in AEC (AEC being the programming language I've designed and written two compilers for).
For AEC-to-x86:
Code:
mkdir ArithmeticExpressionCompiler
cd ArithmeticExpressionCompiler
if [ $(command -v wget > /dev/null 2>&1 ; echo $?) -eq 0 ] # Check if "wget" exists, see those StackOverflow answers for more details:
                                                                                         # https://stackoverflow.com/a/75103891/8902065
                                                                                         # https://stackoverflow.com/a/75103209/8902065
then
  wget https://flatassembler.github.io/Duktape.zip
else
  curl -o Duktape.zip https://flatassembler.github.io/Duktape.zip
fi
unzip Duktape.zip
if [ $(command -v gcc > /dev/null 2>&1 ; echo $?) -eq 0 ]
then
  gcc -o aec aec.c duktape.c -lm # The linker that comes with recent versions of Debian Linux insists that "-lm" is put AFTER the source files, or else it outputs some confusing error message.
else
  clang -o aec aec.c duktape.c -lm
fi
./aec analogClock.aec
if [ $(command -v gcc > /dev/null 2>&1 ; echo $?) -eq 0 ]
then
  gcc -o analogClock analogClock.s -m32
else
  clang -o analogClock analogClock.s -m32
fi
./analogClock
        
For AEC-to-WebAssembly:
Code:
if [ $(command -v git > /dev/null 2>&1 ; echo $?) -eq 0 ]
then
  git clone https://github.com/FlatAssembler/AECforWebAssembly.git
  cd AECforWebAssembly
elif [ $(command -v wget > /dev/null 2>&1 ; echo $?) -eq 0 ]
then
  mkdir AECforWebAssembly
  cd AECforWebAssembly
  wget https://github.com/FlatAssembler/AECforWebAssembly/archive/refs/heads/master.zip
  unzip master.zip
  cd AECforWebAssembly-master
else
  mkdir AECforWebAssembly
  cd AECforWebAssembly
  curl -o AECforWebAssembly.zip -L https://github.com/FlatAssembler/AECforWebAssembly/archive/refs/heads/master.zip # Without the "-L", "curl" will store HTTP Response headers of redirects to the ZIP file instead of the actual ZIP file.
  unzip AECforWebAssembly.zip
  cd AECforWebAssembly-master
fi
if [ $(command -v g++ > /dev/null 2>&1 ; echo $?) -eq 0 ]
then
  g++ -std=c++11 -o aec AECforWebAssembly.cpp # "-std=c++11" should not be necessary for newer versions of "g++". Let me know if it is, as that probably means I disobeyed some new C++ standard (say, C++23).
else
  clang++ -o aec AECforWebAssembly.cpp
fi
cd analogClock
../aec analogClock.aec
npx -p wabt wat2wasm analogClock.wat
node analogClock
Is there anybody knowledgeable about various operating systems here to know how to make the scripts better?
Reply
#2
RE: Writing scripts for UNIX-like operating systems
Doesn't your university have instructors?
[Image: MmQV79M.png]  
                                      
Reply
#3
RE: Writing scripts for UNIX-like operating systems
(January 13, 2023 at 5:19 pm)arewethereyet Wrote: Doesn't your university have instructors?

You really think I should e-mail some of my professors about this?
Reply
#4
RE: Writing scripts for UNIX-like operating systems
(January 13, 2023 at 5:05 pm)FlatAssembler Wrote: I've tried to write a as-portable-as-possible script for downloading the source code and building the Analog Clock in AEC (AEC being the programming language I've designed and written two compilers for).
For AEC-to-x86:
Code:
mkdir ArithmeticExpressionCompiler
cd ArithmeticExpressionCompiler
if [ $(command -v wget > /dev/null 2>&1 ; echo $?) -eq 0 ] # Check if "wget" exists, see those StackOverflow answers for more details:
                                                                                         # https://stackoverflow.com/a/75103891/8902065
                                                                                         # https://stackoverflow.com/a/75103209/8902065
then
  wget https://flatassembler.github.io/Duktape.zip
else
  curl -o Duktape.zip https://flatassembler.github.io/Duktape.zip
fi
unzip Duktape.zip
if [ $(command -v gcc > /dev/null 2>&1 ; echo $?) -eq 0 ]
then
  gcc -o aec aec.c duktape.c -lm # The linker that comes with recent versions of Debian Linux insists that "-lm" is put AFTER the source files, or else it outputs some confusing error message.
else
  clang -o aec aec.c duktape.c -lm
fi
./aec analogClock.aec
if [ $(command -v gcc > /dev/null 2>&1 ; echo $?) -eq 0 ]
then
  gcc -o analogClock analogClock.s -m32
else
  clang -o analogClock analogClock.s -m32
fi
./analogClock
        
For AEC-to-WebAssembly:
Code:
if [ $(command -v git > /dev/null 2>&1 ; echo $?) -eq 0 ]
then
  git clone https://github.com/FlatAssembler/AECforWebAssembly.git
  cd AECforWebAssembly
elif [ $(command -v wget > /dev/null 2>&1 ; echo $?) -eq 0 ]
then
  mkdir AECforWebAssembly
  cd AECforWebAssembly
  wget https://github.com/FlatAssembler/AECforWebAssembly/archive/refs/heads/master.zip
  unzip master.zip
  cd AECforWebAssembly-master
else
  mkdir AECforWebAssembly
  cd AECforWebAssembly
  curl -o AECforWebAssembly.zip -L https://github.com/FlatAssembler/AECforWebAssembly/archive/refs/heads/master.zip # Without the "-L", "curl" will store HTTP Response headers of redirects to the ZIP file instead of the actual ZIP file.
  unzip AECforWebAssembly.zip
  cd AECforWebAssembly-master
fi
if [ $(command -v g++ > /dev/null 2>&1 ; echo $?) -eq 0 ]
then
  g++ -std=c++11 -o aec AECforWebAssembly.cpp # "-std=c++11" should not be necessary for newer versions of "g++". Let me know if it is, as that probably means I disobeyed some new C++ standard (say, C++23).
else
  clang++ -o aec AECforWebAssembly.cpp
fi
cd analogClock
../aec analogClock.aec
npx -p wabt wat2wasm analogClock.wat
node analogClock
Is there anybody knowledgeable about various operating systems here to know how to make the scripts better?

Yes.

My consulting rate is $250 USD / hour with a 4 hour minimum.
Reply
#5
RE: Writing scripts for UNIX-like operating systems
Also, do your own damn homework.
Reply
#6
RE: Writing scripts for UNIX-like operating systems
I will charge only $400 an hour for subcontracting to Jackalope
Reply
#7
RE: Writing scripts for UNIX-like operating systems
(January 13, 2023 at 5:42 pm)Anomalocaris Wrote: I will charge only $400 an hour for subcontracting to Jackalope

So, it's subcontractors all the way down then.
Reply
#8
RE: Writing scripts for UNIX-like operating systems
(January 13, 2023 at 5:30 pm)FlatAssembler Wrote:
(January 13, 2023 at 5:19 pm)arewethereyet Wrote: Doesn't your university have instructors?

You really think I should e-mail some of my professors about this?

It's obvious that you need help.  You are in your fifth year of a three year program.  

And I agree, do your own work.
[Image: MmQV79M.png]  
                                      
Reply
#9
RE: Writing scripts for UNIX-like operating systems
Have you tried heating it to a cherry-red colour and then beating it with a hammer?

Boru
‘I can’t be having with this.’ - Esmeralda Weatherwax
Reply
#10
RE: Writing scripts for UNIX-like operating systems


[Image: extraordinarywoo-sig.jpg]
Reply



Possibly Related Threads...
Thread Author Replies Views Last Post
  License for operating social media Fake Messiah 2 865 December 16, 2022 at 10:41 pm
Last Post: Rev. Rye
  TempleOS: a Christian Operating System Rev. Rye 5 1473 December 23, 2018 at 12:32 pm
Last Post: Rev. Rye
  Operating systems Wars! Sterben 60 6120 March 14, 2017 at 8:49 pm
Last Post: Sterben
  Using SSDs for dual boot systems emjay 9 1816 November 8, 2016 at 7:33 pm
Last Post: emjay



Users browsing this thread: 1 Guest(s)