Explorar el Código

* _updated_coding_style(aBit);

tags/v0.99.beta14
Jean-Yves Lamoureux jylam hace 19 años
padre
commit
e5ea6fb7cf
Se han modificado 1 ficheros con 20 adiciones y 20 borrados
  1. +20
    -20
      cucul/import.c

+ 20
- 20
cucul/import.c Ver fichero

@@ -196,10 +196,10 @@ static cucul_canvas_t *import_text(void const *data, unsigned int size)
} }


#define IS_ALPHA(x) (x>='A' && x<='z') #define IS_ALPHA(x) (x>='A' && x<='z')
void updateCanvasSize(cucul_canvas_t *cv, int x, int y, int *max_x, int *max_y);
unsigned char get_ansi_command(unsigned char const *buffer, int size);
int parse_tuple(unsigned int *ret, unsigned char const *buffer, int size);
void manage_modifiers(char c, int *fg, int *bg, int *old_fg, int *old_bg);
void _update_canvas_size(cucul_canvas_t *cv, int x, int y, int *max_x, int *max_y);
unsigned char _get_ansi_command(unsigned char const *buffer, int size);
int _parse_tuple(unsigned int *ret, unsigned char const *buffer, int size);
void _manage_modifiers(char c, int *fg, int *bg, int *old_fg, int *old_bg);


static cucul_canvas_t *import_ansi(void const *data, unsigned int size) static cucul_canvas_t *import_ansi(void const *data, unsigned int size)
{ {
@@ -226,8 +226,8 @@ static cucul_canvas_t *import_ansi(void const *data, unsigned int size)
i++; // ESC i++; // ESC
i++; // [ i++; // [
sent_size = size - i; sent_size = size - i;
c = get_ansi_command(&buffer[i], sent_size);
add = parse_tuple(tuple, &buffer[i], sent_size);
c = _get_ansi_command(&buffer[i], sent_size);
add = _parse_tuple(tuple, &buffer[i], sent_size);
count = 0; count = 0;


while(tuple[count] != 0x1337) while(tuple[count] != 0x1337)
@@ -248,7 +248,7 @@ static cucul_canvas_t *import_ansi(void const *data, unsigned int size)
x = 0; x = 0;
y = 0; y = 0;
} }
updateCanvasSize(cv, x, y, &max_x, &max_y);
_update_canvas_size(cv, x, y, &max_x, &max_y);
break; break;
case 'A': case 'A':
if(tuple[0] == 0x1337) if(tuple[0] == 0x1337)
@@ -256,21 +256,21 @@ static cucul_canvas_t *import_ansi(void const *data, unsigned int size)
else else
y -= tuple[0]; y -= tuple[0];
if(y < 0) y = 0; if(y < 0) y = 0;
updateCanvasSize(cv, x, y, &max_x, &max_y);
_update_canvas_size(cv, x, y, &max_x, &max_y);
break; break;
case 'B': case 'B':
if(tuple[0] == 0x1337) if(tuple[0] == 0x1337)
y++; y++;
else else
y += tuple[0]; y += tuple[0];
updateCanvasSize(cv, x, y, &max_x, &max_y);
_update_canvas_size(cv, x, y, &max_x, &max_y);
break; break;
case 'C': case 'C':
if(tuple[0] == 0x1337) if(tuple[0] == 0x1337)
x++; x++;
else else
x += tuple[0]; x += tuple[0];
updateCanvasSize(cv, x, y, &max_x, &max_y);
_update_canvas_size(cv, x, y, &max_x, &max_y);
break; break;
case 'D': case 'D':
if(tuple[0] == 0x1337) if(tuple[0] == 0x1337)
@@ -278,7 +278,7 @@ static cucul_canvas_t *import_ansi(void const *data, unsigned int size)
else else
x -= tuple[0]; x -= tuple[0];
if(x < 0) x = 0; if(x < 0) x = 0;
updateCanvasSize(cv, x, y, &max_x, &max_y);
_update_canvas_size(cv, x, y, &max_x, &max_y);
break; break;
case 's': case 's':
save_x = x; save_x = x;
@@ -287,14 +287,14 @@ static cucul_canvas_t *import_ansi(void const *data, unsigned int size)
case 'u': case 'u':
x = save_x; x = save_x;
y = save_y; y = save_y;
updateCanvasSize(cv, x, y, &max_x, &max_y);
_update_canvas_size(cv, x, y, &max_x, &max_y);
break; break;
case 'J': case 'J':
if(tuple[0] == 2) if(tuple[0] == 2)
{ {
x = 0; x = 0;
y = 0; y = 0;
updateCanvasSize(cv, x, y, &max_x, &max_y);
_update_canvas_size(cv, x, y, &max_x, &max_y);
} }
break; break;
case 'K': case 'K':
@@ -302,7 +302,7 @@ static cucul_canvas_t *import_ansi(void const *data, unsigned int size)
break; break;
case 'm': case 'm':
for(j = 0; j < count; j++) for(j = 0; j < count; j++)
manage_modifiers(tuple[j], &fg, &bg, &old_fg, &old_bg);
_manage_modifiers(tuple[j], &fg, &bg, &old_fg, &old_bg);
cucul_set_color(cv, fg, bg); cucul_set_color(cv, fg, bg);
break; break;
default: default:
@@ -316,7 +316,7 @@ static cucul_canvas_t *import_ansi(void const *data, unsigned int size)
{ {
x = 0; x = 0;
y++; y++;
updateCanvasSize(cv, x, y, &max_x, &max_y);
_update_canvas_size(cv, x, y, &max_x, &max_y);
} }
else if(buffer[i] == '\r') else if(buffer[i] == '\r')
{ {
@@ -333,7 +333,7 @@ static cucul_canvas_t *import_ansi(void const *data, unsigned int size)
else else
cucul_putchar(cv, x, y, '?'); cucul_putchar(cv, x, y, '?');
x++; x++;
updateCanvasSize(cv, x, y, &max_x, &max_y);
_update_canvas_size(cv, x, y, &max_x, &max_y);
} }
} }


@@ -346,7 +346,7 @@ static cucul_canvas_t *import_ansi(void const *data, unsigned int size)


/* XXX : ANSI loader helpers */ /* XXX : ANSI loader helpers */


unsigned char get_ansi_command(unsigned char const *buffer, int size)
unsigned char _get_ansi_command(unsigned char const *buffer, int size)
{ {
int i; int i;


@@ -357,7 +357,7 @@ unsigned char get_ansi_command(unsigned char const *buffer, int size)
return 0; return 0;
} }


int parse_tuple(unsigned int *ret, unsigned char const *buffer, int size)
int _parse_tuple(unsigned int *ret, unsigned char const *buffer, int size)
{ {
int i = 0; int i = 0;
int j = 0; int j = 0;
@@ -399,7 +399,7 @@ int parse_tuple(unsigned int *ret, unsigned char const *buffer, int size)






void manage_modifiers(char c, int *fg, int *bg, int *old_fg, int *old_bg)
void _manage_modifiers(char c, int *fg, int *bg, int *old_fg, int *old_bg)
{ {
switch(c) switch(c)
{ {
@@ -469,7 +469,7 @@ void manage_modifiers(char c, int *fg, int *bg, int *old_fg, int *old_bg)
} }
} }


void updateCanvasSize(cucul_canvas_t *cv, int x, int y, int *max_x, int *max_y)
void _update_canvas_size(cucul_canvas_t *cv, int x, int y, int *max_x, int *max_y)
{ {
if(x > *max_x) if(x > *max_x)
*max_x = x; *max_x = x;


Cargando…
Cancelar
Guardar