西电编译原理大作业——函数绘图语言解释器,使用libSDL2绘图
Usage: function_printer [-h] [-W Width] [-H High] <FILE>
推荐使用Visual studio 2022
进行构建,当然不用也无所谓
Do the following in the project root directory:
-
mkdir build
-
cd build
-
cmake ..
-
Open
function_printer.sln
in visual studio then build it.
Open the project folder in visual studio and build.
-
The output files is located in the
/bin
directory -
Before running the program, please ensure that it is located in the same directory as
bin/SDL2.dll
- install
libSDL2
:
sudo apt install libsdl2-dev
sudo apt install libsdl2-image-dev
sudo apt install libsdl2-mixer-dev
sudo apt install libsdl2-ttf-dev
sudo apt install libsdl2-gfx-dev
Do the following in the project root directory:
-
mkdir build
-
cd build
-
cmake ..
-
make
-
The output files is located in the
/bin
directory -
If your system cannot use package manager (like
apt
) to installlibsld2
, try building and installing from the source code: Downdlow Source Code.
test.funcs
rot is 0;
origin is (50, 400);
scale is (2, 1);
for T from 0 to 300 step 0.01 draw (t, 0);
for T from 0 to 300 step 0.01 draw (0, -t);
for T from 0 to 300 step 0.01 draw (t, -t);
scale is (2, 0.1);
for T from 0 to 55 step 0.01 draw (t, -(t*t));
scale is (10, 5);
for T from 0 to 60 step 0.01 draw (t, -sqrt(t));
scale is (20, 0.1);
for T from 0 to 8 step 0.01 draw (t, -exp(t));
scale is (2, 20);
for T from 0 to 300 step 0.01 draw (t, -ln(t));
function_printer ./test.funcs
- Windows
- Linux