more bla, and more bugs

This commit is contained in:
tth 2021-09-16 18:53:40 +02:00
parent d20a832a8d
commit 0ad7108d5a
12 changed files with 159 additions and 10 deletions

View File

@ -350,7 +350,8 @@ Il y a plein d'autres exemples de code en C, sur des sujets
divers comme Open Sound Control (page \pageref{chap:OSC}) ou
libsndfile (page \pageref{chap:son}).
Et pour les gens du système~:
l'utilisation des signaux (page \pageref{get-signal}).
l'utilisation des signaux (page \pageref{get-signal}),
le chargement dynamique (page \pageref{ex_dlopen}.
% ---------------------------------------------------------

7
chap/README.md Normal file
View File

@ -0,0 +1,7 @@
# Les chapitres
Le label d'un chapitre est de la forme
`chap:filename`.

21
chap/buzybox.tex Normal file
View File

@ -0,0 +1,21 @@
\chapter{Buzybox}
\label{chap:buzybox}
\index{buzybox}
Buzybox est un peu le couteau suisse des systèmes Unix minimalistes,
tels que ceux que l'on peut trouver dans des routeurs WiFi
(OpenWrt\index{OpenWrt}, par exemple. Cf page \pageref{chap:openwrt}),
ou des systèmes embarqués de toutes natures.
%
% https://opensource.com/article/21/8/what-busybox
%
\begin{quote}
BusyBox is an open source (GPL) project providing simple implementations
of nearly \textbf{400} common commands, including ls, mv, ln, mkdir, more, ps,
gzip, bzip2, tar, and grep. It also contains a version of the programming
language awk, the stream editor sed, the filesystem checker fsck, the
rpm and dpkg package managers, and of course, a shell (sh) that provides
easy access to all of these commands.
\end{quote}

30
chap/cd-dvd.tex Normal file
View File

@ -0,0 +1,30 @@
\chapter{CD \& DVD}
\label{chap:cd-dvd}
\index{cdrom} \index{dvd}
Vous allez bien dire : « Encore un truc de vieux\dots ».
Oui, peut-être, mais il y a quand même pas mal d'usages
assez cools pour ces technologies du passé. Nous allons
en explorer quelques uns.
% --------------------------------------------------------
\section{CD Audio}
\subsection {Riping}
Le \textsl{ripage} est l'action d'extraire les pistes d'un
ce audion pour les convertir en fichier numérique audio.
\subsection {Mastering}
% --------------------------------------------------------
\section{DVD}
% --------------------------------------------------------
% --------------------------------------------------------

View File

@ -8,12 +8,22 @@ Gnuplot - an interactive plotting program
There is an on-line demo collection at http://gnuplot.info/demo
\begin{verbatim}
gnuplot> splot "cam.indoor" using 2:4:3, "cam.indoor" using 5:7:6
\end{verbatim}
% -------------------------------------------------------------------
\section{Exemple : le phytotron}
\index{phytotron}
Un exemple réel, issu d'un projet d'élevage d'algues
bio-luminescentes dans un frigo bricolé.
Le fichier des données contient cinq champs séparés par des blancs.
Le premier est
un \textsl{timestamp} exprimé en secondes depuis l'\textsl{epoch},
et les quatre suivants sont des températures en degrés Celsius.
\begin{verbatim}
#!/bin/bash
@ -48,6 +58,10 @@ __EOC__
display ${IMAGE} &
\end{verbatim}
\textsf{Bon, un de ces jours, il faudrait que je ressorte des archives
l'enregistrement d'un été dans le dd2, pour que vous puissiez voir
le résulate de ce script en « pour de vrai ».}
% -------------------------------------------------------------------
\section{Questions}

View File

@ -1,5 +1,7 @@
\chapter{Graphisme}
Quelques notes en vrac.
% ------------------------------------------------
\section{Flydraw}\index{Flydraw}
@ -17,6 +19,53 @@ GIF, JPEG, or PNG\index{PNG} files.
\textbf{Persistence Of Vision} est un logiciel de raytracing qui
existe depuis plus de trente ans.
\subsection{Caméra}
Vous avez des problèmes pour caler les mouvement de la caméra ?
Vous avez deux trajectoires (mal) calculées pour la
\texttt{location} et le \texttt{look\_at}, et rien ne tombe
en face de l'objectif ? Voici une approche de solution.
La première étape est l'enregistrerement des paramètres de la caméra
lors du calcul de la séquence~:
\begin{verbatim}
#if (0 = clock)
#fopen CL "cam.log" create
#else
#fopen CL "cam.log" append
#end
#write (CL, clock, " ", CamX, " ", CamY, " ", CamZ,
" ", LatX, " ", LatY, " ", LatZ,"\n")
#fclose CL
\end{verbatim}
Et la seconde, l'exploitation des données~:
\begin{verbatim}
#!/bin/bash
FILE="cam.log"
TMPF="/dev/shm/cam.data"
IMAGE="graphe.png"
tail -360 $FILE | sort -n > $TMPF
gnuplot << __EOC__
set term png size 720,720
set output "${IMAGE}"
set ytics 2
set xtics 2
set grid front
set title "Rush Camera"
plot "$TMPF" using 2:4 title "Cam", \
"$TMPF" using 5:7 title "Lat" with dots
__EOC__
display "${IMAGE}" &
\end{verbatim}
% ------------------------------------------------
% ------------------------------------------------

11
chap/openwrt.tex Normal file
View File

@ -0,0 +1,11 @@
\chapter{OpenWrt}
\label{chap:openwrt}
\index{openwrt}
\begin{verbatim}
TP Ling
AC 1750
Archer C7
\end{verbatim}

View File

@ -33,6 +33,7 @@ and dlclose().
% ------------------------------------
\section{Un exemple ?}
\label{ex_dlopen}
Comme d'habitude, je vais proposer un exemple un peu artificiel,
mais qui, de part sa simplicité, illustrera clairement
@ -53,6 +54,9 @@ lecteurs, à titre d'exercice.
\lstinputlisting[language=c]{code/plugiciel.c}
On peut difficelement faire plus simple pour une première
approche, mais attendez la suite.
\subsection{L'appelant}
@ -64,6 +68,16 @@ tortueux à déchiffrer. Il était temps.
\texttt{void (*funcname)(const char*, const float *);}
\subsection{Le run}
\begin{verbatim}
tth@fubar:~/Documents/TetaTricks/code$ make plugin
gcc -Wall -shared -fPIC plugiciel.c -o plugiciel.so
gcc -Wall appelant.c -ldl -o appelant
tth@fubar:~/Documents/TetaTricks/code$ ./appelant
rgb * a = : 6.685000 8.320000 1.570795
tth@fubar:~/Documents/TetaTricks/code$
\end{verbatim}
% ------------------------------------

View File

@ -37,6 +37,8 @@ fifo-rx: fifo-rx.c my-fifo.h dtime.o Makefile
#------------- PLUGIN --------------------
plugin: plugiciel.so appelant
plugiciel.so: plugiciel.c plugiciel.h Makefile
gcc -Wall -shared -fPIC $< -o $@

View File

@ -5,7 +5,6 @@
void affichage(char *titre, float vals[4]);
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - */
int main(int argc, char *argv[])
{
void *handle;
@ -24,10 +23,9 @@ if (!handle) {
values[0] = 13.37; values[1] = 16.64;
values[2] = 3.14159; values[3] = 0.5;
funcname("rgb * a =", values);
dlclose(handle);
return 0;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - */

View File

@ -3,10 +3,9 @@
#include <stdio.h>
#include "plugiciel.h"
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void affichage(char *titre, float vals[4])
{
printf("%s : %f %f %f\n", titre,
vals[0]*vals[3], vals[1]*vals[3], vals[2]*vals[3]);
vals[0]*vals[3], vals[1]*vals[3],
vals[2]*vals[3]);
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - */

View File

@ -117,7 +117,8 @@ en ligne sur le site du Tetalab. Your mileage may vary\dots
% \input{chap/GMP}
\input{chap/Python}
\input{chap/dino}
\input{chap/C.tex}
\input{chap/cd-dvd}
\input{chap/C}
\input{chap/textes}
% \input{chap/MINITEL}
% \input{chap/Raspberry}
@ -131,6 +132,7 @@ en ligne sur le site du Tetalab. Your mileage may vary\dots
\input{chap/plugins}
\input{chap/Bonjour}
\input{chap/debug}
\input{chap/buzybox}
\input{chap/gif89a}
\input{chap/IRC}
% \input{chap/SCCS} % nouveau 18 mars 2021
@ -141,6 +143,7 @@ en ligne sur le site du Tetalab. Your mileage may vary\dots
\input{chap/gadgets}
% \input{chap/slang}
\input{chap/curses}
\input{chap/openwrt}
\input{chap/WiFi}
% \input{chap/GIT}
\input{chap/divers}