From 8f7457e64d2048a8507a276ad24c686359fb1144 Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Tue, 20 Mar 2018 13:12:11 +0100 Subject: [PATCH] MP_01 Testat --- 01_ENV/Testat/a.out | Bin 0 -> 6152 bytes 01_ENV/Testat/build-c.sh | 4 ++++ 01_ENV/Testat/build.sh | 14 ++++++++++++++ 01_ENV/Testat/clean.sh | 4 ++++ 01_ENV/Testat/func1.c | 5 +++++ 01_ENV/Testat/func1.h | 1 + 01_ENV/Testat/func1.o | Bin 0 -> 960 bytes 01_ENV/Testat/main.c | 29 +++++++++++++++++++++++++++++ 01_ENV/Testat/main.o | Bin 0 -> 1744 bytes 9 files changed, 57 insertions(+) create mode 100755 01_ENV/Testat/a.out create mode 100755 01_ENV/Testat/build-c.sh create mode 100755 01_ENV/Testat/build.sh create mode 100755 01_ENV/Testat/clean.sh create mode 100644 01_ENV/Testat/func1.c create mode 100644 01_ENV/Testat/func1.h create mode 100644 01_ENV/Testat/func1.o create mode 100644 01_ENV/Testat/main.c create mode 100644 01_ENV/Testat/main.o diff --git a/01_ENV/Testat/a.out b/01_ENV/Testat/a.out new file mode 100755 index 0000000000000000000000000000000000000000..bf54c6af21dedc90529e55568c7e751d035a2949 GIT binary patch literal 6152 zcmeHLU2Ggz6}~%;?QMQ$7f2L0LCSy<$$@$@YscFqQRwW(+l;|frm+bUb=PZq9b2r| zW_Px6kQ{dOgth? zaX>sO+Cb9^hbb+H-iWbAp&5hZ*8;c$j+o*pVu~pTjGy(?f{`mk#C(lr($GVb5-Sv_sieuU7vFPz**@>>~ zbgnqxH6M$1MUU%+S-o4%8{?zznWu(jCOqF93KeMM1Lgm;9R|lwKfw8m57F-ez4icq z0rk&dxlxfyou8S_r3!XBZ>Lgd821cw`RSZJ33gPGeI`Af6K4kc6Q@(%dbi$-p_QhY z1z=VOK*#G_JTUzTdYqyfs-aOi!gJNU9%shx%8SFSnV( zTD=vPuqs-Cv+uoKnz$P})F;I7k^vQ1r)2MJ*!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pWWJ=xET z*0_FH{|hkSQgMEMuJC`;HL4%4e{9U-^LPVv=)!#dPgcdEps}APHTWE71q{u6LC<$4 zYD^?#9^!h{$=Q5<1`M6u%>#!48DX&-?VuZ${4D Q?D{(8Uu#yvn0c)JCpM~)pa1{> literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..913e3882ed8cdab0806037c2da959019bc17a4c8 GIT binary patch literal 960 zcmbtSF-yZh6uzWdi>NK)An1@qP_XBvp=l?rh}J^^r}gS*zC^Qzyi4>~W&^g}-)qmrb7bo&QS#H~8ssd35u;H>T$Hf5A$gG~_upC)ME@a|L77zaXclOO=tRdi7Y%tcB-E|f zYTN_j)k99pJA2t6blh`7;fN09mBSO?sc~|0;khPt2@OI&bdCY9YKW08M*Is3;7xZ>Zn6jjBy7aSp@aHJ!!(9bYYqAK`~q9K*@CF1iWS6d&|MB(w? zxle!N+Z}<{6P}_#2`Nbg8h}GF4by!wXj;_poWroBU+OEM#b=|Xj~m2Mw11uv? + +#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 0000000000000000000000000000000000000000..a3d69ce1d93f0736170c0e30b733157338429080 GIT binary patch literal 1744 zcmbtUL2DCH5T3Nf)>2K83ZjC0QL5N=x1q7LA`x8;T1r)l2$r%DlzWHY6&AgYsG-hu1#9|;M z2G^nE2^3(iuVbe|GX;aloKJh-)0MhbHJXHa|6ZRQ4IPfjF{c#RvYNBE=x4X#I1SBD5_|ptVjIJ;Gei9YZ}DPJA$B&50K6xCYw!cd;j zA1Ov|H@S;oAN*={i}gZJHyC;`BPu2W!%-0ZllYyG>V#)T>=J(6_&Vorqb3RGKs_FM z5LTk@O}t?eF)zLOUd|yk!)=;?b|d&NI4<~fJ`%63!um4*hlI<0e{x*ZxxoED5?`*P zNVvS!YY|+`4Jy6|Q+3#e18Sy_&oj$`yt!t9Y84!&-kF^rD>`Q8DXiOTmXigWWn6rF zCB`$^>SES5^DInKGoTh7+cB3=Kg*NOx>iOtqMB#s5CqTfLzQgO#zbAqQxKF