Jenkins Html Publish

This commit is contained in:
Jenkins 2022-03-01 14:30:52 +01:00
parent 71ab7db1ba
commit ec19345d67
29 changed files with 13218 additions and 269 deletions

View File

@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 5c323e642e12d9fbf3c26fc7fc5af7e8
config: ec1c17e11e152d8570ac6dba2421115f
tags: 645f666f9bcd5a90fca523b33c5a78b7

View File

@ -5,6 +5,10 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta content="metadata description" lang="en" name="description" xml:lang="en" />
<meta content="description des métadonnées" lang="fr" name="description" xml:lang="fr" />
<meta content="Sphinx, MyST" name="keywords" />
<meta content="en_US" property="og:locale" />
<title>01 - Erste Schritte mit C &#8212; SNP Labs documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
@ -105,7 +109,7 @@
<hr class="docutils" />
<section id="aufgabe-4-zeichen-und-worter-zahlen">
<h2>6. Aufgabe 4: Zeichen und Wörter zählen<a class="headerlink" href="#aufgabe-4-zeichen-und-worter-zahlen" title="Permalink to this headline"></a></h2>
<p>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.</p>
<p>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.</p>
<ul class="simple">
<li><p>Verwenden Sie die <code class="docutils literal notranslate"><span class="pre">char</span> <span class="pre">getchar(void)</span></code> Funktion aus der <code class="docutils literal notranslate"><span class="pre">stdio.h</span></code> Library, um die Zeichen einzeln einzulesen. Die Funktion <code class="docutils literal notranslate"><span class="pre">getchar</span></code> 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 <code class="docutils literal notranslate"><span class="pre">getchar</span></code> das Zeichen <code class="docutils literal notranslate"><span class="pre">\n</span></code> zurück, ist die Zeile komplett zurückgegeben und der Puffer ist wieder leer.</p></li>
<li><p>Setzen Sie eine Schleife ein, die beim Zeichen \n terminiert.</p></li>
@ -156,7 +160,6 @@
</li>
<li class="toctree-l1"><a class="reference internal" href="../P02_Funktionen_Datentyp_enum/README.html">02: Funktionen, Datentyp “enum”</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P03_Bit_Operation_struct_typedef/README.html">03 - Bit Operationen, Struct, Typedef</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html">04 - Modularisieren von C Code</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P05_TicTacToe/README.html">05 - Arrays/Strings/TicTacToe</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P06_Personen_Verwaltung_Linked_List/README.html">06 - Personen Verwaltung Linked List</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P07_Prozesse_und_Threads/README.html">07 - Prozesse und Threads</a></li>
@ -200,7 +203,7 @@
&copy;2022, stsh.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.4.0</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|

View File

@ -5,6 +5,10 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta content="metadata description" lang="en" name="description" xml:lang="en" />
<meta content="description des métadonnées" lang="fr" name="description" xml:lang="fr" />
<meta content="Sphinx, MyST" name="keywords" />
<meta content="en_US" property="og:locale" />
<title>02: Funktionen, Datentyp “enum” &#8212; SNP Labs documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
@ -37,7 +41,7 @@
<h1>02: Funktionen, Datentyp “enum”<a class="headerlink" href="#funktionen-datentyp-enum" title="Permalink to this headline"></a></h1>
<hr class="docutils" />
<p><img alt="" src="../_images/random_number.png" /></p>
<p>(Copyright Bild: xkcd.com)</p>
<p>(Copyright Bild: <a class="reference external" href="http://xkcd.com">xkcd.com</a>)</p>
<hr class="docutils" />
<section id="ubersicht">
<h2>1. Übersicht<a class="headerlink" href="#ubersicht" title="Permalink to this headline"></a></h2>
@ -94,7 +98,7 @@ Beispiel einer Additions-Funktion:</p></li>
<figure class="align-center" id="kalender-108-v-ardfotogalerie">
<a class="reference internal image-reference" href="../_images/kalender-108_v-ARDFotogalerie.jpg"><img alt="../_images/kalender-108_v-ARDFotogalerie.jpg" src="../_images/kalender-108_v-ARDFotogalerie.jpg" style="width: 600px;" /></a>
</figure>
<p>(Copyright Bild: www.planet-wissen.de)</p>
<p>(Copyright Bild: <a class="reference external" href="http://www.planet-wissen.de">www.planet-wissen.de</a>)</p>
<section id="aufgabe-1-tage-pro-monat">
<h3>3.1 Aufgabe 1 Tage pro Monat<a class="headerlink" href="#aufgabe-1-tage-pro-monat" title="Permalink to this headline"></a></h3>
<p>In der ersten Aufgabe berechnen Sie die Tag pro Monat einer beliebigen Kombination Monat / Jahr.
@ -116,7 +120,7 @@ Erweitern Sie dazu das Programm um folgende Aspekte:</p>
<li><p>Schaltjahre sind alle Jahre, die durch 4 teilbar sind.</p></li>
<li><p>Eine Ausnahme bilden die Jahrhunderte (1600, 1700…). Diese sind keine Schltjahre.</p></li>
<li><p>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</p></li>
… also zum Beispiel 1600 ist eines, nicht jedoch 1700. Weiterführende Details finden Sie unter <a class="reference external" href="https://de.wikipedia.org/wiki/Gregorianischer_Kalender">https://de.wikipedia.org/wiki/Gregorianischer_Kalender</a></p></li>
</ul>
<p>Gegeben ist die main Funktion des Programms. Ergänzen Sie die enum Definition und die fehlenden Funktionen:</p>
<ul class="simple">
@ -204,7 +208,7 @@ Die Formel wird Georg Glaeser zugeschrieben, möglicherweise angelehnt an eine F
<figure class="align-center" id="wochentagsberechnung">
<a class="reference internal image-reference" href="../_images/Wochentagsberechnung.jpg"><img alt="../_images/Wochentagsberechnung.jpg" src="../_images/Wochentagsberechnung.jpg" style="width: 600px;" /></a>
</figure>
<p>(Quelle: https://de.wikipedia.org/wiki/Wochentagsberechnung)</p>
<p>(Quelle: <a class="reference external" href="https://de.wikipedia.org/wiki/Wochentagsberechnung">https://de.wikipedia.org/wiki/Wochentagsberechnung</a>)</p>
<p>Hier ist eine für C abgewandelte Variante davon.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">weekday</span> <span class="o">=</span> <span class="p">((</span><span class="n">day</span> <span class="o">+</span> <span class="p">(</span><span class="mi">13</span> <span class="o">*</span> <span class="n">m</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span> <span class="o">+</span> <span class="n">y</span> <span class="o">+</span> <span class="n">y</span> <span class="o">/</span> <span class="mi">4</span> <span class="o">+</span> <span class="n">c</span> <span class="o">/</span> <span class="mi">4</span> <span class="o">-</span> <span class="mi">2</span> <span class="o">*</span> <span class="n">c</span><span class="p">)</span> <span class="o">%</span> <span class="mi">7</span> <span class="o">+</span> <span class="mi">7</span><span class="p">)</span> <span class="o">%</span> <span class="mi">7</span>
<span class="n">alle</span> <span class="n">Zahlen</span> <span class="n">sind</span> <span class="nb">int</span> <span class="n">Werte</span> <span class="n">und</span> <span class="n">alles</span> <span class="n">basiert</span> <span class="n">auf</span> <span class="nb">int</span><span class="o">-</span><span class="n">Arithmetik</span>
@ -219,9 +223,9 @@ Vorgaben an die Umsetzung</p>
<ol class="arabic simple">
<li><p>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 stel-len Sie sicher dass die Abkürzungen für die Werte 0…6 stehen.</p></li>
<li><p>Schreiben Sie eine Funktion weekday_t calculate_weekday(date_t date) nach der Beschreibung der obigen Formel. Das date Argument ist als gültig angenom-men, 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));)</p></li>
<li><p>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ülti-ger Wert für day erkannt wird, soll assert(!day is out-of-range”); aufgeru-fen werden.
<li><p>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ülti-ger Wert für day erkannt wird, soll assert(!day is out-of-range”); aufgeru-fen werden.
Hinweise
• Für interessierte, siehe: https://de.wikipedia.org/wiki/Wochentagsberechnung</p></li>
• Für interessierte, siehe: <a class="reference external" href="https://de.wikipedia.org/wiki/Wochentagsberechnung">https://de.wikipedia.org/wiki/Wochentagsberechnung</a></p></li>
</ol>
</section>
</section>
@ -353,7 +357,6 @@ Schreibt formatierten Text auf den stderr Stream.</p>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../P03_Bit_Operation_struct_typedef/README.html">03 - Bit Operationen, Struct, Typedef</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html">04 - Modularisieren von C Code</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P05_TicTacToe/README.html">05 - Arrays/Strings/TicTacToe</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P06_Personen_Verwaltung_Linked_List/README.html">06 - Personen Verwaltung Linked List</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P07_Prozesse_und_Threads/README.html">07 - Prozesse und Threads</a></li>
@ -397,7 +400,7 @@ Schreibt formatierten Text auf den stderr Stream.</p>
&copy;2022, stsh.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.4.0</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|

View File

@ -5,6 +5,10 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta content="metadata description" lang="en" name="description" xml:lang="en" />
<meta content="description des métadonnées" lang="fr" name="description" xml:lang="fr" />
<meta content="Sphinx, MyST" name="keywords" />
<meta content="en_US" property="og:locale" />
<title>03 - Bit Operationen, Struct, Typedef &#8212; SNP Labs documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
@ -15,7 +19,7 @@
<script src="../_static/doctools.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="04 - Modularisieren von C Code" href="../P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html" />
<link rel="next" title="05 - Arrays/Strings/TicTacToe" href="../P05_TicTacToe/README.html" />
<link rel="prev" title="02: Funktionen, Datentyp “enum”" href="../P02_Funktionen_Datentyp_enum/README.html" />
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
@ -81,44 +85,44 @@
<section id="basis-operationen">
<h4>1. Basis Operationen<a class="headerlink" href="#basis-operationen" title="Permalink to this headline"></a></h4>
<p>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:</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#include</span> <span class="cpf">&lt;stdlib.h&gt;</span><span class="cp"></span>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;stdlib.h&gt;</span><span class="cp"></span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
<span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">number</span><span class="p">;</span>
<span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">bit</span> <span class="o">=</span> <span class="mi">3</span><span class="p">;</span> <span class="c1">// bit at position 3</span>
<span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="kt">unsigned</span><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">number</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="kt">unsigned</span><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">bit</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">3</span><span class="p">;</span><span class="w"> </span><span class="c1">// bit at position 3</span>
<span class="c1">// Setting a bit</span>
<span class="n">number</span> <span class="o">=</span> <span class="p">...;</span> <span class="c1">// solution: number |= 1 &lt;&lt; bit;</span>
<span class="c1">// Clearing a bit</span>
<span class="n">number</span> <span class="o">=</span> <span class="p">...;</span> <span class="c1">// solution: number &amp;= ~(1 &lt;&lt; bit);</span>
<span class="c1">// Toggling a bit</span>
<span class="n">number</span> <span class="o">=</span> <span class="p">...;</span> <span class="c1">// solution; number ^= 1 &lt;&lt; bit;</span>
<span class="k">return</span> <span class="n">EXIT_SUCCESS</span><span class="p">;</span>
<span class="p">}</span>
<span class="w"> </span><span class="c1">// Setting a bit</span>
<span class="w"> </span><span class="n">number</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">...;</span><span class="w"> </span><span class="c1">// solution: number |= 1 &lt;&lt; bit;</span>
<span class="w"> </span>
<span class="w"> </span><span class="c1">// Clearing a bit</span>
<span class="w"> </span><span class="n">number</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">...;</span><span class="w"> </span><span class="c1">// solution: number &amp;= ~(1 &lt;&lt; bit);</span>
<span class="w"> </span>
<span class="w"> </span><span class="c1">// Toggling a bit</span>
<span class="w"> </span><span class="n">number</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">...;</span><span class="w"> </span><span class="c1">// solution; number ^= 1 &lt;&lt; bit;</span>
<span class="w"> </span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">EXIT_SUCCESS</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
</section>
<section id="variablen-tauschen-ohne-dritt-variable">
<h4>2. Variablen tauschen (ohne Dritt-Variable)<a class="headerlink" href="#variablen-tauschen-ohne-dritt-variable" title="Permalink to this headline"></a></h4>
<p>Zwei Variablen zu vertauschen scheint ein einfach lösbares Problem zu sein. Eine offensichtliche Variante wäre mittels einer temporären Variablen:</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#include</span> <span class="cpf">&lt;stdlib.h&gt;</span><span class="cp"></span>
<span class="cp">#include</span> <span class="cpf">&lt;stdio.h&gt;</span><span class="cp"></span>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;stdlib.h&gt;</span><span class="cp"></span>
<span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;stdio.h&gt;</span><span class="cp"></span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">(){</span>
<span class="kt">int</span> <span class="n">a</span> <span class="o">=</span> <span class="mi">3</span><span class="p">;</span>
<span class="kt">int</span> <span class="n">b</span> <span class="o">=</span> <span class="mi">4</span><span class="p">;</span>
<span class="n">printf</span><span class="p">(</span><span class="s">&quot;a: %d; b: %d</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">);</span>
<span class="kt">int</span> <span class="n">temp</span> <span class="o">=</span> <span class="n">a</span><span class="p">;</span>
<span class="n">a</span> <span class="o">=</span> <span class="n">b</span><span class="p">;</span>
<span class="n">b</span> <span class="o">=</span> <span class="n">temp</span><span class="p">;</span>
<span class="n">printf</span><span class="p">(</span><span class="s">&quot;a: %d; b: %d</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">);</span>
<span class="k">return</span> <span class="n">EXIT_SUCCESS</span><span class="p">;</span>
<span class="p">}</span>
<span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">(){</span><span class="w"></span>
<span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">3</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">b</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">4</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;a: %d; b: %d</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="p">);</span><span class="w"></span>
<span class="w"> </span>
<span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">temp</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">a</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">b</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="n">b</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">temp</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span>
<span class="w"> </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;a: %d; b: %d</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="p">);</span><span class="w"></span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">EXIT_SUCCESS</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
<p>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:</p>
@ -126,62 +130,62 @@
<p><em>0111 XOR 0100 = 0011</em></p>
<p>Somit kommt man von einem XOR Resultat (<em>0111</em>) 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.</p>
<p>Überlegen sie sich wie sie damit zwei Variablen vertauschen können ohne Zusatzvariable:</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#include</span> <span class="cpf">&lt;stdlib.h&gt;</span><span class="cp"></span>
<span class="cp">#include</span> <span class="cpf">&lt;stdio.h&gt;</span><span class="cp"></span>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;stdlib.h&gt;</span><span class="cp"></span>
<span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;stdio.h&gt;</span><span class="cp"></span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">(){</span>
<span class="kt">int</span> <span class="n">a</span> <span class="o">=</span> <span class="mi">3</span><span class="p">;</span>
<span class="kt">int</span> <span class="n">b</span> <span class="o">=</span> <span class="mi">4</span><span class="p">;</span>
<span class="n">printf</span><span class="p">(</span><span class="s">&quot;a: %d; b: %d</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">);</span>
<span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">(){</span><span class="w"></span>
<span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">3</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">b</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">4</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;a: %d; b: %d</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="p">);</span><span class="w"></span>
<span class="w"> </span>
<span class="w"> </span><span class="p">...</span><span class="w"></span>
<span class="p">...</span>
<span class="cm">/* Solutions: </span>
<span class="w"> </span><span class="cm">/* Solutions: </span>
<span class="cm"> // a == 0011; b == 0100</span>
<span class="cm"> a ^= b; // a == 0111; b == 0100</span>
<span class="cm"> b ^= a; // a == 0111; b == 0011</span>
<span class="cm"> a ^= b; // a == 0100; b == 0011</span>
<span class="cm"> */</span>
<span class="n">printf</span><span class="p">(</span><span class="s">&quot;a: %d; b: %d</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">);</span>
<span class="k">return</span> <span class="n">EXIT_SUCCESS</span><span class="p">;</span>
<span class="p">}</span>
<span class="cm"> */</span><span class="w"></span>
<span class="w"> </span>
<span class="w"> </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;a: %d; b: %d</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="p">);</span><span class="w"></span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">EXIT_SUCCESS</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
</section>
<section id="lower-uppercase">
<h4>3. Lower- / Uppercase<a class="headerlink" href="#lower-uppercase" title="Permalink to this headline"></a></h4>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#include</span> <span class="cpf">&lt;stdlib.h&gt;</span><span class="cp"></span>
<span class="cp">#include</span> <span class="cpf">&lt;stdio.h&gt;</span><span class="cp"></span>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;stdlib.h&gt;</span><span class="cp"></span>
<span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;stdio.h&gt;</span><span class="cp"></span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">(){</span>
<span class="kt">char</span> <span class="n">word</span><span class="p">[</span><span class="mi">8</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;sREedEv&quot;</span><span class="p">;</span>
<span class="kt">char</span> <span class="o">*</span><span class="n">wordptr</span> <span class="o">=</span> <span class="o">&amp;</span><span class="n">word</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>
<span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">(){</span><span class="w"></span>
<span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="n">word</span><span class="p">[</span><span class="mi">8</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;sREedEv&quot;</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="n">wordptr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="n">word</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span><span class="w"></span>
<span class="k">while</span><span class="p">(</span><span class="n">wordptr</span> <span class="o">&lt;</span> <span class="o">&amp;</span><span class="n">word</span><span class="p">[</span><span class="mi">7</span><span class="p">])</span> <span class="p">{</span>
<span class="n">printf</span><span class="p">(</span><span class="s">&quot;UPPERCASE: %c</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="o">*</span><span class="n">wordptr</span> <span class="o">&amp;</span> <span class="sc">&#39;_&#39;</span><span class="p">);</span> <span class="c1">// converts the char into uppercase regardless of the current casing</span>
<span class="n">printf</span><span class="p">(</span><span class="s">&quot;LOWERCASE: %c</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="o">*</span><span class="n">wordptr</span> <span class="o">|</span> <span class="sc">&#39; &#39;</span><span class="p">);</span> <span class="c1">// converts the char into lowercase regardless of the current casing</span>
<span class="n">wordptr</span><span class="o">++</span><span class="p">;</span>
<span class="p">}</span>
<span class="w"> </span><span class="k">while</span><span class="p">(</span><span class="n">wordptr</span><span class="w"> </span><span class="o">&lt;</span><span class="w"> </span><span class="o">&amp;</span><span class="n">word</span><span class="p">[</span><span class="mi">7</span><span class="p">])</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;UPPERCASE: %c</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="w"> </span><span class="o">*</span><span class="n">wordptr</span><span class="w"> </span><span class="o">&amp;</span><span class="w"> </span><span class="sc">&#39;_&#39;</span><span class="p">);</span><span class="w"> </span><span class="c1">// converts the char into uppercase regardless of the current casing</span>
<span class="w"> </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;LOWERCASE: %c</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="w"> </span><span class="o">*</span><span class="n">wordptr</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="sc">&#39; &#39;</span><span class="p">);</span><span class="w"> </span><span class="c1">// converts the char into lowercase regardless of the current casing</span>
<span class="w"> </span><span class="n">wordptr</span><span class="o">++</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="k">return</span> <span class="n">EXIT_SUCCESS</span><span class="p">;</span>
<span class="p">}</span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">EXIT_SUCCESS</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
</section>
<section id="prufen-auf-2-er-potenz">
<h4>4. Prüfen auf 2-er Potenz<a class="headerlink" href="#prufen-auf-2-er-potenz" title="Permalink to this headline"></a></h4>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#include</span> <span class="cpf">&lt;stdio.h&gt;</span><span class="cp"></span>
<span class="cp">#include</span> <span class="cpf">&lt;stdlib.h&gt;</span><span class="cp"></span>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;stdio.h&gt;</span><span class="cp"></span>
<span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;stdlib.h&gt;</span><span class="cp"></span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">(){</span>
<span class="kt">int</span> <span class="n">a</span><span class="o">=</span><span class="mi">32</span><span class="p">;</span>
<span class="k">if</span><span class="p">(</span><span class="n">a</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="n">a</span> <span class="o">&amp;</span> <span class="p">(</span><span class="n">a</span> <span class="o">-</span> <span class="mi">1</span><span class="p">))</span> <span class="o">==</span> <span class="mi">0</span><span class="p">){</span>
<span class="n">printf</span><span class="p">(</span><span class="s">&quot;%d is a power of 2&quot;</span><span class="p">,</span> <span class="n">a</span><span class="p">);</span>
<span class="p">}</span>
<span class="k">return</span> <span class="n">EXIT_SUCCESS</span><span class="p">;</span>
<span class="p">}</span>
<span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">(){</span><span class="w"></span>
<span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">a</span><span class="o">=</span><span class="mi">32</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="k">if</span><span class="p">(</span><span class="n">a</span><span class="w"> </span><span class="o">&gt;</span><span class="w"> </span><span class="mi">0</span><span class="w"> </span><span class="o">&amp;&amp;</span><span class="w"> </span><span class="p">(</span><span class="n">a</span><span class="w"> </span><span class="o">&amp;</span><span class="w"> </span><span class="p">(</span><span class="n">a</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="mi">1</span><span class="p">))</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="mi">0</span><span class="p">){</span><span class="w"></span>
<span class="w"> </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;%d is a power of 2&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">a</span><span class="p">);</span><span class="w"></span>
<span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">EXIT_SUCCESS</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
</section>
@ -199,11 +203,11 @@
<li><p>Rechnung wird als ein String über scanf dem Programm übergeben</p>
<ul>
<li><p>String wird in Token zerstückelt und in struct gespeichert:</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="k">typedef</span> <span class="k">struct</span> <span class="p">{</span>
<span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">operand_1</span><span class="p">;</span>
<span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">operand_2</span><span class="p">;</span>
<span class="kt">char</span> <span class="n">operation</span><span class="p">;</span>
<span class="p">}</span> <span class="n">Expression</span><span class="p">;</span>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="k">typedef</span><span class="w"> </span><span class="k">struct</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="kt">unsigned</span><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">operand_1</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="kt">unsigned</span><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">operand_2</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="n">operation</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"> </span><span class="n">Expression</span><span class="p">;</span><span class="w"></span>
</pre></div>
</div>
</li>
@ -313,7 +317,6 @@
<li class="toctree-l2"><a class="reference internal" href="#bewertung">4. Bewertung</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html">04 - Modularisieren von C Code</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P05_TicTacToe/README.html">05 - Arrays/Strings/TicTacToe</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P06_Personen_Verwaltung_Linked_List/README.html">06 - Personen Verwaltung Linked List</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P07_Prozesse_und_Threads/README.html">07 - Prozesse und Threads</a></li>
@ -327,7 +330,7 @@
<ul>
<li><a href="../index.html">Documentation overview</a><ul>
<li>Previous: <a href="../P02_Funktionen_Datentyp_enum/README.html" title="previous chapter">02: Funktionen, Datentyp “enum”</a></li>
<li>Next: <a href="../P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html" title="next chapter">04 - Modularisieren von C Code</a></li>
<li>Next: <a href="../P05_TicTacToe/README.html" title="next chapter">05 - Arrays/Strings/TicTacToe</a></li>
</ul></li>
</ul>
</div>
@ -357,7 +360,7 @@
&copy;2022, stsh.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.4.0</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|

View File

@ -5,6 +5,10 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta content="metadata description" lang="en" name="description" xml:lang="en" />
<meta content="description des métadonnées" lang="fr" name="description" xml:lang="fr" />
<meta content="Sphinx, MyST" name="keywords" />
<meta content="en_US" property="og:locale" />
<title>04 - Modularisieren von C Code &#8212; SNP Labs documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
@ -263,7 +267,7 @@ firefox dep.png
den Source Files zu den <code class="docutils literal notranslate"><span class="pre">png</span></code> Files ausführen.</p>
<p>Prüfen Sie schliesslich die Umsetzung Aufgabe mittels <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">dep-clean</span> <span class="pre">dep</span> <span class="pre">&amp;&amp;</span> <span class="pre">firefox</span> <span class="pre">src/*.png.</span></code></p>
<section id="neue-regeln-hinzufugen">
<h3>4.1 Neue Regeln hinzufügen<a class="headerlink" href="#neue-regeln-hinzufugen" title="Permalink to this headline"></a></h3>
<h3>4.1 Neue Regeln hinzufügen<a class="headerlink" href="#neue-regeln-hinzufugen" title="Permalink to this headline"></a></h3>
<p>Führen Sie im <code class="docutils literal notranslate"><span class="pre">Makefile</span></code> an den angegebenen Stellen folgende
Ergänzungen durch</p>
<ul class="simple">
@ -284,10 +288,17 @@ macht</p></li>
</ul>
<p>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 Inclu-de Files
Firefox die Abhängigkeiten der C-Files von den Include Files
dargestellt wird.</p>
<p><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">dep-clean</span> <span class="pre">dep</span> <span class="pre">&amp;&amp;</span> <span class="pre">firefox</span> <span class="pre">src/*.png.</span></code></p>
</section>
<section id="resultate-analysieren-und-erklaren">
<h3>4.2 Resultate analysieren und erklären<a class="headerlink" href="#resultate-analysieren-und-erklaren" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p>Analysieren Sie die in der vorherigen Aufgabe erstellten grafischen Darstellungen.</p></li>
<li><p>Erklären Sie was dargestellt wird und stellen Sie den Bezug zum zugehörigen C-Code her.</p></li>
</ul>
</section>
</section>
<section id="bewertung">
<span id="grading"></span><h2>5. Bewertung<a class="headerlink" href="#bewertung" title="Permalink to this headline"></a></h2>
@ -329,7 +340,7 @@ dargestellt wird.</p>
<p><strong>Beschreibung</strong></p>
</td></tr>
<tr><td>
<div class="highlight-C notranslate"><div class="highlight"><pre><span></span><span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;v=%d&quot;</span><span class="p">,</span> <span class="n">v</span><span class="p">)</span>
<div class="highlight-C notranslate"><div class="highlight"><pre><span></span><span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;v=%d&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">v</span><span class="p">)</span><span class="w"></span>
</pre></div>
</div>
</td><td>
@ -418,40 +429,43 @@ andere Formate übersetzt.</p>
<p>Es gibt als Teil dieses Tool-Sets verschiedene Übersetzer. Der hier
verwendete ist der Basis-übersetzer: <code class="docutils literal notranslate"><span class="pre">dot</span></code>.</p>
<p>Das <code class="docutils literal notranslate"><span class="pre">dot</span></code>-File Format kennt viele Möglichkeiten die Knoten und Kanten
eines Graphen und de-ren Anordnung anzugeben.</p>
eines Graphen und deren Anordnung anzugeben.</p>
<p>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.</p>
<p><strong>Beispiel File</strong> (<code class="docutils literal notranslate"><span class="pre">dot</span> <span class="pre">-Tpng</span> <span class="pre">sample.dot</span> <span class="pre">&gt;</span> <span class="pre">sample.png</span></code>)</p>
<div class="highlight-C notranslate"><div class="highlight"><pre><span></span><span class="n">digraph</span> <span class="n">G</span> <span class="p">{</span>
<span class="n">node</span> <span class="p">[</span><span class="n">shape</span><span class="o">=</span><span class="n">box</span><span class="p">]</span>
<span class="n">A</span> <span class="p">[</span><span class="n">label</span><span class="o">=</span><span class="s">&quot;a.c&quot;</span><span class="p">];</span>
<span class="n">B</span> <span class="p">[</span><span class="n">label</span><span class="o">=</span><span class="s">&quot;a.h&quot;</span><span class="p">];</span>
<span class="n">C</span> <span class="p">[</span><span class="n">label</span><span class="o">=</span><span class="s">&quot;b.h&quot;</span><span class="p">];</span>
<div class="highlight-C notranslate"><div class="highlight"><pre><span></span><span class="n">digraph</span><span class="w"> </span><span class="n">G</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="n">node</span><span class="w"> </span><span class="p">[</span><span class="n">shape</span><span class="o">=</span><span class="n">box</span><span class="p">]</span><span class="w"></span>
<span class="w"> </span><span class="n">A</span><span class="w"> </span><span class="p">[</span><span class="n">label</span><span class="o">=</span><span class="s">&quot;a.c&quot;</span><span class="p">];</span><span class="w"></span>
<span class="w"> </span><span class="n">B</span><span class="w"> </span><span class="p">[</span><span class="n">label</span><span class="o">=</span><span class="s">&quot;a.h&quot;</span><span class="p">];</span><span class="w"></span>
<span class="w"> </span><span class="n">C</span><span class="w"> </span><span class="p">[</span><span class="n">label</span><span class="o">=</span><span class="s">&quot;b.h&quot;</span><span class="p">];</span><span class="w"></span>
<span class="n">subgraph</span> <span class="n">cluster_c0</span> <span class="p">{</span>
<span class="n">label</span><span class="o">=</span><span class="s">&quot;main&quot;</span><span class="p">;</span> <span class="n">color</span><span class="o">=</span><span class="n">black</span><span class="p">;</span>
<span class="n">A</span><span class="p">;</span>
<span class="p">}</span>
<span class="w"> </span><span class="n">subgraph</span><span class="w"> </span><span class="n">cluster_c0</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="n">label</span><span class="o">=</span><span class="s">&quot;main&quot;</span><span class="p">;</span><span class="w"> </span><span class="n">color</span><span class="o">=</span><span class="n">black</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="n">A</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="n">subgraph</span> <span class="n">cluster_c1</span> <span class="p">{</span>
<span class="n">label</span><span class="o">=</span><span class="s">&quot;others&quot;</span><span class="p">;</span> <span class="n">style</span><span class="o">=</span><span class="n">filled</span><span class="p">;</span> <span class="n">col</span><span class="o">-</span><span class="n">or</span><span class="o">=</span><span class="n">lightgrey</span><span class="p">;</span>
<span class="p">{</span> <span class="n">B</span><span class="p">;</span> <span class="n">C</span><span class="p">;</span> <span class="n">rank</span><span class="o">=</span><span class="n">same</span><span class="p">;</span> <span class="p">}</span>
<span class="p">}</span>
<span class="w"> </span><span class="n">subgraph</span><span class="w"> </span><span class="n">cluster_c1</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="n">label</span><span class="o">=</span><span class="s">&quot;others&quot;</span><span class="p">;</span><span class="w"> </span><span class="n">style</span><span class="o">=</span><span class="n">filled</span><span class="p">;</span><span class="w"> </span><span class="n">color</span><span class="o">=</span><span class="n">lightgrey</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">B</span><span class="p">;</span><span class="w"> </span><span class="n">C</span><span class="p">;</span><span class="w"> </span><span class="n">rank</span><span class="o">=</span><span class="n">same</span><span class="p">;</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="n">A</span> <span class="o">-&gt;</span> <span class="n">B</span><span class="p">;</span>
<span class="n">A</span> <span class="o">-&gt;</span> <span class="n">C</span><span class="p">;</span>
<span class="n">B</span> <span class="o">-&gt;</span> <span class="n">C</span><span class="p">;</span>
<span class="p">}</span>
<span class="w"> </span><span class="n">A</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">B</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="n">A</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">C</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="n">B</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">C</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
<figure class="align-center" id="bsp-dot">
<a class="reference internal image-reference" href="../_images/bsp_dot.png"><img alt="../_images/bsp_dot.png" src="../_images/bsp_dot.png" style="width: 210px;" /></a>
</figure>
</section>
<section id="png-file">
<h4>6.2.3 png File<a class="headerlink" href="#png-file" title="Permalink to this headline"></a></h4>
<p>Das <code class="docutils literal notranslate"><span class="pre">png</span></code> Format ist ein verlustfrei komprimiertes Raster Graphik
Format. Es wird oft in Web Pages verwendet.</p>
<hr class="docutils" />
<p>Version: 15.02.2022</p>
<p>Version: 22.02.2022</p>
</section>
</section>
</section>
@ -485,7 +499,6 @@ Format. Es wird oft in Web Pages verwendet.</p>
<li class="toctree-l1"><a class="reference internal" href="../P01_Erste_Schritte_mit_C/README.html">01 - Erste Schritte mit C</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P02_Funktionen_Datentyp_enum/README.html">02: Funktionen, Datentyp “enum”</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P03_Bit_Operation_struct_typedef/README.html">03 - Bit Operationen, Struct, Typedef</a></li>
<li class="toctree-l1"><a class="reference internal" href="new_P04/P04_Modularisieren_von_C_Code.html">04 - Modularisieren von C Code</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P05_TicTacToe/README.html">05 - Arrays/Strings/TicTacToe</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P06_Personen_Verwaltung_Linked_List/README.html">06 - Personen Verwaltung Linked List</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P07_Prozesse_und_Threads/README.html">07 - Prozesse und Threads</a></li>
@ -527,7 +540,7 @@ Format. Es wird oft in Web Pages verwendet.</p>
&copy;2022, stsh.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.4.0</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|

View File

@ -196,8 +196,8 @@ init_model:… 0/0 FAILED</p>
<p>2. Konzentrieren Sie sich auf den ersten Test der fehlschlägt. Dies ist ein Unit Test, welcher die Funktion <strong>model_init()</strong> prüft. Suchen Sie die Funktion in <strong>src/model.h</strong> und <strong>src/model.c</strong>.
Was ist die geforderte Funktionalität und wie ist sie implementiert?
Suchen Sie die darin aufgerufene <strong>model_init()</strong> Funktion und implementieren Sie diese.</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="kt">void</span> <span class="nf">model_init</span><span class="p">(</span><span class="n">model_t</span> <span class="o">*</span><span class="n">instance</span><span class="p">)</span> <span class="p">{</span>
<span class="n">assert</span><span class="p">(</span><span class="n">instance</span><span class="p">);</span>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="kt">void</span><span class="w"> </span><span class="nf">model_init</span><span class="p">(</span><span class="n">model_t</span><span class="w"> </span><span class="o">*</span><span class="n">instance</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="n">assert</span><span class="p">(</span><span class="n">instance</span><span class="p">);</span><span class="w"></span>
<span class="c1">// Instructions to the students:</span>
<span class="c1">// set all fields of the board to model_state_none</span>
<span class="c1">// BEGIN-STUDENTS-TO-ADD-CODE</span>
@ -215,21 +215,21 @@ Suchen Sie die darin aufgerufene <strong>model_init()</strong> Funktion und impl
1. Führen Sie <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">test</span></code> aus.
2. Suchen Sie die Funktion <strong>model_get_state()</strong> in <strong>model.h</strong> und <strong>model.c</strong>.
3. Implementieren Sie die intern benutzte Funktion <strong>get_state()</strong> gemäss der Anleitung im Code.</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">model_state_t</span> <span class="nf">model_get_state</span><span class="p">(</span><span class="n">model_t</span> <span class="o">*</span><span class="n">instance</span><span class="p">,</span> <span class="n">model_pos_t</span> <span class="n">pos</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">assert</span><span class="p">(</span><span class="n">instance</span><span class="p">);</span>
<span class="n">assert_pos</span><span class="p">(</span><span class="n">pos</span><span class="p">);</span>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">model_state_t</span><span class="w"> </span><span class="nf">model_get_state</span><span class="p">(</span><span class="n">model_t</span><span class="w"> </span><span class="o">*</span><span class="n">instance</span><span class="p">,</span><span class="w"> </span><span class="n">model_pos_t</span><span class="w"> </span><span class="n">pos</span><span class="p">)</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="n">assert</span><span class="p">(</span><span class="n">instance</span><span class="p">);</span><span class="w"></span>
<span class="n">assert_pos</span><span class="p">(</span><span class="n">pos</span><span class="p">);</span><span class="w"></span>
<span class="c1">// Instructions to the students:</span>
<span class="c1">// replace the stub implementation my access to the field at the given position.</span>
<span class="c1">// BEGIN-STUDENTS-TO-ADD-CODE</span>
<span class="k">return</span> <span class="n">model_state_none</span><span class="p">;</span> <span class="c1">// stub</span>
<span class="k">return</span><span class="w"> </span><span class="n">model_state_none</span><span class="p">;</span><span class="w"> </span><span class="c1">// stub</span>
<span class="c1">// END-STUDENTS-TO-ADD-CODE</span>
<span class="p">}</span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
<ol class="arabic simple" start="4">
@ -242,36 +242,36 @@ Suchen Sie die darin aufgerufene <strong>model_init()</strong> Funktion und impl
1. Führen Sie <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">test</span></code> aus.
2. Suchen Sie die Funktion <strong>model_get_state()</strong> in <strong>model.h</strong> und <strong>model.c</strong>.
3. Implementieren Sie die intern benutzte Funktion <strong>get_state()</strong> gemäss der Anleitung im Code.</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">model_state_t</span> <span class="nf">model_get_state</span><span class="p">(</span><span class="n">model_t</span> <span class="o">*</span><span class="n">instance</span><span class="p">,</span> <span class="n">model_pos_t</span> <span class="n">pos</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">assert</span><span class="p">(</span><span class="n">instance</span><span class="p">);</span>
<span class="n">assert_pos</span><span class="p">(</span><span class="n">pos</span><span class="p">);</span>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">model_state_t</span><span class="w"> </span><span class="nf">model_get_state</span><span class="p">(</span><span class="n">model_t</span><span class="w"> </span><span class="o">*</span><span class="n">instance</span><span class="p">,</span><span class="w"> </span><span class="n">model_pos_t</span><span class="w"> </span><span class="n">pos</span><span class="p">)</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="n">assert</span><span class="p">(</span><span class="n">instance</span><span class="p">);</span><span class="w"></span>
<span class="n">assert_pos</span><span class="p">(</span><span class="n">pos</span><span class="p">);</span><span class="w"></span>
<span class="c1">// Instructions to the students:</span>
<span class="c1">// replace the stub implementation my access to the field at the given position.</span>
<span class="c1">// BEGIN-STUDENTS-TO-ADD-CODE</span>
<span class="k">return</span> <span class="n">model_state_none</span><span class="p">;</span> <span class="c1">// stub</span>
<span class="k">return</span><span class="w"> </span><span class="n">model_state_none</span><span class="p">;</span><span class="w"> </span><span class="c1">// stub</span>
<span class="c1">// END-STUDENTS-TO-ADD-CODE</span>
<span class="p">}</span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
</section>
<section id="test-model-can-move">
<h3><a class="toc-backref" href="#id8">3.4 test_model_can_move</a><a class="headerlink" href="#test-model-can-move" title="Permalink to this headline"></a></h3>
<p>Gehen Sie analog den obigen Teilaufgaben vor und implementieren Sie, gemäss Vorgaben im Code, die Funktion <strong>model_can_move()</strong>.</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="kt">int</span> <span class="nf">model_can_move</span><span class="p">(</span><span class="n">model_t</span> <span class="o">*</span><span class="n">instance</span><span class="p">){</span>
<span class="n">assert</span><span class="p">(</span><span class="n">instance</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">model_get_winner</span><span class="p">(</span><span class="n">instance</span><span class="p">)</span> <span class="o">==</span> <span class="n">model_state_none</span><span class="p">)</span> <span class="p">{</span>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="nf">model_can_move</span><span class="p">(</span><span class="n">model_t</span><span class="w"> </span><span class="o">*</span><span class="n">instance</span><span class="p">){</span><span class="w"></span>
<span class="n">assert</span><span class="p">(</span><span class="n">instance</span><span class="p">);</span><span class="w"></span>
<span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">model_get_winner</span><span class="p">(</span><span class="n">instance</span><span class="p">)</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">model_state_none</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="c1">// Instructions to the students:</span>
<span class="c1">// scan all fields: return 1 with first field which equals model_state_none</span>
<span class="c1">// BEGIN-STUDENTS-TO-ADD-CODE</span>
<span class="c1">// END-STUDENTS-TO-ADD-CODE}</span>
<span class="k">return</span> <span class="mi">0</span><span class="p">;}</span>
<span class="k">return</span><span class="w"> </span><span class="mi">0</span><span class="p">;}</span><span class="w"></span>
</pre></div>
</div>
</section>
@ -283,17 +283,17 @@ Suchen Sie die darin aufgerufene <strong>model_init()</strong> Funktion und impl
<span class="cm">* @param instance [INOUT] The instance which holds the state.</span>
<span class="cm">* @param pos [IN] The affected field.</span>
<span class="cm">* @param state [IN] The new state of the field.</span>
<span class="cm">*/</span>
<span class="k">static</span> <span class="kt">void</span> <span class="n">set_state</span><span class="p">(</span><span class="n">model_t</span> <span class="o">*</span><span class="n">instance</span><span class="p">,</span> <span class="n">model_pos_t</span> <span class="n">pos</span><span class="p">,</span> <span class="n">model_state_t</span> <span class="n">state</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">assert_pos</span><span class="p">(</span><span class="n">pos</span><span class="p">);</span>
<span class="cm">*/</span><span class="w"></span>
<span class="k">static</span><span class="w"> </span><span class="kt">void</span><span class="w"> </span><span class="nf">set_state</span><span class="p">(</span><span class="n">model_t</span><span class="w"> </span><span class="o">*</span><span class="n">instance</span><span class="p">,</span><span class="w"> </span><span class="n">model_pos_t</span><span class="w"> </span><span class="n">pos</span><span class="p">,</span><span class="w"> </span><span class="n">model_state_t</span><span class="w"> </span><span class="n">state</span><span class="p">)</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="n">assert_pos</span><span class="p">(</span><span class="n">pos</span><span class="p">);</span><span class="w"></span>
<span class="c1">// Instructions to the students:</span>
<span class="c1">// set the field of the board to the new state</span>
<span class="c1">// BEGIN-STUDENTS-TO-ADD-CODE</span>
<span class="c1">// END-STUDENTS-TO-ADD-CODE</span>
<span class="p">}</span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
<p>Wenn die beiden obigen Teilaufgaben erfolgreich umgesetzt sind, laufen die Tests ohne Fehler durch und das Spiel kann gespielt werden.</p>
@ -367,7 +367,6 @@ Suchen Sie die darin aufgerufene <strong>model_init()</strong> Funktion und impl
<li class="toctree-l1"><a class="reference internal" href="../P01_Erste_Schritte_mit_C/README.html">01 - Erste Schritte mit C</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P02_Funktionen_Datentyp_enum/README.html">02: Funktionen, Datentyp “enum”</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P03_Bit_Operation_struct_typedef/README.html">03 - Bit Operationen, Struct, Typedef</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html">04 - Modularisieren von C Code</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html">05 - Arrays/Strings/TicTacToe</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P06_Personen_Verwaltung_Linked_List/README.html">06 - Personen Verwaltung Linked List</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P07_Prozesse_und_Threads/README.html">07 - Prozesse und Threads</a></li>
@ -409,7 +408,7 @@ Suchen Sie die darin aufgerufene <strong>model_init()</strong> Funktion und impl
&copy;2022, stsh.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.4.0</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|

View File

@ -5,6 +5,10 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta content="metadata description" lang="en" name="description" xml:lang="en" />
<meta content="description des métadonnées" lang="fr" name="description" xml:lang="fr" />
<meta content="Sphinx, MyST" name="keywords" />
<meta content="en_US" property="og:locale" />
<title>05 - Arrays/Strings/TicTacToe &#8212; SNP Labs documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
@ -16,7 +20,7 @@
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="06 - Personen Verwaltung Linked List" href="../P06_Personen_Verwaltung_Linked_List/README.html" />
<link rel="prev" title="04 - Modularisieren von C Code" href="../P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html" />
<link rel="prev" title="03 - Bit Operationen, Struct, Typedef" href="../P03_Bit_Operation_struct_typedef/README.html" />
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
@ -146,27 +150,27 @@ Run Summary: Type Total Ran Passed Failed Inactive
asserts <span class="m">6</span> <span class="m">6</span> <span class="m">0</span> <span class="m">6</span> n/a
</pre></div>
</div>
<ol class="arabic simple">
<ol class="arabic simple" start="2">
<li><p>Konzentrieren Sie sich auf den ersten Test der fehlschlägt. Dies ist ein Unit Test, welcher die Funktion <strong>model_init()</strong> prüft. Suchen Sie die Funktion in <strong>src/model.h</strong> und <strong>src/model.c</strong>.</p></li>
<li><p>Was ist die geforderte Funktionalität und wie ist sie implementiert?</p></li>
</ol>
<p>Suchen Sie die darin aufgerufene <strong>model_init()</strong> Funktion und implementieren Sie diese.</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="kt">void</span> <span class="nf">model_init</span><span class="p">(</span><span class="n">model_t</span> <span class="o">*</span><span class="n">instance</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">assert</span><span class="p">(</span><span class="n">instance</span><span class="p">);</span>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="kt">void</span><span class="w"> </span><span class="nf">model_init</span><span class="p">(</span><span class="n">model_t</span><span class="w"> </span><span class="o">*</span><span class="n">instance</span><span class="p">)</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="n">assert</span><span class="p">(</span><span class="n">instance</span><span class="p">);</span><span class="w"></span>
<span class="c1">// Instructions to the students:</span>
<span class="c1">// set all fields of the board to model_state_none</span>
<span class="c1">// BEGIN-STUDENTS-TO-ADD-CODE</span>
<span class="w"> </span><span class="c1">// Instructions to the students:</span>
<span class="w"> </span><span class="c1">// set all fields of the board to model_state_none</span>
<span class="w"> </span><span class="c1">// BEGIN-STUDENTS-TO-ADD-CODE</span>
<span class="c1">// END-STUDENTS-TO-ADD-CODE</span>
<span class="p">}</span>
<span class="w"> </span><span class="c1">// END-STUDENTS-TO-ADD-CODE</span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
<ol class="arabic simple">
<ol class="arabic simple" start="3">
<li><p>Führen Sie <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">test</span></code> und korrigieren Sie obige Funktion, bis der Test nicht mehr fehlschlägt.</p></li>
</ol>
</section>
@ -179,21 +183,21 @@ Run Summary: Type Total Ran Passed Failed Inactive
<li><p>Suchen Sie die Funktion <strong>model_get_state()</strong> in <strong>model.h</strong> und <strong>model.c</strong>.</p></li>
<li><p>Implementieren Sie die intern benutzte Funktion <strong>get_state()</strong> gemäss der Anleitung im Code.</p></li>
</ol>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">model_state_t</span> <span class="nf">model_get_state</span><span class="p">(</span><span class="n">model_t</span> <span class="o">*</span><span class="n">instance</span><span class="p">,</span> <span class="n">model_pos_t</span> <span class="n">pos</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">assert</span><span class="p">(</span><span class="n">instance</span><span class="p">);</span>
<span class="n">assert_pos</span><span class="p">(</span><span class="n">pos</span><span class="p">);</span>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">model_state_t</span><span class="w"> </span><span class="nf">model_get_state</span><span class="p">(</span><span class="n">model_t</span><span class="w"> </span><span class="o">*</span><span class="n">instance</span><span class="p">,</span><span class="w"> </span><span class="n">model_pos_t</span><span class="w"> </span><span class="n">pos</span><span class="p">)</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="n">assert</span><span class="p">(</span><span class="n">instance</span><span class="p">);</span><span class="w"></span>
<span class="w"> </span><span class="n">assert_pos</span><span class="p">(</span><span class="n">pos</span><span class="p">);</span><span class="w"></span>
<span class="c1">// Instructions to the students:</span>
<span class="c1">// replace the stub implementation my access to the field at the given position.</span>
<span class="c1">// BEGIN-STUDENTS-TO-ADD-CODE</span>
<span class="w"> </span><span class="c1">// Instructions to the students:</span>
<span class="w"> </span><span class="c1">// replace the stub implementation my access to the field at the given position.</span>
<span class="w"> </span><span class="c1">// BEGIN-STUDENTS-TO-ADD-CODE</span>
<span class="k">return</span> <span class="n">model_state_none</span><span class="p">;</span> <span class="c1">// stub</span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">model_state_none</span><span class="p">;</span><span class="w"> </span><span class="c1">// stub</span>
<span class="c1">// END-STUDENTS-TO-ADD-CODE</span>
<span class="p">}</span>
<span class="w"> </span><span class="c1">// END-STUDENTS-TO-ADD-CODE</span>
<span class="p">}</span><span class="w"></span>
</pre></div>
@ -203,20 +207,20 @@ Run Summary: Type Total Ran Passed Failed Inactive
<section id="teilaufgabe-test-model-can-move">
<h3>4.3 Teilaufgabe test_model_can_move<a class="headerlink" href="#teilaufgabe-test-model-can-move" title="Permalink to this headline"></a></h3>
<p>Gehen Sie analog den obigen Teilaufgaben vor und implementieren Sie, gemäss Vorgaben im Code, die Funktion <strong>model_can_move()</strong>.</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="kt">int</span> <span class="nf">model_can_move</span><span class="p">(</span><span class="n">model_t</span> <span class="o">*</span><span class="n">instance</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">assert</span><span class="p">(</span><span class="n">instance</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">model_get_winner</span><span class="p">(</span><span class="n">instance</span><span class="p">)</span> <span class="o">==</span> <span class="n">model_state_none</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// Instructions to the students:</span>
<span class="c1">// scan all fields: return 1 with first field which equals model_state_none</span>
<span class="c1">// BEGIN-STUDENTS-TO-ADD-CODE</span>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="nf">model_can_move</span><span class="p">(</span><span class="n">model_t</span><span class="w"> </span><span class="o">*</span><span class="n">instance</span><span class="p">)</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="n">assert</span><span class="p">(</span><span class="n">instance</span><span class="p">);</span><span class="w"></span>
<span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">model_get_winner</span><span class="p">(</span><span class="n">instance</span><span class="p">)</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">model_state_none</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="c1">// Instructions to the students:</span>
<span class="w"> </span><span class="c1">// scan all fields: return 1 with first field which equals model_state_none</span>
<span class="w"> </span><span class="c1">// BEGIN-STUDENTS-TO-ADD-CODE</span>
<span class="c1">// END-STUDENTS-TO-ADD-CODE</span>
<span class="p">}</span>
<span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
<span class="p">}</span>
<span class="w"> </span><span class="c1">// END-STUDENTS-TO-ADD-CODE</span>
<span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
@ -230,20 +234,20 @@ Run Summary: Type Total Ran Passed Failed Inactive
<span class="cm"> * @param instance [INOUT] The instance which holds the state.</span>
<span class="cm"> * @param pos [IN] The affected field.</span>
<span class="cm"> * @param state [IN] The new state of the field.</span>
<span class="cm"> */</span>
<span class="k">static</span> <span class="kt">void</span> <span class="n">set_state</span><span class="p">(</span><span class="n">model_t</span> <span class="o">*</span><span class="n">instance</span><span class="p">,</span> <span class="n">model_pos_t</span> <span class="n">pos</span><span class="p">,</span> <span class="n">model_state_t</span> <span class="n">state</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">assert_pos</span><span class="p">(</span><span class="n">pos</span><span class="p">);</span>
<span class="cm"> */</span><span class="w"></span>
<span class="k">static</span><span class="w"> </span><span class="kt">void</span><span class="w"> </span><span class="nf">set_state</span><span class="p">(</span><span class="n">model_t</span><span class="w"> </span><span class="o">*</span><span class="n">instance</span><span class="p">,</span><span class="w"> </span><span class="n">model_pos_t</span><span class="w"> </span><span class="n">pos</span><span class="p">,</span><span class="w"> </span><span class="n">model_state_t</span><span class="w"> </span><span class="n">state</span><span class="p">)</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="n">assert_pos</span><span class="p">(</span><span class="n">pos</span><span class="p">);</span><span class="w"></span>
<span class="c1">// Instructions to the students:</span>
<span class="c1">// set the field of the board to the new state</span>
<span class="c1">// BEGIN-STUDENTS-TO-ADD-CODE</span>
<span class="w"> </span><span class="c1">// Instructions to the students:</span>
<span class="w"> </span><span class="c1">// set the field of the board to the new state</span>
<span class="w"> </span><span class="c1">// BEGIN-STUDENTS-TO-ADD-CODE</span>
<span class="c1">// END-STUDENTS-TO-ADD-CODE</span>
<span class="p">}</span>
<span class="w"> </span><span class="c1">// END-STUDENTS-TO-ADD-CODE</span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
@ -321,7 +325,6 @@ Run Summary: Type Total Ran Passed Failed Inactive
<li class="toctree-l1"><a class="reference internal" href="../P01_Erste_Schritte_mit_C/README.html">01 - Erste Schritte mit C</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P02_Funktionen_Datentyp_enum/README.html">02: Funktionen, Datentyp “enum”</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P03_Bit_Operation_struct_typedef/README.html">03 - Bit Operationen, Struct, Typedef</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html">04 - Modularisieren von C Code</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">05 - Arrays/Strings/TicTacToe</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#ubersicht">1. Übersicht</a></li>
<li class="toctree-l2"><a class="reference internal" href="#lernziele">2. Lernziele</a></li>
@ -347,7 +350,7 @@ Run Summary: Type Total Ran Passed Failed Inactive
<h3>Related Topics</h3>
<ul>
<li><a href="../index.html">Documentation overview</a><ul>
<li>Previous: <a href="../P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html" title="previous chapter">04 - Modularisieren von C Code</a></li>
<li>Previous: <a href="../P03_Bit_Operation_struct_typedef/README.html" title="previous chapter">03 - Bit Operationen, Struct, Typedef</a></li>
<li>Next: <a href="../P06_Personen_Verwaltung_Linked_List/README.html" title="next chapter">06 - Personen Verwaltung Linked List</a></li>
</ul></li>
</ul>
@ -378,7 +381,7 @@ Run Summary: Type Total Ran Passed Failed Inactive
&copy;2022, stsh.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.4.0</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|

View File

@ -5,6 +5,10 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta content="metadata description" lang="en" name="description" xml:lang="en" />
<meta content="description des métadonnées" lang="fr" name="description" xml:lang="fr" />
<meta content="Sphinx, MyST" name="keywords" />
<meta content="en_US" property="og:locale" />
<title>06 - Personen Verwaltung Linked List &#8212; SNP Labs documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
@ -98,18 +102,18 @@ Abbildung 1: Zyklisch verkettete Liste</p>
<p>Die für je eine Person zu speichernden Daten sollen in folgendem C <code class="docutils literal notranslate"><span class="pre">struct</span></code> zusammengefasst sein.</p>
<div class="highlight-C notranslate"><div class="highlight"><pre><span></span><span class="cp">#define NAME_LEN 20</span>
<span class="k">typedef</span> <span class="k">struct</span> <span class="p">{</span>
<span class="kt">char</span> <span class="n">name</span><span class="p">[</span><span class="n">NAME_LEN</span><span class="p">];</span>
<span class="kt">char</span> <span class="n">first_name</span><span class="p">[</span><span class="n">NAME_LEN</span><span class="p">];</span>
<span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">age</span><span class="p">;</span>
<span class="p">}</span> <span class="n">person_t</span><span class="p">;</span>
<span class="k">typedef</span><span class="w"> </span><span class="k">struct</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="n">name</span><span class="p">[</span><span class="n">NAME_LEN</span><span class="p">];</span><span class="w"></span>
<span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="n">first_name</span><span class="p">[</span><span class="n">NAME_LEN</span><span class="p">];</span><span class="w"></span>
<span class="w"> </span><span class="kt">unsigned</span><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">age</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"> </span><span class="n">person_t</span><span class="p">;</span><span class="w"></span>
</pre></div>
</div>
<p>Jeder Knoten der verketteten Liste soll aus folgendem C <code class="docutils literal notranslate"><span class="pre">struct</span></code> bestehen.</p>
<div class="highlight-C notranslate"><div class="highlight"><pre><span></span><span class="k">typedef</span> <span class="k">struct</span> <span class="nc">node</span> <span class="p">{</span>
<span class="n">person_t</span> <span class="n">content</span><span class="p">;</span> <span class="c1">// in diesem Knoten gespeicherte Person</span>
<span class="k">struct</span> <span class="nc">node</span> <span class="o">*</span><span class="n">next</span><span class="p">;</span> <span class="c1">// Pointer auf den nächsten Knoten in der Liste</span>
<span class="p">}</span> <span class="n">node_t</span><span class="p">;</span>
<div class="highlight-C notranslate"><div class="highlight"><pre><span></span><span class="k">typedef</span><span class="w"> </span><span class="k">struct</span><span class="w"> </span><span class="nc">node</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="n">person_t</span><span class="w"> </span><span class="n">content</span><span class="p">;</span><span class="w"> </span><span class="c1">// in diesem Knoten gespeicherte Person</span>
<span class="w"> </span><span class="k">struct</span><span class="w"> </span><span class="nc">node</span><span class="w"> </span><span class="o">*</span><span class="n">next</span><span class="p">;</span><span class="w"> </span><span class="c1">// Pointer auf den nächsten Knoten in der Liste</span>
<span class="p">}</span><span class="w"> </span><span class="n">node_t</span><span class="p">;</span><span class="w"></span>
</pre></div>
</div>
<p><strong>Vorschlag: zyklisch verkettete Liste</strong></p>
@ -119,7 +123,7 @@ Abbildung 1: Zyklisch verkettete Liste</p>
<p><strong>Sortiertes Einfügen</strong></p>
<p>Die Personen Records sollen sortiert in die Liste eingefügt werden. Dies bedeutet, dass vom Anker her gesucht werden soll, bis der erste Knoten gefunden wurde dessen Nachfolgeknoten entweder „grösser“ ist als der einzufügende Knoten, oder wo das Ende der Liste erreicht ist. Die Ordnung (grösser, gleich, kleiner) soll so definiert sein:</p>
<div class="highlight-C notranslate"><div class="highlight"><pre><span></span><span class="c1">// if (p1 &gt; p2) { ... }</span>
<span class="k">if</span> <span class="p">(</span><span class="n">person_compare</span><span class="p">(</span><span class="o">&amp;</span><span class="n">p1</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">p2</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span> <span class="p">...</span> <span class="p">}</span>
<span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">person_compare</span><span class="p">(</span><span class="o">&amp;</span><span class="n">p1</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="n">p2</span><span class="p">)</span><span class="w"> </span><span class="o">&gt;</span><span class="w"> </span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">...</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="cm">/**</span>
<span class="cm"> * @brief Compares two persons in this sequence: 1st=name, 2nd=first_name, 3rd=age</span>
<span class="cm"> * @param a [IN] const reference to 1st person in the comparison</span>
@ -129,8 +133,8 @@ Abbildung 1: Zyklisch verkettete Liste</p>
<span class="cm"> * &lt;0 if all previous fields are the same, but for this field, b is greater</span>
<span class="cm"> * @remark strncmp() is used for producing the result of string field comparisons</span>
<span class="cm"> * @remark a-&gt;age b-&gt;age is used for producing the result of age comparison</span>
<span class="cm"> */</span>
<span class="kt">int</span> <span class="n">person_compare</span><span class="p">(</span><span class="k">const</span> <span class="n">person_t</span> <span class="o">*</span><span class="n">a</span><span class="p">,</span> <span class="k">const</span> <span class="n">person_t</span> <span class="o">*</span><span class="n">b</span><span class="p">);</span>
<span class="cm"> */</span><span class="w"></span>
<span class="kt">int</span><span class="w"> </span><span class="n">person_compare</span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="n">person_t</span><span class="w"> </span><span class="o">*</span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">person_t</span><span class="w"> </span><span class="o">*</span><span class="n">b</span><span class="p">);</span><span class="w"></span>
</pre></div>
</div>
<p><strong>Eingabe</strong></p>
@ -187,12 +191,12 @@ Abbildung 1: Zyklisch verkettete Liste</p>
<p>Kreieren Sie folgende Files in <code class="docutils literal notranslate"><span class="pre">src</span></code> und implementieren Sie <code class="docutils literal notranslate"><span class="pre">main.c</span></code> basierend auf dem unten von Ihnen gegebenen API.</p>
<p><strong>File person.h</strong></p>
<p>Typ Definitionen:</p>
<div class="highlight-C notranslate"><div class="highlight"><pre><span></span><span class="n">person_t</span><span class="p">...</span> <span class="c1">// siehe Beschreibung oben</span>
<div class="highlight-C notranslate"><div class="highlight"><pre><span></span><span class="n">person_t</span><span class="p">...</span><span class="w"> </span><span class="c1">// siehe Beschreibung oben</span>
</pre></div>
</div>
<p>Funktionsdeklarationen:</p>
<div class="highlight-C notranslate"><div class="highlight"><pre><span></span><span class="c1">// siehe Beschreibung oben</span>
<span class="kt">int</span> <span class="nf">person_compare</span><span class="p">(</span><span class="k">const</span> <span class="n">person_t</span> <span class="o">*</span><span class="n">a</span><span class="p">,</span> <span class="k">const</span> <span class="n">person_t</span> <span class="o">*</span><span class="n">b</span><span class="p">);</span>
<span class="kt">int</span><span class="w"> </span><span class="nf">person_compare</span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="n">person_t</span><span class="w"> </span><span class="o">*</span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">person_t</span><span class="w"> </span><span class="o">*</span><span class="n">b</span><span class="p">);</span><span class="w"></span>
</pre></div>
</div>
<ul class="simple">
@ -200,7 +204,7 @@ Abbildung 1: Zyklisch verkettete Liste</p>
</ul>
<p><strong>File list.h</strong></p>
<p>Typ Definitionen:</p>
<div class="highlight-C notranslate"><div class="highlight"><pre><span></span><span class="n">person_t</span><span class="p">...</span> <span class="c1">// siehe Beschreibung oben</span>
<div class="highlight-C notranslate"><div class="highlight"><pre><span></span><span class="n">person_t</span><span class="p">...</span><span class="w"> </span><span class="c1">// siehe Beschreibung oben</span>
</pre></div>
</div>
<p>Funktionsdeklarationen:</p>
@ -317,7 +321,6 @@ Abbildung 1: Zyklisch verkettete Liste</p>
<li class="toctree-l1"><a class="reference internal" href="../P01_Erste_Schritte_mit_C/README.html">01 - Erste Schritte mit C</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P02_Funktionen_Datentyp_enum/README.html">02: Funktionen, Datentyp “enum”</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P03_Bit_Operation_struct_typedef/README.html">03 - Bit Operationen, Struct, Typedef</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html">04 - Modularisieren von C Code</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P05_TicTacToe/README.html">05 - Arrays/Strings/TicTacToe</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">06 - Personen Verwaltung Linked List</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#ubersicht">1. Übersicht</a></li>
@ -379,7 +382,7 @@ Abbildung 1: Zyklisch verkettete Liste</p>
&copy;2022, stsh.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.4.0</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|

View File

@ -5,6 +5,10 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta content="metadata description" lang="en" name="description" xml:lang="en" />
<meta content="description des métadonnées" lang="fr" name="description" xml:lang="fr" />
<meta content="Sphinx, MyST" name="keywords" />
<meta content="en_US" property="og:locale" />
<title>07 - Prozesse und Threads &#8212; SNP Labs documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
@ -252,7 +256,7 @@
</pre></div>
</div>
<p><strong>Hinweis:</strong> ein core Dump ist ein Abbild des Speichers z.B. zum Zeitpunkt, wenn das Programm abstürzt (wie oben mit der Speicher Zugriff Verletzung). Der Dump wird im File <strong>core</strong> abgelegt und kann mit dem <strong>gdb</strong> (GNU-Debugger) gelesen werden (siehe <code class="docutils literal notranslate"><span class="pre">README</span></code>). Tippen Sie nach dem Starten des Command Line UI des <code class="docutils literal notranslate"><span class="pre">gdb</span> <span class="pre">where</span></code> gefolgt von list ein, damit sie den Ort des Absturzes sehen. Mit <code class="docutils literal notranslate"><span class="pre">quit</span></code> verlassen Sie <strong>gdb</strong> wieder.</p>
<ol class="arabic">
<ol class="arabic" start="3">
<li><p>Wenn Sie <code class="docutils literal notranslate"><span class="pre">ProcA7.e</span> <span class="pre">2</span></code> starten, sendet das Kind das Signal 30 an sich selbst. Was geschieht?</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>
</pre></div>
@ -331,7 +335,7 @@
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>
</pre></div>
</div>
<ol class="arabic">
<ol class="arabic" start="2">
<li><p>Setzen Sie in der Thread-Routine vor dem Befehl <code class="docutils literal notranslate"><span class="pre">pthread_exit()</span></code> eine unendliche Schleife ein, z.B. <code class="docutils literal notranslate"><span class="pre">while(1)</span> <span class="pre">{</span> <span class="pre">}</span></code>; .</p>
<ul>
<li><p>Starten Sie das Programm und beobachten Sie das Verhalten mit <code class="docutils literal notranslate"><span class="pre">top</span></code>. Was beobachten Sie und was schliessen Sie daraus?</p>
@ -389,7 +393,7 @@
<p>Im Abschnitt 4 finden Sie Zusatzinformationen über diese Implementation eines Dämon Prozesses plus weiterführende Informationen.</p>
<p><strong>Aufgaben</strong></p>
<ol class="arabic">
<li><p>Für die folgende Aufgabe benötigen Sie mindestens zwei Fenster (Kommandozeilen-Konsolen). Übersetzen Sie die Programme mit <code class="docutils literal notranslate"><span class="pre">make</span></code> und starten Sie das Programm <strong>PlapperMaul</strong> in einem der Fenster. Das Programm schreibt (ca.) alle 0.5 Sekunden <em>Hallo, ich bins…. Pidi</em> plus seine Prozess-ID auf den Bildschirm. Mit dem Shell Befehl <code class="docutils literal notranslate"><span class="pre">ps</span></code> können Sie Ihre aktiven Prozesse auflisten, auch <strong>PlapperMaul</strong>. Überlegen Sie sich zuerst, was mit <strong>PlapperMaul</strong> geschieht, wenn Sie das Fenster schliessen: läuft <strong>PlapperMaul</strong> weiter? Was geschieht mit <strong>PlapperMaul</strong> wenn Sie sich ausloggen und wieder einloggen? Testen Sie Ihre Überlegungen, in dem Sie die entsprechenden Aktionen durchführen. Stimmen Ihre Überlegungen?</p>
<li><p>Für die folgende Aufgabe benötigen Sie mindestens zwei Fenster (Kommandozeilen-Konsolen). Übersetzen Sie die Programme mit <code class="docutils literal notranslate"><span class="pre">make</span></code> und starten Sie das Programm <strong>PlapperMaul</strong> in einem der Fenster. Das Programm schreibt (ca.) alle 0.5 Sekunden <em>Hallo, ich bins… Pidi</em> plus seine Prozess-ID auf den Bildschirm. Mit dem Shell Befehl <code class="docutils literal notranslate"><span class="pre">ps</span></code> können Sie Ihre aktiven Prozesse auflisten, auch <strong>PlapperMaul</strong>. Überlegen Sie sich zuerst, was mit <strong>PlapperMaul</strong> geschieht, wenn Sie das Fenster schliessen: läuft <strong>PlapperMaul</strong> weiter? Was geschieht mit <strong>PlapperMaul</strong> wenn Sie sich ausloggen und wieder einloggen? Testen Sie Ihre Überlegungen, in dem Sie die entsprechenden Aktionen durchführen. Stimmen Ihre Überlegungen?</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>
</pre></div>
</div>
@ -553,7 +557,6 @@ Die Firewall können Sie mit folgendem Befehl wiederherstellen:</p>
<li class="toctree-l1"><a class="reference internal" href="../P01_Erste_Schritte_mit_C/README.html">01 - Erste Schritte mit C</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P02_Funktionen_Datentyp_enum/README.html">02: Funktionen, Datentyp “enum”</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P03_Bit_Operation_struct_typedef/README.html">03 - Bit Operationen, Struct, Typedef</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html">04 - Modularisieren von C Code</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P05_TicTacToe/README.html">05 - Arrays/Strings/TicTacToe</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P06_Personen_Verwaltung_Linked_List/README.html">06 - Personen Verwaltung Linked List</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">07 - Prozesse und Threads</a><ul>
@ -631,7 +634,7 @@ Die Firewall können Sie mit folgendem Befehl wiederherstellen:</p>
&copy;2022, stsh.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.4.0</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|

View File

@ -5,6 +5,10 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta content="metadata description" lang="en" name="description" xml:lang="en" />
<meta content="description des métadonnées" lang="fr" name="description" xml:lang="fr" />
<meta content="Sphinx, MyST" name="keywords" />
<meta content="en_US" property="og:locale" />
<title>09/02 - Dämon Prozesse &#8212; SNP Labs documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
@ -77,24 +81,24 @@
<p>Im Abschnitt 4 finden Sie Zusatzinformationen über diese Implementation eines Dämon Prozesses plus weiterführende Informationen.</p>
<p><strong>Aufgaben</strong></p>
<ol class="arabic simple">
<li><p>Für die folgende Aufgabe benötigen Sie mindestens zwei Fenster (Kommandozeilen-Konsolen). Übersetzen Sie die Programme mit <code class="docutils literal notranslate"><span class="pre">make</span></code> und starten Sie das Programm <strong>PlapperMaul</strong> in einem der Fenster. Das Programm schreibt (ca.) alle 0.5 Sekunden <em>Hallo, ich bins…. Pidi</em> plus seine Prozess-ID auf den Bildschirm. Mit dem Shell Befehl <code class="docutils literal notranslate"><span class="pre">ps</span></code> können Sie Ihre aktiven Prozesse auflisten, auch <strong>PlapperMaul</strong>. Überlegen Sie sich zuerst, was mit <strong>PlapperMaul</strong> geschieht, wenn Sie das Fenster schliessen: läuft <strong>PlapperMaul</strong> weiter? Was geschieht mit <strong>PlapperMaul</strong> wenn Sie sich ausloggen und wieder einloggen? Testen Sie Ihre Überlegungen, in dem Sie die entsprechenden Aktionen durchführen. Stimmen Ihre Überlegungen?</p></li>
<li><p>Für die folgende Aufgabe benötigen Sie mindestens zwei Fenster (Kommandozeilen-Konsolen). Übersetzen Sie die Programme mit <code class="docutils literal notranslate"><span class="pre">make</span></code> und starten Sie das Programm <strong>PlapperMaul</strong> in einem der Fenster. Das Programm schreibt (ca.) alle 0.5 Sekunden <em>Hallo, ich bins… Pidi</em> plus seine Prozess-ID auf den Bildschirm. Mit dem Shell Befehl <code class="docutils literal notranslate"><span class="pre">ps</span></code> können Sie Ihre aktiven Prozesse auflisten, auch <strong>PlapperMaul</strong>. Überlegen Sie sich zuerst, was mit <strong>PlapperMaul</strong> geschieht, wenn Sie das Fenster schliessen: läuft <strong>PlapperMaul</strong> weiter? Was geschieht mit <strong>PlapperMaul</strong> wenn Sie sich ausloggen und wieder einloggen? Testen Sie Ihre Überlegungen, in dem Sie die entsprechenden Aktionen durchführen. Stimmen Ihre Überlegungen?</p></li>
</ol>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>
</pre></div>
</div>
<ol class="arabic simple">
<ol class="arabic simple" start="2">
<li><p>Starten Sie nun das Programm bzw. den Daemon <strong>MrTimeDaemon</strong>. Stellen Sie die gleichen Überlegungen an wie mit <strong>PlapperMaul</strong> und testen Sie wiederum, ob Ihre Überlegungen stimmen. Ob <strong>MrTimeDaemon</strong> noch läuft können Sie feststellen, indem Sie die Zeit abfragen oder den Befehl <code class="docutils literal notranslate"><span class="pre">ps</span> <span class="pre">ajx</span> <span class="pre">|</span> <span class="pre">grep</span> <span class="pre">MrTimeDaemon</span></code> eingeben: was fällt Ihnen am Output auf? Was schliessen Sie aus Ihren Beobachtungen?</p></li>
</ol>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>
</pre></div>
</div>
<ol class="arabic simple">
<ol class="arabic simple" start="3">
<li><p>Starten Sie <strong>MrTimeDaemon</strong> erneut, was geschieht?</p></li>
</ol>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>
</pre></div>
</div>
<ol class="arabic simple">
<ol class="arabic simple" start="4">
<li><p>Stoppen Sie nun <strong>MrTimeDaemon</strong> mit <code class="docutils literal notranslate"><span class="pre">killall</span> <span class="pre">MrTimeDaemon</span></code>.</p></li>
<li><p>Starten Sie <strong>MrTimeDaemon</strong> und fragen Sie mit <code class="docutils literal notranslate"><span class="pre">WhatsTheTimeMr</span> <span class="pre">localhost</span></code> oder mit <code class="docutils literal notranslate"><span class="pre">WhatsTheTimeMr</span> <span class="pre">127.0.0.1</span></code> die aktuelle Zeit auf Ihrem Rechner ab.</p></li>
</ol>
@ -110,13 +114,13 @@ Die Firewall können Sie mit folgendem Befehl wiederherstellen:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>iptables-restore myTables.txt
</pre></div>
</div>
<ol class="arabic simple">
<ol class="arabic simple" start="6">
<li><p>Studieren Sie <code class="docutils literal notranslate"><span class="pre">MrTimeDaemon.c</span></code>, <code class="docutils literal notranslate"><span class="pre">Daemonizer.c</span></code> und <code class="docutils literal notranslate"><span class="pre">TimeDaemon.c</span></code> und analysieren Sie, wie die Daemonisierung abläuft. Entfernen Sie die Kommentare im Macro <code class="docutils literal notranslate"><span class="pre">Out-PutPIDs</span></code> am Anfang des Moduls <code class="docutils literal notranslate"><span class="pre">Daemonizer.c</span></code>. Übersetzen Sie die Programme mit make und starten Sie <code class="docutils literal notranslate"><span class="pre">MrTimeDaemon</span></code> erneut. Analysieren Sie die Ausgabe, was fällt Ihnen auf? Notieren Sie alle für die vollständige Daemonisierung notwendigen Schritte.</p></li>
</ol>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>
</pre></div>
</div>
<ol class="arabic">
<ol class="arabic" start="7">
<li><p>Setzen Sie beim Aufruf von <code class="docutils literal notranslate"><span class="pre">Daemonizer()</span></code> in <code class="docutils literal notranslate"><span class="pre">MrTimeDaemon.c</span></code> anstelle von <code class="docutils literal notranslate"><span class="pre">lock-FilePath</span></code> den Null-Zeiger <code class="docutils literal notranslate"><span class="pre">NULL</span></code> ein. Damit wird keine lock-Datei erzeugt. Übersetzen Sie die Programme und starten Sie erneut <code class="docutils literal notranslate"><span class="pre">MrTimedaemon</span></code>. Was geschieht bzw. wie können Sie feststellen, was geschehen ist?</p>
<p><strong>Hinweis:</strong> lesen Sie das log-File: <code class="docutils literal notranslate"><span class="pre">/tmp/timeDaemon.log.</span></code></p>
</li>
@ -207,7 +211,6 @@ Die Firewall können Sie mit folgendem Befehl wiederherstellen:</p>
<li class="toctree-l1"><a class="reference internal" href="../P01_Erste_Schritte_mit_C/README.html">01 - Erste Schritte mit C</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P02_Funktionen_Datentyp_enum/README.html">02: Funktionen, Datentyp “enum”</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P03_Bit_Operation_struct_typedef/README.html">03 - Bit Operationen, Struct, Typedef</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html">04 - Modularisieren von C Code</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P05_TicTacToe/README.html">05 - Arrays/Strings/TicTacToe</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P06_Personen_Verwaltung_Linked_List/README.html">06 - Personen Verwaltung Linked List</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html">07 - Prozesse und Threads</a></li>
@ -249,7 +252,7 @@ Die Firewall können Sie mit folgendem Befehl wiederherstellen:</p>
&copy;2022, stsh.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.4.0</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|

View File

@ -5,6 +5,10 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta content="metadata description" lang="en" name="description" xml:lang="en" />
<meta content="description des métadonnées" lang="fr" name="description" xml:lang="fr" />
<meta content="Sphinx, MyST" name="keywords" />
<meta content="en_US" property="og:locale" />
<title>08 - Synchronisationsprobleme &#8212; SNP Labs documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
@ -88,8 +92,8 @@ Erweitern sie nun alle Prozesse aus Schritt 2 mit den notwendigen Semaphore Oper
Implementieren und testen sie das vollständige Programm.</p></li>
</ul>
<p><img alt="" src="../_images/coffee_customer.png" /></p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">coin</span> <span class="o">=</span> <span class="n">sem_open</span><span class="p">(...,</span><span class="mi">0</span><span class="p">);</span>
<span class="n">coffee</span> <span class="o">=</span> <span class="n">sem_open</span><span class="p">(...,</span><span class="mi">0</span><span class="p">);</span>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">coin</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">sem_open</span><span class="p">(...,</span><span class="mi">0</span><span class="p">);</span><span class="w"></span>
<span class="n">coffee</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">sem_open</span><span class="p">(...,</span><span class="mi">0</span><span class="p">);</span><span class="w"></span>
</pre></div>
</div>
<p>Ablaufgraph und Pseudocode für 2 Prozesse und zwei Semaphore<br />
@ -114,17 +118,17 @@ Analysieren sie die Datenwerte in den Fehlermeldungen, beschreiben sie was die G
<li><p>Schützen sie nun den Zugriff auf die gemeinsamen Daten mit einem Mutex so, dass alle Threads eine konsistente Sicht der Daten haben.
Wir haben für sie einen Mutex vorbereitet: die Datenstruktur <em>cData</em> enthält die Mutex-Variable <em>mutex</em>, die in <strong>startApp.c</strong> initialisiert wird. Die Funktionen für das Schliessen und das Öffnen des Mutex (Locks) aus der <em>pthread</em> Bibliothek sind:</p></li>
</ol>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">pthread</span> <span class="n">mutex</span> <span class="n">lock</span><span class="p">(</span><span class="o">&amp;</span><span class="p">(</span><span class="n">cD</span><span class="o">-&gt;</span><span class="n">lock</span><span class="p">));</span>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">pthread</span><span class="w"> </span><span class="n">mutex</span><span class="w"> </span><span class="n">lock</span><span class="p">(</span><span class="o">&amp;</span><span class="p">(</span><span class="n">cD</span><span class="o">-&gt;</span><span class="n">lock</span><span class="p">));</span><span class="w"></span>
</pre></div>
</div>
<ul class="simple">
<li><p>und</p></li>
</ul>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">pthread</span> <span class="n">mutex</span> <span class="n">unlock</span><span class="p">(</span><span class="o">&amp;</span><span class="p">(</span><span class="n">cD</span><span class="o">-&gt;</span><span class="n">lock</span><span class="p">));</span>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">pthread</span><span class="w"> </span><span class="n">mutex</span><span class="w"> </span><span class="n">unlock</span><span class="p">(</span><span class="o">&amp;</span><span class="p">(</span><span class="n">cD</span><span class="o">-&gt;</span><span class="n">lock</span><span class="p">));</span><span class="w"></span>
</pre></div>
</div>
<p>Überprüfen sie, ob der Kaffee-Automat nun keine Fehlermeldungen mehr ausgibt. Erhö-hen sie dazu auch die Anzahl Kunden <em>CUSTOMERS</em> in <strong>commonDefs.h</strong>, z.B. auf 10.</p>
<ol class="arabic simple">
<ol class="arabic simple" start="3">
<li><p>Im Thread des Kaffee-Automaten wird an verschiedenen Orten mehrmals auf die gemeinsamen Daten in <em>cD</em> zugegriffen. Wenn sie die gemeinsamen Daten in lokale Variablen kopieren und dann nur noch auf diese lokalen Variablen zugreifen würden, könn-ten sie dann auf die Synchronisation mit dem Mutex verzichten?</p></li>
<li><p>Wie oft kann ein einzelner Kunde einen Kaffee beziehen, bis der nächste Kunde an die Reihe kommt? Hier reicht eine qualitative Aussage.</p></li>
</ol>
@ -146,15 +150,15 @@ Im Folgenden soll eine erzwungene Verarbeitungsreihenfolge implementiert werden:
<li><p>Implementieren sie nun den Kaffee-Automaten. Ergänzen sie dazu den <em>coffeeTeller</em> und den <em>customer</em> Prozess so mit vier Semaphoren, dass die vorgegebenen Ablaufbedingungen eingehalten werden. Mit welchen Werten müssen die Semaphore initialisiert werden?
Wir haben für sie vier Semaphore vorbereitet: Achtung, sie sind aber noch auskommentiert (siehe commonDefs.h und startApp.c. Die benötigten Semaphor-Funktionen aus der POSIX Bibliothek sind:</p></li>
</ol>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">sem_wait</span><span class="p">(</span><span class="o">&amp;</span><span class="n">semaphor</span><span class="p">);</span>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">sem_wait</span><span class="p">(</span><span class="o">&amp;</span><span class="n">semaphor</span><span class="p">);</span><span class="w"></span>
</pre></div>
</div>
<p>und</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">sem_post</span><span class="p">(</span><span class="o">&amp;</span><span class="n">semaphor</span><span class="p">);</span>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">sem_post</span><span class="p">(</span><span class="o">&amp;</span><span class="n">semaphor</span><span class="p">);</span><span class="w"></span>
</pre></div>
</div>
<p>Analysieren sie die Ausgabe der Prozesse (mehrmals starten). Was fällt auf?</p>
<ol class="arabic simple">
<ol class="arabic simple" start="3">
<li><p>Gibt Ihr Programm den Output in der korrekten Reihenfolge aus? Falls nicht, wie könnte das gelöst werden?</p></li>
</ol>
</section>
@ -290,7 +294,6 @@ Wichtiger
<li class="toctree-l1"><a class="reference internal" href="../P01_Erste_Schritte_mit_C/README.html">01 - Erste Schritte mit C</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P02_Funktionen_Datentyp_enum/README.html">02: Funktionen, Datentyp “enum”</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P03_Bit_Operation_struct_typedef/README.html">03 - Bit Operationen, Struct, Typedef</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html">04 - Modularisieren von C Code</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P05_TicTacToe/README.html">05 - Arrays/Strings/TicTacToe</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P06_Personen_Verwaltung_Linked_List/README.html">06 - Personen Verwaltung Linked List</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P07_Prozesse_und_Threads/README.html">07 - Prozesse und Threads</a></li>
@ -369,7 +372,7 @@ Wichtiger
&copy;2022, stsh.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.4.0</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|

View File

@ -5,6 +5,10 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta content="metadata description" lang="en" name="description" xml:lang="en" />
<meta content="description des métadonnées" lang="fr" name="description" xml:lang="fr" />
<meta content="Sphinx, MyST" name="keywords" />
<meta content="en_US" property="og:locale" />
<title>09 - File Operations &#8212; SNP Labs documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
@ -103,7 +107,6 @@
<li class="toctree-l1"><a class="reference internal" href="../P01_Erste_Schritte_mit_C/README.html">01 - Erste Schritte mit C</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P02_Funktionen_Datentyp_enum/README.html">02: Funktionen, Datentyp “enum”</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P03_Bit_Operation_struct_typedef/README.html">03 - Bit Operationen, Struct, Typedef</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html">04 - Modularisieren von C Code</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P05_TicTacToe/README.html">05 - Arrays/Strings/TicTacToe</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P06_Personen_Verwaltung_Linked_List/README.html">06 - Personen Verwaltung Linked List</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P07_Prozesse_und_Threads/README.html">07 - Prozesse und Threads</a></li>
@ -153,7 +156,7 @@
&copy;2022, stsh.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.4.0</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|

View File

@ -5,6 +5,10 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta content="metadata description" lang="en" name="description" xml:lang="en" />
<meta content="description des métadonnées" lang="fr" name="description" xml:lang="fr" />
<meta content="Sphinx, MyST" name="keywords" />
<meta content="en_US" property="og:locale" />
<title>10 - IPC &#8212; SNP Labs documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
@ -101,7 +105,6 @@
<li class="toctree-l1"><a class="reference internal" href="../P01_Erste_Schritte_mit_C/README.html">01 - Erste Schritte mit C</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P02_Funktionen_Datentyp_enum/README.html">02: Funktionen, Datentyp “enum”</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P03_Bit_Operation_struct_typedef/README.html">03 - Bit Operationen, Struct, Typedef</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html">04 - Modularisieren von C Code</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P05_TicTacToe/README.html">05 - Arrays/Strings/TicTacToe</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P06_Personen_Verwaltung_Linked_List/README.html">06 - Personen Verwaltung Linked List</a></li>
<li class="toctree-l1"><a class="reference internal" href="../P07_Prozesse_und_Threads/README.html">07 - Prozesse und Threads</a></li>
@ -150,7 +153,7 @@
&copy;2022, stsh.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.4.0</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|

View File

@ -5,6 +5,10 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta content="metadata description" lang="en" name="description" xml:lang="en" />
<meta content="description des métadonnées" lang="fr" name="description" xml:lang="fr" />
<meta content="Sphinx, MyST" name="keywords" />
<meta content="en_US" property="og:locale" />
<title>SNP - Praktika &#8212; SNP Labs documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
@ -33,7 +37,7 @@
<section class="tex2jax_ignore mathjax_ignore" id="snp-praktika">
<h1>SNP - Praktika<a class="headerlink" href="#snp-praktika" title="Permalink to this headline"></a></h1>
<img align="right" title="zhaw.ch" width="176" height="92" src="en-zhaw-ines-rgb.png">
<a class="reference internal image-reference" href="_images/en-zhaw-ines-rgb.png"><img alt="_images/en-zhaw-ines-rgb.png" class="align-right" src="_images/en-zhaw-ines-rgb.png" style="width: 176px; height: 92px;" /></a>
<section id="ubersicht">
<h2>Übersicht<a class="headerlink" href="#ubersicht" title="Permalink to this headline"></a></h2>
<p><a class="reference external" href="https://github.zhaw.ch/pages/SNP/snp-lab-code/">Online Beschreibungen der Praktika und Aufgaben</a></p>
@ -70,7 +74,6 @@
<li class="toctree-l1"><a class="reference internal" href="P01_Erste_Schritte_mit_C/README.html">01 - Erste Schritte mit C</a></li>
<li class="toctree-l1"><a class="reference internal" href="P02_Funktionen_Datentyp_enum/README.html">02: Funktionen, Datentyp “enum”</a></li>
<li class="toctree-l1"><a class="reference internal" href="P03_Bit_Operation_struct_typedef/README.html">03 - Bit Operationen, Struct, Typedef</a></li>
<li class="toctree-l1"><a class="reference internal" href="P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html">04 - Modularisieren von C Code</a></li>
<li class="toctree-l1"><a class="reference internal" href="P05_TicTacToe/README.html">05 - Arrays/Strings/TicTacToe</a></li>
<li class="toctree-l1"><a class="reference internal" href="P06_Personen_Verwaltung_Linked_List/README.html">06 - Personen Verwaltung Linked List</a></li>
<li class="toctree-l1"><a class="reference internal" href="P07_Prozesse_und_Threads/README.html">07 - Prozesse und Threads</a></li>
@ -112,7 +115,7 @@
&copy;2022, stsh.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.4.0</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -311,7 +311,7 @@ Prüfen Sie schliesslich die Umsetzung Aufgabe mittels `make dep-clean
dep && firefox src/*.png.`
### 4.1 Neue Regeln hinzufügen
### 4.1 Neue Regeln hinzufügen
Führen Sie im `Makefile` an den angegebenen Stellen folgende
@ -336,12 +336,16 @@ Ergänzungen durch
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 Inclu-de Files
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.
(04_grading)=
@ -490,7 +494,7 @@ 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 de-ren Anordnung anzugeben.
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
@ -511,7 +515,7 @@ digraph G {
}
subgraph cluster_c1 {
label="others"; style=filled; col-or=lightgrey;
label="others"; style=filled; color=lightgrey;
{ B; C; rank=same; }
}
@ -521,6 +525,13 @@ digraph G {
}
```
```{eval-rst}
.. figure:: bsp_dot.png
:width: 210px
:name: bsp_dot
:align: center
```
#### 6.2.3 png File
@ -529,4 +540,4 @@ Format. Es wird oft in Web Pages verwendet.
___
Version: 15.02.2022
Version: 22.02.2022

View File

@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- basic theme.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@ -757,7 +757,6 @@ span.pre {
-ms-hyphens: none;
-webkit-hyphens: none;
hyphens: none;
white-space: nowrap;
}
div[class*="highlight-"] {

View File

@ -4,7 +4,7 @@
*
* Sphinx JavaScript utilities for all documentation.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@ -264,9 +264,6 @@ var Documentation = {
hideSearchWords : function() {
$('#searchbox .highlight-link').fadeOut(300);
$('span.highlighted').removeClass('highlighted');
var url = new URL(window.location);
url.searchParams.delete('highlight');
window.history.replaceState({}, '', url);
},
/**

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@
* This script contains the language-specific data used by searchtools.js,
* namely the list of stopwords, stemmer, scorer and splitter.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/

View File

@ -4,7 +4,7 @@
*
* Sphinx JavaScript utilities for the full-text search.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@ -328,6 +328,9 @@ var Search = {
var results = [];
for (var prefix in objects) {
if (!(objects[prefix] instanceof Array)) {
objects[prefix] = Object.entries(objects[prefix]).map(([name, match]) => [...match, name]);
}
for (var iMatch = 0; iMatch != objects[prefix].length; ++iMatch) {
var match = objects[prefix][iMatch];
var name = match[4];

File diff suppressed because one or more lines are too long

View File

@ -65,7 +65,6 @@
<li class="toctree-l1"><a class="reference internal" href="P01_Erste_Schritte_mit_C/README.html">01 - Erste Schritte mit C</a></li>
<li class="toctree-l1"><a class="reference internal" href="P02_Funktionen_Datentyp_enum/README.html">02: Funktionen, Datentyp “enum”</a></li>
<li class="toctree-l1"><a class="reference internal" href="P03_Bit_Operation_struct_typedef/README.html">03 - Bit Operationen, Struct, Typedef</a></li>
<li class="toctree-l1"><a class="reference internal" href="P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html">04 - Modularisieren von C Code</a></li>
<li class="toctree-l1"><a class="reference internal" href="P05_TicTacToe/README.html">05 - Arrays/Strings/TicTacToe</a></li>
<li class="toctree-l1"><a class="reference internal" href="P06_Personen_Verwaltung_Linked_List/README.html">06 - Personen Verwaltung Linked List</a></li>
<li class="toctree-l1"><a class="reference internal" href="P07_Prozesse_und_Threads/README.html">07 - Prozesse und Threads</a></li>
@ -107,7 +106,7 @@
&copy;2022, stsh.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.4.0</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
</div>

View File

@ -95,22 +95,6 @@
<li class="toctree-l2"><a class="reference internal" href="P03_Bit_Operation_struct_typedef/README.html#bewertung">4. Bewertung</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html">04 - Modularisieren von C Code</a><ul>
<li class="toctree-l2"><a class="reference internal" href="P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html#ubersicht">1. Übersicht</a></li>
<li class="toctree-l2"><a class="reference internal" href="P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html#lernziele">2. Lernziele</a></li>
<li class="toctree-l2"><a class="reference internal" href="P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html#aufgabe-1-modularisieren">3. Aufgabe 1: Modularisieren</a><ul>
<li class="toctree-l3"><a class="reference internal" href="P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html#teilaufgabe-modules-einbinden-header-files-schreiben">3.1 Teilaufgabe Modules einbinden, Header Files schreiben</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html#aufgabe-2-makefile-regeln">4. Aufgabe 2: Makefile Regeln</a><ul>
<li class="toctree-l3"><a class="reference internal" href="P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html#neue-regeln-hinzufugen">4.1 Neue Regeln hinzufügen</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html#aufgabe-3">5. Aufgabe 3</a></li>
<li class="toctree-l2"><a class="reference internal" href="P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html#bewertung">6. Bewertung</a></li>
<li class="toctree-l2"><a class="reference internal" href="P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html#erweiterung-doxyfile-fur-abhangigkeitsanalyse">7. Erweiterung Doxyfile für Abhängigkeitsanalyse</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="P05_TicTacToe/README.html">05 - Arrays/Strings/TicTacToe</a><ul>
<li class="toctree-l2"><a class="reference internal" href="P05_TicTacToe/README.html#ubersicht">1. Übersicht</a></li>
<li class="toctree-l2"><a class="reference internal" href="P05_TicTacToe/README.html#lernziele">2. Lernziele</a></li>
@ -261,7 +245,6 @@
<li class="toctree-l1"><a class="reference internal" href="P01_Erste_Schritte_mit_C/README.html">01 - Erste Schritte mit C</a></li>
<li class="toctree-l1"><a class="reference internal" href="P02_Funktionen_Datentyp_enum/README.html">02: Funktionen, Datentyp “enum”</a></li>
<li class="toctree-l1"><a class="reference internal" href="P03_Bit_Operation_struct_typedef/README.html">03 - Bit Operationen, Struct, Typedef</a></li>
<li class="toctree-l1"><a class="reference internal" href="P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html">04 - Modularisieren von C Code</a></li>
<li class="toctree-l1"><a class="reference internal" href="P05_TicTacToe/README.html">05 - Arrays/Strings/TicTacToe</a></li>
<li class="toctree-l1"><a class="reference internal" href="P06_Personen_Verwaltung_Linked_List/README.html">06 - Personen Verwaltung Linked List</a></li>
<li class="toctree-l1"><a class="reference internal" href="P07_Prozesse_und_Threads/README.html">07 - Prozesse und Threads</a></li>
@ -304,7 +287,7 @@
&copy;2022, stsh.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.4.0</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|

Binary file not shown.

View File

@ -94,7 +94,6 @@
<li class="toctree-l1"><a class="reference internal" href="P01_Erste_Schritte_mit_C/README.html">01 - Erste Schritte mit C</a></li>
<li class="toctree-l1"><a class="reference internal" href="P02_Funktionen_Datentyp_enum/README.html">02: Funktionen, Datentyp “enum”</a></li>
<li class="toctree-l1"><a class="reference internal" href="P03_Bit_Operation_struct_typedef/README.html">03 - Bit Operationen, Struct, Typedef</a></li>
<li class="toctree-l1"><a class="reference internal" href="P04_Modularisieren_von_C_Code/new_P04/P04_Modularisieren_von_C_Code.html">04 - Modularisieren von C Code</a></li>
<li class="toctree-l1"><a class="reference internal" href="P05_TicTacToe/README.html">05 - Arrays/Strings/TicTacToe</a></li>
<li class="toctree-l1"><a class="reference internal" href="P06_Personen_Verwaltung_Linked_List/README.html">06 - Personen Verwaltung Linked List</a></li>
<li class="toctree-l1"><a class="reference internal" href="P07_Prozesse_und_Threads/README.html">07 - Prozesse und Threads</a></li>
@ -126,7 +125,7 @@
&copy;2022, stsh.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.4.0</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
</div>

File diff suppressed because one or more lines are too long