Compare commits
No commits in common. "master" and "backup_HS21" have entirely different histories.
master
...
backup_HS2
|
@ -0,0 +1,52 @@
|
|||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Linker output
|
||||
*.ilk
|
||||
*.map
|
||||
*.exp
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
# Debug files
|
||||
*.dSYM/
|
||||
*.su
|
||||
*.idb
|
||||
*.pdb
|
||||
|
||||
# Kernel Module Compile Results
|
||||
*.mod*
|
||||
*.cmd
|
||||
.tmp_versions/
|
||||
modules.order
|
||||
Module.symvers
|
||||
Mkfile.old
|
||||
dkms.conf
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
# produces a tabular output of all executables as found over the $PATH environment variable
|
||||
# - output format: [1-based index of $PATH entry]:[$PATH entry]:[name of the executable]
|
||||
# - e.g. 6:/bin:bash
|
||||
# - the first argument (if given) is used as alternative to $PATH (e.g. for testing purposes)
|
||||
# usage: ./get-exec-list-arg.sh # examines $PATH
|
||||
# usage: ./get-exec-list-arg.sh "$PATH" # equivalent to the above call
|
||||
# usage: ./get-exec-list-arg.sh ".:~/bin" # examines the current directory (.) and ~/bin
|
||||
|
||||
# argument handling
|
||||
path="$1"
|
||||
[ -n "$path" ] || path="$PATH"
|
||||
|
||||
# input-field-separator: tells the shell to split in the 'for' loop the $var by ":"
|
||||
IFS=":"
|
||||
|
||||
for p in $path
|
||||
do
|
||||
i=$((i+1))
|
||||
[ -n "$p" ] || p="."
|
||||
if [ -d "$p" ] && [ -x "$p" ]
|
||||
then
|
||||
find -L "$p" -maxdepth 1 -type f -executable -printf "$i:%h:%f\n" 2>/dev/null
|
||||
fi
|
||||
done
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
|
||||
# produces a crude HTML table from a tabular file (given on stdin) with columns separated by ":"
|
||||
# usage: tab2html < inbut.txt > output.html
|
||||
|
||||
awk $* -- '
|
||||
BEGIN {
|
||||
FS=":" # field-separator: which character separats fields in a record (i.e. in a line)
|
||||
print "<!DOCTYPE html>"
|
||||
print "<html>"
|
||||
print " <head>"
|
||||
print " <style>"
|
||||
print " table{border:1px solid black;border-collapse:collapse;}"
|
||||
print " tr:nth-child(even){background-color: #f2f2f2;}"
|
||||
print " td{border:1px solid black;padding:15px;}"
|
||||
print " </style>"
|
||||
print " <title>Tabular Data</title>"
|
||||
print " </head>"
|
||||
print " <body>"
|
||||
print " <div style=\"overflow-x:auto;\">"
|
||||
print " <table>"
|
||||
}
|
||||
{
|
||||
print " <tr>"
|
||||
for (i = 1; i <= NF; i++) { print " <td>"$i"</td>" }
|
||||
print " </tr>"
|
||||
}
|
||||
END {
|
||||
print " </table>"
|
||||
print " </div>"
|
||||
print " </body>"
|
||||
print "</html>"
|
||||
}
|
||||
'
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
# produces an XML file from a tabular file (given on stdin) with columns separated by ":"
|
||||
# usage: tab2xml < inbut.txt > output.xml
|
||||
|
||||
awk $* -- '
|
||||
BEGIN {
|
||||
FS=":" # field-separator: which character separats fields in a record (i.e. in a line)
|
||||
print "<?xml version=\"1.0\" standalone=\"yes\"?>"
|
||||
print "<Table>"
|
||||
}
|
||||
{
|
||||
print " <Row>"
|
||||
for (i = 1; i <= NF; i++) { print " <Col>"$i"</Col>" }
|
||||
print " </Row>"
|
||||
}
|
||||
END {
|
||||
print "</Table>"
|
||||
}
|
||||
'
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
|
@ -1 +0,0 @@
|
|||
Praktikum1
|
|
@ -1,2 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||
</project>
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/P01_Erste_Schritte_mit_C.iml" filepath="$PROJECT_DIR$/.idea/P01_Erste_Schritte_mit_C.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -1,9 +0,0 @@
|
|||
cmake_minimum_required(VERSION 3.21)
|
||||
project(Praktikum1 C)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
|
||||
add_executable(Praktikum1
|
||||
P1_aufgabe3.c
|
||||
P1_aufgabe4.c
|
||||
P1_helloworld.c)
|
|
@ -1,21 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define NUM_ROWS 5
|
||||
|
||||
int main(void) {
|
||||
int value = 0;
|
||||
int row = 0;
|
||||
double umrechnungsfaktor = 0.0;
|
||||
|
||||
(void)printf("Enter conversion rate (1.00 BTC -> CHF): ");
|
||||
scanf("%lf", &umrechnungsfaktor);
|
||||
|
||||
for(row = 1; row <= NUM_ROWS; row += 1) {
|
||||
value += 200;
|
||||
(void)printf("%d CHF <--> %f BTC \n", value, value / umrechnungsfaktor);
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
int words = 0;
|
||||
(void)printf("Enter your Text: ");
|
||||
|
||||
while(getchar() != "\n") {
|
||||
words ++;
|
||||
|
||||
}
|
||||
|
||||
(void)printf(%d, words);
|
||||
//scanf("%lf", &Text);
|
||||
|
||||
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
(void)printf("Hello World in C\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
# 01 - Erste Schritte mit C
|
||||
|
||||
___
|
||||
## 1. Übersicht
|
||||
|
||||
In diesem Praktikum erstellen Sie mehrere kleine C-Programme, in denen Sie Input- und Output-Funktionen der C Standard Library verwenden.
|
||||
|
||||
Arbeiten Sie in Zweiergruppen und diskutieren Sie ihre Lösungsansätze miteinander, bevor Sie diese umsetzen.
|
||||
|
||||
Bevor Sie mit den Programmieraufgaben beginnen, setzen Sie eine virtuelle Maschine mit der vorbereiteten Praktikumsumgebung auf. Die entsprechende Anleitung finden Sie hier: [https://github.zhaw.ch/SNP/snp-lab-env/blob/master/docs/Arbeitsumgebung_f%C3%BCr_die_Praktika.pdf](https://github.zhaw.ch/SNP/snp-lab-env/blob/master/docs/Arbeitsumgebung_f%C3%BCr_die_Praktika.pdf).
|
||||
|
||||
___
|
||||
## 2. Lernziele
|
||||
In diesem Praktikum schreiben Sie selbst von Grund auf einige einfache C-Programme und wenden verschiedene Kontrollstrukturen an.
|
||||
|
||||
- Sie können mit *#include* Funktionen der C Standard Library einbinden
|
||||
- Sie können mit *#define* Macros definieren und diese anwenden
|
||||
- Sie wenden die *Input-* und *Output-Funktionen* von C an, um Tastatur-Input einzulesen und formatierte Ausgaben zu machen.
|
||||
- Sie verwenden die Kommandozeile, um ihren Sourcecode in ein ausführbares Programm umzuwandeln.
|
||||
- Sie wenden for-und while-Loops sowie if-then-else-Verzweigungen an.
|
||||
- Sie setzen eine Programmieraufgabe selbständig in ein funktionierendes Programm um.
|
||||
|
||||
___
|
||||
## 3. Aufgabe 1: virtuelle Maschine
|
||||
Im Moodle-Kurs "Systemnahe Programmierung" finden Sie unter "Praktika" eine Installationsanleitung für die virtuelle Maschine, die wir Ihnen zur Verfügung stellen. Die virtuelle Maschine enthält ein Ubuntu Linux-Betriebssystem und die für das Praktikum benötigten Frameworks.
|
||||
|
||||
Folgen sie der Anleitung, um die virtuelle Maschine auf ihrem Rechner zu installieren.
|
||||
|
||||
___
|
||||
## 4. Aufgabe 2: Hello World
|
||||
Schreiben Sie ein C-Programm, das "Hello World" auf die Standardausgabe schreibt. Verwenden Sie die printf-Funktion aus der Standard Library. In den Vorlesungsfolien finden Sie bei Bedarf eine Vorlage.
|
||||
|
||||
Erstellen sie das Source-File mit einem beliebigen Editor, sie benötigen nicht unbedingt eine IDE. Speichern Sie das Source-File mit der Endung `.c`.
|
||||
|
||||
Um ihr Source-File zu kompilieren, verwenden Sie den GNU Compiler auf der Kommandozeile:
|
||||
``` sh
|
||||
$> gcc hello.c
|
||||
```
|
||||
|
||||
Der Compiler übersetzt ihr Programm in eine ausführbare Datei `a.out`, die Sie mit
|
||||
|
||||
``` sh
|
||||
$> ./a.out
|
||||
```
|
||||
|
||||
ausführen können. Sie können den Namen der ausführbaren Datei wählen, indem Sie die Option `-o` verwenden:
|
||||
|
||||
``` sh
|
||||
$> gcc hello.c -o hello
|
||||
```
|
||||
|
||||
erzeugt die ausführbare Datei `hello`.
|
||||
|
||||
Verwenden Sie die Option `-Wall`, um alle Warnungen des Compilers auszugeben. Dies weist Sie auf allfällige Programmierfehler hin.
|
||||
|
||||
___
|
||||
## 5. Aufgabe 3: Tabellenausgabe
|
||||
Schreiben Sie ein Programm in C, das von `stdin` einen Umrechnungsfaktor zwischen CHF und Bitcoin einliest und danach eine Tabelle von Franken- und Bitcoin-Beträgen ausgibt. Die Tabelle soll sauber formatiert sein, z.B. so:
|
||||
```
|
||||
Enter conversion rate (1.00 BTC -> CHF): 43158.47
|
||||
200 CHF <--> 0.00463 BTC
|
||||
400 CHF <--> 0.00927 BTC
|
||||
600 CHF <--> 0.01390 BTC
|
||||
800 CHF <--> 0.01854 BTC
|
||||
1000 CHF <--> 0.02317 BTC
|
||||
1200 CHF <--> 0.02780 BTC
|
||||
1400 CHF <--> 0.03244 BTC
|
||||
1600 CHF <--> 0.03707 BTC
|
||||
```
|
||||
|
||||
- Verwenden Sie eine Schleife und die `printf`-Funktion für die Tabellenausgabe
|
||||
- Definieren Sie ein Makro `NUM_ROWS`, um an zentraler Stelle im Source-Code zu definieren, wie viele Einträge die Tabelle in der Ausgabe haben soll.
|
||||
- Lesen Sie den Umrechnungsfaktor mit der `scanf`-Funktion als `double` von der Kommandozeile ein.
|
||||
|
||||
___
|
||||
## 6. Aufgabe 4: Zeichen und Wörter zählen
|
||||
Schreiben Sie ein C-Programm, welches die Zeichen und Wörter einer mit der Tastatur eingegebenen Zeile zählt. Wortzwischenräume sind entweder Leerzeichen (' ') oder Tabulatoren ('\t'). Die Eingabe der Zeile mit einem newline-character ('\n') abgeschlossen. Danach soll ihr Programm die Anzahl Zeichen und die Anzahl Wörter ausgeben und terminieren.
|
||||
- Verwenden Sie die `char getchar(void)` Funktion aus der `stdio.h` Library, um die Zeichen einzeln einzulesen. Die Funktion `getchar` kehrt nicht gleich bei Eingabe des ersten Zeichens zurück, sondern puffert die Daten, bis die Eingabe einer kompletten Zeile mit Return abgeschlossen wird. Dann wird das erste Zeichen aus dem Puffer zurückgegeben und mit weiteren Aufrufen von getchar können die nachfolgenden Zeichen aus dem Puffer gelesen werden. Gibt `getchar` das Zeichen `\n` zurück, ist die Zeile komplett zurückgegeben und der Puffer ist wieder leer.
|
||||
- Setzen Sie eine Schleife ein, die beim Zeichen '\n' terminiert.
|
||||
- Benutzen Sie if-then-else-Strukturen um die Wörter zu zählen.
|
||||
|
||||
___
|
||||
## 7. Bewertung
|
||||
Die gegebenenfalls gestellten Theorieaufgaben und der funktionierende Programmcode müssen der Praktikumsbetreuung gezeigt werden. Die Lösungen müssen mündlich erklärt werden.
|
|
@ -1,401 +0,0 @@
|
|||
{
|
||||
"inputs" :
|
||||
[
|
||||
{
|
||||
"path" : "CMakeLists.txt"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineSystem.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeSystem.cmake.in"
|
||||
},
|
||||
{
|
||||
"isGenerated" : true,
|
||||
"path" : "cmake-build-debug/CMakeFiles/3.21.1/CMakeSystem.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeSystemSpecificInitialize.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCompilerId.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCompilerIdDetection.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/ADSP-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/ARMCC-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/ARMClang-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/AppleClang-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Clang-DetermineCompilerInternal.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Borland-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Bruce-C-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Clang-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Clang-DetermineCompilerInternal.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Compaq-C-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Cray-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Embarcadero-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Fujitsu-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GHS-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU-C-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/HP-C-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IAR-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Intel-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/MSVC-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/NVHPC-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/NVIDIA-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/PGI-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/PathScale-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/ROCMClang-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/SCO-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/SDCC-C-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/SunPro-C-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/TI-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/Watcom-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/XL-C-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/XLClang-C-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/zOS-C-DetermineCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeFindBinUtils.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU-FindBinUtils.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCCompiler.cmake.in"
|
||||
},
|
||||
{
|
||||
"isGenerated" : true,
|
||||
"path" : "cmake-build-debug/CMakeFiles/3.21.1/CMakeCCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeSystemSpecificInformation.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeGenericSystem.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeInitializeConfigs.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/Linux.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/UnixPaths.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCInformation.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeLanguageInformation.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU-C.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/GNU.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Compiler/CMakeCommonCompilerMacros.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/Linux-GNU-C.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Platform/Linux-GNU.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCommonLanguageInclude.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeTestCompilerCommon.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCompilerABI.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeParseImplicitIncludeInfo.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeParseImplicitLinkInfo.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeParseLibraryArchitecture.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeTestCompilerCommon.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCCompilerABI.c"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeDetermineCompileFeatures.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/Internal/FeatureTesting.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCCompiler.cmake.in"
|
||||
},
|
||||
{
|
||||
"isGenerated" : true,
|
||||
"path" : "cmake-build-debug/CMakeFiles/3.21.1/CMakeCCompiler.cmake"
|
||||
}
|
||||
],
|
||||
"kind" : "cmakeFiles",
|
||||
"paths" :
|
||||
{
|
||||
"build" : "/home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C/cmake-build-debug",
|
||||
"source" : "/home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C"
|
||||
},
|
||||
"version" :
|
||||
{
|
||||
"major" : 1,
|
||||
"minor" : 0
|
||||
}
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
{
|
||||
"configurations" :
|
||||
[
|
||||
{
|
||||
"directories" :
|
||||
[
|
||||
{
|
||||
"build" : ".",
|
||||
"jsonFile" : "directory-.-Debug-f5ebdc15457944623624.json",
|
||||
"minimumCMakeVersion" :
|
||||
{
|
||||
"string" : "3.21"
|
||||
},
|
||||
"projectIndex" : 0,
|
||||
"source" : ".",
|
||||
"targetIndexes" :
|
||||
[
|
||||
0
|
||||
]
|
||||
}
|
||||
],
|
||||
"name" : "Debug",
|
||||
"projects" :
|
||||
[
|
||||
{
|
||||
"directoryIndexes" :
|
||||
[
|
||||
0
|
||||
],
|
||||
"name" : "Praktikum1",
|
||||
"targetIndexes" :
|
||||
[
|
||||
0
|
||||
]
|
||||
}
|
||||
],
|
||||
"targets" :
|
||||
[
|
||||
{
|
||||
"directoryIndex" : 0,
|
||||
"id" : "Praktikum1::@6890427a1f51a3e7e1df",
|
||||
"jsonFile" : "target-Praktikum1-Debug-62f97d605090902f9b35.json",
|
||||
"name" : "Praktikum1",
|
||||
"projectIndex" : 0
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"kind" : "codemodel",
|
||||
"paths" :
|
||||
{
|
||||
"build" : "/home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C/cmake-build-debug",
|
||||
"source" : "/home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C"
|
||||
},
|
||||
"version" :
|
||||
{
|
||||
"major" : 2,
|
||||
"minor" : 3
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
"backtraceGraph" :
|
||||
{
|
||||
"commands" : [],
|
||||
"files" : [],
|
||||
"nodes" : []
|
||||
},
|
||||
"installers" : [],
|
||||
"paths" :
|
||||
{
|
||||
"build" : ".",
|
||||
"source" : "."
|
||||
}
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
{
|
||||
"cmake" :
|
||||
{
|
||||
"generator" :
|
||||
{
|
||||
"multiConfig" : false,
|
||||
"name" : "Ninja"
|
||||
},
|
||||
"paths" :
|
||||
{
|
||||
"cmake" : "/snap/clion/184/bin/cmake/linux/bin/cmake",
|
||||
"cpack" : "/snap/clion/184/bin/cmake/linux/bin/cpack",
|
||||
"ctest" : "/snap/clion/184/bin/cmake/linux/bin/ctest",
|
||||
"root" : "/snap/clion/184/bin/cmake/linux/share/cmake-3.21"
|
||||
},
|
||||
"version" :
|
||||
{
|
||||
"isDirty" : false,
|
||||
"major" : 3,
|
||||
"minor" : 21,
|
||||
"patch" : 1,
|
||||
"string" : "3.21.1",
|
||||
"suffix" : ""
|
||||
}
|
||||
},
|
||||
"objects" :
|
||||
[
|
||||
{
|
||||
"jsonFile" : "codemodel-v2-f39e677af37b2c97765b.json",
|
||||
"kind" : "codemodel",
|
||||
"version" :
|
||||
{
|
||||
"major" : 2,
|
||||
"minor" : 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"jsonFile" : "cache-v2-671bfda618eefad7518e.json",
|
||||
"kind" : "cache",
|
||||
"version" :
|
||||
{
|
||||
"major" : 2,
|
||||
"minor" : 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"jsonFile" : "cmakeFiles-v1-55f98b5e2af98e506ed1.json",
|
||||
"kind" : "cmakeFiles",
|
||||
"version" :
|
||||
{
|
||||
"major" : 1,
|
||||
"minor" : 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"jsonFile" : "toolchains-v1-cd8c58e1522147f815df.json",
|
||||
"kind" : "toolchains",
|
||||
"version" :
|
||||
{
|
||||
"major" : 1,
|
||||
"minor" : 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"reply" :
|
||||
{
|
||||
"cache-v2" :
|
||||
{
|
||||
"jsonFile" : "cache-v2-671bfda618eefad7518e.json",
|
||||
"kind" : "cache",
|
||||
"version" :
|
||||
{
|
||||
"major" : 2,
|
||||
"minor" : 0
|
||||
}
|
||||
},
|
||||
"cmakeFiles-v1" :
|
||||
{
|
||||
"jsonFile" : "cmakeFiles-v1-55f98b5e2af98e506ed1.json",
|
||||
"kind" : "cmakeFiles",
|
||||
"version" :
|
||||
{
|
||||
"major" : 1,
|
||||
"minor" : 0
|
||||
}
|
||||
},
|
||||
"codemodel-v2" :
|
||||
{
|
||||
"jsonFile" : "codemodel-v2-f39e677af37b2c97765b.json",
|
||||
"kind" : "codemodel",
|
||||
"version" :
|
||||
{
|
||||
"major" : 2,
|
||||
"minor" : 3
|
||||
}
|
||||
},
|
||||
"toolchains-v1" :
|
||||
{
|
||||
"jsonFile" : "toolchains-v1-cd8c58e1522147f815df.json",
|
||||
"kind" : "toolchains",
|
||||
"version" :
|
||||
{
|
||||
"major" : 1,
|
||||
"minor" : 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,118 +0,0 @@
|
|||
{
|
||||
"artifacts" :
|
||||
[
|
||||
{
|
||||
"path" : "Praktikum1"
|
||||
}
|
||||
],
|
||||
"backtrace" : 1,
|
||||
"backtraceGraph" :
|
||||
{
|
||||
"commands" :
|
||||
[
|
||||
"add_executable"
|
||||
],
|
||||
"files" :
|
||||
[
|
||||
"CMakeLists.txt"
|
||||
],
|
||||
"nodes" :
|
||||
[
|
||||
{
|
||||
"file" : 0
|
||||
},
|
||||
{
|
||||
"command" : 0,
|
||||
"file" : 0,
|
||||
"line" : 6,
|
||||
"parent" : 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"compileGroups" :
|
||||
[
|
||||
{
|
||||
"compileCommandFragments" :
|
||||
[
|
||||
{
|
||||
"fragment" : "-g"
|
||||
},
|
||||
{
|
||||
"fragment" : "-std=gnu11"
|
||||
}
|
||||
],
|
||||
"language" : "C",
|
||||
"languageStandard" :
|
||||
{
|
||||
"backtraces" :
|
||||
[
|
||||
1
|
||||
],
|
||||
"standard" : "11"
|
||||
},
|
||||
"sourceIndexes" :
|
||||
[
|
||||
0,
|
||||
1,
|
||||
2
|
||||
]
|
||||
}
|
||||
],
|
||||
"id" : "Praktikum1::@6890427a1f51a3e7e1df",
|
||||
"link" :
|
||||
{
|
||||
"commandFragments" :
|
||||
[
|
||||
{
|
||||
"fragment" : "-g",
|
||||
"role" : "flags"
|
||||
},
|
||||
{
|
||||
"fragment" : "",
|
||||
"role" : "flags"
|
||||
}
|
||||
],
|
||||
"language" : "C"
|
||||
},
|
||||
"name" : "Praktikum1",
|
||||
"nameOnDisk" : "Praktikum1",
|
||||
"paths" :
|
||||
{
|
||||
"build" : ".",
|
||||
"source" : "."
|
||||
},
|
||||
"sourceGroups" :
|
||||
[
|
||||
{
|
||||
"name" : "Source Files",
|
||||
"sourceIndexes" :
|
||||
[
|
||||
0,
|
||||
1,
|
||||
2
|
||||
]
|
||||
}
|
||||
],
|
||||
"sources" :
|
||||
[
|
||||
{
|
||||
"backtrace" : 1,
|
||||
"compileGroupIndex" : 0,
|
||||
"path" : "P1_aufgabe3.c",
|
||||
"sourceGroupIndex" : 0
|
||||
},
|
||||
{
|
||||
"backtrace" : 1,
|
||||
"compileGroupIndex" : 0,
|
||||
"path" : "P1_aufgabe4.c",
|
||||
"sourceGroupIndex" : 0
|
||||
},
|
||||
{
|
||||
"backtrace" : 1,
|
||||
"compileGroupIndex" : 0,
|
||||
"path" : "P1_helloworld.c",
|
||||
"sourceGroupIndex" : 0
|
||||
}
|
||||
],
|
||||
"type" : "EXECUTABLE"
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
{
|
||||
"kind" : "toolchains",
|
||||
"toolchains" :
|
||||
[
|
||||
{
|
||||
"compiler" :
|
||||
{
|
||||
"id" : "GNU",
|
||||
"implicit" :
|
||||
{
|
||||
"includeDirectories" :
|
||||
[
|
||||
"/usr/lib/gcc/x86_64-linux-gnu/7/include",
|
||||
"/usr/local/include",
|
||||
"/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed",
|
||||
"/usr/include/x86_64-linux-gnu",
|
||||
"/usr/include"
|
||||
],
|
||||
"linkDirectories" :
|
||||
[
|
||||
"/usr/lib/gcc/x86_64-linux-gnu/7",
|
||||
"/usr/lib/x86_64-linux-gnu",
|
||||
"/usr/lib",
|
||||
"/lib/x86_64-linux-gnu",
|
||||
"/lib"
|
||||
],
|
||||
"linkFrameworkDirectories" : [],
|
||||
"linkLibraries" :
|
||||
[
|
||||
"gcc",
|
||||
"gcc_s",
|
||||
"c",
|
||||
"gcc",
|
||||
"gcc_s"
|
||||
]
|
||||
},
|
||||
"path" : "/usr/bin/cc",
|
||||
"version" : "7.5.0"
|
||||
},
|
||||
"language" : "C",
|
||||
"sourceFileExtensions" :
|
||||
[
|
||||
"c",
|
||||
"m"
|
||||
]
|
||||
}
|
||||
],
|
||||
"version" :
|
||||
{
|
||||
"major" : 1,
|
||||
"minor" : 0
|
||||
}
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
# ninja log v5
|
||||
0 143 1646206998839919295 CMakeFiles/Praktikum1.dir/P1_aufgabe3.c.o 2fad6a5767b0faef
|
||||
0 140 1646206998835917296 CMakeFiles/Praktikum1.dir/P1_helloworld.c.o c8ed882a4ff8153b
|
||||
0 39 1646207060726847295 CMakeFiles/Praktikum1.dir/P1_aufgabe4.c.o 689bdfb5e3085400
|
|
@ -1,320 +0,0 @@
|
|||
# This is the CMakeCache file.
|
||||
# For build in directory: /home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C/cmake-build-debug
|
||||
# It was generated by CMake: /snap/clion/184/bin/cmake/linux/bin/cmake
|
||||
# You can edit this file to change values found and used by cmake.
|
||||
# If you do not want to change any of the values, simply exit the editor.
|
||||
# If you do want to change a value, simply edit, save, and exit the editor.
|
||||
# The syntax for the file is as follows:
|
||||
# KEY:TYPE=VALUE
|
||||
# KEY is the name of a variable in the cache.
|
||||
# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
|
||||
# VALUE is the current value for the KEY.
|
||||
|
||||
########################
|
||||
# EXTERNAL cache entries
|
||||
########################
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_AR:FILEPATH=/usr/bin/ar
|
||||
|
||||
//Choose the type of build, options are: None Debug Release RelWithDebInfo
|
||||
// MinSizeRel ...
|
||||
CMAKE_BUILD_TYPE:STRING=Debug
|
||||
|
||||
//C compiler
|
||||
CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc
|
||||
|
||||
//A wrapper around 'ar' adding the appropriate '--plugin' option
|
||||
// for the GCC compiler
|
||||
CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-7
|
||||
|
||||
//A wrapper around 'ranlib' adding the appropriate '--plugin' option
|
||||
// for the GCC compiler
|
||||
CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-7
|
||||
|
||||
//Flags used by the C compiler during all build types.
|
||||
CMAKE_C_FLAGS:STRING=
|
||||
|
||||
//Flags used by the C compiler during DEBUG builds.
|
||||
CMAKE_C_FLAGS_DEBUG:STRING=-g
|
||||
|
||||
//Flags used by the C compiler during MINSIZEREL builds.
|
||||
CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
|
||||
|
||||
//Flags used by the C compiler during RELEASE builds.
|
||||
CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
|
||||
|
||||
//Flags used by the C compiler during RELWITHDEBINFO builds.
|
||||
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND
|
||||
|
||||
//Flags used by the linker during all build types.
|
||||
CMAKE_EXE_LINKER_FLAGS:STRING=
|
||||
|
||||
//Flags used by the linker during DEBUG builds.
|
||||
CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=
|
||||
|
||||
//Flags used by the linker during MINSIZEREL builds.
|
||||
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=
|
||||
|
||||
//Flags used by the linker during RELEASE builds.
|
||||
CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=
|
||||
|
||||
//Flags used by the linker during RELWITHDEBINFO builds.
|
||||
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
||||
|
||||
//Enable/Disable output of compile commands during generation.
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=
|
||||
|
||||
//Install path prefix, prepended onto install directories.
|
||||
CMAKE_INSTALL_PREFIX:PATH=/usr/local
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_LINKER:FILEPATH=/usr/bin/ld
|
||||
|
||||
//No help, variable specified on the command line.
|
||||
CMAKE_MAKE_PROGRAM:UNINITIALIZED=/snap/clion/184/bin/ninja/linux/ninja
|
||||
|
||||
//Flags used by the linker during the creation of modules during
|
||||
// all build types.
|
||||
CMAKE_MODULE_LINKER_FLAGS:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of modules during
|
||||
// DEBUG builds.
|
||||
CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of modules during
|
||||
// MINSIZEREL builds.
|
||||
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of modules during
|
||||
// RELEASE builds.
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of modules during
|
||||
// RELWITHDEBINFO builds.
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_NM:FILEPATH=/usr/bin/nm
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_DESCRIPTION:STATIC=
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_HOMEPAGE_URL:STATIC=
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_NAME:STATIC=Praktikum1
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_READELF:FILEPATH=/usr/bin/readelf
|
||||
|
||||
//Flags used by the linker during the creation of shared libraries
|
||||
// during all build types.
|
||||
CMAKE_SHARED_LINKER_FLAGS:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of shared libraries
|
||||
// during DEBUG builds.
|
||||
CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of shared libraries
|
||||
// during MINSIZEREL builds.
|
||||
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of shared libraries
|
||||
// during RELEASE builds.
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of shared libraries
|
||||
// during RELWITHDEBINFO builds.
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
||||
|
||||
//If set, runtime paths are not added when installing shared libraries,
|
||||
// but are added when building.
|
||||
CMAKE_SKIP_INSTALL_RPATH:BOOL=NO
|
||||
|
||||
//If set, runtime paths are not added when using shared libraries.
|
||||
CMAKE_SKIP_RPATH:BOOL=NO
|
||||
|
||||
//Flags used by the linker during the creation of static libraries
|
||||
// during all build types.
|
||||
CMAKE_STATIC_LINKER_FLAGS:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of static libraries
|
||||
// during DEBUG builds.
|
||||
CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of static libraries
|
||||
// during MINSIZEREL builds.
|
||||
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of static libraries
|
||||
// during RELEASE builds.
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of static libraries
|
||||
// during RELWITHDEBINFO builds.
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_STRIP:FILEPATH=/usr/bin/strip
|
||||
|
||||
//If this value is on, makefiles will be generated without the
|
||||
// .SILENT directive, and all commands will be echoed to the console
|
||||
// during the make. This is useful for debugging only. With Visual
|
||||
// Studio IDE projects all commands are done without /nologo.
|
||||
CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
|
||||
|
||||
//Value Computed by CMake
|
||||
Praktikum1_BINARY_DIR:STATIC=/home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C/cmake-build-debug
|
||||
|
||||
//Value Computed by CMake
|
||||
Praktikum1_IS_TOP_LEVEL:STATIC=ON
|
||||
|
||||
//Value Computed by CMake
|
||||
Praktikum1_SOURCE_DIR:STATIC=/home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C
|
||||
|
||||
|
||||
########################
|
||||
# INTERNAL cache entries
|
||||
########################
|
||||
|
||||
//ADVANCED property for variable: CMAKE_ADDR2LINE
|
||||
CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_AR
|
||||
CMAKE_AR-ADVANCED:INTERNAL=1
|
||||
//This is the directory where this CMakeCache.txt was created
|
||||
CMAKE_CACHEFILE_DIR:INTERNAL=/home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C/cmake-build-debug
|
||||
//Major version of cmake used to create the current loaded cache
|
||||
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
|
||||
//Minor version of cmake used to create the current loaded cache
|
||||
CMAKE_CACHE_MINOR_VERSION:INTERNAL=21
|
||||
//Patch version of cmake used to create the current loaded cache
|
||||
CMAKE_CACHE_PATCH_VERSION:INTERNAL=1
|
||||
//Path to CMake executable.
|
||||
CMAKE_COMMAND:INTERNAL=/snap/clion/184/bin/cmake/linux/bin/cmake
|
||||
//Path to cpack program executable.
|
||||
CMAKE_CPACK_COMMAND:INTERNAL=/snap/clion/184/bin/cmake/linux/bin/cpack
|
||||
//Path to ctest program executable.
|
||||
CMAKE_CTEST_COMMAND:INTERNAL=/snap/clion/184/bin/cmake/linux/bin/ctest
|
||||
//ADVANCED property for variable: CMAKE_C_COMPILER
|
||||
CMAKE_C_COMPILER-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_COMPILER_AR
|
||||
CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB
|
||||
CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS
|
||||
CMAKE_C_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG
|
||||
CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL
|
||||
CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_DLLTOOL
|
||||
CMAKE_DLLTOOL-ADVANCED:INTERNAL=1
|
||||
//Executable file format
|
||||
CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS
|
||||
CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG
|
||||
CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL
|
||||
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE
|
||||
CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1
|
||||
//Name of external makefile project generator.
|
||||
CMAKE_EXTRA_GENERATOR:INTERNAL=
|
||||
//Name of generator.
|
||||
CMAKE_GENERATOR:INTERNAL=Ninja
|
||||
//Generator instance identifier.
|
||||
CMAKE_GENERATOR_INSTANCE:INTERNAL=
|
||||
//Name of generator platform.
|
||||
CMAKE_GENERATOR_PLATFORM:INTERNAL=
|
||||
//Name of generator toolset.
|
||||
CMAKE_GENERATOR_TOOLSET:INTERNAL=
|
||||
//Source directory with the top level CMakeLists.txt file for this
|
||||
// project
|
||||
CMAKE_HOME_DIRECTORY:INTERNAL=/home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C
|
||||
//Install .so files without execute permission.
|
||||
CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_LINKER
|
||||
CMAKE_LINKER-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS
|
||||
CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG
|
||||
CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL
|
||||
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_NM
|
||||
CMAKE_NM-ADVANCED:INTERNAL=1
|
||||
//number of local generators
|
||||
CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_OBJCOPY
|
||||
CMAKE_OBJCOPY-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_OBJDUMP
|
||||
CMAKE_OBJDUMP-ADVANCED:INTERNAL=1
|
||||
//Platform information initialized
|
||||
CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_RANLIB
|
||||
CMAKE_RANLIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_READELF
|
||||
CMAKE_READELF-ADVANCED:INTERNAL=1
|
||||
//Path to CMake installation.
|
||||
CMAKE_ROOT:INTERNAL=/snap/clion/184/bin/cmake/linux/share/cmake-3.21
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS
|
||||
CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG
|
||||
CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL
|
||||
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH
|
||||
CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SKIP_RPATH
|
||||
CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS
|
||||
CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG
|
||||
CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
|
||||
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STRIP
|
||||
CMAKE_STRIP-ADVANCED:INTERNAL=1
|
||||
//uname command
|
||||
CMAKE_UNAME:INTERNAL=/bin/uname
|
||||
//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE
|
||||
CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
set(CMAKE_C_COMPILER "/usr/bin/cc")
|
||||
set(CMAKE_C_COMPILER_ARG1 "")
|
||||
set(CMAKE_C_COMPILER_ID "GNU")
|
||||
set(CMAKE_C_COMPILER_VERSION "7.5.0")
|
||||
set(CMAKE_C_COMPILER_VERSION_INTERNAL "")
|
||||
set(CMAKE_C_COMPILER_WRAPPER "")
|
||||
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "11")
|
||||
set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert")
|
||||
set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes")
|
||||
set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros")
|
||||
set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert")
|
||||
set(CMAKE_C17_COMPILE_FEATURES "")
|
||||
set(CMAKE_C23_COMPILE_FEATURES "")
|
||||
|
||||
set(CMAKE_C_PLATFORM_ID "Linux")
|
||||
set(CMAKE_C_SIMULATE_ID "")
|
||||
set(CMAKE_C_COMPILER_FRONTEND_VARIANT "")
|
||||
set(CMAKE_C_SIMULATE_VERSION "")
|
||||
|
||||
|
||||
|
||||
|
||||
set(CMAKE_AR "/usr/bin/ar")
|
||||
set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-7")
|
||||
set(CMAKE_RANLIB "/usr/bin/ranlib")
|
||||
set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-7")
|
||||
set(CMAKE_LINKER "/usr/bin/ld")
|
||||
set(CMAKE_MT "")
|
||||
set(CMAKE_COMPILER_IS_GNUCC 1)
|
||||
set(CMAKE_C_COMPILER_LOADED 1)
|
||||
set(CMAKE_C_COMPILER_WORKS TRUE)
|
||||
set(CMAKE_C_ABI_COMPILED TRUE)
|
||||
set(CMAKE_COMPILER_IS_MINGW )
|
||||
set(CMAKE_COMPILER_IS_CYGWIN )
|
||||
if(CMAKE_COMPILER_IS_CYGWIN)
|
||||
set(CYGWIN 1)
|
||||
set(UNIX 1)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_COMPILER_ENV_VAR "CC")
|
||||
|
||||
if(CMAKE_COMPILER_IS_MINGW)
|
||||
set(MINGW 1)
|
||||
endif()
|
||||
set(CMAKE_C_COMPILER_ID_RUN 1)
|
||||
set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
|
||||
set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
|
||||
set(CMAKE_C_LINKER_PREFERENCE 10)
|
||||
|
||||
# Save compiler ABI information.
|
||||
set(CMAKE_C_SIZEOF_DATA_PTR "8")
|
||||
set(CMAKE_C_COMPILER_ABI "ELF")
|
||||
set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN")
|
||||
set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
|
||||
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR)
|
||||
set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ABI)
|
||||
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_LIBRARY_ARCHITECTURE)
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "")
|
||||
if(CMAKE_C_CL_SHOWINCLUDES_PREFIX)
|
||||
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}")
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include")
|
||||
set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s")
|
||||
set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/7;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib")
|
||||
set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
|
|
@ -1,15 +0,0 @@
|
|||
set(CMAKE_HOST_SYSTEM "Linux-4.15.0-171-generic")
|
||||
set(CMAKE_HOST_SYSTEM_NAME "Linux")
|
||||
set(CMAKE_HOST_SYSTEM_VERSION "4.15.0-171-generic")
|
||||
set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
|
||||
|
||||
|
||||
|
||||
set(CMAKE_SYSTEM "Linux-4.15.0-171-generic")
|
||||
set(CMAKE_SYSTEM_NAME "Linux")
|
||||
set(CMAKE_SYSTEM_VERSION "4.15.0-171-generic")
|
||||
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
|
||||
|
||||
set(CMAKE_CROSSCOMPILING "FALSE")
|
||||
|
||||
set(CMAKE_SYSTEM_LOADED 1)
|
|
@ -1,807 +0,0 @@
|
|||
#ifdef __cplusplus
|
||||
# error "A C++ compiler has been selected for C."
|
||||
#endif
|
||||
|
||||
#if defined(__18CXX)
|
||||
# define ID_VOID_MAIN
|
||||
#endif
|
||||
#if defined(__CLASSIC_C__)
|
||||
/* cv-qualifiers did not exist in K&R C */
|
||||
# define const
|
||||
# define volatile
|
||||
#endif
|
||||
|
||||
#if !defined(__has_include)
|
||||
/* If the compiler does not have __has_include, pretend the answer is
|
||||
always no. */
|
||||
# define __has_include(x) 0
|
||||
#endif
|
||||
|
||||
|
||||
/* Version number components: V=Version, R=Revision, P=Patch
|
||||
Version date components: YYYY=Year, MM=Month, DD=Day */
|
||||
|
||||
#if defined(__INTEL_COMPILER) || defined(__ICC)
|
||||
# define COMPILER_ID "Intel"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# if defined(__GNUC__)
|
||||
# define SIMULATE_ID "GNU"
|
||||
# endif
|
||||
/* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later,
|
||||
except that a few beta releases use the old format with V=2021. */
|
||||
# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
|
||||
# if defined(__INTEL_COMPILER_UPDATE)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
|
||||
# else
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
|
||||
# endif
|
||||
# else
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE)
|
||||
/* The third version component from --version is an update index,
|
||||
but no macro is provided for it. */
|
||||
# define COMPILER_VERSION_PATCH DEC(0)
|
||||
# endif
|
||||
# if defined(__INTEL_COMPILER_BUILD_DATE)
|
||||
/* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
|
||||
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
|
||||
# endif
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
# if defined(__GNUC__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
|
||||
# elif defined(__GNUG__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
|
||||
# endif
|
||||
# if defined(__GNUC_MINOR__)
|
||||
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
# endif
|
||||
# if defined(__GNUC_PATCHLEVEL__)
|
||||
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER)
|
||||
# define COMPILER_ID "IntelLLVM"
|
||||
#if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
# define SIMULATE_ID "GNU"
|
||||
#endif
|
||||
/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and
|
||||
* later. Look for 6 digit vs. 8 digit version number to decide encoding.
|
||||
* VVVV is no smaller than the current year when a version is released.
|
||||
*/
|
||||
#if __INTEL_LLVM_COMPILER < 1000000L
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10)
|
||||
#else
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100)
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
|
||||
#elif defined(__GNUG__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
|
||||
#endif
|
||||
#if defined(__GNUC_MINOR__)
|
||||
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
#endif
|
||||
#if defined(__GNUC_PATCHLEVEL__)
|
||||
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
#endif
|
||||
|
||||
#elif defined(__PATHCC__)
|
||||
# define COMPILER_ID "PathScale"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
|
||||
# if defined(__PATHCC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
|
||||
# define COMPILER_ID "Embarcadero"
|
||||
# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
|
||||
# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
|
||||
# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF)
|
||||
|
||||
#elif defined(__BORLANDC__)
|
||||
# define COMPILER_ID "Borland"
|
||||
/* __BORLANDC__ = 0xVRR */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
|
||||
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
|
||||
|
||||
#elif defined(__WATCOMC__) && __WATCOMC__ < 1200
|
||||
# define COMPILER_ID "Watcom"
|
||||
/* __WATCOMC__ = VVRR */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
|
||||
# if (__WATCOMC__ % 10) > 0
|
||||
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# define COMPILER_ID "OpenWatcom"
|
||||
/* __WATCOMC__ = VVRP + 1100 */
|
||||
# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
|
||||
# if (__WATCOMC__ % 10) > 0
|
||||
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__SUNPRO_C)
|
||||
# define COMPILER_ID "SunPro"
|
||||
# if __SUNPRO_C >= 0x5100
|
||||
/* __SUNPRO_C = 0xVRRP */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12)
|
||||
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF)
|
||||
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
|
||||
# else
|
||||
/* __SUNPRO_CC = 0xVRP */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8)
|
||||
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF)
|
||||
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
|
||||
# endif
|
||||
|
||||
#elif defined(__HP_cc)
|
||||
# define COMPILER_ID "HP"
|
||||
/* __HP_cc = VVRRPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100)
|
||||
|
||||
#elif defined(__DECC)
|
||||
# define COMPILER_ID "Compaq"
|
||||
/* __DECC_VER = VVRRTPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000)
|
||||
|
||||
#elif defined(__IBMC__) && defined(__COMPILER_VER__)
|
||||
# define COMPILER_ID "zOS"
|
||||
/* __IBMC__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
|
||||
|
||||
#elif defined(__ibmxl__) && defined(__clang__)
|
||||
# define COMPILER_ID "XLClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
|
||||
# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
|
||||
|
||||
|
||||
#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800
|
||||
# define COMPILER_ID "XL"
|
||||
/* __IBMC__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
|
||||
|
||||
#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800
|
||||
# define COMPILER_ID "VisualAge"
|
||||
/* __IBMC__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
|
||||
|
||||
#elif defined(__NVCOMPILER)
|
||||
# define COMPILER_ID "NVHPC"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__)
|
||||
# if defined(__NVCOMPILER_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(__PGI)
|
||||
# define COMPILER_ID "PGI"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
|
||||
# if defined(__PGIC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(_CRAYC)
|
||||
# define COMPILER_ID "Cray"
|
||||
# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
|
||||
# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
|
||||
|
||||
#elif defined(__TI_COMPILER_VERSION__)
|
||||
# define COMPILER_ID "TI"
|
||||
/* __TI_COMPILER_VERSION__ = VVVRRRPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
|
||||
# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
|
||||
|
||||
#elif defined(__CLANG_FUJITSU)
|
||||
# define COMPILER_ID "FujitsuClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
|
||||
# define COMPILER_VERSION_INTERNAL_STR __clang_version__
|
||||
|
||||
|
||||
#elif defined(__FUJITSU)
|
||||
# define COMPILER_ID "Fujitsu"
|
||||
# if defined(__FCC_version__)
|
||||
# define COMPILER_VERSION __FCC_version__
|
||||
# elif defined(__FCC_major__)
|
||||
# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
|
||||
# endif
|
||||
# if defined(__fcc_version)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__fcc_version)
|
||||
# elif defined(__FCC_VERSION)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION)
|
||||
# endif
|
||||
|
||||
|
||||
#elif defined(__ghs__)
|
||||
# define COMPILER_ID "GHS"
|
||||
/* __GHS_VERSION_NUMBER = VVVVRP */
|
||||
# ifdef __GHS_VERSION_NUMBER
|
||||
# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__TINYC__)
|
||||
# define COMPILER_ID "TinyCC"
|
||||
|
||||
#elif defined(__BCC__)
|
||||
# define COMPILER_ID "Bruce"
|
||||
|
||||
#elif defined(__SCO_VERSION__)
|
||||
# define COMPILER_ID "SCO"
|
||||
|
||||
#elif defined(__ARMCC_VERSION) && !defined(__clang__)
|
||||
# define COMPILER_ID "ARMCC"
|
||||
#if __ARMCC_VERSION >= 1000000
|
||||
/* __ARMCC_VERSION = VRRPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
|
||||
#else
|
||||
/* __ARMCC_VERSION = VRPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
|
||||
#endif
|
||||
|
||||
|
||||
#elif defined(__clang__) && defined(__apple_build_version__)
|
||||
# define COMPILER_ID "AppleClang"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
|
||||
|
||||
#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION)
|
||||
# define COMPILER_ID "ARMClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION)
|
||||
|
||||
#elif defined(__clang__) && __has_include(<hip/hip_version.h>)
|
||||
# define COMPILER_ID "ROCMClang"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# elif defined(__clang__)
|
||||
# define SIMULATE_ID "Clang"
|
||||
# elif defined(__GNUC__)
|
||||
# define SIMULATE_ID "GNU"
|
||||
# endif
|
||||
# if defined(__clang__) && __has_include(<hip/hip_version.h>)
|
||||
# include <hip/hip_version.h>
|
||||
# define COMPILER_VERSION_MAJOR DEC(HIP_VERSION_MAJOR)
|
||||
# define COMPILER_VERSION_MINOR DEC(HIP_VERSION_MINOR)
|
||||
# define COMPILER_VERSION_PATCH DEC(HIP_VERSION_PATCH)
|
||||
# endif
|
||||
|
||||
#elif defined(__clang__)
|
||||
# define COMPILER_ID "Clang"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
# define COMPILER_ID "GNU"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
|
||||
# if defined(__GNUC_MINOR__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
# endif
|
||||
# if defined(__GNUC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
# define COMPILER_ID "MSVC"
|
||||
/* _MSC_VER = VVRR */
|
||||
# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# if defined(_MSC_FULL_VER)
|
||||
# if _MSC_VER >= 1400
|
||||
/* _MSC_FULL_VER = VVRRPPPPP */
|
||||
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
|
||||
# else
|
||||
/* _MSC_FULL_VER = VVRRPPPP */
|
||||
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
|
||||
# endif
|
||||
# endif
|
||||
# if defined(_MSC_BUILD)
|
||||
# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
|
||||
# endif
|
||||
|
||||
#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
|
||||
# define COMPILER_ID "ADSP"
|
||||
#if defined(__VISUALDSPVERSION__)
|
||||
/* __VISUALDSPVERSION__ = 0xVVRRPP00 */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
|
||||
# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
|
||||
# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
|
||||
#endif
|
||||
|
||||
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
|
||||
# define COMPILER_ID "IAR"
|
||||
# if defined(__VER__) && defined(__ICCARM__)
|
||||
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
|
||||
# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
|
||||
# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__))
|
||||
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100))
|
||||
# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
|
||||
# endif
|
||||
|
||||
#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC)
|
||||
# define COMPILER_ID "SDCC"
|
||||
# if defined(__SDCC_VERSION_MAJOR)
|
||||
# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR)
|
||||
# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR)
|
||||
# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH)
|
||||
# else
|
||||
/* SDCC = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(SDCC/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(SDCC % 10)
|
||||
# endif
|
||||
|
||||
|
||||
/* These compilers are either not known or too old to define an
|
||||
identification macro. Try to identify the platform and guess that
|
||||
it is the native compiler. */
|
||||
#elif defined(__hpux) || defined(__hpua)
|
||||
# define COMPILER_ID "HP"
|
||||
|
||||
#else /* unknown compiler */
|
||||
# define COMPILER_ID ""
|
||||
#endif
|
||||
|
||||
/* Construct the string literal in pieces to prevent the source from
|
||||
getting matched. Store it in a pointer rather than an array
|
||||
because some compilers will just produce instructions to fill the
|
||||
array rather than assigning a pointer to a static array. */
|
||||
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
|
||||
#ifdef SIMULATE_ID
|
||||
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
|
||||
#endif
|
||||
|
||||
#ifdef __QNXNTO__
|
||||
char const* qnxnto = "INFO" ":" "qnxnto[]";
|
||||
#endif
|
||||
|
||||
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
|
||||
char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
|
||||
#endif
|
||||
|
||||
#define STRINGIFY_HELPER(X) #X
|
||||
#define STRINGIFY(X) STRINGIFY_HELPER(X)
|
||||
|
||||
/* Identify known platforms by name. */
|
||||
#if defined(__linux) || defined(__linux__) || defined(linux)
|
||||
# define PLATFORM_ID "Linux"
|
||||
|
||||
#elif defined(__MSYS__)
|
||||
# define PLATFORM_ID "MSYS"
|
||||
|
||||
#elif defined(__CYGWIN__)
|
||||
# define PLATFORM_ID "Cygwin"
|
||||
|
||||
#elif defined(__MINGW32__)
|
||||
# define PLATFORM_ID "MinGW"
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
# define PLATFORM_ID "Darwin"
|
||||
|
||||
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||
# define PLATFORM_ID "Windows"
|
||||
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD)
|
||||
# define PLATFORM_ID "FreeBSD"
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__NetBSD)
|
||||
# define PLATFORM_ID "NetBSD"
|
||||
|
||||
#elif defined(__OpenBSD__) || defined(__OPENBSD)
|
||||
# define PLATFORM_ID "OpenBSD"
|
||||
|
||||
#elif defined(__sun) || defined(sun)
|
||||
# define PLATFORM_ID "SunOS"
|
||||
|
||||
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
|
||||
# define PLATFORM_ID "AIX"
|
||||
|
||||
#elif defined(__hpux) || defined(__hpux__)
|
||||
# define PLATFORM_ID "HP-UX"
|
||||
|
||||
#elif defined(__HAIKU__)
|
||||
# define PLATFORM_ID "Haiku"
|
||||
|
||||
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
|
||||
# define PLATFORM_ID "BeOS"
|
||||
|
||||
#elif defined(__QNX__) || defined(__QNXNTO__)
|
||||
# define PLATFORM_ID "QNX"
|
||||
|
||||
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
|
||||
# define PLATFORM_ID "Tru64"
|
||||
|
||||
#elif defined(__riscos) || defined(__riscos__)
|
||||
# define PLATFORM_ID "RISCos"
|
||||
|
||||
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
|
||||
# define PLATFORM_ID "SINIX"
|
||||
|
||||
#elif defined(__UNIX_SV__)
|
||||
# define PLATFORM_ID "UNIX_SV"
|
||||
|
||||
#elif defined(__bsdos__)
|
||||
# define PLATFORM_ID "BSDOS"
|
||||
|
||||
#elif defined(_MPRAS) || defined(MPRAS)
|
||||
# define PLATFORM_ID "MP-RAS"
|
||||
|
||||
#elif defined(__osf) || defined(__osf__)
|
||||
# define PLATFORM_ID "OSF1"
|
||||
|
||||
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
|
||||
# define PLATFORM_ID "SCO_SV"
|
||||
|
||||
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
|
||||
# define PLATFORM_ID "ULTRIX"
|
||||
|
||||
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
|
||||
# define PLATFORM_ID "Xenix"
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# if defined(__LINUX__)
|
||||
# define PLATFORM_ID "Linux"
|
||||
|
||||
# elif defined(__DOS__)
|
||||
# define PLATFORM_ID "DOS"
|
||||
|
||||
# elif defined(__OS2__)
|
||||
# define PLATFORM_ID "OS2"
|
||||
|
||||
# elif defined(__WINDOWS__)
|
||||
# define PLATFORM_ID "Windows3x"
|
||||
|
||||
# elif defined(__VXWORKS__)
|
||||
# define PLATFORM_ID "VxWorks"
|
||||
|
||||
# else /* unknown platform */
|
||||
# define PLATFORM_ID
|
||||
# endif
|
||||
|
||||
#elif defined(__INTEGRITY)
|
||||
# if defined(INT_178B)
|
||||
# define PLATFORM_ID "Integrity178"
|
||||
|
||||
# else /* regular Integrity */
|
||||
# define PLATFORM_ID "Integrity"
|
||||
# endif
|
||||
|
||||
#else /* unknown platform */
|
||||
# define PLATFORM_ID
|
||||
|
||||
#endif
|
||||
|
||||
/* For windows compilers MSVC and Intel we can determine
|
||||
the architecture of the compiler being used. This is because
|
||||
the compilers do not have flags that can change the architecture,
|
||||
but rather depend on which compiler is being used
|
||||
*/
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
# if defined(_M_IA64)
|
||||
# define ARCHITECTURE_ID "IA64"
|
||||
|
||||
# elif defined(_M_ARM64EC)
|
||||
# define ARCHITECTURE_ID "ARM64EC"
|
||||
|
||||
# elif defined(_M_X64) || defined(_M_AMD64)
|
||||
# define ARCHITECTURE_ID "x64"
|
||||
|
||||
# elif defined(_M_IX86)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# elif defined(_M_ARM64)
|
||||
# define ARCHITECTURE_ID "ARM64"
|
||||
|
||||
# elif defined(_M_ARM)
|
||||
# if _M_ARM == 4
|
||||
# define ARCHITECTURE_ID "ARMV4I"
|
||||
# elif _M_ARM == 5
|
||||
# define ARCHITECTURE_ID "ARMV5I"
|
||||
# else
|
||||
# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
|
||||
# endif
|
||||
|
||||
# elif defined(_M_MIPS)
|
||||
# define ARCHITECTURE_ID "MIPS"
|
||||
|
||||
# elif defined(_M_SH)
|
||||
# define ARCHITECTURE_ID "SHx"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# if defined(_M_I86)
|
||||
# define ARCHITECTURE_ID "I86"
|
||||
|
||||
# elif defined(_M_IX86)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
|
||||
# if defined(__ICCARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__ICCRX__)
|
||||
# define ARCHITECTURE_ID "RX"
|
||||
|
||||
# elif defined(__ICCRH850__)
|
||||
# define ARCHITECTURE_ID "RH850"
|
||||
|
||||
# elif defined(__ICCRL78__)
|
||||
# define ARCHITECTURE_ID "RL78"
|
||||
|
||||
# elif defined(__ICCRISCV__)
|
||||
# define ARCHITECTURE_ID "RISCV"
|
||||
|
||||
# elif defined(__ICCAVR__)
|
||||
# define ARCHITECTURE_ID "AVR"
|
||||
|
||||
# elif defined(__ICC430__)
|
||||
# define ARCHITECTURE_ID "MSP430"
|
||||
|
||||
# elif defined(__ICCV850__)
|
||||
# define ARCHITECTURE_ID "V850"
|
||||
|
||||
# elif defined(__ICC8051__)
|
||||
# define ARCHITECTURE_ID "8051"
|
||||
|
||||
# elif defined(__ICCSTM8__)
|
||||
# define ARCHITECTURE_ID "STM8"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__ghs__)
|
||||
# if defined(__PPC64__)
|
||||
# define ARCHITECTURE_ID "PPC64"
|
||||
|
||||
# elif defined(__ppc__)
|
||||
# define ARCHITECTURE_ID "PPC"
|
||||
|
||||
# elif defined(__ARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__x86_64__)
|
||||
# define ARCHITECTURE_ID "x64"
|
||||
|
||||
# elif defined(__i386__)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__TI_COMPILER_VERSION__)
|
||||
# if defined(__TI_ARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__MSP430__)
|
||||
# define ARCHITECTURE_ID "MSP430"
|
||||
|
||||
# elif defined(__TMS320C28XX__)
|
||||
# define ARCHITECTURE_ID "TMS320C28x"
|
||||
|
||||
# elif defined(__TMS320C6X__) || defined(_TMS320C6X)
|
||||
# define ARCHITECTURE_ID "TMS320C6x"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#else
|
||||
# define ARCHITECTURE_ID
|
||||
#endif
|
||||
|
||||
/* Convert integer to decimal digit literals. */
|
||||
#define DEC(n) \
|
||||
('0' + (((n) / 10000000)%10)), \
|
||||
('0' + (((n) / 1000000)%10)), \
|
||||
('0' + (((n) / 100000)%10)), \
|
||||
('0' + (((n) / 10000)%10)), \
|
||||
('0' + (((n) / 1000)%10)), \
|
||||
('0' + (((n) / 100)%10)), \
|
||||
('0' + (((n) / 10)%10)), \
|
||||
('0' + ((n) % 10))
|
||||
|
||||
/* Convert integer to hex digit literals. */
|
||||
#define HEX(n) \
|
||||
('0' + ((n)>>28 & 0xF)), \
|
||||
('0' + ((n)>>24 & 0xF)), \
|
||||
('0' + ((n)>>20 & 0xF)), \
|
||||
('0' + ((n)>>16 & 0xF)), \
|
||||
('0' + ((n)>>12 & 0xF)), \
|
||||
('0' + ((n)>>8 & 0xF)), \
|
||||
('0' + ((n)>>4 & 0xF)), \
|
||||
('0' + ((n) & 0xF))
|
||||
|
||||
/* Construct a string literal encoding the version number. */
|
||||
#ifdef COMPILER_VERSION
|
||||
char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]";
|
||||
|
||||
/* Construct a string literal encoding the version number components. */
|
||||
#elif defined(COMPILER_VERSION_MAJOR)
|
||||
char const info_version[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
|
||||
COMPILER_VERSION_MAJOR,
|
||||
# ifdef COMPILER_VERSION_MINOR
|
||||
'.', COMPILER_VERSION_MINOR,
|
||||
# ifdef COMPILER_VERSION_PATCH
|
||||
'.', COMPILER_VERSION_PATCH,
|
||||
# ifdef COMPILER_VERSION_TWEAK
|
||||
'.', COMPILER_VERSION_TWEAK,
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
']','\0'};
|
||||
#endif
|
||||
|
||||
/* Construct a string literal encoding the internal version number. */
|
||||
#ifdef COMPILER_VERSION_INTERNAL
|
||||
char const info_version_internal[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
|
||||
'i','n','t','e','r','n','a','l','[',
|
||||
COMPILER_VERSION_INTERNAL,']','\0'};
|
||||
#elif defined(COMPILER_VERSION_INTERNAL_STR)
|
||||
char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]";
|
||||
#endif
|
||||
|
||||
/* Construct a string literal encoding the version number components. */
|
||||
#ifdef SIMULATE_VERSION_MAJOR
|
||||
char const info_simulate_version[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
|
||||
SIMULATE_VERSION_MAJOR,
|
||||
# ifdef SIMULATE_VERSION_MINOR
|
||||
'.', SIMULATE_VERSION_MINOR,
|
||||
# ifdef SIMULATE_VERSION_PATCH
|
||||
'.', SIMULATE_VERSION_PATCH,
|
||||
# ifdef SIMULATE_VERSION_TWEAK
|
||||
'.', SIMULATE_VERSION_TWEAK,
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
']','\0'};
|
||||
#endif
|
||||
|
||||
/* Construct the string literal in pieces to prevent the source from
|
||||
getting matched. Store it in a pointer rather than an array
|
||||
because some compilers will just produce instructions to fill the
|
||||
array rather than assigning a pointer to a static array. */
|
||||
char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
|
||||
char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
|
||||
|
||||
|
||||
|
||||
#if !defined(__STDC__) && !defined(__clang__)
|
||||
# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__)
|
||||
# define C_DIALECT "90"
|
||||
# else
|
||||
# define C_DIALECT
|
||||
# endif
|
||||
#elif __STDC_VERSION__ > 201710L
|
||||
# define C_DIALECT "23"
|
||||
#elif __STDC_VERSION__ >= 201710L
|
||||
# define C_DIALECT "17"
|
||||
#elif __STDC_VERSION__ >= 201000L
|
||||
# define C_DIALECT "11"
|
||||
#elif __STDC_VERSION__ >= 199901L
|
||||
# define C_DIALECT "99"
|
||||
#else
|
||||
# define C_DIALECT "90"
|
||||
#endif
|
||||
const char* info_language_dialect_default =
|
||||
"INFO" ":" "dialect_default[" C_DIALECT "]";
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef ID_VOID_MAIN
|
||||
void main() {}
|
||||
#else
|
||||
# if defined(__CLASSIC_C__)
|
||||
int main(argc, argv) int argc; char *argv[];
|
||||
# else
|
||||
int main(int argc, char* argv[])
|
||||
# endif
|
||||
{
|
||||
int require = 0;
|
||||
require += info_compiler[argc];
|
||||
require += info_platform[argc];
|
||||
require += info_arch[argc];
|
||||
#ifdef COMPILER_VERSION_MAJOR
|
||||
require += info_version[argc];
|
||||
#endif
|
||||
#ifdef COMPILER_VERSION_INTERNAL
|
||||
require += info_version_internal[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_ID
|
||||
require += info_simulate[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_VERSION_MAJOR
|
||||
require += info_simulate_version[argc];
|
||||
#endif
|
||||
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
|
||||
require += info_cray[argc];
|
||||
#endif
|
||||
require += info_language_dialect_default[argc];
|
||||
(void)argv;
|
||||
return require;
|
||||
}
|
||||
#endif
|
|
@ -1,207 +0,0 @@
|
|||
The system is: Linux - 4.15.0-171-generic - x86_64
|
||||
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
|
||||
Compiler: /usr/bin/cc
|
||||
Build flags:
|
||||
Id flags:
|
||||
|
||||
The output was:
|
||||
0
|
||||
|
||||
|
||||
Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out"
|
||||
|
||||
The C compiler identification is GNU, found in "/home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C/cmake-build-debug/CMakeFiles/3.21.1/CompilerIdC/a.out"
|
||||
|
||||
Detecting C compiler ABI info compiled with the following output:
|
||||
Change Dir: /home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C/cmake-build-debug/CMakeFiles/CMakeTmp
|
||||
|
||||
Run Build Command(s):/snap/clion/184/bin/ninja/linux/ninja cmTC_1d9a8 && [1/2] Building C object CMakeFiles/cmTC_1d9a8.dir/CMakeCCompilerABI.c.o
|
||||
Using built-in specs.
|
||||
COLLECT_GCC=/usr/bin/cc
|
||||
OFFLOAD_TARGET_NAMES=nvptx-none
|
||||
OFFLOAD_TARGET_DEFAULT=1
|
||||
Target: x86_64-linux-gnu
|
||||
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
|
||||
Thread model: posix
|
||||
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
|
||||
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_1d9a8.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'
|
||||
/usr/lib/gcc/x86_64-linux-gnu/7/cc1 -quiet -v -imultiarch x86_64-linux-gnu /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_1d9a8.dir/CMakeCCompilerABI.c.o -version -fstack-protector-strong -Wformat -Wformat-security -o /tmp/cc9CLwPx.s
|
||||
GNU C11 (Ubuntu 7.5.0-3ubuntu1~18.04) version 7.5.0 (x86_64-linux-gnu)
|
||||
compiled by GNU C version 7.5.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP
|
||||
|
||||
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
|
||||
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
|
||||
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/7/../../../../x86_64-linux-gnu/include"
|
||||
#include "..." search starts here:
|
||||
#include <...> search starts here:
|
||||
/usr/lib/gcc/x86_64-linux-gnu/7/include
|
||||
/usr/local/include
|
||||
/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed
|
||||
/usr/include/x86_64-linux-gnu
|
||||
/usr/include
|
||||
End of search list.
|
||||
GNU C11 (Ubuntu 7.5.0-3ubuntu1~18.04) version 7.5.0 (x86_64-linux-gnu)
|
||||
compiled by GNU C version 7.5.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP
|
||||
|
||||
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
|
||||
Compiler executable checksum: b62ed4a2880cd4159476ea8293b72fa8
|
||||
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_1d9a8.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'
|
||||
as -v --64 -o CMakeFiles/cmTC_1d9a8.dir/CMakeCCompilerABI.c.o /tmp/cc9CLwPx.s
|
||||
GNU assembler version 2.30 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.30
|
||||
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/
|
||||
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../:/lib/:/usr/lib/
|
||||
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_1d9a8.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'
|
||||
[2/2] Linking C executable cmTC_1d9a8
|
||||
Using built-in specs.
|
||||
COLLECT_GCC=/usr/bin/cc
|
||||
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
|
||||
OFFLOAD_TARGET_NAMES=nvptx-none
|
||||
OFFLOAD_TARGET_DEFAULT=1
|
||||
Target: x86_64-linux-gnu
|
||||
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
|
||||
Thread model: posix
|
||||
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
|
||||
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/
|
||||
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../:/lib/:/usr/lib/
|
||||
COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_1d9a8' '-mtune=generic' '-march=x86-64'
|
||||
/usr/lib/gcc/x86_64-linux-gnu/7/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/7/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper -plugin-opt=-fresolution=/tmp/ccTuimBv.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_1d9a8 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/7 -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/7/../../.. CMakeFiles/cmTC_1d9a8.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o
|
||||
COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_1d9a8' '-mtune=generic' '-march=x86-64'
|
||||
|
||||
|
||||
|
||||
Parsed C implicit include dir info from above output: rv=done
|
||||
found start of include info
|
||||
found start of implicit include info
|
||||
add: [/usr/lib/gcc/x86_64-linux-gnu/7/include]
|
||||
add: [/usr/local/include]
|
||||
add: [/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed]
|
||||
add: [/usr/include/x86_64-linux-gnu]
|
||||
add: [/usr/include]
|
||||
end of search list found
|
||||
collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/7/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/7/include]
|
||||
collapse include dir [/usr/local/include] ==> [/usr/local/include]
|
||||
collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed] ==> [/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed]
|
||||
collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu]
|
||||
collapse include dir [/usr/include] ==> [/usr/include]
|
||||
implicit include dirs: [/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include]
|
||||
|
||||
|
||||
Parsed C implicit link information from above output:
|
||||
link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)]
|
||||
ignore line: [Change Dir: /home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C/cmake-build-debug/CMakeFiles/CMakeTmp]
|
||||
ignore line: []
|
||||
ignore line: [Run Build Command(s):/snap/clion/184/bin/ninja/linux/ninja cmTC_1d9a8 && [1/2] Building C object CMakeFiles/cmTC_1d9a8.dir/CMakeCCompilerABI.c.o]
|
||||
ignore line: [Using built-in specs.]
|
||||
ignore line: [COLLECT_GCC=/usr/bin/cc]
|
||||
ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none]
|
||||
ignore line: [OFFLOAD_TARGET_DEFAULT=1]
|
||||
ignore line: [Target: x86_64-linux-gnu]
|
||||
ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu]
|
||||
ignore line: [Thread model: posix]
|
||||
ignore line: [gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) ]
|
||||
ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_1d9a8.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64']
|
||||
ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/7/cc1 -quiet -v -imultiarch x86_64-linux-gnu /snap/clion/184/bin/cmake/linux/share/cmake-3.21/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_1d9a8.dir/CMakeCCompilerABI.c.o -version -fstack-protector-strong -Wformat -Wformat-security -o /tmp/cc9CLwPx.s]
|
||||
ignore line: [GNU C11 (Ubuntu 7.5.0-3ubuntu1~18.04) version 7.5.0 (x86_64-linux-gnu)]
|
||||
ignore line: [ compiled by GNU C version 7.5.0 GMP version 6.1.2 MPFR version 4.0.1 MPC version 1.1.0 isl version isl-0.19-GMP]
|
||||
ignore line: []
|
||||
ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072]
|
||||
ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"]
|
||||
ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/7/../../../../x86_64-linux-gnu/include"]
|
||||
ignore line: [#include "..." search starts here:]
|
||||
ignore line: [#include <...> search starts here:]
|
||||
ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/7/include]
|
||||
ignore line: [ /usr/local/include]
|
||||
ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed]
|
||||
ignore line: [ /usr/include/x86_64-linux-gnu]
|
||||
ignore line: [ /usr/include]
|
||||
ignore line: [End of search list.]
|
||||
ignore line: [GNU C11 (Ubuntu 7.5.0-3ubuntu1~18.04) version 7.5.0 (x86_64-linux-gnu)]
|
||||
ignore line: [ compiled by GNU C version 7.5.0 GMP version 6.1.2 MPFR version 4.0.1 MPC version 1.1.0 isl version isl-0.19-GMP]
|
||||
ignore line: []
|
||||
ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072]
|
||||
ignore line: [Compiler executable checksum: b62ed4a2880cd4159476ea8293b72fa8]
|
||||
ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_1d9a8.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64']
|
||||
ignore line: [ as -v --64 -o CMakeFiles/cmTC_1d9a8.dir/CMakeCCompilerABI.c.o /tmp/cc9CLwPx.s]
|
||||
ignore line: [GNU assembler version 2.30 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.30]
|
||||
ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/]
|
||||
ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../:/lib/:/usr/lib/]
|
||||
ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_1d9a8.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64']
|
||||
ignore line: [[2/2] Linking C executable cmTC_1d9a8]
|
||||
ignore line: [Using built-in specs.]
|
||||
ignore line: [COLLECT_GCC=/usr/bin/cc]
|
||||
ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper]
|
||||
ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none]
|
||||
ignore line: [OFFLOAD_TARGET_DEFAULT=1]
|
||||
ignore line: [Target: x86_64-linux-gnu]
|
||||
ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu]
|
||||
ignore line: [Thread model: posix]
|
||||
ignore line: [gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) ]
|
||||
ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/]
|
||||
ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../:/lib/:/usr/lib/]
|
||||
ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_1d9a8' '-mtune=generic' '-march=x86-64']
|
||||
link line: [ /usr/lib/gcc/x86_64-linux-gnu/7/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/7/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper -plugin-opt=-fresolution=/tmp/ccTuimBv.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_1d9a8 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/7 -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/7/../../.. CMakeFiles/cmTC_1d9a8.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o]
|
||||
arg [/usr/lib/gcc/x86_64-linux-gnu/7/collect2] ==> ignore
|
||||
arg [-plugin] ==> ignore
|
||||
arg [/usr/lib/gcc/x86_64-linux-gnu/7/liblto_plugin.so] ==> ignore
|
||||
arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper] ==> ignore
|
||||
arg [-plugin-opt=-fresolution=/tmp/ccTuimBv.res] ==> ignore
|
||||
arg [-plugin-opt=-pass-through=-lgcc] ==> ignore
|
||||
arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore
|
||||
arg [-plugin-opt=-pass-through=-lc] ==> ignore
|
||||
arg [-plugin-opt=-pass-through=-lgcc] ==> ignore
|
||||
arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore
|
||||
arg [--build-id] ==> ignore
|
||||
arg [--eh-frame-hdr] ==> ignore
|
||||
arg [-m] ==> ignore
|
||||
arg [elf_x86_64] ==> ignore
|
||||
arg [--hash-style=gnu] ==> ignore
|
||||
arg [--as-needed] ==> ignore
|
||||
arg [-dynamic-linker] ==> ignore
|
||||
arg [/lib64/ld-linux-x86-64.so.2] ==> ignore
|
||||
arg [-pie] ==> ignore
|
||||
arg [-znow] ==> ignore
|
||||
arg [-zrelro] ==> ignore
|
||||
arg [-o] ==> ignore
|
||||
arg [cmTC_1d9a8] ==> ignore
|
||||
arg [/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o]
|
||||
arg [/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o]
|
||||
arg [/usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o]
|
||||
arg [-L/usr/lib/gcc/x86_64-linux-gnu/7] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/7]
|
||||
arg [-L/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu]
|
||||
arg [-L/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib]
|
||||
arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu]
|
||||
arg [-L/lib/../lib] ==> dir [/lib/../lib]
|
||||
arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu]
|
||||
arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib]
|
||||
arg [-L/usr/lib/gcc/x86_64-linux-gnu/7/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/7/../../..]
|
||||
arg [CMakeFiles/cmTC_1d9a8.dir/CMakeCCompilerABI.c.o] ==> ignore
|
||||
arg [-lgcc] ==> lib [gcc]
|
||||
arg [--push-state] ==> ignore
|
||||
arg [--as-needed] ==> ignore
|
||||
arg [-lgcc_s] ==> lib [gcc_s]
|
||||
arg [--pop-state] ==> ignore
|
||||
arg [-lc] ==> lib [c]
|
||||
arg [-lgcc] ==> lib [gcc]
|
||||
arg [--push-state] ==> ignore
|
||||
arg [--as-needed] ==> ignore
|
||||
arg [-lgcc_s] ==> lib [gcc_s]
|
||||
arg [--pop-state] ==> ignore
|
||||
arg [/usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o]
|
||||
arg [/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o]
|
||||
collapse obj [/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o] ==> [/usr/lib/x86_64-linux-gnu/Scrt1.o]
|
||||
collapse obj [/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o] ==> [/usr/lib/x86_64-linux-gnu/crti.o]
|
||||
collapse obj [/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o] ==> [/usr/lib/x86_64-linux-gnu/crtn.o]
|
||||
collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/7] ==> [/usr/lib/gcc/x86_64-linux-gnu/7]
|
||||
collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu]
|
||||
collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib] ==> [/usr/lib]
|
||||
collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu]
|
||||
collapse library dir [/lib/../lib] ==> [/lib]
|
||||
collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu]
|
||||
collapse library dir [/usr/lib/../lib] ==> [/usr/lib]
|
||||
collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/7/../../..] ==> [/usr/lib]
|
||||
implicit libs: [gcc;gcc_s;c;gcc;gcc_s]
|
||||
implicit objs: [/usr/lib/x86_64-linux-gnu/Scrt1.o;/usr/lib/x86_64-linux-gnu/crti.o;/usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o;/usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o;/usr/lib/x86_64-linux-gnu/crtn.o]
|
||||
implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/7;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib]
|
||||
implicit fwks: []
|
||||
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
/home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C/cmake-build-debug/CMakeFiles/rebuild_cache.dir
|
||||
/home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C/cmake-build-debug/CMakeFiles/edit_cache.dir
|
||||
/home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C/cmake-build-debug/CMakeFiles/Praktikum1.dir
|
|
@ -1,3 +0,0 @@
|
|||
ToolSet: 1.0 (local)Options:
|
||||
|
||||
Options:-DCMAKE_MAKE_PROGRAM=/snap/clion/184/bin/ninja/linux/ninja
|
|
@ -1,10 +0,0 @@
|
|||
/snap/clion/184/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/snap/clion/184/bin/ninja/linux/ninja -G Ninja /home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C
|
||||
-- The C compiler identification is GNU 7.5.0
|
||||
-- Detecting C compiler ABI info
|
||||
-- Detecting C compiler ABI info - done
|
||||
-- Check for working C compiler: /usr/bin/cc - skipped
|
||||
-- Detecting C compile features
|
||||
-- Detecting C compile features - done
|
||||
-- Configuring done
|
||||
-- Generating done
|
||||
-- Build files have been written to: /home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C/cmake-build-debug
|
|
@ -1 +0,0 @@
|
|||
# This file is generated by cmake for dependency checking of the CMakeCache.txt file
|
|
@ -1,64 +0,0 @@
|
|||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Ninja" Generator, CMake Version 3.21
|
||||
|
||||
# This file contains all the rules used to get the outputs files
|
||||
# built from the input files.
|
||||
# It is included in the main 'build.ninja'.
|
||||
|
||||
# =============================================================================
|
||||
# Project: Praktikum1
|
||||
# Configurations: Debug
|
||||
# =============================================================================
|
||||
# =============================================================================
|
||||
|
||||
#############################################
|
||||
# Rule for running custom commands.
|
||||
|
||||
rule CUSTOM_COMMAND
|
||||
command = $COMMAND
|
||||
description = $DESC
|
||||
|
||||
|
||||
#############################################
|
||||
# Rule for compiling C files.
|
||||
|
||||
rule C_COMPILER__Praktikum1_Debug
|
||||
depfile = $DEP_FILE
|
||||
deps = gcc
|
||||
command = /usr/bin/cc $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in
|
||||
description = Building C object $out
|
||||
|
||||
|
||||
#############################################
|
||||
# Rule for linking C executable.
|
||||
|
||||
rule C_EXECUTABLE_LINKER__Praktikum1_Debug
|
||||
command = $PRE_LINK && /usr/bin/cc $FLAGS $LINK_FLAGS $in -o $TARGET_FILE $LINK_PATH $LINK_LIBRARIES && $POST_BUILD
|
||||
description = Linking C executable $TARGET_FILE
|
||||
restat = $RESTAT
|
||||
|
||||
|
||||
#############################################
|
||||
# Rule for re-running cmake.
|
||||
|
||||
rule RERUN_CMAKE
|
||||
command = /snap/clion/184/bin/cmake/linux/bin/cmake --regenerate-during-build -S/home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C -B/home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C/cmake-build-debug
|
||||
description = Re-running CMake...
|
||||
generator = 1
|
||||
|
||||
|
||||
#############################################
|
||||
# Rule for cleaning all built files.
|
||||
|
||||
rule CLEAN
|
||||
command = /snap/clion/184/bin/ninja/linux/ninja $FILE_ARG -t clean $TARGETS
|
||||
description = Cleaning all built files...
|
||||
|
||||
|
||||
#############################################
|
||||
# Rule for printing all primary targets available.
|
||||
|
||||
rule HELP
|
||||
command = /snap/clion/184/bin/ninja/linux/ninja -t targets
|
||||
description = All primary targets available:
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
Start testing: Mar 23 15:37 CET
|
||||
----------------------------------------------------------
|
||||
End testing: Mar 23 15:37 CET
|
|
@ -1,54 +0,0 @@
|
|||
# Install script for directory: /home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C
|
||||
|
||||
# Set the install prefix
|
||||
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
|
||||
set(CMAKE_INSTALL_PREFIX "/usr/local")
|
||||
endif()
|
||||
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
# Set the install configuration name.
|
||||
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
|
||||
if(BUILD_TYPE)
|
||||
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
|
||||
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
|
||||
else()
|
||||
set(CMAKE_INSTALL_CONFIG_NAME "Debug")
|
||||
endif()
|
||||
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
|
||||
endif()
|
||||
|
||||
# Set the component getting installed.
|
||||
if(NOT CMAKE_INSTALL_COMPONENT)
|
||||
if(COMPONENT)
|
||||
message(STATUS "Install component: \"${COMPONENT}\"")
|
||||
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
|
||||
else()
|
||||
set(CMAKE_INSTALL_COMPONENT)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Install shared libraries without execute permission?
|
||||
if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
|
||||
set(CMAKE_INSTALL_SO_NO_EXE "1")
|
||||
endif()
|
||||
|
||||
# Is this installation the result of a crosscompile?
|
||||
if(NOT DEFINED CMAKE_CROSSCOMPILING)
|
||||
set(CMAKE_CROSSCOMPILING "FALSE")
|
||||
endif()
|
||||
|
||||
# Set default install directory permissions.
|
||||
if(NOT DEFINED CMAKE_OBJDUMP)
|
||||
set(CMAKE_OBJDUMP "/usr/bin/objdump")
|
||||
endif()
|
||||
|
||||
if(CMAKE_INSTALL_COMPONENT)
|
||||
set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
|
||||
else()
|
||||
set(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
|
||||
"${CMAKE_INSTALL_MANIFEST_FILES}")
|
||||
file(WRITE "/home/vagrant/snp/snp-lab-code/P01_Erste_Schritte_mit_C/cmake-build-debug/${CMAKE_INSTALL_MANIFEST}"
|
||||
"${CMAKE_INSTALL_MANIFEST_CONTENT}")
|
|
@ -1,108 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Funktionsdeklarationen */
|
||||
int gibIntWert(char text[], int min, int max);
|
||||
int istSchaltjahr(int jahr);
|
||||
int tageProMonat(int jahr, int monat);
|
||||
|
||||
|
||||
/* Mainfunktion */
|
||||
int main (int argc, char *argv[]) {
|
||||
|
||||
int monat, jahr;
|
||||
|
||||
// Monat einlesen und Bereich ueberpruefen
|
||||
monat = gibIntWert("Monat", 1, 12);
|
||||
jahr = gibIntWert("Jahr", 1600, 9999);
|
||||
|
||||
// Ausgabe zum Test
|
||||
printf("Monat: %d, Jahr: %d \n", monat, jahr);
|
||||
|
||||
// Ausgabe zum Test (hier mit dem ternaeren Operator "?:")
|
||||
printf("%d ist %s Schaltjahr\n", jahr, istSchaltjahr(jahr) ? "ein" : "kein");
|
||||
|
||||
// Ausgabe
|
||||
printf("Der Monat %02d-%d hat %d Tage.\n", monat, jahr, tageProMonat(jahr, monat));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Funktionsdefinitionen */
|
||||
int gibIntWert(char text[], int min, int max) {
|
||||
int wert;
|
||||
(void) printf("Enter %s :", text);
|
||||
scanf("%d", &wert);
|
||||
if(wert >= min & wert <= max){
|
||||
return wert;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int istSchaltjahr(int jahr){
|
||||
int ergebnis;
|
||||
if(jahr % 400 == 0){
|
||||
ergebnis = 1;
|
||||
}
|
||||
else if (jahr % 100 == 0){
|
||||
ergebnis = 0;
|
||||
}
|
||||
else if(jahr % 4 == 0){
|
||||
ergebnis = 1;
|
||||
}
|
||||
else {
|
||||
ergebnis = 0;
|
||||
}
|
||||
return ergebnis;
|
||||
}
|
||||
|
||||
int tageProMonat(int jahr, int monat){
|
||||
int ergebnis = 0;
|
||||
switch (monat) {
|
||||
case 1:
|
||||
ergebnis = 31;
|
||||
break;
|
||||
case 2:
|
||||
if(istSchaltjahr(jahr)){
|
||||
ergebnis = 29;
|
||||
}
|
||||
else {
|
||||
ergebnis = 28;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
ergebnis = 31;
|
||||
break;
|
||||
case 4:
|
||||
ergebnis = 30;
|
||||
break;
|
||||
case 5:
|
||||
ergebnis = 31;
|
||||
break;
|
||||
case 6:
|
||||
ergebnis = 30;
|
||||
break;
|
||||
case 7:
|
||||
ergebnis = 31;
|
||||
break;
|
||||
case 8:
|
||||
ergebnis = 31;
|
||||
break;
|
||||
case 9:
|
||||
ergebnis = 30;
|
||||
break;
|
||||
case 10:
|
||||
ergebnis = 31;
|
||||
break;
|
||||
case 11:
|
||||
ergebnis = 30;
|
||||
break;
|
||||
case 12:
|
||||
ergebnis = 31;
|
||||
break;
|
||||
}
|
||||
return ergebnis;
|
||||
}
|
|
@ -1,264 +0,0 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
* -- _____ ______ _____ -
|
||||
* -- |_ _| | ____|/ ____| -
|
||||
* -- | | _ __ | |__ | (___ Institute of Embedded Systems -
|
||||
* -- | | | '_ \| __| \___ \ Zuercher Hochschule Winterthur -
|
||||
* -- _| |_| | | | |____ ____) | (University of Applied Sciences) -
|
||||
* -- |_____|_| |_|______|_____/ 8401 Winterthur, Switzerland -
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* @file
|
||||
* @brief Lab P02 weekday
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
// *** TASK1: typedef enum types for month_t (Jan=1,...Dec} ***
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
typedef enum {Jan=1, Feb, Mar, Apr, May, June, July, Aug, Sept, Oct, Nov, Dec} month_t;
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
|
||||
// *** TASK1: typedef struct for date_t ***
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
typedef struct {int year, month, day;} date_t;
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
|
||||
// *** TASK2: typedef enum weekday_t (Sun=0, Mon, ...Sat) ***
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
typedef enum {Sun=0, Mon, Tue, Wed, Thu, Fri, Sat} weekday_t;
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
/**
|
||||
* @brief TASK1: Checks if the given date is a leap year.
|
||||
* @returns 0 = is not leap year, 1 = is leap year
|
||||
*/
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
int is_leap_year(date_t date){
|
||||
int ergebnis;
|
||||
if(date.year % 400 == 0){
|
||||
ergebnis = 1;
|
||||
}
|
||||
else if (date.year % 100 == 0){
|
||||
ergebnis = 0;
|
||||
}
|
||||
else if(date.year % 4 == 0){
|
||||
ergebnis = 1;
|
||||
}
|
||||
else {
|
||||
ergebnis = 0;
|
||||
}
|
||||
return ergebnis;
|
||||
}
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
/**
|
||||
* @brief TASK1: Calculates the length of the month given by the data parameter
|
||||
* @returns 28, 29, 30, 31 if a valid month, else 0
|
||||
*/
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
int get_month_length(date_t date){
|
||||
int ergebnis = 0;
|
||||
switch (date.month) {
|
||||
case Jan:
|
||||
ergebnis = 31;
|
||||
break;
|
||||
case Feb:
|
||||
if(is_leap_year(date)){
|
||||
ergebnis = 29;
|
||||
}
|
||||
else {
|
||||
ergebnis = 28;
|
||||
}
|
||||
break;
|
||||
case Mar:
|
||||
ergebnis = 31;
|
||||
break;
|
||||
case Apr:
|
||||
ergebnis = 30;
|
||||
break;
|
||||
case May:
|
||||
ergebnis = 31;
|
||||
break;
|
||||
case June:
|
||||
ergebnis = 30;
|
||||
break;
|
||||
case July:
|
||||
ergebnis = 31;
|
||||
break;
|
||||
case Aug:
|
||||
ergebnis = 31;
|
||||
break;
|
||||
case Sept:
|
||||
ergebnis = 30;
|
||||
break;
|
||||
case Oct:
|
||||
ergebnis = 31;
|
||||
break;
|
||||
case Nov:
|
||||
ergebnis = 30;
|
||||
break;
|
||||
case Dec:
|
||||
ergebnis = 31;
|
||||
break;
|
||||
}
|
||||
return ergebnis;
|
||||
}
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
/**
|
||||
* @brief TASK1: Checks if the given date is in the gregorian date range
|
||||
* @returns 0 = no, 1 = yes
|
||||
*/
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
int is_gregorian_date(date_t date) {
|
||||
int ergebnis = 1;
|
||||
if((date.year == 1582 && date.month <= Oct && date.day < 15) || date.year < 1582 || (date.year > 9999)){
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
/**
|
||||
* @brief TASK1: Checks if the given date is a valid date.
|
||||
* @returns 0 = is not valid date, 1 = is valid date
|
||||
*/
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
int is_valid_date(date_t date) {
|
||||
int ergebnis = 1;
|
||||
int ml = get_month_length(date);
|
||||
|
||||
|
||||
if((int)ml < (int)date.day ){//|| date.month < 1 || date.month > 12 || is_gregorian_date == 0){
|
||||
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
printf("Länge Monat: %d\n", get_month_length(date));
|
||||
printf("Länge Monat: %d\n", ml);
|
||||
printf("Tag: %d\n", date.day);
|
||||
printf("Monat: %d\n", date.month);
|
||||
printf("Jahr: %d\n", date.year);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
/**
|
||||
* @brief TASK2: calculated from a valid date the weekday
|
||||
* @returns returns a weekday in the range Sun...Sat
|
||||
*/
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
weekday_t calculate_weekday(date_t date) {
|
||||
int m = 1 + (date.month + 9) % 12;
|
||||
int a;
|
||||
if(date.month < Mar){
|
||||
a = date.year - 1;
|
||||
}
|
||||
else {
|
||||
a = date.year;
|
||||
}
|
||||
int y = a % 100;
|
||||
int c = a / 100;
|
||||
weekday_t weekday = ((date.day + (13 * m - 1) / 5 + y + y / 4 + c / 4 - 2 * c) % 7 + 7) % 7;
|
||||
return weekday;
|
||||
}
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief TASK2: print weekday as 3-letter abreviated English day name
|
||||
*/
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
void print_weekday(weekday_t day) {
|
||||
int ergebnis = 0;
|
||||
switch (day) {
|
||||
case Sun:
|
||||
printf("Sun");
|
||||
break;
|
||||
case Mon:
|
||||
printf("Mon");
|
||||
break;
|
||||
case Tue:
|
||||
printf("Tue");
|
||||
break;
|
||||
case Wed:
|
||||
printf("Wed");
|
||||
break;
|
||||
case Thu:
|
||||
printf("Thu");
|
||||
break;
|
||||
case Fri:
|
||||
printf("Fri");
|
||||
break;
|
||||
case Sat:
|
||||
printf("Sat");
|
||||
break;
|
||||
default:
|
||||
assert(!"day is out-of-range");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
/**
|
||||
* @brief main function
|
||||
* @param argc [in] number of entries in argv
|
||||
* @param argv [in] program name plus command line arguments
|
||||
* @returns returns success if valid date is given, failure otherwise
|
||||
*/
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
// TASK1: parse the mandatory argument into a date_t variable and check if the date is valid
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
date_t date;
|
||||
int res = sscanf(argv[1]
|
||||
, "%d-%d-%d"
|
||||
, &date.year, &date.month, &date.day
|
||||
);
|
||||
if (res != 3 || is_valid_date(date) == 0) {
|
||||
printf("Fehler\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
// TASK2: calculate the weekday and print it in this format: "%04d-%02d-%02d is a %s\n"
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
printf("%04d-%02d-%02d is a ", date.year, date.month, date.day);
|
||||
print_weekday(calculate_weekday(date));
|
||||
printf("\n");
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,219 +0,0 @@
|
|||
# 02: Funktionen, Datentyp "enum"
|
||||
|
||||
___
|
||||
|
||||
![](./random_number.png)
|
||||
|
||||
(Copyright Bild: xkcd.com)
|
||||
|
||||
___
|
||||
## 1. Übersicht
|
||||
In diesem Praktikum sind zwei Themen im Fokus: Funktionen und der Datentyp enum.
|
||||
|
||||
Funktionen sind der wesentlichste Bestandteil der C Programmierung, welcher eine strukturierte Programmierung ermöglicht:
|
||||
* Eine Funktion ist ein Teil eines C Codes, der eine spezielle Aufgabe ausführt. Sie kann aus dem Hauptprogramm, oder aus anderen Funktionen, aufgerufen werden.
|
||||
* Jede Funktion besitzt einen eindeutigen Namen, eine eindeutige Signatur (Typen und Reihenfolge der Parameter) und einen Rückgabewert (int falls nichts angegeben wird).
|
||||
* Eine Funktion kann Werte aus dem aufrufenden Kontext übernehmen und bei Bedarf einen Wert an den aufrufenden Kontext zurückliefern.
|
||||
Beispiel einer Additions-Funktion:
|
||||
```
|
||||
#include <stdio.h>
|
||||
|
||||
/* Funktionsdeklaration */
|
||||
int add(int a, int b);
|
||||
|
||||
int main(void) {
|
||||
int aa = 1, bb = 2, cc;
|
||||
printf("%d + %d = %d", aa, bb, add(aa, bb););
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Funktionsdefinition */
|
||||
int add(int a, int b) {
|
||||
return a + b;
|
||||
}
|
||||
```
|
||||
Der Daten typt enum wird verwendet um die Lesbarkeit von Programmen zu erhöhen:
|
||||
|
||||
Beispiel eines enum:
|
||||
```
|
||||
enum Ampeln = {rot =1, gelb, gruen};
|
||||
|
||||
int main(void) {
|
||||
Ampeln ampel1;
|
||||
if (ampel1 == rot) {...}
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
___
|
||||
## 2. Lernziele
|
||||
|
||||
In diesem Praktikum lernen Sie Funktionen zu definieren und aufzurufen, sowie enum anzuwenden.
|
||||
* Sie können ein Programm schreiben, welches aus mehreren Funktionen besteht.
|
||||
* Sie können Funktionen deklarieren, definieren und aufrufen.
|
||||
* Sie können enum Typen definieren und deren Werte bestimmen und abfragen.
|
||||
|
||||
___
|
||||
## 3. Aufgaben
|
||||
|
||||
![](./kalender-108_v-ARDFotogalerie.jpg)
|
||||
|
||||
(Copyright Bild: www.planet-wissen.de)
|
||||
|
||||
### 3.1 Aufgabe 1 Tage pro Monat
|
||||
In der ersten Aufgabe berechnen Sie die Anzahl Tage pro Monat einer beliebigen Kombination Monat / Jahr.
|
||||
Erweitern Sie dazu das Programm um folgende Aspekte:
|
||||
* Bereichsprüfung von Jahr und Monat
|
||||
* Funktion istSchaltjahr, welche berechnet, ob das Jahr eine Schaljahr ist
|
||||
* Funktion tageProMonat, welche die Anzahl Tage des gegebenen Monats und Jahres berechnet.
|
||||
|
||||
Vorgaben:
|
||||
* Die Funktion istSchaltjahr nimmt einen Integer (jahr) entgegen und gibt 1 im Falle eines Schaltjahres und 0 im andreren Fall zurück
|
||||
* Die Funktion tageProMonat nimmt zwei Integer (monat und jahr) entgegen und gibt die Anzahl Tage als Integer zurück
|
||||
* Die Jahreszahl, welche den Funktionen übergeben wird, muss überprüft werden und grösser gleich 1599 und kleiner als 10000 sein
|
||||
* Der übergebene Monat muss grösser als 0 und kleiner als 13 sein.
|
||||
|
||||
Die Regeln für die Schaltjahrberechnung:
|
||||
* Schaltjahre sind alle Jahre, die durch 4 teilbar sind.
|
||||
* Eine Ausnahme bilden die Jahrhunderte (1600, 1700…). Diese sind keine Schaltjahre.
|
||||
* zu den 100er gibt es ebenfalls Ausnahmen: Diese sind immer Schaltjahre, wenn sie durch 400 teilbar sind
|
||||
... also zum Beispiel 1600 ist eines, nicht jedoch 1700. Weiterführende Details finden Sie unter https://de.wikipedia.org/wiki/Gregorianischer_Kalender
|
||||
|
||||
Gegeben ist die main Funktion des Programms. Ergänzen Sie die enum Definition und die fehlenden Funktionen:
|
||||
* gibIntWert: Die Funktion soll einen Int Wert zurückgeben. Der Bereich, wie auch Fehleingaben sollen berücksichtigt werden. (atoi und fgets sind hier hilfreich)
|
||||
* istSchaltjahr: Die Funktion gibt 1 im Falle eines Schaltjahrs und o im anderen Falle zurück.
|
||||
* tageProMonat: Die Funktion gibt den die Tage des Monats für das definierte Jahr zurück. Verwenden Sie die Switch-Anweisung , sowie den enum Datentypen
|
||||
|
||||
```
|
||||
int main (int argc, char *argv[]) {
|
||||
|
||||
int monat, jahr;
|
||||
|
||||
// Monat einlesen und Bereich ueberpruefen
|
||||
monat = gibIntWert("Monat", 1, 12);
|
||||
jahr = gibIntWert("Jahr", 1600, 9999);
|
||||
|
||||
// Ausgabe zum Test
|
||||
printf("Monat: %d, Jahr: %d \n", monat, jahr);
|
||||
|
||||
// Ausgabe zum Test (hier mit dem ternaeren Operator "?:")
|
||||
printf("%d ist %s Schaltjahr\n", jahr, istSchaltjahr(jahr) ? "ein" : "kein");
|
||||
|
||||
// Ausgabe
|
||||
printf("Der Monat %02d-%d hat %d Tage.\n", monat, jahr, tageProMonat(jahr, monat));
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
Tipp: Angenommen Sie verwenden den enum month_t { JAN=1, FEB, MAR, APR, MAI, JUN, JUL, AUG, SEP, OKT, NOV, DEZ };
|
||||
Dann können Sie im Programm direkt die Konstanten verwenden:
|
||||
```
|
||||
if (m == 2) ... // schlecht lesbar
|
||||
if (monat == 2) ... // besserer Variablenname
|
||||
if (monat == FEB) ... // am besten lesbar
|
||||
```
|
||||
|
||||
|
||||
Als Abnahme müssen die Tests unverändert ohne Fehler ausgeführt werden (`make test`)
|
||||
___
|
||||
### 3.2 Aufgabe 2 Bestimmen des Wochentags
|
||||
Erweitern Sie das vorgegebene zweite Programm Gerüst an den bezeichneten Stellen so, dass das Programm von der Kommando Zeile ein Argument entgegennimmt, es auf Gültigkeit überprüft und schliesslich den Wochentag für das gegebene Datum berechnet und ausgibt.
|
||||
Prüfen Sie die Umsetzung beider Teilaufgaben mittels make test.
|
||||
#### 3.2.1 Teilaufgabe Argumente Parsen und auf Korrektheit prüfen
|
||||
Das Argument stellt ein gültiges Datum unseres Gregorianischen Kalenders dar (d.h. ein Datum ab Donnerstag, den 15. Oktober 1582, mit der Gregorianischen Schaltjahr Regel).
|
||||
Wenn kein Argument gegeben ist oder wenn das eingegebene Datum nicht gültig ist, soll das Programm einem Hilfetext auf stderr ausgeben und mit EXIT_FAILURE Exit Code terminieren. Wenn ein gültiges Datum erkannt wurde terminiert das Programm mit Exit Code EXIT_SUCCESS.
|
||||
##### 3.2.1.1 Argument Format
|
||||
Das Format des Kommando Zeilen Arguments soll yyyy-mm-dd sein, wobei yyyy für das vier-stellige Jahr, mm für einen 1-2-stelligen Monat (1…12) und dd für einen Tag des Monats, beginnend mit 01. Z.B. 2020-02-29.
|
||||
##### 3.2.1.2 Korrektes Datum
|
||||
Das Datum muss alle folgenden Bedingungen erfüllen damit es als korrekt erkannt wird:
|
||||
* Obergrenze für ein «sinnvolles» Datum ist das Jahr 9999
|
||||
* es muss Gregorianisch sein, d.h. ab 15. Oktober 1582 (inklusive)
|
||||
* es darf nur Monate von 1 für Januar bis 12 für Dezember beinhalten
|
||||
* der Tag muss grösser oder gleich 1 sein
|
||||
* der Tag darf nicht grösser als 31 sein für Monate mit einer Länge von 31 Tagen
|
||||
* der Tag darf nicht grösser als 30 sein für Monate mit einer Länge von 30 Tagen
|
||||
* der Tag darf für den Februar nicht grösser sein als 29 für ein Schaltjahr
|
||||
* der Tag darf für den Februar nicht grösser sein als 28 für ein Nicht-Schaltjahr
|
||||
|
||||
##### 3.2.1.3 Vorgaben an die Umsetzung
|
||||
1. Definieren Sie einen enum Typen mit (typedef) Namen month_t dessen Werte die Englischen 3-Zeichen Abkürzungen der Monate sind, nämlich Jan, Feb, … Dec und stellen Sie sicher dass die Abkürzungen für die uns geläufigen Monatsnummer stehen.
|
||||
2. Definierend Sie einen struct Typen mit (typedef) Namen date_t und den int Elementen year, month, day. Lesen Sie das Argument (falls vorhanden) via sscanf und dem Formatstring "%d-%d-%d" in die drei Elemente einer Date Variable. Siehe dazu die Hinweise im Anhang.
|
||||
3. Für die Berechnung der Monatslänge implementieren Sie die Hilfsfunktion is_leap_year(date_t date) (nach obigen Vorgaben). Der Return Wert 0 bedeutet «Kein Schaltjahr», 1 bedeutet «Schaltjahr».
|
||||
4. Implementieren Sie die Funktion `int get_month_length(date_t date)`. Diese soll für den Monat des Datums die Monatslänge (was dem letzten Tag des Monats entspricht) ausgeben – geben Sie 0 für ungültige Monatswerte zurück.
|
||||
5. Schliesslich implementieren Sie die Funktion int is_gregorian_date(date_t date) welche prüft, ob ein gegebenes Datum im Bereich 15. Oktober 1582 und dem Jahr 9999 ist (0 = nein, 1 = ja).
|
||||
6. Implementieren Sie eine Funktion int is_valid_date(date_t date), welche obige Bedingungen für ein gültiges Datum umsetzt. Der Return Wert 0 bedeutet «Kein gültiges Datum», 1 bedeutet «Gültiges Datum». Benutzen Sie für die Prüfung des Datums die `month_t` Werte wo immer möglich und sinnvoll. Verwenden Sie die oben implementierten Hilfsfunktionen.
|
||||
##### 3.2.1.4 Hinweise
|
||||
Beachten Sie die Kommentare im Code für die geforderten Implementierungs-Details.
|
||||
#### 3.2.2 Teilaufgabe Wochentag Berechnung
|
||||
Schreiben Sie eine Funktion, welche zu einem Datum den Wochentag berechnet.
|
||||
Die Formel wird Georg Glaeser zugeschrieben, möglicherweise angelehnt an eine Formel von Carl Friedrich Gauss.
|
||||
|
||||
![](./Wochentagsberechnung.jpg)
|
||||
|
||||
(Quelle: https://de.wikipedia.org/wiki/Wochentagsberechnung)
|
||||
|
||||
Hier ist eine für C abgewandelte Variante davon.
|
||||
```
|
||||
weekday = ((day + (13 * m - 1) / 5 + y + y / 4 + c / 4 - 2 * c) % 7 + 7) % 7
|
||||
alle Zahlen sind int Werte und alles basiert auf int-Arithmetik
|
||||
m = 1 + (month + 9) % 12
|
||||
a = year - 1 (für month < Mar), ansonsten year
|
||||
y = a % 100
|
||||
c = a / 100
|
||||
```
|
||||
Erweitern sie das Programm so, dass vor dem erfolgreichen Terminieren des Programms folgende Zeile (inklusive Zeilenumbruch) ausgegeben wird: yyyy-mm-dd is a Ddd, wobei yyyy für das Jahr, mm für die Nummer des Monats (01…12) und dd für den Tag im Monat (01…). Z.B. 2020-02-29 is a Sat.
|
||||
Vorgaben an die Umsetzung
|
||||
1. Definieren Sie einen enum Typen mit (typedef) Namen weekday_t dessen Werte die Englischen 3-Zeichen Abkürzungen der Tage sind, nämlich Sun, Mon, … Sat und stellen Sie sicher, dass die Abkürzungen für die Werte 0…6 stehen.
|
||||
2. Schreiben Sie eine Funktion weekday_t calculate_weekday(date_t date) nach der Beschreibung der obigen Formel. Das date Argument ist als gültig angenommen, d.h. es ist ein Programmier-Fehler, wenn das Programm diese Funktion mit einem ungültigen Datum aufruft. Machen Sie dafür als erste Codezeile in der Funktion eine Zu-sicherung (assert(is_valid_date(date));)
|
||||
3. Schreiben Sie eine Funktion void print_weekday(weekday_t day), welche für jeden gülteigen Tag eine Zeile auf stdout schreibt mit den Englischen 3-Zeichen Ab-kürzungen für den Wochentag, z.B. Sonntag: Sun, Montag: Mon, etc. Wenn ein ungültiger Wert für day erkannt wird, soll assert(!"day is out-of-range"); aufgerufen werden.
|
||||
Hinweise
|
||||
• Für interessierte, siehe: https://de.wikipedia.org/wiki/Wochentagsberechnung
|
||||
|
||||
|
||||
___
|
||||
## 4. Bewertung
|
||||
|
||||
Die gegebenenfalls gestellten Theorieaufgaben und der funktionierende Programmcode müssen der Praktikumsbetreuung gezeigt werden. Die Lösungen müssen mündlich erklärt werden können.
|
||||
| Aufgabe | Kriterium | Gewicht |
|
||||
| :-- | :-- | :-- |
|
||||
| alle | Sie können das funktionierende Programm inklusive funktionierende Tests demonstrieren und erklären. | |
|
||||
| gibIntWert | Eingabe, Bereichsüberprüfung korrekt | 1 |
|
||||
| istSchaltjahr | Funktion korrekt | 1 |
|
||||
| TageProMonat | Funktion korrekt | 1 |
|
||||
| Aufgabe 2 | Fehlenden Teile ergänzt und lauffähig | 1 |
|
||||
___
|
||||
## 5. Anhang
|
||||
|
||||
### 5.1 Sprachelemente
|
||||
|
||||
```int main(int argc, char *argv[]) {
|
||||
...
|
||||
} argc: Anzahl Einträge in argv.
|
||||
argv: Array von Command Line Argumenten.
|
||||
argv[0]: wie das Programm gestartet wurde
|
||||
argv[1]: erstes Argument
|
||||
…
|
||||
argv[argc-1]: letztes Argument
|
||||
int a = 0;
|
||||
int b = 0;
|
||||
int c = 0;
|
||||
int res = sscanf(argv[1]
|
||||
, "%d-%d-%d"
|
||||
, &a, &b, &c
|
||||
);
|
||||
if (res != 3) {
|
||||
// Fehler Behandlung...
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
### 5.2 Beschreibung
|
||||
Siehe man 3 sscanf.
|
||||
Die Funktion sscanf gibt die Anzahl erfolgreich erkannte Argumente zurück. Unbedingt prüfen und angemessen darauf reagieren.
|
||||
Die gelesenen Werte werden in a, b und c, gespeichert, dazu müssen Sie die Adresse der Variablen übergeben. Mehr Details dazu werden später erklärt.
|
||||
fprintf(stderr, "Usage: %s…\n", argv[0]); Siehe man 3 fprintf.
|
||||
Schreibt formatierten Text auf den stderr Stream.
|
||||
|
||||
___
|
||||
Version: 15.02.2022
|
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 7.3 KiB |
|
@ -1,42 +0,0 @@
|
|||
/**
|
||||
* P02 Praktikum
|
||||
*
|
||||
* Das Programm liest einen Monat (1-12) und ein Jahr (1600-2400) ein und
|
||||
* gibt die Anzahl der Tage dieses Monats aus.
|
||||
*
|
||||
* @author Gerrit Burkert, Adaptation bazz
|
||||
* @version 15-FEB-2013, 16-OCT-2017, 17-OCT-2019, 16-FEB-2022
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define ERROR_IN_MONTH 1
|
||||
#define ERROR_IN_YEAR 2
|
||||
|
||||
///// Student Code
|
||||
|
||||
|
||||
|
||||
///// END Student Code
|
||||
|
||||
|
||||
int main (int argc, char *argv[]) {
|
||||
|
||||
int monat, jahr;
|
||||
|
||||
// Monat einlesen und Bereich ueberpruefen
|
||||
monat = gibIntWert("Monat", 1, 12);
|
||||
jahr = gibIntWert("Jahr", 1600, 9999);
|
||||
|
||||
// Ausgabe zum Test
|
||||
printf("Monat: %d, Jahr: %d \n", monat, jahr);
|
||||
|
||||
// Ausgabe zum Test (hier mit dem ternaeren Operator "?:")
|
||||
printf("%d ist %s Schaltjahr\n", jahr, istSchaltjahr(jahr) ? "ein" : "kein");
|
||||
|
||||
// Ausgabe
|
||||
printf("Der Monat %02d-%d hat %d Tage.\n", monat, jahr, tageProMonat(jahr, monat));
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,197 +0,0 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
* -- _____ ______ _____ -
|
||||
* -- |_ _| | ____|/ ____| -
|
||||
* -- | | _ __ | |__ | (___ Institute of Embedded Systems -
|
||||
* -- | | | '_ \| __| \___ \ Zuercher Hochschule Winterthur -
|
||||
* -- _| |_| | | | |____ ____) | (University of Applied Sciences) -
|
||||
* -- |_____|_| |_|______|_____/ 8401 Winterthur, Switzerland -
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* @file
|
||||
* @brief Test suite for the given package.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/wait.h>
|
||||
#include <time.h>
|
||||
#include <assert.h>
|
||||
#include <CUnit/Basic.h>
|
||||
#include "test_utils.h"
|
||||
|
||||
#ifndef TARGET // must be given by the make file --> see test target
|
||||
#error missing TARGET define
|
||||
#endif
|
||||
|
||||
/// @brief alias for EXIT_SUCCESS
|
||||
#define OK EXIT_SUCCESS
|
||||
/// @brief alias for EXIT_FAILURE
|
||||
#define FAIL EXIT_FAILURE
|
||||
|
||||
/// @brief The name of the STDOUT text file.
|
||||
#define OUTFILE "stdout.txt"
|
||||
/// @brief The name of the STDERR text file.
|
||||
#define ERRFILE "stderr.txt"
|
||||
|
||||
// setup & cleanup
|
||||
static int setup(void)
|
||||
{
|
||||
remove_file_if_exists(OUTFILE);
|
||||
remove_file_if_exists(ERRFILE);
|
||||
return 0; // success
|
||||
}
|
||||
|
||||
static int teardown(void)
|
||||
{
|
||||
// Do nothing.
|
||||
// Especially: do not remove result files - they are removed in int setup(void) *before* running a test.
|
||||
return 0; // success
|
||||
}
|
||||
|
||||
static struct tm now()
|
||||
{
|
||||
time_t t = time(NULL);
|
||||
return *localtime(&t);
|
||||
}
|
||||
|
||||
static const char* weekday_name(int wday)
|
||||
{
|
||||
assert(0 <= wday && wday <= 6);
|
||||
static const char* days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
|
||||
return days[wday];
|
||||
}
|
||||
|
||||
// tests
|
||||
static void test_task1_fail_no_arg(void)
|
||||
{
|
||||
// arrange & act & assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
}
|
||||
|
||||
static void test_task1_fail_not_gregorian(void)
|
||||
{
|
||||
// arrange & act & assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1291-08-01 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1582-10-14 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1583-10-14 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
}
|
||||
|
||||
static void test_task1_fail_month_out_of_range(void)
|
||||
{
|
||||
// arrange & act & assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-13-13 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-00-13 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-12-13 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
}
|
||||
|
||||
static void test_task1_fail_day_out_of_range(void)
|
||||
{
|
||||
// arrange & act & assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-01-32 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-01-31 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-02-30 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-02-29 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2019-02-29 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2019-02-28 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2019-02-29 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2019-02-28 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
}
|
||||
|
||||
static void test_task1_fail_leap_year(void)
|
||||
{
|
||||
// arrange & act & assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1900-02-29 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1900-02-28 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2000-02-30 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2000-02-29 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2001-02-29 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2001-02-28 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2004-02-30 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2004-02-29 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
}
|
||||
|
||||
static void test_task1_valid_date(void)
|
||||
{
|
||||
// arrange & act & assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-01-01 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-01-31 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-02-29 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-03-31 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-04-30 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-05-31 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-06-30 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-07-31 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-08-31 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-09-30 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-10-31 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-11-30 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-12-31 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-01-32 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-02-30 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-03-32 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-04-31 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-05-32 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-06-31 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-07-32 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-08-32 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-09-31 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-10-32 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-11-31 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-12-32 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
}
|
||||
|
||||
static void test_task2_start_gregorian(void)
|
||||
{
|
||||
// arrange & act & assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1581-10-14 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1581-10-15 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1582-10-14 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1582-10-15 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1583-10-14 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1583-10-15 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
|
||||
const char *out_txt[] = { "1582-10-15 is a Fri\n" };
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1582-10-15 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
assert_lines(OUTFILE, out_txt, sizeof(out_txt)/sizeof(*out_txt));
|
||||
}
|
||||
|
||||
static void test_task2_today(void)
|
||||
{
|
||||
// arrange
|
||||
const size_t SIZE = 1000;
|
||||
char command[SIZE];
|
||||
struct tm t = now();
|
||||
snprintf(command, SIZE, "%s %04d-%02d-%02d 2>%s | tail -1 >%s", XSTR(TARGET), t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, ERRFILE, OUTFILE);
|
||||
|
||||
char buffer[SIZE];
|
||||
snprintf(buffer, SIZE, "%04d-%02d-%02d is a %s\n", t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, weekday_name(t.tm_wday));
|
||||
const char *out_txt[] = { buffer };
|
||||
const char *err_txt[] = { NULL };
|
||||
|
||||
// act & assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(command)), OK);
|
||||
assert_lines(OUTFILE, out_txt, sizeof(out_txt)/sizeof(*out_txt));
|
||||
assert_lines(ERRFILE, err_txt, sizeof(err_txt)/sizeof(*err_txt));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Registers and runs the tests.
|
||||
* @returns success (0) or one of the CU_ErrorCode (>0)
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
// setup, run, teardown
|
||||
TestMainBasic("lab test", setup, teardown
|
||||
, test_task1_fail_no_arg
|
||||
, test_task1_fail_not_gregorian
|
||||
, test_task1_fail_month_out_of_range
|
||||
, test_task1_fail_day_out_of_range
|
||||
, test_task1_fail_leap_year
|
||||
, test_task1_valid_date
|
||||
, test_task2_start_gregorian
|
||||
, test_task2_today
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
SNP_SHARED_MAKEFILE := $(if $(SNP_SHARED_MAKEFILE),$(SNP_SHARED_MAKEFILE),"~/snp/shared.mk")
|
||||
|
||||
TARGET := bin/term-qr-code
|
||||
SOURCES := src/main.c
|
||||
TSTSOURCES := tests/tests.c
|
||||
|
||||
include $(SNP_SHARED_MAKEFILE)
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* @mainpage SNP - P02 QR Code
|
||||
*
|
||||
* @section Purpose
|
||||
*
|
||||
* This is a lab to display a QR code on the color terminal.
|
||||
*
|
||||
*/
|
|
@ -9,22 +9,27 @@
|
|||
*/
|
||||
/**
|
||||
* @file
|
||||
* @brief Lab implementation
|
||||
* @brief Lab P02 QR Code
|
||||
* @remark prerequisite: sudo apt install qrencode
|
||||
*/
|
||||
// begin students to add code for task 4.1
|
||||
#ifndef READ_H
|
||||
#define READ_H
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define EOL 10
|
||||
#define PARSE_ERROR -1
|
||||
#define READ_ERROR -2
|
||||
#define ASCII_SPACE 32
|
||||
#define ASCII_DIGIT_0 48
|
||||
#define ASCII_DIGIT_9 57
|
||||
#define NO_POS -1
|
||||
#define BUFFERSIZE 10
|
||||
// define local macros
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
|
||||
int getInt(int maxResult);
|
||||
|
||||
#endif
|
||||
// end students to add code
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
/**
|
||||
* @brief main function
|
||||
* @returns always success (0)
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
return EXIT_SUCCESS;
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
|
||||
|
||||
|
||||
############## ######## ##############
|
||||
## ## ## ## ##
|
||||
## ###### ## #### ## ###### ##
|
||||
## ###### ## ###### ## ###### ##
|
||||
## ###### ## ## ## ## ###### ##
|
||||
## ## #### ## ##
|
||||
############## ## ## ## ##############
|
||||
######
|
||||
#### #### ## ######## ## ##
|
||||
## ## ## ## ## ##
|
||||
## #### #### #### ## ## ##
|
||||
## ######## ######
|
||||
## #### #### ## #### ######
|
||||
###### ## ## ## ## ##
|
||||
############## ###### ####
|
||||
## ## ## ## ####
|
||||
## ###### ## ############ ## ######
|
||||
## ###### ## ## #### ##
|
||||
## ###### ## #### #### #### ####
|
||||
## ## ## #### ######
|
||||
############## ############ ## ##
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
* -- _____ ______ _____ -
|
||||
* -- |_ _| | ____|/ ____| -
|
||||
* -- | | _ __ | |__ | (___ Institute of Embedded Systems -
|
||||
* -- | | | '_ \| __| \___ \ Zuercher Hochschule Winterthur -
|
||||
* -- _| |_| | | | |____ ____) | (University of Applied Sciences) -
|
||||
* -- |_____|_| |_|______|_____/ 8401 Winterthur, Switzerland -
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* @file
|
||||
* @brief Test suite for the given package.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/wait.h>
|
||||
#include <CUnit/Basic.h>
|
||||
#include "test_utils.h"
|
||||
|
||||
#ifndef TARGET // must be given by the make file --> see test target
|
||||
#error missing TARGET define
|
||||
#endif
|
||||
|
||||
/// @brief The name of the STDOUT text file.
|
||||
#define OUTFILE "stdout.txt"
|
||||
/// @brief The name of the STDERR text file.
|
||||
#define ERRFILE "stderr.txt"
|
||||
/// @brief The input data
|
||||
#define SNP_INPUT "snp.input"
|
||||
|
||||
// setup & cleanup
|
||||
static int setup(void)
|
||||
{
|
||||
remove_file_if_exists(OUTFILE);
|
||||
remove_file_if_exists(ERRFILE);
|
||||
return 0; // success
|
||||
}
|
||||
|
||||
static int teardown(void)
|
||||
{
|
||||
// Do nothing.
|
||||
// Especially: do not remove result files - they are removed in int setup(void) *before* running a test.
|
||||
return 0; // success
|
||||
}
|
||||
|
||||
|
||||
/// @brief Reset
|
||||
#define N "\033[0m\n"
|
||||
/// @brief Black
|
||||
#define X "\033[40m "
|
||||
/// @brief White
|
||||
#define _ "\033[47m "
|
||||
|
||||
// tests
|
||||
static void test_empty_input(void)
|
||||
{
|
||||
// arrange
|
||||
const char *out_txt[] =
|
||||
{ N
|
||||
, N
|
||||
};
|
||||
const char *err_txt[] = { NULL };
|
||||
// act
|
||||
int exit_code = system(XSTR(TARGET) "</dev/null 1>" OUTFILE " 2>" ERRFILE);
|
||||
// assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(exit_code), EXIT_SUCCESS);
|
||||
assert_lines(OUTFILE, out_txt, sizeof(out_txt)/sizeof(*out_txt));
|
||||
assert_lines(ERRFILE, err_txt, sizeof(err_txt)/sizeof(*err_txt));
|
||||
}
|
||||
|
||||
static void test_black_and_white_input(void)
|
||||
{
|
||||
// arrange
|
||||
const char *out_txt[] =
|
||||
{ N
|
||||
, _ X _ N
|
||||
, N
|
||||
};
|
||||
const char *err_txt[] = { NULL };
|
||||
// act
|
||||
int exit_code = system("echo ' # ' | " XSTR(TARGET) " 1>" OUTFILE " 2>" ERRFILE);
|
||||
// assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(exit_code), EXIT_SUCCESS);
|
||||
assert_lines(OUTFILE, out_txt, sizeof(out_txt)/sizeof(*out_txt));
|
||||
assert_lines(ERRFILE, err_txt, sizeof(err_txt)/sizeof(*err_txt));
|
||||
}
|
||||
|
||||
static void test_snp_input(void)
|
||||
{
|
||||
// arrange
|
||||
const char *out_txt[] =
|
||||
{ N
|
||||
, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ X X X X X X X X X X X X X X _ _ X X X X X X X X _ _ _ _ X X X X X X X X X X X X X X _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ X X _ _ _ _ _ _ _ _ _ _ X X _ _ _ _ _ _ _ _ _ _ X X _ _ X X _ _ _ _ _ _ _ _ _ _ X X _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ X X _ _ X X X X X X _ _ X X _ _ _ _ X X X X _ _ _ _ _ _ X X _ _ X X X X X X _ _ X X _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ X X _ _ X X X X X X _ _ X X _ _ _ _ _ _ X X X X X X _ _ X X _ _ X X X X X X _ _ X X _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ X X _ _ X X X X X X _ _ X X _ _ _ _ _ _ X X _ _ X X _ _ X X _ _ X X X X X X _ _ X X _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ X X _ _ _ _ _ _ _ _ _ _ X X _ _ _ _ _ _ _ _ X X X X _ _ X X _ _ _ _ _ _ _ _ _ _ X X _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ X X X X X X X X X X X X X X _ _ X X _ _ X X _ _ X X _ _ X X X X X X X X X X X X X X _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ X X X X X X _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ X X X X _ _ X X X X _ _ X X _ _ _ _ X X X X X X X X _ _ X X _ _ _ _ _ _ _ _ _ _ X X _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ X X _ _ X X _ _ _ _ _ _ _ _ X X _ _ X X _ _ X X _ _ _ _ X X _ _ _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ X X _ _ X X X X _ _ X X X X _ _ X X X X _ _ _ _ _ _ _ _ X X _ _ _ _ _ _ X X _ _ X X _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ _ _ _ _ X X _ _ _ _ _ _ _ _ _ _ _ _ _ _ X X X X X X X X _ _ _ _ X X X X X X _ _ _ _ _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ _ _ X X _ _ _ _ _ _ X X X X _ _ X X X X _ _ _ _ X X _ _ _ _ X X X X _ _ X X X X X X _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ X X X X X X _ _ X X _ _ X X _ _ X X _ _ X X _ _ X X _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ X X X X X X X X X X X X X X _ _ _ _ _ _ _ _ _ _ X X X X X X _ _ X X X X _ _ _ _ _ _ _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ X X _ _ _ _ _ _ _ _ _ _ X X _ _ _ _ _ _ _ _ _ _ _ _ X X _ _ _ _ _ _ X X _ _ X X X X _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ X X _ _ X X X X X X _ _ X X _ _ X X X X X X X X X X X X _ _ _ _ X X _ _ X X X X X X _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ X X _ _ X X X X X X _ _ X X _ _ X X _ _ _ _ _ _ X X X X _ _ _ _ _ _ _ _ X X _ _ _ _ _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ X X _ _ X X X X X X _ _ X X _ _ _ _ X X X X _ _ X X X X _ _ _ _ X X X X _ _ X X X X _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ X X _ _ _ _ _ _ _ _ _ _ X X _ _ X X _ _ _ _ _ _ _ _ _ _ X X X X _ _ X X X X X X _ _ _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ X X X X X X X X X X X X X X _ _ X X X X X X X X X X X X _ _ _ _ X X _ _ _ _ X X _ _ _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ N
|
||||
, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ N
|
||||
, N
|
||||
};
|
||||
const char *err_txt[] = { NULL };
|
||||
// act
|
||||
int exit_code = system(XSTR(TARGET) "<" SNP_INPUT " 1>" OUTFILE " 2>" ERRFILE);
|
||||
// assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(exit_code), EXIT_SUCCESS);
|
||||
assert_lines(OUTFILE, out_txt, sizeof(out_txt)/sizeof(*out_txt));
|
||||
assert_lines(ERRFILE, err_txt, sizeof(err_txt)/sizeof(*err_txt));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Registers and runs the tests.
|
||||
* @returns success (0) or one of the CU_ErrorCode (>0)
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
// setup, run, teardown
|
||||
TestMainBasic("lab test", setup, teardown
|
||||
, test_empty_input
|
||||
, test_black_and_white_input
|
||||
, test_snp_input
|
||||
);
|
||||
|
||||
}
|
Before Width: | Height: | Size: 28 KiB |
|
@ -1,143 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define OPERAND_BUFFER_SIZE 10
|
||||
|
||||
typedef struct {
|
||||
/*
|
||||
Students: The Expression struct should hold the two operands and
|
||||
the operation (use a char for the operation)
|
||||
*/
|
||||
int operator1;
|
||||
int operator2;
|
||||
char operation;
|
||||
} Expression;
|
||||
|
||||
int bits_per_int() {
|
||||
return sizeof(unsigned int) * 8;
|
||||
}
|
||||
|
||||
unsigned int parse_operand(char operand_str[]) {
|
||||
unsigned int operand;
|
||||
if (operand_str[0] == '0' && operand_str[1] == 'x') {
|
||||
sscanf(&operand_str[2], "%x", &operand);
|
||||
} else if (operand_str[0] == '0') {
|
||||
sscanf(&operand_str[1], "%o", &operand);
|
||||
} else {
|
||||
sscanf(operand_str, "%u", &operand);
|
||||
}
|
||||
return operand;
|
||||
}
|
||||
|
||||
void print_binary(unsigned int value) {
|
||||
|
||||
// Students: Print a single number as a binary string
|
||||
int chars[32];
|
||||
int counter;
|
||||
for(counter = 0; counter < 32; counter = counter + 1) {
|
||||
if((value % 2) == 0) {
|
||||
chars[counter] = 0;
|
||||
} else {
|
||||
chars[counter] = 1;
|
||||
}
|
||||
value = value / 2;
|
||||
}
|
||||
for(counter = 31; counter >= 0; counter--) {
|
||||
printf("%d", chars[counter]);
|
||||
if(counter == 24 || counter == 16 || counter == 8) {
|
||||
printf("'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print_bit_operation_bin(Expression expression, unsigned int result) {
|
||||
/*
|
||||
Students: Print the entire operation in bin including the result
|
||||
|
||||
Bin:
|
||||
00000000'00000000'00000000'00001100
|
||||
00000000'00000000'00000000'00001111 ^
|
||||
-----------------------------------
|
||||
00000000'00000000'00000000'00000011
|
||||
*/
|
||||
|
||||
printf("Bin:\n");
|
||||
print_binary(expression.operator1);
|
||||
printf("\n");
|
||||
print_binary(expression.operator2);
|
||||
printf(" %c\n", expression.operation);
|
||||
printf("-----------------------------------\n");
|
||||
print_binary(result);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void print_bit_operation_hex(Expression expression, unsigned int result) {
|
||||
/*
|
||||
Students: Print the entire operation in hex including the result
|
||||
|
||||
Hex:
|
||||
0x0c ^ 0x0f = 0x03
|
||||
*/
|
||||
|
||||
printf("\nHex:\n0x%x %c 0x%x\n0x%x\n", expression.operator1, expression.operation, expression.operator2, result);
|
||||
}
|
||||
|
||||
void print_bit_operation_dec(Expression expression, unsigned int result) {
|
||||
/*
|
||||
Students: Print the entire operation in hex including the result
|
||||
|
||||
Dec:
|
||||
12 ^ 15 = 3
|
||||
*/
|
||||
|
||||
printf("\nDec:\n%d %c %d\n%d\n", expression.operator1, expression.operation, expression.operator2, result);
|
||||
}
|
||||
|
||||
unsigned int bit_operation(Expression expression) {
|
||||
// Students: Do the actual bit operation and return the result
|
||||
switch(expression.operation) {
|
||||
case '&': return expression.operator1 & expression.operator2; break;
|
||||
case '|': return expression.operator1 | expression.operator2; break;
|
||||
case '^': return expression.operator1 ^ expression.operator2; break;
|
||||
case '<': return expression.operator1 < expression.operator2; break;
|
||||
case '>': return expression.operator1 > expression.operator2; break;
|
||||
default: printf("ubekannte Operation\n"); break;
|
||||
}
|
||||
}
|
||||
|
||||
int main(){
|
||||
char operand1_str[10];
|
||||
char operand2_str[10];
|
||||
char operation;
|
||||
|
||||
unsigned int operand1, operand2;
|
||||
|
||||
do {
|
||||
printf("Geben sie die Bit-Operation ein:\n");
|
||||
|
||||
scanf("%s %c %s", operand1_str, &operation, operand2_str);
|
||||
|
||||
operand1 = parse_operand(operand1_str);
|
||||
operand2 = parse_operand(operand2_str);
|
||||
|
||||
Expression expression; // Students: Create an expression
|
||||
expression.operator1 = operand1;
|
||||
expression.operator2 = operand2;
|
||||
expression.operation = operation;
|
||||
|
||||
|
||||
|
||||
unsigned int result = bit_operation(expression);
|
||||
print_bit_operation_bin(expression, result);
|
||||
print_bit_operation_hex(expression, result);
|
||||
print_bit_operation_dec(expression, result);
|
||||
|
||||
while(getchar() != '\n');
|
||||
printf("\nMöchten sie weiter machen oder abbrechen? [(n)ext|(q)uit] ");
|
||||
|
||||
} while(getchar() == 'n');
|
||||
|
||||
printf("Byebye..\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#define RED "\x1B[31m"
|
||||
#define GRN "\x1B[32m"
|
||||
#define YEL "\x1B[33m"
|
||||
#define WHT "\x1B[37m"
|
||||
#define RESET "\x1B[0m"
|
||||
|
||||
enum SHAPE {OVAL, RECTANGLE};
|
||||
/*
|
||||
Students: Create a new type "Graphic" that can store:
|
||||
- shape (OVAL, RECTANGLE) -> create a new enum for this type
|
||||
- size
|
||||
- color
|
||||
*/
|
||||
typedef struct {
|
||||
int shape;
|
||||
int size;
|
||||
char *color;
|
||||
} Graphic;
|
||||
|
||||
|
||||
void paint(Graphic graphic) {
|
||||
double radius = graphic.size / 2.0;
|
||||
int i,j;
|
||||
|
||||
for (i = 0; i <= 2 * radius; i++){
|
||||
for (j = 0; j <= 2 * radius; j++){
|
||||
switch(graphic.shape) {
|
||||
case RECTANGLE: printf("%s*" RESET, graphic.color); break;
|
||||
case OVAL: {
|
||||
double distance = sqrt((i - radius) * (i - radius) + (j - radius) * (j - radius));
|
||||
if (distance > radius - 0.5 && distance < radius + 0.5) {
|
||||
printf("%s*" RESET, graphic.color);
|
||||
} else {
|
||||
printf(" ");
|
||||
}
|
||||
} break;
|
||||
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
int input;
|
||||
Graphic graphic;
|
||||
|
||||
do {
|
||||
printf("Geben Sie die gewünschte Form an [OVAL=0 | RECTANGLE=1]:");
|
||||
scanf("%d", &input);
|
||||
// Students: store the input in graphic
|
||||
graphic.shape = input;
|
||||
|
||||
printf("Geben Sie die gewünschte Grösse an:");
|
||||
scanf("%u", &input);
|
||||
// Students: store the input in graphic
|
||||
graphic.size = input;
|
||||
|
||||
printf("Geben Sie die gewünschte Farb an [RED=0 | GREEN=1 | YELLOW=2]:");
|
||||
scanf("%d", &input);
|
||||
// Students: store the input in graphic
|
||||
switch (input) {
|
||||
case 0: graphic.color = RED; break;
|
||||
case 1: graphic.color = GRN; break;
|
||||
case 2: graphic.color = YEL; break;
|
||||
}
|
||||
|
||||
paint(graphic);
|
||||
|
||||
while(getchar() != '\n'); // empty buffer
|
||||
printf("\nMöchten sie weiter machen oder abbrechen? [(n)ext|(q)uit] ");
|
||||
} while(getchar() == 'n');
|
||||
|
||||
printf("Byebye..\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
int main() {
|
||||
unsigned int number = 0x77; //0111 0101
|
||||
unsigned int bit = 3; // bit at position 3
|
||||
|
||||
// Setting a bit
|
||||
unsigned int vector = 1;
|
||||
vector = vector << bit;
|
||||
number = number | vector; //
|
||||
printf("number after setting bit 3: 0x%02X\n", number);
|
||||
|
||||
// Clearing a bit
|
||||
bit = 1;
|
||||
vector = 1;
|
||||
vector = vector << bit;
|
||||
vector = vector ^ 0xFF;
|
||||
number = number & vector;
|
||||
printf("number after clearing bit 1: 0x%02X\n", number);
|
||||
|
||||
// Toggling a bit
|
||||
bit = 0;
|
||||
vector = 1;
|
||||
vector <<= bit;
|
||||
number ^= vector;
|
||||
|
||||
printf("number after Toggling bit 0: 0x%02X\n", number);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
int a = 3;
|
||||
int b = 4;
|
||||
printf("a: %d; b: %d\n", a, b);
|
||||
|
||||
// swapping
|
||||
a = a ^ b;
|
||||
b = a ^ b;
|
||||
a = a ^ b;
|
||||
|
||||
|
||||
|
||||
printf("a: %d; b: %d\n", a, b);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
char word[8] = "sREedEv";
|
||||
char *wordptr = &word[0];
|
||||
|
||||
while(wordptr < &word[7]) {
|
||||
printf("UPPERCASE: %c\n", *wordptr & '_'); // converts the char into uppercase regardless of the current casing
|
||||
printf("LOWERCASE: %c\n", *wordptr | ' '); // converts the char into lowercase regardless of the current casing
|
||||
wordptr++;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
// _ ASCII Wert 95 = 0b101111 bitweise & verknüpft setzt bit 4 auf 0
|
||||
// _ ASCII Wert 95 = 0b101111 bitweise | verknüpft setzt bit 4 auf 1
|
||||
// gemäss ASCII Tabelle hat ein Zeichen gross und kleingeschriben den gleichen Binärwert, nur Bit 4 unterscheidet sich.
|
|
@ -1,23 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(){
|
||||
int a = 64; // any positive number
|
||||
int pruefzahl = 1;
|
||||
int imax = 0;
|
||||
|
||||
for(int i = 2; i < (a+2); i = i * 2) {
|
||||
imax = i;
|
||||
pruefzahl = pruefzahl + i;
|
||||
}
|
||||
pruefzahl = pruefzahl - imax;
|
||||
|
||||
if(a > 0 && ((a & pruefzahl) == 0)){
|
||||
printf("%d is a power of 2\n", a);
|
||||
}
|
||||
else {
|
||||
printf("%d is not a power of 2\n", a);
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
|
@ -1,221 +0,0 @@
|
|||
# 03 - Bit Operationen, Struct, Typedef
|
||||
|
||||
|
||||
## 1. Bit Operationen
|
||||
|
||||
![](./135oALYhkYyXB2aG0F-qrwA.jpeg)
|
||||
|
||||
|
||||
Bit Operationen sind allgegenwärtig in den Computer-Wissenschaften und finden in vielen Disziplinen Anwendung. Folgend ein kleiner Auszug aus den wichtigsten Themen:
|
||||
- **Bit Felder**: Sind die effizienteste Art, etwas darzustellen, dessen Zustand durch mehrere "wahr" oder "falsch" definiert werden kann. Besonders auf Systemen mit begrenzten Ressourcen sollte jede überflüssige Speicher-Allozierung vermieden werden.
|
||||
|
||||
Beispiel:
|
||||
```c
|
||||
// primary colors
|
||||
#define BLUE 0b100
|
||||
#define GREEN 0b010
|
||||
#define RED 0b001
|
||||
|
||||
// mixed colors
|
||||
#define BLACK 0 /* 000 */
|
||||
#define YELLOW (RED | GREEN) /* 011 */
|
||||
#define MAGENTA (RED | BLUE) /* 101 */
|
||||
#define CYAN (GREEN | BLUE) /* 110 */
|
||||
#define WHITE (RED | GREEN | BLUE) /* 111 */
|
||||
```
|
||||
[https://de.wikipedia.org/wiki/Bitfeld](https://de.wikipedia.org/wiki/Bitfeld)
|
||||
|
||||
- **Kommunikation**:
|
||||
- **Prüfsummen/Paritätsbit**: Übertragungsfehler und Integrität können bis zu einem definiertem Grad erkannt werden. Je nach Komplexität der Berechnung können mehrere Fehler erkannt oder auch korrigiert werden.
|
||||
[https://de.wikipedia.org/wiki/Parit%C3%A4tsbit](https://de.wikipedia.org/wiki/Parit%C3%A4tsbit), [https://de.wikipedia.org/wiki/Pr%C3%BCfsumme](https://de.wikipedia.org/wiki/Pr%C3%BCfsumme)
|
||||
- **Stoppbit**: Markieren bei asynchronen seriellen Datenübertragungen das Ende bzw. Start eines definierten Blocks.
|
||||
[https://de.wikipedia.org/wiki/Stoppbit](https://de.wikipedia.org/wiki/Stoppbit)
|
||||
- **Datenflusssteuerung**: Unterschiedliche Verfahren, mit denen die Datenübertragung von Endgeräten an einem Datennetz, die nicht synchron arbeiten, so gesteuert wird, dass eine möglichst kontinuierliche Datenübermittlung ohne Verluste erfolgen kann.
|
||||
[https://de.wikipedia.org/wiki/Datenflusssteuerung](https://de.wikipedia.org/wiki/Datenflusssteuerung)
|
||||
- ...
|
||||
|
||||
- **Datenkompression**: Bei der Datenkompression wird versucht, redundante Informationen zu entfernen. Dazu werden die Daten in eine Darstellung überführt, mit der sich alle – oder zumindest die meisten – Information in kürzerer Form darstellen lassen.
|
||||
[https://de.wikipedia.org/wiki/Datenkompression](https://de.wikipedia.org/wiki/Datenkompression)
|
||||
- **Kryptographie**: Konzeption, Definition und Konstruktion von Informationssystemen, die widerstandsfähig gegen Manipulation und unbefugtes Lesen sind. [https://de.wikipedia.org/wiki/Verschl%C3%BCsselung](https://de.wikipedia.org/wiki/Verschl%C3%BCsselung)
|
||||
- **Grafik-Programmierung**: XOR (oder ^) ist hier besonders interessant, weil eine zweite Eingabe derselben Eingabe die erste rückgängig macht (ein Beispiel dazu weiter unten: "Variablen tauschen, ohne Dritt-Variable
|
||||
"). Ältere GUIs verwendeten dies für die Hervorhebung von Auswahlen und andere Überlagerungen, um kostspielige Neuzeichnungen zu vermeiden. Sie sind immer noch nützlich in langsamen Grafikprotokollen (z. B. Remote-Desktop).
|
||||
|
||||
### 1.1 Übungen
|
||||
|
||||
#### 1. Basis Operationen
|
||||
Manipulationen von einzelnen Bits gehören zu den Basis Operationen und dienen als Grundlagen um weitere komplexere Konstrukte zu schaffen.
|
||||
|
||||
Verfollständigen sie folgendes Beispiel mit den drei Basis Operationen. Dabei gibt die Variable `bit` an, welches Bit manipuliert werden soll (Denken sie daran, dass die Bit-Positionen bei 0 beginnen. Bit 3 ist also das vierte Bit von rechts). Bei den gefragten Manipulationen, soll nur das angegebene `bit` geändert werden und der Rest soll unverändert bleiben:
|
||||
|
||||
- Bit 3 setzen: `0011 => 1011`
|
||||
- Bit 1 löschen: `1011 => 1001`
|
||||
- Bit 0 flippen: `1001 => 1000`
|
||||
|
||||
Versuchen sie die Operationen in C umzusetzen:
|
||||
```c
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
unsigned int number = 0x75;
|
||||
unsigned int bit = 3; // bit at position 3
|
||||
|
||||
// Setting a bit
|
||||
number = ...;
|
||||
|
||||
// Clearing a bit
|
||||
bit = 1;
|
||||
number = ...;
|
||||
|
||||
// Toggling a bit
|
||||
bit = 0;
|
||||
number = ...;
|
||||
|
||||
printf("number = 0x%02X\n", number);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
```
|
||||
|
||||
#### 2. Variablen tauschen (ohne Dritt-Variable)
|
||||
Zwei Variablen zu vertauschen scheint ein einfach lösbares Problem zu sein. Eine offensichtliche Variante wäre mittels einer temporären Variablen:
|
||||
```c
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
int a = 3;
|
||||
int b = 4;
|
||||
printf("a: %d; b: %d\n", a, b);
|
||||
|
||||
int temp = a;
|
||||
a = b;
|
||||
b = temp;
|
||||
|
||||
printf("a: %d; b: %d\n", a, b);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
```
|
||||
|
||||
Es gibt aber auch eine Variante, die ohne zusätzliche Variable auskommt. Dabei wird die Tatsache, dass eine zweite XOR Operation eine erste XOR Operation rückgängig macht:
|
||||
|
||||
`0011 XOR 0100 = 0111`
|
||||
|
||||
`0111 XOR 0100 = 0011`
|
||||
|
||||
Somit kommt man von einem XOR Resultat (`0111`) wieder auf beide Anfangs Operanden zurück indem man einfach ein zweites Mal mit einem Operanden eine XOR Verknüpfung macht. Damit kann ein Operand als Zwischenspeicher dienen und man muss nicht extra eine Zusatzvariable verwenden.
|
||||
|
||||
Überlegen sie sich wie sie damit zwei Variablen vertauschen können ohne Zusatzvariable:
|
||||
```c
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
int a = 3;
|
||||
int b = 4;
|
||||
printf("a: %d; b: %d\n", a, b);
|
||||
|
||||
...
|
||||
|
||||
printf("a: %d; b: %d\n", a, b);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
```
|
||||
|
||||
#### 3. Lower- / Uppercase
|
||||
Folgendes Code Beispiel kann Buchstaben in Gross- oder Kleinbuchstaben wandeln mit nur einer einzigen Bit-Operation. Überlegen sie sich warum das funktioniert, damit sie es jemand anderem in ihren Worten erklären könnten. Machen sie Notizen falls nötig.
|
||||
```c
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
char word[8] = "sREedEv";
|
||||
char *wordptr = &word[0];
|
||||
|
||||
while(wordptr < &word[7]) {
|
||||
printf("UPPERCASE: %c\n", *wordptr & '_'); // converts the char into uppercase regardless of the current casing
|
||||
printf("LOWERCASE: %c\n", *wordptr | ' '); // converts the char into lowercase regardless of the current casing
|
||||
wordptr++;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
```
|
||||
|
||||
#### 4. Prüfen auf 2-er Potenz
|
||||
Um eine gegebene Zahl zu prüfen ob sie eine 2er Potenz ist, können wir folgende Bit-Muster vergleichen:
|
||||
|
||||
Beispiel mit der Zahl 8: `1000 & 0111 == 0`. Wir prüfen also, ob die gegebene Zahl 8 (`1000`) nur ein Bit auf `1` hat und den Rest auf `0`.
|
||||
|
||||
Überlegen Sie sich einen Algorithmus um dies für beliebige positive Zahlen zu prüfen. Das Bitmuster, dass für die `&` Operation gebraucht wird, kann mittel Subtraktion von 1 berechnet werden (`1000 - 1 = 0111`):
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(){
|
||||
int a = 32; // any positive number
|
||||
|
||||
if(a > 0 && ...){
|
||||
printf("%d is a power of 2", a);
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
```
|
||||
___
|
||||
## 2. Struct & typedef
|
||||
|
||||
### 2.1 Bit Operationen Rechner
|
||||
Vervollständigen sie das beiliegende Programm `bin_calculator.c`. Es soll einfache Bit-Operationen mit zwei Operanden lösen können. Die unterstützten Operationen sind:
|
||||
- & (AND)
|
||||
- | (OR)
|
||||
- ^ (XOR)
|
||||
- < (left shift)
|
||||
- \> (right shift)
|
||||
|
||||
Eine Rechnung kann direkt als einen String eingeben werden (z.B: `0x0c ^ 0x0f`). Dabei werden Hexadezimal, Oktal und Dezimal als Eingabeformate akzeptiert. Die Rechnung wird in 3 Teile aufgeteilt (Operand 1, Operand 2, Operation) und in einer Datenstruktur gespeichert (`struct`).
|
||||
|
||||
Als Ausgabe soll die Rechnung wie folgt dargestellt werden:
|
||||
```
|
||||
Bin:
|
||||
00000000'00000000'00000000'00001100
|
||||
00000000'00000000'00000000'00001111 ^
|
||||
-----------------------------------
|
||||
00000000'00000000'00000000'00000011
|
||||
|
||||
Hex:
|
||||
0x0c ^ 0x0f = 0x03
|
||||
|
||||
Dec:
|
||||
12 ^ 15 = 3
|
||||
```
|
||||
|
||||
### 2.2 Einfache Formen
|
||||
Der Code in `simple_shape.c` kompiliert nicht. Überlegen sie sich, wie der neue Datentype `Graphic` aussehen soll, damit alle nötigen Informationen dazu gespeichert werden können.
|
||||
|
||||
Eine Form (`Graphic`) wird aus folgenden Attributen zusammengesetzt:
|
||||
- **Shape**: *OVAL* oder *RECTANGLE* (verwenden sie dazu einen separaten `enum` Typ)
|
||||
- **Size**: Ein positiver Integer
|
||||
- Für *RECTANGLE* bestimmt er die Seitengrösse
|
||||
- Für *OVAL* bestimmt er den Radius
|
||||
- **Color**: char Pointer zu dem vordefinierten char array mit Farbinformationen. Verwenden sie: `char *color;`
|
||||
|
||||
Erweitern sie den Code an den markierten Stellen, damit er kompiliert. Per Terminal sollte es möglich sein die Attribute für die Form zu bestimmen, um sie danach angezeigt zu bekommen.
|
||||
|
||||
**Bemerkung**: Das Programm verwendet die Math Bibliothek `math.h`. Um das Programm kompilieren zu können, müssen sie das Flag `-lm` verwenden:
|
||||
|
||||
gcc -o main main.c -lm
|
||||
|
||||
___
|
||||
## 4. Bewertung
|
||||
|
||||
Die gegebenenfalls gestellten Theorieaufgaben und der funktionierende Programmcode müssen der Praktikumsbetreuung gezeigt werden. Die Lösungen müssen mündlich erklärt werden können.
|
||||
| Aufgabe | Kriterium | Gewicht |
|
||||
| :-- | :-- | :-- |
|
||||
| alle | Sie können das funktionierende Programm demonstrieren und erklären. | |
|
||||
| Basis Operationen | Funktion korrekt | 0.5 |
|
||||
| Variablen tauschen | Funktion korrekt | 0.5 |
|
||||
| Lower- / Uppercase | Funktion korrekt | 0.5 |
|
||||
| Prüfen auf 2-er Potenz | Funktion korrekt | 0.5 |
|
||||
| Bit Operationen Rechner | Fehlenden Teile ergänzt und lauffähig | 1 |
|
||||
| Einfache Formen | Fehlenden Teile ergänzt und lauffähig | 1 |
|
|
@ -1,96 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define OPERAND_BUFFER_SIZE 10
|
||||
|
||||
typedef struct {
|
||||
/*
|
||||
Students: The Expression struct should hold the two operands and
|
||||
the operation (use a char for the operation)
|
||||
*/
|
||||
} Expression;
|
||||
|
||||
int bits_per_int() {
|
||||
return sizeof(unsigned int) * 8;
|
||||
}
|
||||
|
||||
unsigned int parse_operand(char operand_str[]) {
|
||||
unsigned int operand;
|
||||
if (operand_str[0] == '0' && operand_str[1] == 'x') {
|
||||
sscanf(&operand_str[2], "%x", &operand);
|
||||
} else if (operand_str[0] == '0') {
|
||||
sscanf(&operand_str[1], "%o", &operand);
|
||||
} else {
|
||||
sscanf(operand_str, "%u", &operand);
|
||||
}
|
||||
return operand;
|
||||
}
|
||||
|
||||
void print_binary(unsigned int value) {
|
||||
// Students: Print a single number as a binary string
|
||||
}
|
||||
|
||||
void print_bit_operation_bin(Expression expression, unsigned int result) {
|
||||
/*
|
||||
Students: Print the entire operation in bin including the result
|
||||
|
||||
Bin:
|
||||
00000000'00000000'00000000'00001100
|
||||
00000000'00000000'00000000'00001111 ^
|
||||
-----------------------------------
|
||||
00000000'00000000'00000000'00000011
|
||||
*/
|
||||
}
|
||||
|
||||
void print_bit_operation_hex(Expression expression, unsigned int result) {
|
||||
/*
|
||||
Students: Print the entire operation in hex including the result
|
||||
|
||||
Hex:
|
||||
0x0c ^ 0x0f = 0x03
|
||||
*/
|
||||
}
|
||||
|
||||
void print_bit_operation_dec(Expression expression, unsigned int result) {
|
||||
/*
|
||||
Students: Print the entire operation in hex including the result
|
||||
|
||||
Dec:
|
||||
12 ^ 15 = 3
|
||||
*/
|
||||
}
|
||||
|
||||
unsigned int bit_operation(Expression expression) {
|
||||
// Students: Do the actual bit operation and return the result
|
||||
}
|
||||
|
||||
int main(){
|
||||
char operand1_str[10];
|
||||
char operand2_str[10];
|
||||
char operation;
|
||||
|
||||
unsigned int operand1, operand2;
|
||||
|
||||
do {
|
||||
printf("Geben sie die Bit-Operation ein:\n");
|
||||
|
||||
scanf("%s %c %s", operand1_str, &operation, operand2_str);
|
||||
|
||||
operand1 = parse_operand(operand1_str);
|
||||
operand2 = parse_operand(operand2_str);
|
||||
|
||||
Expression expression = ... ; // Students: Create an expression
|
||||
|
||||
unsigned int result = bit_operation(expression);
|
||||
print_bit_operation_bin(expression, result);
|
||||
print_bit_operation_hex(expression, result);
|
||||
print_bit_operation_dec(expression, result);
|
||||
|
||||
while(getchar() != '\n');
|
||||
printf("\nMöchten sie weiter machen oder abbrechen? [(n)ext|(q)uit] ");
|
||||
|
||||
} while(getchar() == 'n');
|
||||
|
||||
printf("Byebye..\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#define RED "\x1B[31m"
|
||||
#define GRN "\x1B[32m"
|
||||
#define YEL "\x1B[33m"
|
||||
#define WHT "\x1B[37m"
|
||||
#define RESET "\x1B[0m"
|
||||
|
||||
/*
|
||||
Students: Create a new type "Graphic" that can store:
|
||||
- shape (OVAL, RECTANGLE) -> create a new enum for this type
|
||||
- size
|
||||
- color
|
||||
*/
|
||||
|
||||
|
||||
void paint(Graphic graphic) {
|
||||
double radius = graphic.size / 2.0;
|
||||
int i,j;
|
||||
|
||||
for (i = 0; i <= 2 * radius; i++){
|
||||
for (j = 0; j <= 2 * radius; j++){
|
||||
switch(graphic.shape) {
|
||||
case RECTANGLE: printf("%s*" RESET, graphic.color); break;
|
||||
case OVAL: {
|
||||
double distance = sqrt((i - radius) * (i - radius) + (j - radius) * (j - radius));
|
||||
if (distance > radius - 0.5 && distance < radius + 0.5) {
|
||||
printf("%s*" RESET, graphic.color);
|
||||
} else {
|
||||
printf(" ");
|
||||
}
|
||||
} break;
|
||||
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
int input;
|
||||
Graphic graphic;
|
||||
|
||||
do {
|
||||
printf("Geben Sie die gewünschte Form an [OVAL=0 | RECTANGLE=1]:");
|
||||
scanf("%d", &input);
|
||||
// Students: store the input in graphic
|
||||
|
||||
printf("Geben Sie die gewünschte Grösse an:");
|
||||
scanf("%u", &input);
|
||||
// Students: store the input in graphic
|
||||
|
||||
printf("Geben Sie die gewünschte Farb an [RED=0 | GREEN=1 | YELLOW=2]:");
|
||||
scanf("%d", &input);
|
||||
// Students: store the input in graphic
|
||||
|
||||
paint(graphic);
|
||||
|
||||
while(getchar() != '\n'); // empty buffer
|
||||
printf("\nMöchten sie weiter machen oder abbrechen? [(n)ext|(q)uit] ");
|
||||
} while(getchar() == 'n');
|
||||
|
||||
printf("Byebye..\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
SNP_SHARED_MAKEFILE := $(if $(SNP_SHARED_MAKEFILE),$(SNP_SHARED_MAKEFILE),"~/snp/shared.mk")
|
||||
|
||||
TARGET := bin/triangle
|
||||
SOURCES := src/triangle.c src/read.c src/rectang.c
|
||||
TARGET := bin/boundinbox
|
||||
SOURCES := src/main.c
|
||||
TSTSOURCES := tests/tests.c
|
||||
LIBS := -lm
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* @mainpage SNP - P03 Calculate bounding box
|
||||
*
|
||||
* @section Purpose
|
||||
*
|
||||
* This is a lab to calculate the bounding box of some triangle and to compare the boxes
|
||||
*
|
||||
*/
|
|
@ -0,0 +1,209 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
* -- _____ ______ _____ -
|
||||
* -- |_ _| | ____|/ ____| -
|
||||
* -- | | _ __ | |__ | (___ Institute of Embedded Systems -
|
||||
* -- | | | '_ \| __| \___ \ Zuercher Hochschule Winterthur -
|
||||
* -- _| |_| | | | |____ ____) | (University of Applied Sciences) -
|
||||
* -- |_____|_| |_|______|_____/ 8401 Winterthur, Switzerland -
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* @file
|
||||
* @brief Lab P03 weekday
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
/// @brief point of two coordinate axes
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
/// @brief box with an origin point and a dimension w and h
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
/// @brief triangle given by three points a, b, and c
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
/**
|
||||
* @brief Compares two double values with a given hard coded tolerance.
|
||||
* @param [in] a the first value
|
||||
* @param [in] b the second value
|
||||
* @returns 0 if fabs(a-b) <= tolerance, -1 if a < b, 1 otherwise
|
||||
* @remark the tolerance is expected to be 0.05 (internally hard coded)
|
||||
*/
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
/**
|
||||
* @brief Compares two box parameters for their area (w * h of the box).
|
||||
* @param [in] a the first box
|
||||
* @param [in] b the second box
|
||||
* @returns the return value from compare_double() when given the areas of both boxes as parameter to compare_double()
|
||||
*/
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
/**
|
||||
* @brief Compares the area of the parameter against 0.
|
||||
* @param [in] box the box to check against area 0
|
||||
* @returns compare_double() == 0 with the boxes area and 0 as parameters
|
||||
*/
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
/**
|
||||
* @brief Calculates the bounding box of a triangle
|
||||
* @param [in] t the trinagle for which the baounding box is to be calculated
|
||||
* @returns the bounding box of the triangle
|
||||
* @remark calculates first the point with the minimum x and y of the triangle's points,
|
||||
* plus as second point the one with the max coordinates of all points
|
||||
* @remark the minial point is the origin of the bounding box, the width and hight is the x/y delta of the two points
|
||||
*
|
||||
*/
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
// forward declaration of used functions in main()
|
||||
static box_t get_match(box_t board, triangle_t t);
|
||||
static triangle_t triangle_rotate(triangle_t t, double degree);
|
||||
static void write_data(box_t board, triangle_t t, int degree);
|
||||
|
||||
|
||||
/**
|
||||
* @brief main function
|
||||
* @param argc [in] number of entries in argv
|
||||
* @param argv [in] program name plus command line arguments
|
||||
* @returns returns success if valid date is given, failure otherwise
|
||||
*/
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
int x1, x2, x3, y1, y2, y3;
|
||||
if (argc < 2 || sscanf(argv[1], "%d/%d-%d/%d-%d/%d", &x1, &y1, &x2, &y2, &x3, &y3) != 6) {
|
||||
fprintf(stderr, "Usage: %s x1/y1-x2/y2-x3/y3\ne.g. 0/0-100/0-50/50\n", argv[0]);
|
||||
return EXIT_FAILURE;
|
||||
|
||||
}
|
||||
|
||||
box_t board = { { 0, 0 }, 100, 200 };
|
||||
|
||||
// rotate the triangle in steps of 1 degree to find the "best position" of the triangle in the board
|
||||
triangle_t t = { { x1, y1 }, { x2, y2 }, { x3, y3 } };
|
||||
int degree_best = -1;
|
||||
box_t best;
|
||||
for(int degree = 0; degree < 360; degree++) {
|
||||
box_t match = get_match(board, triangle_rotate(t, degree));
|
||||
if (!is_zero_area(match)) {
|
||||
if (degree_best == -1 || compare_area(match, best) < 0) {
|
||||
degree_best = degree;
|
||||
best = match;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// write as tabular file
|
||||
write_data(board, t, degree_best);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/****************** internal functions ********************/
|
||||
|
||||
// forward declarations
|
||||
static point_t point_rotate(point_t p, double degree);
|
||||
static point_t point_move(point_t p, double dx, double dy);
|
||||
static triangle_t triangle_move(triangle_t t, double dx, double dy);
|
||||
|
||||
|
||||
static box_t get_match(box_t board, triangle_t t)
|
||||
{
|
||||
box_t b = triangle_bounding_box(t);
|
||||
if (compare_double(board.w, b.w) < 0) return (box_t){ board.p, 0, 0 };
|
||||
if (compare_double(board.h, b.h) < 0) return (box_t){ board.p, 0, 0 };
|
||||
return (box_t){ board.p, b.w, b.h };
|
||||
}
|
||||
|
||||
static triangle_t triangle_rotate(triangle_t t, double degree)
|
||||
{
|
||||
return (triangle_t){ point_rotate(t.a, degree), point_rotate(t.b, degree), point_rotate(t.c, degree) };
|
||||
}
|
||||
|
||||
static triangle_t triangle_move(triangle_t t, double dx, double dy)
|
||||
{
|
||||
return (triangle_t){ point_move(t.a, dx, dy), point_move(t.b, dx, dy), point_move(t.c, dx, dy) };
|
||||
}
|
||||
|
||||
static point_t point_rotate(point_t p, double degree)
|
||||
{
|
||||
double rad = fmod(degree, 360.0) * acos(-1.0) / 180.0;
|
||||
double s = sin(rad);
|
||||
double c = cos(rad);
|
||||
|
||||
return (point_t){ c*p.x - s*p.y, s*p.x + c*p.y };
|
||||
}
|
||||
|
||||
static point_t point_move(point_t p, double dx, double dy)
|
||||
{
|
||||
return (point_t) { p.x+dx, p.y+dy };
|
||||
}
|
||||
|
||||
static void write_data(box_t board, triangle_t t, int degree)
|
||||
{
|
||||
double border = 10.0;
|
||||
double gap = 2*border;
|
||||
|
||||
// move board to origin
|
||||
board.p.x = 0.0;
|
||||
board.p.y = 0.0;
|
||||
|
||||
// move original triangle to above the board
|
||||
box_t tbb = triangle_bounding_box(t);
|
||||
t = triangle_move(t, -tbb.p.x, -tbb.p.y + board.h + gap);
|
||||
tbb.p.x = 0.0;
|
||||
tbb.p.y = board.h + gap;
|
||||
|
||||
// view box
|
||||
box_t view = { { -border, -border }, fmax(board.w, tbb.w) + 2 * border, board.h + gap + tbb.h + 2 * border };
|
||||
printf("viewbox:%.1f:%.1f:%.1f:%.1f\n", view.p.x, view.p.y, view.w, view.h);
|
||||
|
||||
printf("rect:%.1f:%.1f:%.1f:%.1f:%s\n", board.p.x, board.p.y, board.w, board.h, "gray");
|
||||
printf("polygon:%.1f:%.1f:%.1f:%.1f:%.1f:%.1f:%s\n", t.a.x, t.a.y, t.b.x, t.b.y, t.c.x, t.c.y, "green");
|
||||
|
||||
// there was a match, show it
|
||||
if (degree >= 0) {
|
||||
triangle_t rotated = triangle_rotate(t, degree);
|
||||
box_t rbb = triangle_bounding_box(rotated);
|
||||
t = triangle_move(rotated, -rbb.p.x, -rbb.p.y); // move to origin
|
||||
printf("polygon:%.1f:%.1f:%.1f:%.1f:%.1f:%.1f:%s\n", t.a.x, t.a.y, t.b.x, t.b.y, t.c.x, t.c.y, "yellow");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
#!/bin/bash
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
# produces a crude HTML embedded SVG drawing from a tabular file (given on stdin) with columns separated by ":"
|
||||
# usage: tab2svg < inbut.txt > output.html
|
||||
|
||||
awk $* -- '
|
||||
BEGIN {
|
||||
FS=":" # field-separator: which character separats fields in a record (i.e. in a line)
|
||||
print "<!DOCTYPE html>"
|
||||
print "<html>"
|
||||
print " <head>"
|
||||
print " <title>SVG Data</title>"
|
||||
print " </head>"
|
||||
print " <body>"
|
||||
}
|
||||
/^viewbox/ {
|
||||
x = $2
|
||||
y = $3
|
||||
w = $4
|
||||
h = $5
|
||||
}
|
||||
/^rect/ {
|
||||
if (h > 0) {
|
||||
printf " <b>board = %dmm x %dmm</b>\n</p>\n", $4, $5
|
||||
printf " <svg width=\"%dmm\" viewbox=\"%.1f %.1f %.1f %.1f\" xmlns=\"http://www.w3.org/2000/svg\">\n", $4, x, y, w, h
|
||||
h = 0
|
||||
}
|
||||
printf " <rect fill=\"%s\" stroke=\"black\" x=\"%.1f\" y=\"%.1f\" width=\"%.1f\" height=\"%.1f\"/>\n", $6, $2, $3, $4, $5
|
||||
}
|
||||
/^polygon/ {
|
||||
printf " <polygon fill=\"%s\" stroke=\"black\" points=\"%.1f,%.1f %.1f,%.1f %.1f,%.1f\"/>\n", $8, $2, $3, $4, $5, $6, $7
|
||||
}
|
||||
END {
|
||||
print " </svg>"
|
||||
print " </body>"
|
||||
print "</html>"
|
||||
}
|
||||
'
|
|
@ -0,0 +1,109 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
* -- _____ ______ _____ -
|
||||
* -- |_ _| | ____|/ ____| -
|
||||
* -- | | _ __ | |__ | (___ Institute of Embedded Systems -
|
||||
* -- | | | '_ \| __| \___ \ Zuercher Hochschule Winterthur -
|
||||
* -- _| |_| | | | |____ ____) | (University of Applied Sciences) -
|
||||
* -- |_____|_| |_|______|_____/ 8401 Winterthur, Switzerland -
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* @file
|
||||
* @brief Test suite for the given package.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/wait.h>
|
||||
#include <time.h>
|
||||
#include <assert.h>
|
||||
#include <CUnit/Basic.h>
|
||||
#include "test_utils.h"
|
||||
|
||||
#ifndef TARGET // must be given by the make file --> see test target
|
||||
#error missing TARGET define
|
||||
#endif
|
||||
|
||||
/// @brief alias for EXIT_SUCCESS
|
||||
#define OK EXIT_SUCCESS
|
||||
/// @brief alias for EXIT_FAILURE
|
||||
#define FAIL EXIT_FAILURE
|
||||
|
||||
/// @brief The name of the STDOUT text file.
|
||||
#define OUTFILE "stdout.txt"
|
||||
/// @brief The name of the STDERR text file.
|
||||
#define ERRFILE "stderr.txt"
|
||||
|
||||
// setup & cleanup
|
||||
static int setup(void)
|
||||
{
|
||||
remove_file_if_exists(OUTFILE);
|
||||
remove_file_if_exists(ERRFILE);
|
||||
return 0; // success
|
||||
}
|
||||
|
||||
static int teardown(void)
|
||||
{
|
||||
// Do nothing.
|
||||
// Especially: do not remove result files - they are removed in int setup(void) *before* running a test.
|
||||
return 0; // success
|
||||
}
|
||||
|
||||
// tests
|
||||
static void test_no_match(void)
|
||||
{
|
||||
// arrange
|
||||
const char *out_txt[] = {
|
||||
"viewbox:-10.0:-10.0:250.0:290.0\n",
|
||||
"rect:0.0:0.0:100.0:200.0:gray\n",
|
||||
"polygon:0.0:220.0:230.0:220.0:100.0:270.0:green\n",
|
||||
};
|
||||
|
||||
// act & assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 0/0-230/0-100/50 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
assert_lines(OUTFILE, out_txt, sizeof(out_txt)/sizeof(*out_txt));
|
||||
}
|
||||
|
||||
static void test_initial_match(void)
|
||||
{
|
||||
// arrange
|
||||
const char *out_txt[] = {
|
||||
"viewbox:-10.0:-10.0:120.0:340.0\n",
|
||||
"rect:0.0:0.0:100.0:200.0:gray\n",
|
||||
"polygon:0.0:220.0:100.0:220.0:100.0:320.0:green\n",
|
||||
"polygon:0.0:0.0:100.0:0.0:100.0:100.0:yellow\n",
|
||||
};
|
||||
|
||||
// act & assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 0/0-100/0-100/100 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
assert_lines(OUTFILE, out_txt, sizeof(out_txt)/sizeof(*out_txt));
|
||||
}
|
||||
|
||||
static void test_tight_match(void)
|
||||
{
|
||||
// arrange
|
||||
const char *out_txt[] = {
|
||||
"viewbox:-10.0:-10.0:225.0:290.0\n",
|
||||
"rect:0.0:0.0:100.0:200.0:gray\n",
|
||||
"polygon:0.0:220.0:205.0:220.0:205.0:270.0:green\n",
|
||||
"polygon:94.8:0.0:48.7:199.7:0.0:188.5:yellow\n",
|
||||
};
|
||||
|
||||
// act & assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 0/0-205/0-205/50 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
assert_lines(OUTFILE, out_txt, sizeof(out_txt)/sizeof(*out_txt));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Registers and runs the tests.
|
||||
* @returns success (0) or one of the CU_ErrorCode (>0)
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
// setup, run, teardown
|
||||
TestMainBasic("lab test", setup, teardown
|
||||
, test_no_match
|
||||
, test_initial_match
|
||||
, test_tight_match
|
||||
);
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* @mainpage SNP - P03 Calculate the week day
|
||||
*
|
||||
* @section Purpose
|
||||
*
|
||||
* This is a lab to calculate the week day from a given Gregorian date.
|
||||
*
|
||||
*/
|
|
@ -9,7 +9,7 @@
|
|||
*/
|
||||
/**
|
||||
* @file
|
||||
* @brief Lab P02 weekday
|
||||
* @brief Lab P03 weekday
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -110,13 +110,12 @@ int main(int argc, const char *argv[])
|
|||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
// TASK2: calculate the weekday and print it in this format: "%04d-%02d-%02d is a %s\n"
|
||||
|
||||
// TASK2: calculate the weekday and print it in this format: YYYY-MM-DD is a Ddd\n, e.g. 2021-03-08 is a Mon\n
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -0,0 +1,196 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
* -- _____ ______ _____ -
|
||||
* -- |_ _| | ____|/ ____| -
|
||||
* -- | | _ __ | |__ | (___ Institute of Embedded Systems -
|
||||
* -- | | | '_ \| __| \___ \ Zuercher Hochschule Winterthur -
|
||||
* -- _| |_| | | | |____ ____) | (University of Applied Sciences) -
|
||||
* -- |_____|_| |_|______|_____/ 8401 Winterthur, Switzerland -
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* @file
|
||||
* @brief Test suite for the given package.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/wait.h>
|
||||
#include <time.h>
|
||||
#include <assert.h>
|
||||
#include <CUnit/Basic.h>
|
||||
#include "test_utils.h"
|
||||
|
||||
#ifndef TARGET // must be given by the make file --> see test target
|
||||
#error missing TARGET define
|
||||
#endif
|
||||
|
||||
/// @brief alias for EXIT_SUCCESS
|
||||
#define OK EXIT_SUCCESS
|
||||
/// @brief alias for EXIT_FAILURE
|
||||
#define FAIL EXIT_FAILURE
|
||||
|
||||
/// @brief The name of the STDOUT text file.
|
||||
#define OUTFILE "stdout.txt"
|
||||
/// @brief The name of the STDERR text file.
|
||||
#define ERRFILE "stderr.txt"
|
||||
|
||||
// setup & cleanup
|
||||
static int setup(void)
|
||||
{
|
||||
remove_file_if_exists(OUTFILE);
|
||||
remove_file_if_exists(ERRFILE);
|
||||
return 0; // success
|
||||
}
|
||||
|
||||
static int teardown(void)
|
||||
{
|
||||
// Do nothing.
|
||||
// Especially: do not remove result files - they are removed in int setup(void) *before* running a test.
|
||||
return 0; // success
|
||||
}
|
||||
|
||||
static struct tm now()
|
||||
{
|
||||
time_t t = time(NULL);
|
||||
return *localtime(&t);
|
||||
}
|
||||
|
||||
static const char* weekday_name(int wday)
|
||||
{
|
||||
assert(0 <= wday && wday <= 6);
|
||||
static const char* days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
|
||||
return days[wday];
|
||||
}
|
||||
|
||||
// tests
|
||||
static void test_task1_fail_no_arg(void)
|
||||
{
|
||||
// arrange & act & assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
}
|
||||
|
||||
static void test_task1_fail_not_gregorian(void)
|
||||
{
|
||||
// arrange & act & assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1291-08-01 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1582-10-14 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1583-10-14 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
}
|
||||
|
||||
static void test_task1_fail_month_out_of_range(void)
|
||||
{
|
||||
// arrange & act & assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-13-13 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-00-13 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-12-13 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
}
|
||||
|
||||
static void test_task1_fail_day_out_of_range(void)
|
||||
{
|
||||
// arrange & act & assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-01-32 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-01-31 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-02-30 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-02-29 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2019-02-29 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2019-02-28 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2019-02-29 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2019-02-28 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
}
|
||||
|
||||
static void test_task1_fail_leap_year(void)
|
||||
{
|
||||
// arrange & act & assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1900-02-29 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1900-02-28 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2000-02-30 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2000-02-29 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2001-02-29 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2001-02-28 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2004-02-30 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2004-02-29 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
}
|
||||
|
||||
static void test_task1_valid_date(void)
|
||||
{
|
||||
// arrange & act & assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-01-01 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-01-31 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-02-29 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-03-31 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-04-30 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-05-31 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-06-30 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-07-31 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-08-31 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-09-30 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-10-31 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-11-30 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-12-31 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-01-32 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-02-30 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-03-32 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-04-31 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-05-32 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-06-31 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-07-32 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-08-32 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-09-31 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-10-32 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-11-31 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 2020-12-32 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
}
|
||||
|
||||
static void test_task2_start_gregorian(void)
|
||||
{
|
||||
// arrange & act & assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1581-10-14 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1581-10-15 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1582-10-14 >" OUTFILE " 2>" ERRFILE)), FAIL);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1582-10-15 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1583-10-14 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1583-10-15 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
|
||||
const char *out_txt[] = { "1582-10-15 is a Fri\n" };
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(XSTR(TARGET) " 1582-10-15 >" OUTFILE " 2>" ERRFILE)), OK);
|
||||
assert_lines(OUTFILE, out_txt, sizeof(out_txt)/sizeof(*out_txt));
|
||||
}
|
||||
|
||||
static void test_task2_today(void)
|
||||
{
|
||||
// arrange
|
||||
const size_t SIZE = 1000;
|
||||
char command[SIZE];
|
||||
struct tm t = now();
|
||||
snprintf(command, SIZE, "%s %04d-%02d-%02d 2>%s | tail -1 >%s", XSTR(TARGET), t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, ERRFILE, OUTFILE);
|
||||
|
||||
char buffer[SIZE];
|
||||
snprintf(buffer, SIZE, "%04d-%02d-%02d is a %s\n", t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, weekday_name(t.tm_wday));
|
||||
const char *out_txt[] = { buffer };
|
||||
const char *err_txt[] = { NULL };
|
||||
|
||||
// act & assert
|
||||
CU_ASSERT_EQUAL(WEXITSTATUS(system(command)), OK);
|
||||
assert_lines(OUTFILE, out_txt, sizeof(out_txt)/sizeof(*out_txt));
|
||||
assert_lines(ERRFILE, err_txt, sizeof(err_txt)/sizeof(*err_txt));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Registers and runs the tests.
|
||||
* @returns success (0) or one of the CU_ErrorCode (>0)
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
// setup, run, teardown
|
||||
TestMainBasic("lab test", setup, teardown
|
||||
, test_task1_fail_no_arg
|
||||
, test_task1_fail_not_gregorian
|
||||
, test_task1_fail_month_out_of_range
|
||||
, test_task1_fail_day_out_of_range
|
||||
, test_task1_fail_leap_year
|
||||
, test_task1_valid_date
|
||||
, test_task2_start_gregorian
|
||||
, test_task2_today
|
||||
);
|
||||
}
|
|
@ -1,474 +0,0 @@
|
|||
# 04 - Modularisieren von C Code
|
||||
|
||||
![](./modularisieren_von_c_code.JPG)
|
||||
|
||||
___
|
||||
|
||||
## 1. Übersicht
|
||||
|
||||
In diesem Praktikum üben Sie modulare Programmierung indem Sie ein
|
||||
Java Programm (bestehend aus drei Java Files) in ein entsprechendes C
|
||||
Programm aus drei Modulen (aus je einem Header- und Implementations-
|
||||
File) übersetzen. Sie passen das Makefile so an, dass die
|
||||
entsprechenden Module mit kompiliert werden.
|
||||
|
||||
In der zweiten Aufgabe erstellen Sie Makefile Regeln für die drei
|
||||
Schritte von den C Source Files zur graphischen Darstellung der
|
||||
Abhängigkeiten.
|
||||
|
||||
|
||||
![](./uebersicht.png)
|
||||
|
||||
|
||||
Im Anhang ist eine Übersicht über die verwendeten File Formate gegeben.
|
||||
|
||||
|
||||
## 2. Lernziele
|
||||
|
||||
In diesem Praktikum lernen Sie die Handgriffe um ein Programm zu modularisieren, d.h. in mehrere Module aufzuteilen.
|
||||
|
||||
* Sie wissen, dass ein Modul aus einem C-File und einem passenden
|
||||
H-File besteht.
|
||||
* Sie können Header Files korrekt strukturieren.
|
||||
* Sie deklarieren im Header-File die öffentlichen Typen und Funktionen
|
||||
eines Moduls.
|
||||
* Sie wissen wie **Include Guards** anzuwenden sind.
|
||||
* Sie können Module im `Makefile` zur Kompilation hinzufügen.
|
||||
* Sie können `Makefile` Regeln schreiben.
|
||||
|
||||
Die Bewertung dieses Praktikums ist am Ende angegeben.
|
||||
|
||||
Erweitern Sie die vorgegebenen Code Gerüste, welche im `git`
|
||||
Repository `snp-lab-code` verfügbar sind.
|
||||
|
||||
|
||||
## 3. Aufgabe 1: Modularisieren
|
||||
Das zu ergänzende Programm dep2dot hat folgende Funktionalität:
|
||||
|
||||
Ergänzen Sie in **`modularize/src`** den Code in **`triangle.c`**,
|
||||
**`read.h`**, **`read.c`**, **`rectang.h`** und **`rectang.c`** so
|
||||
dass die Tests erfolgreich durchlaufen. Die C Implementation soll
|
||||
dieselbe Funktionalität haben wie die gegebenen Java Files. Lehnen Sie
|
||||
sich so nahe wie möglich an die Java Files an.
|
||||
|
||||
1. In den Header-Files implementieren Sie den Include-Guard und
|
||||
deklarieren Sie die öffentlichen Funktionen und gegebenenfalls
|
||||
**`#define`**.
|
||||
2. In den Implementations-Files implementieren Sie die Funktionen.
|
||||
|
||||
Die drei Java Files liegen in **`modularize/java`**.
|
||||
|
||||
### Tipps
|
||||
|
||||
* Implementieren Sie die Symbole welche vollständig in Grossbuchstaben
|
||||
geschrieben sind als **`#define`**.
|
||||
* **`EOF`** kommt schon aus **`stdio.h`** und sollte deshalb nicht
|
||||
mehr definiert werden.
|
||||
* Jene **`#define`** welche von andern Modulen verwendet werden
|
||||
kommen ins Header-File, die andern ins Implementations-File.
|
||||
* Ein Grossteil des Java Codes aus den Methoden Bodies kann
|
||||
eins-zu-eins in C übernommen werden. Listen Sie auf welche
|
||||
Unterschiede es gibt:
|
||||
|
||||
<table>
|
||||
<style>
|
||||
table, th, td {
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table th:first-of-type {
|
||||
width: 50%;
|
||||
}
|
||||
table th:nth-of-type(2) {
|
||||
width: 50%;
|
||||
}
|
||||
</style>
|
||||
<tr><th>Java</th><th>C</th></tr>
|
||||
<tr><td>
|
||||
|
||||
```Java
|
||||
byte
|
||||
```
|
||||
|
||||
</td><td></td></tr>
|
||||
<tr><td>
|
||||
|
||||
```Java
|
||||
boolean
|
||||
```
|
||||
|
||||
</td><td></td></tr>
|
||||
<tr><td>
|
||||
|
||||
|
||||
```Java
|
||||
true
|
||||
```
|
||||
</td><td></td></tr>
|
||||
<tr><td>
|
||||
|
||||
```Java
|
||||
false
|
||||
```
|
||||
|
||||
</td><td></td></tr>
|
||||
<tr><td>
|
||||
|
||||
```Java
|
||||
System.out.print(…)
|
||||
```
|
||||
|
||||
</td><td></td></tr>
|
||||
<tr><td>
|
||||
|
||||
```Java
|
||||
System.out.println(…)
|
||||
```
|
||||
|
||||
</td><td></td></tr>
|
||||
<tr><td>
|
||||
|
||||
```Java
|
||||
System.in.read()
|
||||
```
|
||||
|
||||
|
||||
</td><td></td></tr>
|
||||
<tr><td>
|
||||
|
||||
```Java
|
||||
byte[] buffer = new byte[BUFFERSIZE];
|
||||
```
|
||||
|
||||
</td><td></td></tr>
|
||||
<tr><td>
|
||||
|
||||
```Java
|
||||
public class rectang {
|
||||
public boolean Rectangular(…)
|
||||
{ … }
|
||||
}
|
||||
```
|
||||
|
||||
</td><td></td></tr>
|
||||
<tr><td>
|
||||
|
||||
```Java
|
||||
public class read {
|
||||
public int getInt(...)
|
||||
throws java.io.IOException
|
||||
{ ... }
|
||||
}
|
||||
```
|
||||
|
||||
</td><td></td></tr>
|
||||
<tr><td>
|
||||
|
||||
```Java
|
||||
class triangle {
|
||||
public static void main(String[] args)
|
||||
throws java.io.IOException
|
||||
{ ... }
|
||||
}
|
||||
```
|
||||
|
||||
</td><td></td></tr>
|
||||
<tr><td>
|
||||
|
||||
```Java
|
||||
read ReadInt = new read();
|
||||
...
|
||||
word = ReadInt.getInt(MAX_NUMBER);
|
||||
```
|
||||
|
||||
</td><td></td></tr>
|
||||
<tr><td>
|
||||
|
||||
```Java
|
||||
rectang Rect = new rectang();
|
||||
...
|
||||
if (Rect.Rectangular(a, b, c) == true) { ... }
|
||||
```
|
||||
|
||||
</td><td></td></tr>
|
||||
<tr><td>
|
||||
|
||||
```
|
||||
System.out.println(
|
||||
"-> Dreieck " + a + "-" + b + "-" + c
|
||||
+ " ist rechtwinklig");
|
||||
```
|
||||
|
||||
</td><td></td></tr>
|
||||
</table>
|
||||
|
||||
## 4. Aufgabe 2: Makefile Regeln
|
||||
|
||||
Die folgenden drei Schritte erstellen von einem C Source File eine
|
||||
graphische Darstellung der Abhängigkeiten:
|
||||
|
||||
1. `gcc ... -H .. file.c ... 2> file.dep` (Regeln im Makefile bereits vorhanden)
|
||||
2. `dep2dot file.c <file.dep >file.dot` (in dieser Aufgabe zu erstellen)
|
||||
3. `dot -Tpng file.dot >file.png` (in dieser Aufgabe zu erstellen)
|
||||
|
||||
Sie sollen für die Compiler-ähnlichen Programme `dep2dot` und `dot`
|
||||
Makefile Regeln schreiben.
|
||||
|
||||
|
||||
![](./uebersicht.png)
|
||||
|
||||
|
||||
|
||||
Das Programm `dep2dot` hat folgende Funktionalität:
|
||||
|
||||
|
||||
1. Es liest von `stdin` die vom Compiler generierten
|
||||
Abhängigkeits-Daten in Form des `dep` Formates ein.
|
||||
2. Das erste und einzige Command Line Argument gibt das File an für
|
||||
welches die von `stdin` gelesenen Abhängigkeiten gelten.
|
||||
3. Auf `stdout` werden die Abhängigkeiten von `stdin` übersetzt als
|
||||
`dot`-File Format ausgegeben.
|
||||
|
||||
Das Programm `dot` hat folgende Funktionalität:
|
||||
1. Es liest die textuelle Beschreibung eines Graphen aus der
|
||||
übergebenen Datei (erstes Argument) ein.
|
||||
2. Auf `stdout` wird die grafische Darstellung der Beschreibung der
|
||||
Eingabe-Datei im `png`-File Format ausgegeben.
|
||||
|
||||
Das `dep`-Format und das `dot`-Format sind im Anhang beschrieben.
|
||||
|
||||
Sie können die Funktionalität des Programms `dep2dot` kennen lernen,
|
||||
indem Sie folgende Zeilen auf der Bash Shell ausführen. Das
|
||||
`dep.input` File ist Teil der automatisierten Test Suite im
|
||||
Verzeichnis `tests`:
|
||||
|
||||
|
||||
```bash
|
||||
bin/dep2dot dir/file <tests/dep.input >dep.dot
|
||||
dot -Tpng dep.dot >dep.png
|
||||
firefox dep.png
|
||||
```
|
||||
|
||||
Als Resultat sollte Firefox folgende Graphik darstellen:
|
||||
|
||||
|
||||
![](./dep_dot.png)
|
||||
|
||||
|
||||
|
||||
|
||||
Definieren Sie im `Makefile` Regeln, welche die einzelnen Schritte von
|
||||
den Source Files zu den `png` Files ausführen.
|
||||
|
||||
|
||||
Prüfen Sie schliesslich die Umsetzung Aufgabe mittels `make dep-clean
|
||||
dep && firefox src/*.png.`
|
||||
|
||||
|
||||
### 4.1 Neue Regeln hinzufügen
|
||||
|
||||
|
||||
Führen Sie im `Makefile` an den angegebenen Stellen folgende
|
||||
Ergänzungen durch
|
||||
|
||||
* definieren Sie eine Variable `DEPFILES` deren Inhalt die Liste alle
|
||||
Einträge der Variable `SOURCES` ist, wobei bei allen die Endung `.c`
|
||||
durch die Endung `.c.png` ersetzt ist
|
||||
* fügen Sie zum `Pseudo-Target .PHONEY` das Target `dep` dazu – dies
|
||||
besagt, dass das später folgenden Target `dep` nicht ein File
|
||||
repräsentiert (ohne dieses Setting würde make gegebenenfalls nach
|
||||
einem File mit Namen `dep` suchen um zu entscheiden ob es
|
||||
inkrementell gebildet werden muss)
|
||||
* schreiben Sie das Target `dep` gemäss der Beschreibung im Makefile
|
||||
* schreiben Sie die Suffix Regel für die Übersetzung von `.png <-
|
||||
.dot` gemäss Vorgabe im `Makefile` (als Inspiration, siehe auch die
|
||||
`%.c.dep: %.c` Suffix Regel weiter unten im `Makefile`) – erklären
|
||||
Sie was die Regel macht
|
||||
* schreiben Sie die Suffix Regel für die Übersetzung von` .dot <-
|
||||
.dep` gemäss Vorgabe im `Makefile` – erklären Sie was die Regel
|
||||
macht
|
||||
|
||||
Die Umsetzung der obigen Änderungen sind erfolgreich, wenn Sie
|
||||
folgende Shell Command Line erfolgreich ausführen können und in
|
||||
Firefox die Abhängigkeiten der C-Files von den Include Files
|
||||
dargestellt wird.
|
||||
|
||||
`make dep-clean dep && firefox src/*.png.`
|
||||
|
||||
|
||||
### 4.2 Resultate analysieren und erklären
|
||||
|
||||
* Analysieren Sie die in der vorherigen Aufgabe erstellten grafischen Darstellungen.
|
||||
* Erklären Sie was dargestellt wird und stellen Sie den Bezug zum zugehörigen C-Code her.
|
||||
|
||||
___
|
||||
## 5. Bewertung
|
||||
|
||||
Die gegebenenfalls gestellten Theorieaufgaben und der funktionierende Programmcode müssen der Praktikumsbetreuung gezeigt werden. Die Lösungen müssen mündlich erklärt werden.
|
||||
|
||||
| Aufgabe | Kriterium | Punkte |
|
||||
| :-- | :-- | :-- |
|
||||
| 1 | Sie können das funktionierende Programm inklusive funktionierende Tests demonstrieren und erklären. | |
|
||||
| 1 | Module einbinden, Header Files schreiben | 2 |
|
||||
| 2 | Sie können das funktionierende Makefile demonstrieren und erklären. | |
|
||||
| 2 | Neue Regeln hinzufügen | 2 |
|
||||
|
||||
|
||||
___
|
||||
|
||||
## 6. Anhang
|
||||
|
||||
### 6.1 Verwendete zusätzliche Sprach Elemente
|
||||
|
||||
|
||||
**Sprach Element**
|
||||
|
||||
```C
|
||||
fprintf(stderr, "v=%d", v)
|
||||
```
|
||||
|
||||
**Beschreibung**
|
||||
|
||||
Formatierte Ausgabe auf den Standard Error Stream. Siehe ***man 3
|
||||
stderr*** und ***man 3 fprintf***.
|
||||
|
||||
|
||||
### 6.2 Verarbeitung und verwendete File Formate <a name="file_formats"></a>
|
||||
|
||||
Das Programm in diesem Praktikum ist Teil für die graphische
|
||||
Darstellung von `#include` File Abhängigkeit von C Files.
|
||||
|
||||
Den ersten Schritt für die Darstellung der `#include` File
|
||||
Abhängigkeiten bietet der Compiler. Der Compiler kann mittels der `-H`
|
||||
Command Line Option auf `stderr` ein Text File generieren, welches die
|
||||
tatsächlich verwendeten Header Files auflistet. Zusätzlich wird im
|
||||
Resultat die Verschachtelungstiefe der Includes angegeben.
|
||||
|
||||
Im zweiten Schritt übersetzt das Programm (`dep2dot`) dieses
|
||||
Praktikums solche Dependency Files (`dep`) in eine Text Repräsentation
|
||||
der Abhängigkeiten (`dot`) welche in graphische Darstel-lung (`png`)
|
||||
übersetzt werden kann.
|
||||
|
||||
Als Tool zur Übersetzung der `dot` Files in das `png` Format dient das
|
||||
`dot` Tool. Dieses Tool muss gegebenenfalls installiert werden:
|
||||
|
||||
```sudo apt install graphviz```
|
||||
|
||||
Die `png` Files können dann z.B. in der Programm Dokumentation
|
||||
integriert werden (Darstellung zu Test Zwecken z.B. mittels `firefox
|
||||
file.png`).
|
||||
|
||||
|
||||
#### 6.2.1 dep File
|
||||
|
||||
|
||||
Siehe: `man gcc`
|
||||
|
||||
```bash
|
||||
-H Print the name of each header file used, in addition to other
|
||||
normal activities. Each name is indented to show how deep in the
|
||||
#include stack it is. [...]
|
||||
```
|
||||
|
||||
Das File wird auf `stderr` ausgegeben.
|
||||
|
||||
**Beispiel File** (für Abhängigkeiten des `main.c` Files des `dep2dot` Programms)
|
||||
|
||||
```bash
|
||||
. /usr/include/stdio.h
|
||||
.. /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
|
||||
... /usr/include/features.h
|
||||
.... /usr/include/x86_64-linux-gnu/sys/cdefs.h
|
||||
..... /usr/include/x86_64-linux-gnu/bits/wordsize.h
|
||||
..... /usr/include/x86_64-linux-gnu/bits/long-double.h
|
||||
.... /usr/include/x86_64-linux-gnu/gnu/stubs.h
|
||||
..... /usr/include/x86_64-linux-gnu/gnu/stubs-64.h
|
||||
.. /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h
|
||||
.. /usr/include/x86_64-linux-gnu/bits/types.h
|
||||
... /usr/include/x86_64-linux-gnu/bits/wordsize.h
|
||||
... /usr/include/x86_64-linux-gnu/bits/typesizes.h
|
||||
.. /usr/include/x86_64-linux-gnu/bits/types/__FILE.h
|
||||
.. /usr/include/x86_64-linux-gnu/bits/types/FILE.h
|
||||
.. /usr/include/x86_64-linux-gnu/bits/libio.h
|
||||
... /usr/include/x86_64-linux-gnu/bits/_G_config.h
|
||||
.... /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h
|
||||
.... /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h
|
||||
... /usr/lib/gcc/x86_64-linux-gnu/7/include/stdarg.h
|
||||
.. /usr/include/x86_64-linux-gnu/bits/stdio_lim.h
|
||||
.. /usr/include/x86_64-linux-gnu/bits/sys_errlist.h
|
||||
. /usr/include/stdlib.h
|
||||
.. /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
|
||||
.. /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h
|
||||
.. /usr/include/x86_64-linux-gnu/bits/floatn.h
|
||||
... /usr/include/x86_64-linux-gnu/bits/floatn-common.h
|
||||
.... /usr/include/x86_64-linux-gnu/bits/long-double.h
|
||||
.. /usr/include/x86_64-linux-gnu/bits/stdlib-float.h
|
||||
. src/error.h
|
||||
.. /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h
|
||||
. src/data.h
|
||||
.. /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h
|
||||
. src/output.h
|
||||
Multiple include guards may be useful for:
|
||||
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h
|
||||
/usr/include/x86_64-linux-gnu/bits/sys_errlist.h
|
||||
/usr/include/x86_64-linux-gnu/bits/typesizes.h
|
||||
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h
|
||||
/usr/include/x86_64-linux-gnu/gnu/stubs.h
|
||||
```
|
||||
|
||||
|
||||
#### 6.2.2 dot File
|
||||
|
||||
**Graphviz** ist ein mächtiges Tool-Set welches Graphen, definiert in
|
||||
einem `dot`-Text File, automatisch anordnet und in `png`, `gif` und
|
||||
andere Formate übersetzt.
|
||||
|
||||
Siehe die offizielle Web-Page
|
||||
[https://www.graphviz.org/](https://www.graphviz.org/).
|
||||
|
||||
Es gibt als Teil dieses Tool-Sets verschiedene Übersetzer. Der hier
|
||||
verwendete ist der Basis-übersetzer: `dot`.
|
||||
|
||||
Das `dot`-File Format kennt viele Möglichkeiten die Knoten und Kanten
|
||||
eines Graphen und deren Anordnung anzugeben.
|
||||
|
||||
Der Vorteil eines solchen Tool-Sets ist, dass man den Inhalt (den
|
||||
Graphen) einfach definieren kann und sich nicht um das komplexe
|
||||
Problem der ansprechenden Visualisierung kümmern muss.
|
||||
|
||||
**Beispiel File** (`dot -Tpng sample.dot > sample.png`)
|
||||
|
||||
```C
|
||||
digraph G {
|
||||
node [shape=box]
|
||||
A [label="a.c"];
|
||||
B [label="a.h"];
|
||||
C [label="b.h"];
|
||||
|
||||
subgraph cluster_c0 {
|
||||
label="main"; color=black;
|
||||
A;
|
||||
}
|
||||
|
||||
subgraph cluster_c1 {
|
||||
label="others"; style=filled; color=lightgrey;
|
||||
{ B; C; rank=same; }
|
||||
}
|
||||
|
||||
A -> B;
|
||||
A -> C;
|
||||
B -> C;
|
||||
}
|
||||
```
|
||||
|
||||
![](./bsp_dot.png)
|
||||
|
||||
|
||||
#### 6.2.3 png File
|
||||
|
||||
Das `png` Format ist ein verlustfrei komprimiertes Raster Graphik
|
||||
Format. Es wird oft in Web Pages verwendet.
|
||||
|
||||
|
||||
___
|
||||
Version: 22.02.2022
|
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 392 KiB |
|
@ -1,18 +1,19 @@
|
|||
/**
|
||||
* @file
|
||||
* @brief Access to the GCC produced dependency data (via -H command line option).
|
||||
* @brief Access to the GCC produced dependency data (via gcc -H command line option).
|
||||
*/
|
||||
|
||||
// begin of include guard
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
#ifndef _DATA_H_
|
||||
#define _DATA_H_
|
||||
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
// includes which are needed in this header file
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
|
@ -21,22 +22,17 @@
|
|||
* @brief Directory container for file entries of the dependency file.
|
||||
*/
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
typedef struct {
|
||||
const char *name; ///< @brief the path name of the directory as given by the GCC produced dependency file.
|
||||
} dir_t;
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
/**
|
||||
* @brief File container for the file entries of the dependency file.
|
||||
*/
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
typedef struct {
|
||||
const char *name; ///< @brief The base name of the file from the GGC produced dependency file (i.e. the plain name, without any directory path).
|
||||
size_t dir; ///< @brief The index of the directory entry which represents the path as given by the dependency file.
|
||||
size_t level; ///< @brief The level as read out from the dependecy file.
|
||||
} file_t;
|
||||
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
|
@ -45,12 +41,8 @@ typedef struct {
|
|||
* @brief Overall container for all directories and all files from the dependency file.
|
||||
*/
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
typedef struct {
|
||||
size_t n_dirs; ///< @brief The number of valid entries in the dirs list.
|
||||
dir_t *dirs; ///< @brief The list of directories.
|
||||
size_t n_files; ///< @brief The number of valid entries in the files list.
|
||||
file_t *files; ///< @brief The list of files from the dependency file (the sequence is relevant to determine the dependencies).
|
||||
} data_t;
|
||||
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
|
@ -61,12 +53,14 @@ typedef struct {
|
|||
* @return The container of the read data from stdin. See the documentation on gcc -H for details on the dependencies, etc.
|
||||
*/
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
const data_t data_read_all(const char *root);
|
||||
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|
||||
|
||||
|
||||
|
||||
// end of include guard
|
||||
// BEGIN-STUDENTS-TO-ADD-CODE
|
||||
#endif // _DATA_H_
|
||||
|
||||
|
||||
// END-STUDENTS-TO-ADD-CODE
|