diff --git a/chap/C.tex b/chap/C.tex index ca289aa..f6f96a5 100644 --- a/chap/C.tex +++ b/chap/C.tex @@ -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}. % --------------------------------------------------------- diff --git a/chap/README.md b/chap/README.md new file mode 100644 index 0000000..25dc9f7 --- /dev/null +++ b/chap/README.md @@ -0,0 +1,7 @@ + +# Les chapitres + +Le label d'un chapitre est de la forme +`chap:filename`. + + diff --git a/chap/buzybox.tex b/chap/buzybox.tex new file mode 100644 index 0000000..241a0a5 --- /dev/null +++ b/chap/buzybox.tex @@ -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} + diff --git a/chap/cd-dvd.tex b/chap/cd-dvd.tex new file mode 100644 index 0000000..af5cb68 --- /dev/null +++ b/chap/cd-dvd.tex @@ -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} + +% -------------------------------------------------------- + + +% -------------------------------------------------------- + diff --git a/chap/gnuplot.tex b/chap/gnuplot.tex index 8dc0293..0f2d498 100644 --- a/chap/gnuplot.tex +++ b/chap/gnuplot.tex @@ -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} diff --git a/chap/graphisme.tex b/chap/graphisme.tex index 59df922..6b6a805 100644 --- a/chap/graphisme.tex +++ b/chap/graphisme.tex @@ -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} + + % ------------------------------------------------ % ------------------------------------------------ diff --git a/chap/openwrt.tex b/chap/openwrt.tex new file mode 100644 index 0000000..610c329 --- /dev/null +++ b/chap/openwrt.tex @@ -0,0 +1,11 @@ +\chapter{OpenWrt} +\label{chap:openwrt} +\index{openwrt} + +\begin{verbatim} +TP Ling + AC 1750 + Archer C7 +\end{verbatim} + + diff --git a/chap/plugins.tex b/chap/plugins.tex index 6809552..5e317da 100644 --- a/chap/plugins.tex +++ b/chap/plugins.tex @@ -11,7 +11,7 @@ d'autres mondes, peut-être avec \textsl{AmigaOS} ou \textsl{VAX/VMS}\index{VMS}\dots Et c'est en partie sur ce concept qu'est basé le premier -mécanisme que nous allond écouvrir~: +mécanisme que nous allon découvrir~: \texttt{dlopen} et sa petite famille. % ------------------------------------ @@ -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} % ------------------------------------ diff --git a/code/Makefile b/code/Makefile index 598a4b7..847cc76 100644 --- a/code/Makefile +++ b/code/Makefile @@ -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 $@ diff --git a/code/appelant.c b/code/appelant.c index ba2e917..29e11a0 100644 --- a/code/appelant.c +++ b/code/appelant.c @@ -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; } -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - diff --git a/code/plugiciel.c b/code/plugiciel.c index 0d1eada..fca207d 100644 --- a/code/plugiciel.c +++ b/code/plugiciel.c @@ -3,10 +3,9 @@ #include #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]); } -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - */ diff --git a/main.tex b/main.tex index ab6c176..dc62fd4 100644 --- a/main.tex +++ b/main.tex @@ -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}