summaryrefslogtreecommitdiff
path: root/i
diff options
context:
space:
mode:
Diffstat (limited to 'i')
-rw-r--r--i/serialplot/BFont.c662
-rw-r--r--i/serialplot/BFont.h186
-rw-r--r--i/serialplot/Makefile11
-rw-r--r--i/serialplot/conf_ttyS01
-rw-r--r--i/serialplot/data/1_source.txt394
-rw-r--r--i/serialplot/data/2_source.txt756
-rw-r--r--i/serialplot/data/4_source.txt2149
-rw-r--r--i/serialplot/font.pngbin0 -> 27639 bytes
-rw-r--r--i/serialplot/gene.pl8
-rw-r--r--i/serialplot/read.pl46
-rw-r--r--i/serialplot/serialplot.c243
-rw-r--r--i/serialplot/serialplot_RdMch.c96
-rw-r--r--i/serialplot/serialplot_RdMch.h15
-rw-r--r--i/serialplot/serialplot_io.c54
-rw-r--r--i/serialplot/serialplot_io.h21
-rw-r--r--i/serialplot/serialplot_sdl.c247
-rw-r--r--i/serialplot/serialplot_sdl.h21
-rw-r--r--i/serialplot/toto.pl10
18 files changed, 4920 insertions, 0 deletions
diff --git a/i/serialplot/BFont.c b/i/serialplot/BFont.c
new file mode 100644
index 0000000..58035f7
--- /dev/null
+++ b/i/serialplot/BFont.c
@@ -0,0 +1,662 @@
+
+/***********************************************************/
+/* */
+/* BFONT.c v. 1.1.0 - Billi Font Library by Diego Billi */
+/* */
+/* mail: dbilli@cs.unibo.it */
+/* home: http://www.cs.unibo.it/~dbilli (ITALIAN) */
+/* */
+/***********************************************************/
+
+#include "stdio.h"
+#include "string.h"
+#include "stdlib.h"
+#include "stdarg.h"
+
+#include "SDL_image.h"
+
+#include "BFont.h"
+
+
+/* ATTENTION: MS Visual C++ do not declarate vsnprintf in <stdio.h> */
+#ifdef WIN32
+ #define vsnprintf _vsnprintf
+#endif
+
+
+/* The first character in BFont fonts is '!' */
+#define BFONT_FIRST_FONT_CHAR 33
+
+/* ASCII value for "space" */
+#define SPACE 32
+
+
+/* BFont_Info structure */
+struct _BFont_Info {
+ int h; /* font height */
+ SDL_Surface *Surface; /* font surface */
+ SDL_Rect Chars[BFONT_NUM_CHARS]; /* characters width */
+};
+
+
+/* Current font */
+static BFont_Info *CurrentFont;
+
+
+/* buffer size for buffered prints*/
+#define BFONT_BUFFER_LEN 1024
+
+/* Single global var for buffered prints */
+static char bfont_buffer[BFONT_BUFFER_LEN];
+
+
+/* utility functions */
+static Uint32 GetPixel(SDL_Surface *Surface, Sint32 X, Sint32 Y);
+static void PutPixel(SDL_Surface *surface, Sint32 X, Sint32 Y, Uint32 pixel);
+
+
+/***************************** BFont Functions ********************************/
+
+void InitFont(BFont_Info *Font)
+{
+ int x = 0, i = 0;
+ Uint32 separator_color;
+
+ i= BFONT_FIRST_FONT_CHAR;
+
+ if (SDL_MUSTLOCK(Font->Surface)) SDL_LockSurface(Font->Surface);
+
+ separator_color = GetPixel(Font->Surface,0,0);
+
+ x=0;
+ while ( (x < (Font->Surface->w-1)) && (i < BFONT_NUM_CHARS) )
+ {
+ if(GetPixel(Font->Surface,x,0) != separator_color) {
+ Font->Chars[i].x = x;
+ Font->Chars[i].y = 1;
+ Font->Chars[i].h = Font->Surface->h;
+ for ( ; (GetPixel(Font->Surface, x, 0) != separator_color) && (x < Font->Surface->w); ++x)
+ ;
+ Font->Chars[i].w = (x - Font->Chars[i].x);
+ i++;
+ }
+ else {
+ x++;
+ }
+ }
+
+ Font->Chars[SPACE].x = 0;
+ Font->Chars[SPACE].y = 0;
+ Font->Chars[SPACE].h = Font->Surface->h;
+ Font->Chars[SPACE].w = Font->Chars[BFONT_FIRST_FONT_CHAR].w;
+
+ Font->h = Font->Surface->h;
+
+ SDL_SetColorKey(Font->Surface, SDL_SRCCOLORKEY, GetPixel(Font->Surface, 0, Font->Surface->h-1));
+
+ if (SDL_MUSTLOCK(Font->Surface))
+ SDL_UnlockSurface(Font->Surface);
+}
+
+
+
+BFont_Info * BFont_LoadFont (const char *filename)
+{
+ SDL_Surface *surface = NULL;
+ int x;
+ BFont_Info *Font = NULL;
+
+ Font = (BFont_Info *) malloc(sizeof(BFont_Info));
+ if (Font == NULL)
+ return NULL;
+
+ surface = (SDL_Surface *) IMG_Load(filename);
+ if (surface == NULL) {
+ free(Font);
+ return NULL;
+ }
+
+ Font->Surface = surface;
+ for (x=0; x < BFONT_NUM_CHARS ; x++) {
+ Font->Chars[x].x = 0;
+ Font->Chars[x].y = 0;
+ Font->Chars[x].h = 0;
+ Font->Chars[x].w = 0;
+ }
+
+ InitFont(Font);
+ BFont_SetCurrentFont(Font);
+
+ return Font;
+}
+
+
+
+BFont_Info * BFont_LoadFontFromSurface (SDL_Surface *Surface)
+{
+ int i;
+ BFont_Info *Font=NULL;
+
+ Font = (BFont_Info *) malloc(sizeof(BFont_Info));
+
+ if (Font == NULL)
+ return NULL;
+
+ Font->Surface = Surface;
+ for (i=0; i < BFONT_NUM_CHARS; i++) {
+ Font->Chars[i].x = 0;
+ Font->Chars[i].y = 0;
+ Font->Chars[i].h = 0;
+ Font->Chars[i].w = 0;
+ }
+
+ InitFont(Font);
+ BFont_SetCurrentFont(Font);
+
+ return Font;
+}
+
+
+void BFont_FreeFont(BFont_Info *Font)
+{
+ SDL_FreeSurface(Font->Surface);
+ free(Font);
+ Font = NULL;
+}
+
+BFont_Info * BFont_SetFontColor(BFont_Info *Font,Uint8 r, Uint8 g, Uint8 b)
+{
+ int x,y;
+
+ BFont_Info *newfont;
+ SDL_Surface *surface = NULL;
+
+ Uint32 pixel;
+ Uint8 old_r, old_g, old_b, old_a;
+ Uint8 new_r, new_g, new_b, new_a;
+ Uint32 color_key;
+
+ newfont = (BFont_Info *) malloc(sizeof(BFont_Info));
+ if (newfont == NULL)
+ return NULL;
+
+ newfont->h = Font->h;
+ for (x=0; x < BFONT_NUM_CHARS; x++) {
+ newfont->Chars[x].x = Font->Chars[x].x;
+ newfont->Chars[x].y = Font->Chars[x].y;
+ newfont->Chars[x].h = Font->Chars[x].h;
+ newfont->Chars[x].w = Font->Chars[x].w;
+ }
+
+ surface = SDL_ConvertSurface(Font->Surface, Font->Surface->format, Font->Surface->flags);
+ if (surface == NULL) {
+ free(newfont);
+ return NULL;
+ }
+
+ if (SDL_MUSTLOCK(surface)) SDL_LockSurface(surface);
+ if (SDL_MUSTLOCK(Font->Surface)) SDL_LockSurface(Font->Surface);
+
+ color_key = GetPixel(surface, 0, surface->h-1);
+
+ for( x=0; x < Font->Surface->w; x++)
+ {
+ for( y=0; y < Font->Surface->h; y++)
+ {
+ old_r = old_g = old_b = 0;
+
+ pixel = GetPixel(Font->Surface,x,y);
+
+ if (pixel != color_key)
+ {
+ SDL_GetRGBA(pixel, surface->format, &old_r, &old_g, &old_b, &old_a);
+
+ new_r = (Uint8) ((old_r * r) / 255);
+ new_g = (Uint8) ((old_g * g) / 255);
+ new_b = (Uint8) ((old_b * b) / 255);
+
+ /* Next line modified by Antti Mannisto */
+ new_a = old_a;
+
+ pixel = SDL_MapRGBA(surface->format, new_r, new_g, new_b, new_a);
+
+ PutPixel(surface,x,y,pixel);
+ }
+ }
+ }
+ if (SDL_MUSTLOCK(surface)) SDL_UnlockSurface(surface);
+ if (SDL_MUSTLOCK(Font->Surface)) SDL_UnlockSurface(Font->Surface);
+
+ SDL_SetColorKey(surface, SDL_SRCCOLORKEY, color_key);
+
+ newfont->Surface = surface;
+
+ return newfont;
+}
+
+void BFont_SetCurrentFont(BFont_Info *Font)
+{
+ CurrentFont = Font;
+}
+
+BFont_Info * BFont_GetCurrentFont(void)
+{
+ return CurrentFont;
+}
+
+int BFont_FontHeight (BFont_Info *Font)
+{
+ return (Font->h);
+}
+
+void BFont_SetFontHeight(BFont_Info *Font, int height)
+{
+ if (height >= 0)
+ Font->h = height;
+}
+
+
+int BFont_CharWidth(BFont_Info *Font,int c)
+{
+ return Font->Chars[c].w;
+}
+
+int BFont_PutChar(SDL_Surface *Surface, int x, int y, int c)
+{
+ return BFont_PutCharFont(Surface, CurrentFont, x, y, c);
+}
+
+int BFont_PutCharFont(SDL_Surface *Surface, BFont_Info *Font,int x, int y, int c)
+{
+ SDL_Rect dest;
+ SDL_Rect src;
+
+ src = Font->Chars[c];
+ if (src.h > Font->h)
+ src.h = Font->h;
+
+ dest = src;
+ dest.x = x;
+ dest.y = y;
+
+ if (c != SPACE) {
+ SDL_BlitSurface( Font->Surface, &src, Surface, &dest);
+ }
+
+ /* Next line modified by Antti Mannisto */
+ return (Font->Chars[c].w);
+}
+
+void BFont_PutString(SDL_Surface *Surface, int x, int y, const char *text)
+{
+ BFont_PutStringFont(Surface, CurrentFont, x, y, text);
+}
+
+void BFont_PutStringFont(SDL_Surface *Surface, BFont_Info *Font, int x, int y, const char *text)
+{
+ while ( *text ) {
+ x += BFont_PutCharFont(Surface,Font,x,y, *text);
+ text++;;
+ }
+}
+
+
+int BFont_TextWidth(const char *text)
+{
+ return BFont_TextWidthFont( CurrentFont, text);
+}
+
+int BFont_TextWidthFont(BFont_Info *Font, const char *text)
+{
+ int x=0;
+
+ while (*text) {
+ x += BFont_CharWidth(Font,*text);
+ text++;
+ }
+ return x;
+}
+
+
+/* counts the spaces of the strings */
+static int count (const char *text)
+{
+ char *p = NULL;
+ int pos = -1;
+ int i = 0;
+
+ /* Calculate the space occupied by the text without spaces */
+ while ((p=strchr(&text[pos+1],SPACE)) != NULL) {
+ i++;
+ pos = p - text;
+ }
+ return i;
+}
+
+void BFont_JustifiedPutString(SDL_Surface *Surface, int y, const char *text)
+{
+ BFont_JustifiedPutStringFont( Surface, CurrentFont, y,text);
+}
+
+void BFont_JustifiedPutStringFont(SDL_Surface *Surface, BFont_Info *Font, int y, const char *text)
+{
+ int spaces = 0;
+ int gap;
+ int single_gap;
+ int dif;
+
+ char *strtmp;
+ char *p;
+ int pos = -1;
+ int xpos = 0;
+
+
+ if (strchr(text,SPACE) == NULL) {
+ BFont_PutStringFont(Surface, Font, 0, y, text);
+ }
+ else {
+ gap = (Surface->w-1) - BFont_TextWidthFont(Font,text);
+
+ if (gap <= 0) {
+ BFont_PutStringFont(Surface, Font,0,y,text);
+ } else {
+ spaces = count(text);
+ dif = gap % spaces;
+ single_gap = (gap - dif) / spaces;
+ xpos=0;
+ pos = -1;
+ while ( spaces > 0 ) {
+ p = strstr(&text[pos+1]," ");
+ strtmp = NULL;
+ strtmp = (char *) calloc ((p - &text[pos+1]) + 1,sizeof(char));
+ if (strtmp != NULL)
+ {
+ strncpy (strtmp, &text[pos+1], (p - &text[pos+1]));
+ BFont_PutStringFont(Surface, Font, xpos, y, strtmp);
+ xpos = xpos + BFont_TextWidthFont(Font, strtmp) + single_gap + BFont_CharWidth(Font,SPACE);
+ if (dif >= 0) {
+ xpos ++;
+ dif--;
+ }
+ pos = p - text;
+ spaces--;
+ free(strtmp);
+ }
+ }
+ strtmp = NULL;
+ strtmp = (char *) calloc (strlen(&text[pos+1]) + 1,sizeof(char));
+
+ if (strtmp != NULL) {
+ strncpy (strtmp, &text[pos+1], strlen( &text[pos+1]));
+ BFont_PutStringFont(Surface, Font,xpos, y, strtmp);
+ free(strtmp);
+ }
+ }
+ }
+}
+
+void BFont_CenteredPutString(SDL_Surface *Surface, int y, const char *text)
+{
+ BFont_CenteredPutStringFont(Surface, CurrentFont, y, text);
+}
+
+void BFont_CenteredPutStringFont(SDL_Surface *Surface, BFont_Info *Font, int y, const char *text)
+{
+ BFont_PutStringFont(Surface, Font, (Surface->w/2) - (BFont_TextWidthFont(Font,text)/2), y, text);
+}
+
+void BFont_RightPutString(SDL_Surface *Surface, int y, const char *text)
+{
+ BFont_RightPutStringFont(Surface, CurrentFont, y, text);
+}
+
+void BFont_RightPutStringFont(SDL_Surface *Surface, BFont_Info *Font, int y, const char *text)
+{
+ BFont_PutStringFont(Surface, Font, Surface->w - BFont_TextWidthFont(Font,text) - 1, y, text);
+}
+
+void BFont_LeftPutString(SDL_Surface *Surface, int y, const char *text)
+{
+ BFont_LeftPutStringFont(Surface, CurrentFont, y, text);
+}
+
+void BFont_LeftPutStringFont(SDL_Surface *Surface, BFont_Info *Font, int y, const char *text)
+{
+ BFont_PutStringFont(Surface, Font, 0, y, text);
+}
+
+/******/
+
+void BFont_PrintString (SDL_Surface *Surface, int x, int y, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start (args,fmt);
+ vsnprintf(bfont_buffer,BFONT_BUFFER_LEN,fmt,args);
+ va_end(args);
+
+ bfont_buffer[BFONT_BUFFER_LEN-1] = '\0';
+ BFont_PutStringFont(Surface, CurrentFont, x, y, bfont_buffer);
+}
+
+void BFont_PrintStringFont(SDL_Surface *Surface, BFont_Info *Font, int x, int y, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start (args,fmt);
+ vsnprintf(bfont_buffer,BFONT_BUFFER_LEN,fmt,args);
+ va_end(args);
+
+ bfont_buffer[BFONT_BUFFER_LEN-1] = '\0';
+ BFont_PutStringFont(Surface, Font, x, y, bfont_buffer);
+}
+
+void BFont_CenteredPrintString(SDL_Surface *Surface, int y, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start (args,fmt);
+ vsnprintf(bfont_buffer,BFONT_BUFFER_LEN,fmt,args);
+ va_end(args);
+
+ bfont_buffer[BFONT_BUFFER_LEN-1] = '\0';
+ BFont_CenteredPutString(Surface, y, bfont_buffer);
+}
+
+void BFont_CenteredPrintStringFont(SDL_Surface *Surface, BFont_Info *Font, int y, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start (args,fmt);
+ vsnprintf(bfont_buffer,BFONT_BUFFER_LEN,fmt,args);
+ va_end(args);
+
+ bfont_buffer[BFONT_BUFFER_LEN-1] = '\0';
+ BFont_CenteredPutStringFont(Surface, Font, y, bfont_buffer);
+}
+
+void BFont_RightPrintString(SDL_Surface *Surface, int y, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start (args,fmt);
+ vsnprintf(bfont_buffer,BFONT_BUFFER_LEN,fmt,args);
+ va_end(args);
+
+ bfont_buffer[BFONT_BUFFER_LEN-1] = '\0';
+ BFont_RightPutString(Surface, y, bfont_buffer);
+}
+
+void BFont_RightPrintStringFont(SDL_Surface *Surface, BFont_Info *Font, int y, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start (args,fmt);
+ vsnprintf(bfont_buffer,BFONT_BUFFER_LEN,fmt,args);
+ va_end(args);
+
+ bfont_buffer[BFONT_BUFFER_LEN-1] = '\0';
+ BFont_RightPutStringFont(Surface, Font, y, bfont_buffer);
+}
+
+void BFont_LeftPrintString(SDL_Surface *Surface, int y, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start (args,fmt);
+ vsnprintf(bfont_buffer,BFONT_BUFFER_LEN,fmt,args);
+ va_end(args);
+
+ bfont_buffer[BFONT_BUFFER_LEN-1] = '\0';
+ BFont_LeftPutString(Surface, y, bfont_buffer);
+}
+
+void BFont_LeftPrintStringFont(SDL_Surface *Surface, BFont_Info *Font, int y, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start (args,fmt);
+ vsnprintf(bfont_buffer,BFONT_BUFFER_LEN,fmt,args);
+ va_end(args);
+
+ bfont_buffer[BFONT_BUFFER_LEN-1] = '\0';
+ BFont_LeftPutStringFont(Surface, Font, y, bfont_buffer);
+}
+
+void BFont_JustifiedPrintString(SDL_Surface *Surface, int y, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start (args,fmt);
+ vsnprintf(bfont_buffer,BFONT_BUFFER_LEN,fmt,args);
+ va_end(args);
+
+ bfont_buffer[BFONT_BUFFER_LEN-1] = '\0';
+ BFont_JustifiedPutString( Surface, y,bfont_buffer);
+}
+
+void BFont_JustifiedPrintStringFont(SDL_Surface *Surface, BFont_Info *Font, int y, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start (args,fmt);
+ vsnprintf(bfont_buffer,BFONT_BUFFER_LEN,fmt,args);
+ va_end(args);
+
+ bfont_buffer[BFONT_BUFFER_LEN-1] = '\0';
+ BFont_JustifiedPutStringFont( Surface, Font, y,bfont_buffer);
+}
+
+SDL_Surface * BFont_CreateSurfaceFont (BFont_Info *Font, const char *text)
+{
+ SDL_Surface *surface = NULL;
+ Uint32 color_key;
+
+ surface = SDL_CreateRGBSurface(Font->Surface->flags,
+ BFont_TextWidthFont(Font, text),
+ BFont_FontHeight(Font),
+ Font->Surface->format->BitsPerPixel,
+ Font->Surface->format->Rmask,
+ Font->Surface->format->Gmask,
+ Font->Surface->format->Bmask,
+ 0);
+
+ if (surface == NULL)
+ return NULL;
+
+ if (SDL_MUSTLOCK(Font->Surface)) SDL_LockSurface(Font->Surface);
+
+ color_key = GetPixel(Font->Surface, 0, Font->Surface->h - 1);
+
+ if (SDL_MUSTLOCK(Font->Surface)) SDL_UnlockSurface(Font->Surface);
+
+ SDL_FillRect(surface, NULL, color_key);
+
+ BFont_PutStringFont(surface, Font, 0, 0, text);
+
+ SDL_SetColorKey(surface, SDL_SRCCOLORKEY, color_key);
+
+ return surface;
+}
+
+
+SDL_Surface * BFont_CreateSurface (const char *text)
+{
+ return BFont_CreateSurfaceFont(CurrentFont, text);
+}
+
+
+/*********************************************************************************************************/
+/*********************************************************************************************************/
+/*********************************************************************************************************/
+
+static void PutPixel(SDL_Surface *surface, Sint32 X, Sint32 Y, Uint32 pixel)
+{
+ int bpp = surface->format->BytesPerPixel;
+ /* Here p is the address to the pixel we want to set */
+ Uint8 *p = (Uint8 *)surface->pixels + Y * surface->pitch + X * bpp;
+
+ switch(bpp) {
+ case 1:
+ *p = pixel;
+ break;
+
+ case 2:
+ *(Uint16 *)p = pixel;
+ break;
+
+ case 3:
+ if(SDL_BYTEORDER == SDL_BIG_ENDIAN) {
+ p[0] = (pixel >> 16) & 0xff;
+ p[1] = (pixel >> 8) & 0xff;
+ p[2] = pixel & 0xff;
+ } else {
+ p[0] = pixel & 0xff;
+ p[1] = (pixel >> 8) & 0xff;
+ p[2] = (pixel >> 16) & 0xff;
+ }
+ break;
+
+ case 4:
+ *(Uint32 *)p = pixel;
+ break;
+ }
+}
+
+static Uint32 GetPixel(SDL_Surface *Surface, Sint32 X, Sint32 Y)
+{
+
+ Uint8 *bits;
+ Uint32 Bpp;
+
+ if (X<0) puts("x too small in GetPixel!");
+ if (X>=Surface->w) puts("x too big in GetPixel!");
+
+ Bpp = Surface->format->BytesPerPixel;
+
+ bits = ((Uint8 *)Surface->pixels)+Y*Surface->pitch+X*Bpp;
+
+ // Get the pixel
+ switch(Bpp) {
+ case 1:
+ return *((Uint8 *)Surface->pixels + Y * Surface->pitch + X);
+ break;
+ case 2:
+ return *((Uint16 *)Surface->pixels + Y * Surface->pitch/2 + X);
+ break;
+ case 3: { // Format/endian independent
+ Uint8 r, g, b;
+ r = *((bits)+Surface->format->Rshift/8);
+ g = *((bits)+Surface->format->Gshift/8);
+ b = *((bits)+Surface->format->Bshift/8);
+ return SDL_MapRGB(Surface->format, r, g, b);
+ }
+ break;
+ case 4:
+ return *((Uint32 *)Surface->pixels + Y * Surface->pitch/4 + X);
+ break;
+ }
+
+ return -1;
+}
+
diff --git a/i/serialplot/BFont.h b/i/serialplot/BFont.h
new file mode 100644
index 0000000..bf0875b
--- /dev/null
+++ b/i/serialplot/BFont.h
@@ -0,0 +1,186 @@
+
+/************************************************************/
+/* */
+/* BFONT.h v. 1.1.0 - Billi Font Library by Diego Billi */
+/* */
+/* mail: dbilli@cs.unibo.it */
+/* home: http://www.cs.unibo.it/~dbilli (ITALIAN) */
+/* */
+/************************************************************/
+
+
+#ifndef __BFONT_H_
+#define __BFONT_H_
+
+
+#include "SDL.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Max number of characters allowed in a BFont font */
+#define BFONT_NUM_CHARS 256
+
+
+/* BFont font structure */
+typedef struct _BFont_Info BFont_Info;
+
+
+/* Load and store the font in the BFont_Info structure */
+BFont_Info * BFont_LoadFont (const char *filename);
+
+/* Free memory */
+void BFont_FreeFont(BFont_Info *Font);
+
+/* Returns a pointer to the current font structure */
+BFont_Info * BFont_GetCurrentFont(void);
+
+/* Set the current font */
+void BFont_SetCurrentFont (BFont_Info *Font);
+
+/* Returns the font height */
+int BFont_FontHeight (BFont_Info *Font);
+
+/* Change the font height */
+void BFont_SetFontHeight (BFont_Info *Font, int height);
+
+/* Returns the character width of the specified font */
+int BFont_CharWidth (BFont_Info *Font,int c);
+
+/* Write a single character on the "Surface" with the current font */
+int BFont_PutChar (SDL_Surface *Surface, int x, int y, int c);
+
+/* Write a single character on the "Surface" with the specified font */
+int BFont_PutCharFont (SDL_Surface *Surface, BFont_Info *Font,int x, int y, int c);
+
+/* Returns the width, in pixels, of the text calculated with the current font*/
+int BFont_TextWidth (const char *text);
+
+/* Returns the width, in pixels, of the text calculated with the specified font*/
+int BFont_TextWidthFont (BFont_Info *Font, const char *text);
+
+/* Write a string on the "Surface" with the current font */
+void BFont_PutString (SDL_Surface *Surface, int x, int y, const char *text);
+
+/* Write a string on the "Surface" with the specified font */
+void BFont_PutStringFont (SDL_Surface *Surface, BFont_Info *Font, int x, int y, const char *text);
+
+/* Write a left-aligned string on the "Surface" with the current font */
+void BFont_LeftPutString (SDL_Surface *Surface, int y, const char *text);
+
+/* Write a left-aligned string on the "Surface" with the specified font */
+void BFont_LeftPutStringFont (SDL_Surface *Surface, BFont_Info *Font, int y, const char *text);
+
+/* Write a center-aligned string on the "Surface" with the current font */
+void BFont_CenteredPutString (SDL_Surface *Surface, int y, const char *text);
+
+/* Write a center-aligned string on the "Surface" with the specified font */
+void BFont_CenteredPutStringFont (SDL_Surface *Surface, BFont_Info *Font, int y, const char *text);
+
+/* Write a right-aligned string on the "Surface" with the specified font */
+void BFont_RightPutString (SDL_Surface *Surface, int y, const char *text);
+
+/* Write a right-aligned string on the "Surface" with the specified font */
+void BFont_RightPutStringFont (SDL_Surface *Surface, BFont_Info *Font, int y, const char *text);
+
+/* Write a justify-aligned string on the "Surface" with the specified font */
+void BFont_JustifiedPutString (SDL_Surface *Surface, int y, const char *text);
+
+/* Write a justify-aligned string on the "Surface" with the specified font */
+void BFont_JustifiedPutStringFont (SDL_Surface *Surface, BFont_Info *Font, int y, const char *text);
+
+
+/* The following functions do the same task but have the classic "printf" sintax */
+
+void BFont_PrintString (SDL_Surface *Surface, int x, int y, const char *fmt, ...);
+void BFont_PrintStringFont (SDL_Surface *Surface, BFont_Info *Font, int x, int y, const char *fmt, ...);
+
+void BFont_CenteredPrintString (SDL_Surface *Surface, int y, const char *fmt, ...);
+void BFont_CenteredPrintStringFont (SDL_Surface *Surface, BFont_Info *Font, int y, const char *fmt, ...);
+
+void BFont_RightPrintString (SDL_Surface *Surface, int y, const char *fmt, ...);
+void BFont_RightPrintStringFont (SDL_Surface *Surface, BFont_Info *Font, int y, const char *fmt, ...);
+
+void BFont_LeftPrintString (SDL_Surface *Surface, int y, const char *fmt, ...);
+void BFont_LeftPrintStringFont (SDL_Surface *Surface, BFont_Info *Font, int y, const char *fmt, ...);
+
+void BFont_JustifiedPrintString (SDL_Surface *Surface, int y, const char *fmt, ...);
+void BFont_JustifiedPrintStringFont (SDL_Surface *Surface, BFont_Info *Font, int y, const char *fmt, ...);
+
+
+/* Returns a new font colored with the color (r,g,b) */
+BFont_Info * BFont_SetFontColor (BFont_Info *Font,Uint8 r, Uint8 g, Uint8 b);
+
+
+/* Load and store the font int the BFont_Info structure from a SDL surface */
+BFont_Info * BFont_LoadFontFromSurface (SDL_Surface *Surface);
+
+
+/* Return a SDL Surface containing the string "text" */
+SDL_Surface * BFont_CreateSurface (const char *text);
+SDL_Surface * BFont_CreateSurfaceFont (BFont_Info *Font, const char *text);
+
+
+/* This is for compatibility with old versions 1.0.X */
+
+#ifdef BFONT_KEEP_COMPATIBILITY
+
+ /* BFont v. 1.0.2 */
+
+ #define LoadFont BFont_LoadFont
+ #define FreeFont BFont_FreeFont
+ #define GetCurrentFont BFont_GetCurrentFont
+ #define SetCurrentFont BFont_SetCurrentFont
+ #define FontHeight BFont_FontHeight
+ #define SetFontHeight BFont_SetFontHeight
+ #define CharWidth BFont_CharWidth
+ #define PutChar BFont_PutChar
+ #define PutCharFont BFont_PutCharFont
+ #define TextWidth BFont_TextWidth
+ #define TextWidthFont BFont_TextWidthFont
+ #define PutString BFont_PutString
+ #define PutStringFont BFont_PutStringFont
+ #define LeftPutString BFont_LeftPutString
+ #define LeftPutStringFont BFont_LeftPutStringFont
+ #define CenteredPutString BFont_CenteredPutString
+ #define CenteredPutStringFont BFont_CenteredPutStringFont
+ #define RightPutString BFont_RightPutString
+ #define RightPutStringFont BFont_RightPutStringFont
+ #define JustifiedPutString BFont_JustifiedPutString
+ #define JustifiedPutStringFont BFont_JustifiedPutStringFont
+
+ #define PrintString BFont_PrintString
+ #define PrintStringFont BFont_PrintStringFont
+ #define CenteredPrintString BFont_CenteredPrintString
+ #define CenteredPrintStringFont BFont_CenteredPrintStringFont
+ #define RightPrintString BFont_RightPrintString
+ #define RightPrintStringFont BFont_RightPrintStringFont
+ #define LeftPrintString BFont_LeftPrintString
+ #define LeftPrintStringFont BFont_LeftPrintStringFont
+ #define JustifiedPrintString BFont_JustifiedPrintString
+ #define JustifiedPrintStringFont BFont_JustifiedPrintStringFont
+
+ /* BFont v. 1.0.3 */
+
+ #define SetFontColor BFont_SetFontColor
+
+ /* BFont v. 1.0.4 */
+
+ #define LoadFontFromSurface BFont_LoadFontFromSurface
+
+ /* BFont v. 1.0.5 */
+
+ #define CreateSurface BFont_CreateSurface
+ #define CreateSurfaceFont BFont_CreateSurfaceFont
+
+#endif /* end compatibility */
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/i/serialplot/Makefile b/i/serialplot/Makefile
new file mode 100644
index 0000000..0599042
--- /dev/null
+++ b/i/serialplot/Makefile
@@ -0,0 +1,11 @@
+CFLAGS = $(shell sdl-config --cflags) -g -Wall
+LDLIBS = $(shell sdl-config --libs) -lSDL_image -lefence
+OBJECTS = BFont.o serialplot_sdl.o serialplot_io.o serialplot_RdMch.o
+
+all: serialplot
+
+serialplot: $(OBJECTS) serialplot.o
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+
+clean:
+ rm -f serialplot *.o
diff --git a/i/serialplot/conf_ttyS0 b/i/serialplot/conf_ttyS0
new file mode 100644
index 0000000..a0f872a
--- /dev/null
+++ b/i/serialplot/conf_ttyS0
@@ -0,0 +1 @@
+stty --file /dev/ttyS0 icrnl
diff --git a/i/serialplot/data/1_source.txt b/i/serialplot/data/1_source.txt
new file mode 100644
index 0000000..515ef12
--- /dev/null
+++ b/i/serialplot/data/1_source.txt
@@ -0,0 +1,394 @@
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!Rff,b9
+!R00,00
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,00
+!R00,00
+!Rff,b9
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,00
+!Rff,b9
+!R00,47
+!R00,00
+!R00,00
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!Rff,b9
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!Rff,b9
+!R00,47
+!R00,47
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!Rff,b9
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!Rff,b9
+!R00,00
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!Rff,b9
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!Rff,b9
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,00
+!Rff,b9
+!R00,47
+!R00,00
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,00
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,00
+!R00,47
+!R00,00
+!R00,00
+!R00,47
+!R00,47
+!R00,47
+!R00,47
diff --git a/i/serialplot/data/2_source.txt b/i/serialplot/data/2_source.txt
new file mode 100644
index 0000000..5ca44f9
--- /dev/null
+++ b/i/serialplot/data/2_source.txt
@@ -0,0 +1,756 @@
+!P00,2c
+!Q00,2b
+!P00,2c
+!Q00,2b
+!P00,2c
+!Q00,2b
+!P00,2c
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b
+!P00,2c
+!Q00,2b
+!P00,2c
+!Q00,2b
+!P00,2b
+!Q00,2a
+!P00,2c
+!Q00,2b
+!P00,2d
+!Q00,2b
+!P00,2c
+!Q00,2b
+!P00,2c
+!Q00,2b
+!P00,2c
+!Q00,2b
+!P00,2b
+!Q00,2b
+!P00,2d
+!Q00,2b
+!P00,2c
+!Q00,2b
+!P00,2b
+!Q00,2a
+!P00,2d
+!Q00,2b
diff --git a/i/serialplot/data/4_source.txt b/i/serialplot/data/4_source.txt
new file mode 100644
index 0000000..a2a43b4
--- /dev/null
+++ b/i/serialplot/data/4_source.txt
@@ -0,0 +1,2149 @@
+DJFF™6j Šƒ‚b“k ’ƒ‚bƒ‚j š‚‚b£Ãkÿ!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2d
+!Q00,2a
+!R00,47
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2d
+!Q00,2a
+!R00,47
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2a
+!Rff,b9
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2a
+!R00,00
+!S00,00
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2d
+!Q00,2b
+!R00,47
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
+!Q00,2b
+!Rff,b9
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2c
+!Q00,2b
+!R00,00
+!S00,48
+!P00,2b
diff --git a/i/serialplot/font.png b/i/serialplot/font.png
new file mode 100644
index 0000000..d64fc87
--- /dev/null
+++ b/i/serialplot/font.png
Binary files differ
diff --git a/i/serialplot/gene.pl b/i/serialplot/gene.pl
new file mode 100644
index 0000000..8420d21
--- /dev/null
+++ b/i/serialplot/gene.pl
@@ -0,0 +1,8 @@
+#!/usr/bin/perl -w
+use strict;
+while (1)
+{
+ print "P11,11\n";
+ print "Q22,22\n";
+ print "R33,33\n";
+}
diff --git a/i/serialplot/read.pl b/i/serialplot/read.pl
new file mode 100644
index 0000000..0a9c722
--- /dev/null
+++ b/i/serialplot/read.pl
@@ -0,0 +1,46 @@
+#!/usr/bin/perl -w
+#use strict;
+
+my $i=0;
+my $tab;
+my $init=0;
+
+while (defined($line = <STDIN>) && $init == 0)
+{
+ #if ($line =~ m/[P-W][0-9a-f1-F]{2},[0-9a-f1-F]{2}/)
+ {
+ $tab[$i] = substr ($line,1,1);
+ for (my $j=0; $j<= $i-1; $j++)
+ {
+ if (substr($line,1,1) eq $tab[$j])
+ {
+ $init =1;
+ }
+
+ }
+ $i++ if ($init == 0);
+ }
+}
+
+
+for (my $j=0; $j <= $i; $j++)
+{
+ $line = <STDIN>;
+}
+
+while ($init != 2 )
+{
+ for (my $j=0; $j <= $i-1; $j++)
+ {
+ if (defined($line = <STDIN>))
+ {
+ print "0x" . substr($line,2,2) . substr($line,5,2);
+ }
+ else
+ {
+ $init = 2;
+ }
+ print " ";
+ }
+ print "\n";
+}
diff --git a/i/serialplot/serialplot.c b/i/serialplot/serialplot.c
new file mode 100644
index 0000000..532f128
--- /dev/null
+++ b/i/serialplot/serialplot.c
@@ -0,0 +1,243 @@
+/*TODO : refaire un calcul de moyenne : OK
+ * faire un système d'échelle plus lisible
+ * intégrer la lecture serie dans le programme : OK
+ * plus de protection sur l'option t :
+*/
+
+#include <SDL.h>
+#include <SDL_syswm.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include "serialplot_sdl.h"
+#include "serialplot_io.h"
+#include "serialplot_RdMch.h"
+
+SDL_Surface *screen;
+
+int old_value[256];
+unsigned long cpt[8];
+struct termios oldconf;
+
+
+int
+main (int argc, char **argv)
+{
+ int rep;
+ char *cvalue = NULL;
+ char *cvalue2 = NULL;
+ enum R_stat etat_lect;
+ opterr = 0;
+ int input_flag =0; // flag de choix de l'entre 0 = stdin
+
+
+ // decodeage de la ligne de commande
+ while((rep= getopt (argc, argv,"hvs:t:")) != -1)
+ switch (rep)
+ {
+ case 'h':
+ printf("serialplot -h cet aide\n\n");
+ printf("serialplot -s /dev/ttyS0 permet de choisir\n");
+ printf(" entre le port serie /dev/ttyS0 \n");
+ printf(" au lieu de l'entre standard\n");
+ printf(" -t un nombre dans cet intervalle\n");
+ printf(" [1-255], le nb de bit à 1\n");
+ printf(" correspond au nombre de valeur\n");
+ printf(" a afficher");
+ printf("\nserialplot -v affiche les credits\n\n");
+ exit(0);
+ case 'v':
+ printf("\n%s by __--''\\_TB_/''--__\n\n",argv[0]);
+ exit(0);
+ case 's':
+ cvalue = optarg;
+ input_flag = 1;
+ break;
+ case 't':
+ cvalue2 = optarg;
+ if ((etat_lect = read_std_param(cvalue2)) == EPRINT)
+ {
+ fprintf(stderr,
+ "\n %s est un mauvais parametre\n\n",
+ cvalue2);
+ exit(-1);
+ }
+ printf("decode type: %d\n",conv_Rd_type(etat_lect));
+ break;
+ case '?':
+ if (isprint(optopt))
+ fprintf(stderr,
+ "Option inconnu `-%c'.\n",
+ optopt);
+ else
+ fprintf(stderr,
+ "\ncaractere d'option inconnu '\\x%x'.\n",
+ optopt);
+ exit(-1);
+ default:
+ abort();
+ }
+ static int fd_x11;
+ int quit=0;
+ SDL_Event event;
+ /* Initialise SDL. */
+ if (SDL_Init (SDL_INIT_TIMER | SDL_INIT_VIDEO) == -1) erreur ();
+ atexit (SDL_Quit);
+
+ /* Selectionne un mode video. */
+ screen = SDL_SetVideoMode (640, 480, 0, SDL_HWSURFACE /*| SDL_FULLSCREEN*/
+ | SDL_DOUBLEBUF);
+ if (!screen) erreur ();
+ printf("init SDL : done\n");
+ SDL_SysWMinfo info;
+ SDL_VERSION(&info.version);
+ if ( SDL_GetWMInfo(&info) <0 )
+ {
+ exit(-1);
+ }
+ fd_x11 = ConnectionNumber(info.info.x11.display);
+ printf("fd X11 defined\n");
+
+ int fd_input;
+ char input[8];
+ if (input_flag == 1)
+ {
+ /*ouvre le port serie*/
+ fd_input = init_serial(cvalue);
+ printf("init serial port : done\n");
+
+ //commande specifique a l'appli
+ char command[10];
+ // Not yet implemented
+ //command = "!z";
+ //write_serial(fd_input,&command);
+ //fgets(input,sizeof (input) / sizeof (input[0]),fdopen(fd_input,"r+"))
+
+ strcpy(command,"!c");
+ write_serial(fd_input,command);
+
+// lecture blocante donc marche pas
+// fgets(input,sizeof (input) / sizeof (input[0]),fdopen(fd_input,"r+"));
+// if((input[0]=='!') && (input[1]=='C'))
+// fprintf(stdout,"Calibration: OK\n");
+// else
+// {
+// fprintf(stderr,"Erreur à la calibration\n");
+// quit ++;
+// }
+ }
+ else
+ fd_input = 0 ;
+ int melt = 0;
+ int vals[8];
+ enum R_stat etat_c = E1;
+
+ /* initialisation du select */
+ fd_set fsdcR;
+ int retval;
+ FD_ZERO(&fsdcR);
+
+ FILE * FILE_input = ( input_flag == 1) ? fdopen(fd_input,"r+") : stdin;
+
+ while(!quit)
+ {
+ FD_SET(fd_input,&fsdcR);
+ FD_SET(fd_x11,&fsdcR);
+ retval = select ( (fd_input > fd_x11) ? fd_input + 1 : fd_x11 + 1,
+ &fsdcR,
+ NULL,
+ NULL,
+ NULL
+ );
+ if (retval)
+ {
+ if (FD_ISSET(fd_x11,&fsdcR))
+ {
+ while(SDL_PollEvent(&event))
+ {
+ if(event.type == SDL_KEYDOWN)
+ {
+ switch (event.key.keysym.sym)
+ {
+ case SDLK_ESCAPE:
+ case SDLK_q:
+ quit=1;
+ break;
+ case SDLK_m:
+ melt = !melt;
+ break;
+ case SDLK_a:
+ case SDLK_b:
+ case SDLK_c:
+ case SDLK_d:
+ case SDLK_e:
+ case SDLK_f:
+ case SDLK_g:
+ case SDLK_h: printf("abcdefgh\n");
+ break;
+ default : printf("touche sans fonction\n");
+ break;
+ }
+ }
+ else if (event.type == SDL_QUIT)
+ {
+ quit++;
+ }
+ }
+ }
+ if (FD_ISSET(fd_input,&fsdcR))
+ {
+ if (fgets (input,
+ sizeof (input) / sizeof (input[0]),
+ FILE_input ))
+ {
+ if (input[0] == '!')
+ {
+ read_line(vals,&etat_c,etat_lect,input);
+ }
+ }
+ }
+
+ }
+ // Etat d'affichage
+ if (etat_c == EPRINT)
+ {
+ int i;
+ i =conv_Rd_type(etat_lect);
+ draw(melt,i,vals);
+ draw_inf(i,vals);
+ nextFrame();
+ etat_c = E1;
+ }
+
+
+/*
+ if (fgets (input, sizeof (input) / sizeof (input[0]), stdin))
+ {
+ s = input;
+ for (i = 0; i < sizeof (vals) / sizeof (vals[0]); i++)
+ {
+ vals[i] = strtod (s, &es);
+ if (es == s)
+ break;
+ s = es;
+ }
+
+ draw(melt, i, vals);
+
+ draw_inf(i, vals);
+
+ nextFrame();
+ }
+ */
+ }
+ /* ferme le port serie */
+ if (input_flag ==1) close_serial(fd_input);
+ printf("close\n");
+ return 0;
+}
+
diff --git a/i/serialplot/serialplot_RdMch.c b/i/serialplot/serialplot_RdMch.c
new file mode 100644
index 0000000..52fa543
--- /dev/null
+++ b/i/serialplot/serialplot_RdMch.c
@@ -0,0 +1,96 @@
+#include "serialplot_RdMch.h"
+
+void
+read_line ( int tab[8], enum R_stat * etat_c,
+ const enum R_stat max, const char * chaine)
+{
+ char valeur[8], convert[8] = "0x";
+ int resultat;
+ strcpy(valeur,chaine);
+ valeur[0] = valeur[2];
+ valeur[1] = valeur[3];
+ valeur[2] = valeur[5];
+ valeur[3] = valeur[6];
+ valeur[4] = '\0';
+ strcat(convert,valeur);
+ resultat = (strtod( convert, NULL));
+ /* convertie le le nombre négatif sur le bon nb de bit
+ * si nécessaire
+ */
+ if ( resultat & 0x8000) resultat |= 0xffff8000 ;
+ switch (*etat_c)
+ {
+ case E1 : tab[0] = resultat;
+ if (*etat_c != max) *etat_c = E2; else *etat_c = EPRINT;
+ break;
+ case E2 : tab[1] = resultat;
+ if(*etat_c != max) *etat_c = E3; else *etat_c = EPRINT;
+ break;
+ case E3 : tab[2] = resultat;
+ if (*etat_c != max) *etat_c = E4; else *etat_c = EPRINT;
+ break;
+ case E4 : tab[3] = resultat;
+ if (*etat_c != max) *etat_c = E5; else *etat_c = EPRINT;
+ break;
+ case E5 : tab[4] = resultat;
+ if (*etat_c != max) *etat_c = E6; else *etat_c = EPRINT;
+ break;
+ case E6 : tab[5] = resultat;
+ if (*etat_c != max) *etat_c = E7; else *etat_c = EPRINT;
+ break;
+ case E7 : tab[6] = resultat;
+ if (*etat_c != max) *etat_c = E8; else *etat_c = EPRINT;
+ break;
+ case E8 : tab[7] = resultat;
+ *etat_c =EPRINT; break;
+ default : printf("Ah le connard\n"); break; // make gcc happy
+ }
+}
+
+int conv_Rd_type( const enum R_stat etat)
+{
+
+ switch (etat)
+ {
+ case E1 : return 1;
+ case E2 : return 2;
+ case E3 : return 3;
+ case E4 : return 4;
+ case E5 : return 5;
+ case E6 : return 6;
+ case E7 : return 7;
+ case E8 : return 8;
+ default : return 0;
+ }
+}
+
+enum R_stat
+read_std_param(char *cvalue)
+{
+ //TODO verifier la longeur de la chaine < 3
+ int result = atoi(cvalue);
+ int calcul = 0;
+ if( (result > 0) && (result < 256) )
+ {
+ int test =1;
+ while (test < 256)
+ {
+ if (result & test) calcul ++;
+ test <<= 1;
+ }
+ switch (calcul)
+ {
+ case 1 : return E1;break;
+ case 2 : return E2;break;
+ case 3 : return E3;break;
+ case 4 : return E4;break;
+ case 5 : return E5;break;
+ case 6 : return E6;break;
+ case 7 : return E7;break;
+ case 8 : return E8;break;
+ default : return EPRINT;
+ }
+ }
+ else
+ return EPRINT; // mauvais interval
+}
diff --git a/i/serialplot/serialplot_RdMch.h b/i/serialplot/serialplot_RdMch.h
new file mode 100644
index 0000000..e5cbc95
--- /dev/null
+++ b/i/serialplot/serialplot_RdMch.h
@@ -0,0 +1,15 @@
+#ifndef serialplot_RdMch_h
+#define serialplot_RdMch_h
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+enum R_stat { E1, E2, E3, E4, E5, E6, E7, E8, EPRINT};
+
+void read_line (int tab[8], enum R_stat * etat_c,
+ const enum R_stat max, const char * chaine);
+int conv_Rd_type (const enum R_stat etat);
+enum R_stat read_std_param(char *cvalue);
+
+#endif
diff --git a/i/serialplot/serialplot_io.c b/i/serialplot/serialplot_io.c
new file mode 100644
index 0000000..fa45433
--- /dev/null
+++ b/i/serialplot/serialplot_io.c
@@ -0,0 +1,54 @@
+
+#include "serialplot_io.h"
+
+int
+init_serial(char *cvalue)
+{
+ int fd_ttyS;
+ struct termios newtio;
+ if ( (fd_ttyS=open(cvalue,O_RDWR )) < 0 ) {
+ perror("serial port couldn't be open");
+ exit(-1);
+ }
+
+ tcgetattr(fd_ttyS,&oldconf); /* sauvegarde de la configuration courante */
+ bzero(&newtio, sizeof(newtio)); /* on initialise la structure à zéro */
+ /*
+ * ICRNL convertie CR en NL en entrée sauf si IGNCR est indiqué
+ * Valide la vérification de parité en entré
+ */
+ newtio.c_iflag = ICRNL | INPCK ;
+ /*
+ * BAUDRATE 115200 Baud
+ * CS8 Longeur des caractères
+ * CLOCAL Ignore les signaux de controle du modem
+ * CREAD Valider la reception
+ * PARENB Valider le codage de partié en sortie et la vérification
+ * de parité en entrée
+ */
+ newtio.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD | PARENB ;
+ /*
+ * Traitement des caractères de sortie, ici aucun.
+ */
+ newtio.c_oflag = 0;
+ /*
+ * Mode canonique (permet l'utilisation des caractères speciaux)
+ */
+ newtio.c_lflag = ICANON;
+ tcflush(fd_ttyS, TCIFLUSH);
+ tcsetattr(fd_ttyS,TCSANOW,&newtio);
+ return fd_ttyS;
+}
+
+void
+close_serial(int fd)
+{
+ tcsetattr(fd,TCSANOW,&oldconf);
+ close(fd);
+}
+
+int
+write_serial(int fd,char *command)
+{
+ return fputs(command,fdopen(fd,"r+"));
+}
diff --git a/i/serialplot/serialplot_io.h b/i/serialplot/serialplot_io.h
new file mode 100644
index 0000000..f7780c6
--- /dev/null
+++ b/i/serialplot/serialplot_io.h
@@ -0,0 +1,21 @@
+#ifndef serialplot_io_h
+#define serialplot_io_h
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <termios.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define BAUDRATE B115200
+
+extern struct termios oldconf;
+
+int init_serial (char *cvalue);
+void close_serial(int fd);
+int write_serial(int fd,char *command);
+
+#endif
diff --git a/i/serialplot/serialplot_sdl.c b/i/serialplot/serialplot_sdl.c
new file mode 100644
index 0000000..22013f8
--- /dev/null
+++ b/i/serialplot/serialplot_sdl.c
@@ -0,0 +1,247 @@
+#include "serialplot_sdl.h"
+
+void
+draw (int melt, int n, int vals[])
+{
+ int i;
+ Uint32 color;
+ static const Uint8 colors[][3] =
+ {
+ { 0, 255, 0 },
+ { 255, 0, 255 },
+ { 255, 255, 0 },
+ { 255, 0, 0 },
+ { 0, 255, 255 },
+ { 255, 255, 255 },
+ };
+ int c = 0;
+ static int x = 0;
+ int y;
+ int ymin = 0;
+ int ystep = screen->h / (melt ? 1 : n);
+ x = (x + 1) % screen->w;
+ /* Vérouille la surface pour y ecrire directement. */
+ if (SDL_MUSTLOCK (screen)) SDL_LockSurface (screen);
+ clearcol (x);
+ for (i = 0; i < n; i++)
+ {
+ double v = vals[i];
+ y = ymin + ystep / 2 - v * ystep / 2;
+ y = y < 0 ? ymin : (y >= ymin + ystep ? ymin + ystep - 1 : y);
+ color = SDL_MapRGB (screen->format, colors[c][0], colors[c][1], colors[c][2]);
+ putpixel(x,y,color);
+ if (!melt)
+ ymin += ystep;
+ c = (c + 1) % (sizeof (colors) / sizeof (colors[0]));
+ }
+ if (SDL_MUSTLOCK (screen)) SDL_UnlockSurface (screen);
+}
+
+void
+nextFrame (void)
+{
+// static int lastFrame = 0;
+// static const int minFrame = 1000 / 50;
+// int curFrame;
+ /* Echange les deux tampons. */
+ SDL_Flip (screen);
+ /* Freine le programme s'il est trops rapide. */
+
+// curFrame = SDL_GetTicks ();
+// if (lastFrame && lastFrame + minFrame > curFrame)
+// SDL_Delay (lastFrame + minFrame - curFrame);
+ /* Enregistre l'heure de dernier rafraichisement. */
+// lastFrame = curFrame;
+
+}
+
+void
+putpixel(int x, int y, Uint32 pixel)
+{
+ int bpp = screen ->format->BytesPerPixel;
+ /*Ici p est l'adresse du pixel à colorier*/
+ Uint8 *p = (Uint8 *)screen->pixels + y * screen->pitch + bpp * x;
+
+ switch(bpp) {
+ case 1:
+ *p = pixel;
+ break;
+ case 2:
+ *(Uint16 *)p = pixel;
+ break;
+ case 3:
+ if(SDL_BYTEORDER == SDL_BIG_ENDIAN){
+ p[0] = (pixel >> 16 ) & 0xff;
+ p[1] = (pixel >> 8) & 0xff;
+ p[2] = pixel & 0xff;
+ } else {
+ p[0] = pixel & 0xff;
+ p[1] = (pixel >> 8) & 0xff;
+ p[2] = (pixel >> 16) & 0xff;
+ }
+ break;
+ case 4:
+ *(Uint32 *)p =pixel;
+ break;
+ }
+}
+
+void
+clearcol (int x)
+{
+ int i;
+ int bpp = screen ->format->BytesPerPixel;
+ /*Ici p est l'adresse du pixel à colorier*/
+ Uint8 *p = (Uint8 *)screen->pixels + bpp * x;
+ Uint32 pixel = SDL_MapRGB (screen->format, 0, 0, 0);
+
+ switch(bpp) {
+ case 1:
+ for (i = 0; i < screen->h; i++)
+ {
+ *p = pixel;
+ (Uint8 *)p += screen->pitch;
+ }
+ break;
+ case 2:
+ for (i = 0; i < screen->h; i++)
+ {
+ *(Uint16 *)p = pixel;
+ (Uint8 *)p += screen->pitch;
+ }
+ break;
+ case 3:
+ for (i = 0; i < screen->h; i++)
+ {
+ if(SDL_BYTEORDER == SDL_BIG_ENDIAN){
+ p[0] = (pixel >> 16 ) & 0xff;
+ p[1] = (pixel >> 8) & 0xff;
+ p[2] = pixel & 0xff;
+ } else {
+ p[0] = pixel & 0xff;
+ p[1] = (pixel >> 8) & 0xff;
+ p[2] = (pixel >> 16) & 0xff;
+ }
+ (Uint8 *)p += screen->pitch;
+ }
+ break;
+ case 4:
+ for (i = 0; i < screen->h; i++)
+ {
+ *(Uint32 *)p =pixel;
+ (Uint8 *)p += screen->pitch;
+ }
+ break;
+ }
+}
+
+void
+draw_inf (int n, int vals[])
+{
+ int i;
+ int h1;
+ char chaine[255];
+ SDL_Surface *surf_text;
+ SDL_Rect destpos;
+
+ BFont_Info *Font1=NULL;
+ Font1 = BFont_LoadFont("font.png");
+ if (Font1 == NULL) {
+ fprintf(stderr, "Couldnt load %s\n","font.png");
+ exit(1);
+ }
+ h1 = BFont_FontHeight(Font1);
+ BFont_SetCurrentFont(Font1);
+
+ if (SDL_MUSTLOCK (screen)) SDL_LockSurface (screen);
+ for (i = 0; i < n; i++)
+ {
+ double variance;
+ double moyenne;
+ double somme = 0;
+ int j;
+ // calcul de la moyenne
+ cpt[i]++;
+ // convertion des valeur négative de 2octect à 4octect
+ if ( ((int)vals[i]) & 0x8000)
+ old_value[cpt[i]%32+i*32] = 0xffff8000 | (int) (vals[i]);
+ else
+ old_value[cpt[i]%32+i*32] = (int) (vals[i]);
+ for (j = 0; (j < cpt[i]) && (j < 32);j++)
+ {
+ somme += old_value[j+i*32];
+ }
+ if (cpt[i] < 32)
+ moyenne = somme / cpt[i];
+ else
+ moyenne = somme / 32;
+ variance = vals[i] * vals[i] - moyenne * moyenne;
+ sprintf(chaine,"var : %f ",variance);
+
+ surf_text = BFont_CreateSurfaceFont(Font1, chaine);
+ if (surf_text != NULL)
+ {
+ // Blit it on the bottom right corner
+ memset(&destpos, 0, sizeof(SDL_Rect));
+ destpos.x = 0;
+ destpos.y = 480 - surf_text->h - i * 15 ;
+ destpos.w = surf_text->w;
+ destpos.h = surf_text->h;
+
+ SDL_Surface *dest;
+ dest = SDL_CreateRGBSurface(SDL_HWSURFACE,
+ surf_text->w + 10,
+ surf_text->h,
+ surf_text->format->BitsPerPixel,
+ surf_text->format->Rmask,
+ surf_text->format->Gmask,
+ surf_text->format->Bmask,0);
+ SDL_FillRect(dest,&destpos,0);
+ SDL_BlitSurface(dest, NULL, screen, &destpos);
+
+ SDL_BlitSurface(surf_text, NULL, screen, &destpos);
+ SDL_FreeSurface(dest);
+ SDL_FreeSurface(surf_text);
+ }
+ sprintf(chaine,"moy : %f ", moyenne);
+
+ surf_text = BFont_CreateSurfaceFont(Font1, chaine);
+
+ if (surf_text != NULL)
+ {
+ // Blit it on the bottom right corner
+ memset(&destpos, 0, sizeof(SDL_Rect));
+ destpos.x = 100;
+ destpos.y = 480 - surf_text->h - i * 15 ;
+ destpos.w = surf_text->w;
+ destpos.h = surf_text->h;
+
+ SDL_Surface *dest;
+ dest = SDL_CreateRGBSurface(SDL_HWSURFACE,
+ surf_text->w + 10,
+ surf_text->h,
+ surf_text->format->BitsPerPixel,
+ surf_text->format->Rmask,
+ surf_text->format->Gmask,
+ surf_text->format->Bmask,0);
+ SDL_FillRect(dest,&destpos,0);
+ SDL_BlitSurface(dest, NULL, screen, &destpos);
+
+ SDL_BlitSurface(surf_text, NULL, screen, &destpos);
+ SDL_FreeSurface(dest);
+ SDL_FreeSurface(surf_text);
+ }
+ }
+
+ BFont_FreeFont(Font1);
+ if (SDL_MUSTLOCK (screen)) SDL_UnlockSurface (screen);
+}
+
+
+void
+erreur (void)
+{
+ fprintf (stderr, "Erreur SDL : %s\n", SDL_GetError ());
+ exit (1);
+}
+
diff --git a/i/serialplot/serialplot_sdl.h b/i/serialplot/serialplot_sdl.h
new file mode 100644
index 0000000..2152c8a
--- /dev/null
+++ b/i/serialplot/serialplot_sdl.h
@@ -0,0 +1,21 @@
+#ifndef serialplot_sdl_h
+#define serialplot_sdl_h
+
+#include <SDL.h>
+#include <SDL_image.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "BFont.h"
+
+void erreur (void);
+void nextFrame (void);
+void draw (int melt, int n, int vals[]);
+void putpixel(int x, int y, Uint32 pixel);
+void clearcol (int x);
+void draw_inf(int n, int vals[]);
+
+extern SDL_Surface *screen;
+extern int old_value[256];
+extern unsigned long cpt[8];
+#endif
diff --git a/i/serialplot/toto.pl b/i/serialplot/toto.pl
new file mode 100644
index 0000000..9c95718
--- /dev/null
+++ b/i/serialplot/toto.pl
@@ -0,0 +1,10 @@
+#!/usr/bin/perl -w
+use strict;
+
+my $a = 0;
+
+while (1)
+{
+ print sin ($a * 3.14), ' ', cos ($a * 3.14), "\n";
+ $a += 0.02;
+}