diff --git a/01_ENV/Testat/a.out b/01_ENV/Testat/a.out new file mode 100755 index 0000000..bf54c6a Binary files /dev/null and b/01_ENV/Testat/a.out differ diff --git a/01_ENV/Testat/build-c.sh b/01_ENV/Testat/build-c.sh new file mode 100755 index 0000000..2cf356d --- /dev/null +++ b/01_ENV/Testat/build-c.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +bash clean.sh +clang-6.0 -c func1.c main.c +clang-6.0 -s func1.o main.o -lm diff --git a/01_ENV/Testat/build.sh b/01_ENV/Testat/build.sh new file mode 100755 index 0000000..eeb81d7 --- /dev/null +++ b/01_ENV/Testat/build.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +# generate main.s, main.o, b.out +pcc -O0 -S main.c +as -o main.o main.s +#ld -o b.out main.o /lib/crt0.o /lib/crti.o -lc +pcc -o b.out main.o + +# generate a.out +pcc -O0 -g main.c + +# generate assembly intermixed with source code +objdump -S a.out > objdump-S_a.out.txt + diff --git a/01_ENV/Testat/clean.sh b/01_ENV/Testat/clean.sh new file mode 100755 index 0000000..9469772 --- /dev/null +++ b/01_ENV/Testat/clean.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +rm *.o *.out + diff --git a/01_ENV/Testat/func1.c b/01_ENV/Testat/func1.c new file mode 100644 index 0000000..a8c7014 --- /dev/null +++ b/01_ENV/Testat/func1.c @@ -0,0 +1,5 @@ +#include + +int func1(int x) { + return (x-2)*(x-6)*(x-10)*(x-15); +} diff --git a/01_ENV/Testat/func1.h b/01_ENV/Testat/func1.h new file mode 100644 index 0000000..68814f9 --- /dev/null +++ b/01_ENV/Testat/func1.h @@ -0,0 +1 @@ +int func1(int x); diff --git a/01_ENV/Testat/func1.o b/01_ENV/Testat/func1.o new file mode 100644 index 0000000..913e388 Binary files /dev/null and b/01_ENV/Testat/func1.o differ diff --git a/01_ENV/Testat/main.c b/01_ENV/Testat/main.c new file mode 100644 index 0000000..d3b7be8 --- /dev/null +++ b/01_ENV/Testat/main.c @@ -0,0 +1,29 @@ +#include + +#include "func1.h" + +int recursive(int start, int stop); + +int main(int argc, char **argv) { + + int zero = 0; + for(int i = 0; i <= 20; ++i) { + int tmp = func1(i); + printf("Stelle: %d Wert: %d\n", i, tmp); + if(tmp == 0) ++zero; + } + + printf("Nullstellen: %d\n", zero); + + recursive(0, 20); + +} + + +int recursive(int start, int stop) { + if(start <= stop) { + recursive(start + 1, stop); + printf("Stelle: %d, Wert: %d\n", start, func1(start)); + } + return 0; +} diff --git a/01_ENV/Testat/main.o b/01_ENV/Testat/main.o new file mode 100644 index 0000000..a3d69ce Binary files /dev/null and b/01_ENV/Testat/main.o differ