commit 1490f040bf099d4a1388969e6f47dde88d0ebcf8
parent e668ca29a50b70ceea46dfc022bd40bb617af7b9
Author: Frederic Cambus <fred@statdns.com>
Date: Sat, 13 May 2017 18:53:08 +0200
Rename variables
Diffstat:
10 files changed, 136 insertions(+), 136 deletions(-)
diff --git a/src/ansilove.c b/src/ansilove.c
@@ -13,23 +13,23 @@
// shared method for drawing characters
void drawchar(gdImagePtr im, const unsigned char *font_data, int32_t bits,
- int32_t height, int32_t position_x, int32_t position_y,
+ int32_t height, int32_t row, int32_t column,
int32_t background, int32_t foreground, unsigned char character)
{
- int32_t column, line;
+ int32_t x, y;
- gdImageFilledRectangle(im, position_x * bits, position_y*height, position_x * bits +
- bits - 1, position_y * height + height - 1, background);
+ gdImageFilledRectangle(im, row * bits, column*height, row * bits +
+ bits - 1, column * height + height - 1, background);
- for (line = 0; line < height; line++) {
- for (column = 0; column < bits; column++) {
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < bits; x++) {
- if ((font_data[line+character*height] & (0x80 >> column)) != 0) {
- gdImageSetPixel(im, position_x * bits + column, position_y*height + line, foreground);
+ if ((font_data[y+character*height] & (0x80 >> x)) != 0) {
+ gdImageSetPixel(im, row * bits + x, column*height + y, foreground);
- if (bits==9 && column==7 && character > 191 && character < 224)
+ if (bits==9 && x==7 && character > 191 && character < 224)
{
- gdImageSetPixel(im, position_x * bits + 8, position_y * height + line, foreground);
+ gdImageSetPixel(im, row * bits + 8, column * height + y, foreground);
}
}
}
diff --git a/src/loaders/ansi.c b/src/loaders/ansi.c
@@ -65,8 +65,8 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil
bool bold = false, underline = false, italics = false, blink = false;
// positions
- int32_t position_x = 0, position_y = 0, position_x_max = 0, position_y_max = 0;
- int32_t saved_position_y = 0, saved_position_x = 0;
+ int32_t column = 0, row = 0, columnMax = 0, rowMax = 0;
+ int32_t saved_row = 0, saved_column = 0;
// sequence parsing variables
int32_t seqValue, seqArrayCount, seq_line, seq_column;
@@ -86,30 +86,30 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil
current_character = inputFileBuffer[loop];
next_character = inputFileBuffer[loop + 1];
- if (position_x==80)
+ if (column==80)
{
- position_y++;
- position_x=0;
+ row++;
+ column=0;
}
// CR + LF
if (current_character == 13 && next_character == 10) {
- position_y++;
- position_x = 0;
+ row++;
+ column = 0;
loop++;
}
// LF
if (current_character == 10)
{
- position_y++;
- position_x = 0;
+ row++;
+ column = 0;
}
// tab
if (current_character == 9)
{
- position_x += 8;
+ column += 8;
}
// sub
@@ -141,13 +141,13 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil
seq_column = strtonum(seqArray[1], 0, INT32_MAX, &errstr);
// finally set the positions
- position_y = seq_line-1;
- position_x = seq_column-1;
+ row = seq_line-1;
+ column = seq_column-1;
}
else {
// no coordinates specified? we move to the home position
- position_y = 0;
- position_x = 0;
+ row = 0;
+ column = 0;
}
loop+=ansi_sequence_loop+2;
break;
@@ -163,7 +163,7 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil
int32_t seq_line = strtonum(seqGrab, 0, INT32_MAX, &errstr);
free(seqGrab);
- position_y -= seq_line ? seq_line : 1;
+ row -= seq_line ? seq_line : 1;
loop+=ansi_sequence_loop+2;
break;
@@ -179,7 +179,7 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil
int32_t seq_line = strtonum(seqGrab, 0, INT32_MAX, &errstr);
free(seqGrab);
- position_y += seq_line ? seq_line : 1;
+ row += seq_line ? seq_line : 1;
loop+=ansi_sequence_loop+2;
break;
@@ -195,11 +195,11 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil
int32_t seq_column = strtonum(seqGrab, 0, INT32_MAX, &errstr);
free(seqGrab);
- position_x += seq_column ? seq_column : 1;
+ column += seq_column ? seq_column : 1;
- if (position_x>80)
+ if (column>80)
{
- position_x=80;
+ column=80;
}
loop+=ansi_sequence_loop+2;
@@ -216,11 +216,11 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil
int32_t seq_column = strtonum(seqGrab, 0, INT32_MAX, &errstr);
free(seqGrab);
- position_x -= seq_column ? seq_column : 1;
+ column -= seq_column ? seq_column : 1;
- if (position_x < 0)
+ if (column < 0)
{
- position_x = 0;
+ column = 0;
}
loop+=ansi_sequence_loop+2;
@@ -230,8 +230,8 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil
// save cursor position
if (ansi_sequence_character=='s')
{
- saved_position_y = position_y;
- saved_position_x = position_x;
+ saved_row = row;
+ saved_column = column;
loop+=ansi_sequence_loop+2;
break;
@@ -240,8 +240,8 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil
// restore cursor position
if (ansi_sequence_character=='u')
{
- position_y = saved_position_y;
- position_x = saved_position_x;
+ row = saved_row;
+ column = saved_column;
loop+=ansi_sequence_loop+2;
break;
@@ -259,11 +259,11 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil
if (eraseDisplayInt == 2)
{
- position_x=0;
- position_y=0;
+ column=0;
+ row=0;
- position_x_max=0;
- position_y_max=0;
+ columnMax=0;
+ rowMax=0;
// reset ansi buffer
free(ansi_buffer);
@@ -371,14 +371,14 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil
else if (current_character!=10 && current_character!=13 && current_character!=9)
{
// record number of columns and lines used
- if (position_x>position_x_max)
+ if (column>columnMax)
{
- position_x_max=position_x;
+ columnMax=column;
}
- if (position_y>position_y_max)
+ if (row>rowMax)
{
- position_y_max=position_y;
+ rowMax=row;
}
// write current character in ansiChar structure
@@ -394,19 +394,19 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil
ansi_buffer[structIndex].bold = bold;
ansi_buffer[structIndex].italics = italics;
ansi_buffer[structIndex].underline = underline;
- ansi_buffer[structIndex].position_x = position_x;
- ansi_buffer[structIndex].position_y = position_y;
+ ansi_buffer[structIndex].column = column;
+ ansi_buffer[structIndex].row = row;
structIndex++;
- position_x++;
+ column++;
}
}
loop++;
}
// allocate image buffer memory
- position_x_max++;
- position_y_max++;
+ columnMax++;
+ rowMax++;
if (ced)
{
@@ -414,11 +414,11 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil
}
if (isDizFile) {
- columns = fmin(position_x_max,80);
+ columns = fmin(columnMax,80);
}
// create that damn thingy
- canvas = gdImageCreate(columns * bits,(position_y_max)*fontData.height);
+ canvas = gdImageCreate(columns * bits,(rowMax)*fontData.height);
if (!canvas) {
perror("Can't allocate ANSi buffer image memory");
@@ -492,15 +492,15 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil
bold = ansi_buffer[loop].bold;
italics = ansi_buffer[loop].italics;
underline = ansi_buffer[loop].underline;
- position_x = ansi_buffer[loop].position_x;
- position_y = ansi_buffer[loop].position_y;
+ column = ansi_buffer[loop].column;
+ row = ansi_buffer[loop].row;
if (ced) {
drawchar(canvas, fontData.font_data, bits, fontData.height,
- position_x, position_y, ced_background, ced_foreground, character);
+ column, row, ced_background, ced_foreground, character);
} else {
drawchar(canvas, fontData.font_data, bits, fontData.height,
- position_x, position_y, colors[background], colors[foreground], character);
+ column, row, colors[background], colors[foreground], character);
}
}
diff --git a/src/loaders/ansi.h b/src/loaders/ansi.h
@@ -16,8 +16,8 @@
// Character structure
struct ansiChar {
- int32_t position_x;
- int32_t position_y;
+ int32_t column;
+ int32_t row;
int32_t background;
int32_t foreground;
int32_t current_character;
diff --git a/src/loaders/artworx.c b/src/loaders/artworx.c
@@ -56,16 +56,16 @@ void artworx(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output
gdImageColorAllocate(canvas, 0, 0, 0);
// process ADF
- int32_t position_x = 0, position_y = 0;
+ int32_t column = 0, row = 0;
int32_t character, attribute, foreground, background;
loop = 192 + 4096 + 1;
while(loop < inputFileSize)
{
- if (position_x == 80)
+ if (column == 80)
{
- position_x = 0;
- position_y++;
+ column = 0;
+ row++;
}
character = inputFileBuffer[loop];
@@ -74,9 +74,9 @@ void artworx(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output
background = (attribute & 240) >> 4;
foreground = attribute & 15;
- drawchar(canvas, font_data, 8, 16, position_x, position_y, background, foreground, character);
+ drawchar(canvas, font_data, 8, 16, column, row, background, foreground, character);
- position_x++;
+ column++;
loop+=2;
}
diff --git a/src/loaders/binary.c b/src/loaders/binary.c
@@ -62,14 +62,14 @@ void binary(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputF
// process binary
int32_t character, attribute, background, foreground;
- int32_t loop = 0, position_x = 0, position_y = 0;
+ int32_t loop = 0, column = 0, row = 0;
while (loop < inputFileSize)
{
- if (position_x == columns)
+ if (column == columns)
{
- position_x = 0;
- position_y++;
+ column = 0;
+ row++;
}
character = inputFileBuffer[loop];
@@ -84,9 +84,9 @@ void binary(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputF
}
drawchar(canvas, fontData.font_data, bits, fontData.height,
- position_x, position_y, colors[background], colors[foreground], character);
+ column, row, colors[background], colors[foreground], character);
- position_x++;
+ column++;
loop+=2;
}
diff --git a/src/loaders/icedraw.c b/src/loaders/icedraw.c
@@ -114,15 +114,15 @@ void icedraw(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output
}
// render IDF
- int32_t position_x = 0, position_y = 0;
+ int32_t column = 0, row = 0;
int32_t character, attribute, foreground, background;
for (loop = 0; loop < i ; loop +=2)
{
- if (position_x == x2 + 1)
+ if (column == x2 + 1)
{
- position_x = 0;
- position_y++;
+ column = 0;
+ row++;
}
character = idf_buffer[loop];
@@ -131,9 +131,9 @@ void icedraw(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output
background = (attribute & 240) >> 4;
foreground = attribute & 15;
- drawchar(canvas, font_data, 8, 16, position_x, position_y, colors[background], colors[foreground], character);
+ drawchar(canvas, font_data, 8, 16, column, row, colors[background], colors[foreground], character);
- position_x++;
+ column++;
}
// create output file
diff --git a/src/loaders/pcboard.c b/src/loaders/pcboard.c
@@ -27,7 +27,7 @@ void pcboard(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output
// process PCBoard
int32_t character, current_character, next_character;
int32_t background = 0, foreground = 7;
- int32_t position_x = 0, position_y = 0, position_x_max = 0, position_y_max = 0;
+ int32_t column = 0, row = 0, columnMax = 0, rowMax = 0;
// PCB buffer structure array definition
struct pcbChar *pcboard_buffer, *temp;
@@ -44,30 +44,30 @@ void pcboard(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output
current_character = inputFileBuffer[loop];
next_character = inputFileBuffer[loop+1];
- if (position_x == 80)
+ if (column == 80)
{
- position_y++;
- position_x = 0;
+ row++;
+ column = 0;
}
// CR + LF
if (current_character == 13 && next_character == 10) {
- position_y++;
- position_x = 0;
+ row++;
+ column = 0;
loop++;
}
// LF
if (current_character == 10)
{
- position_y++;
- position_x = 0;
+ row++;
+ column = 0;
}
// Tab
if (current_character==9)
{
- position_x+=8;
+ column+=8;
}
// Sub
@@ -88,11 +88,11 @@ void pcboard(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output
inputFileBuffer[loop+2] == 'L' && inputFileBuffer[loop+3] == 'S')
{
// erase display
- position_x = 0;
- position_y = 0;
+ column = 0;
+ row = 0;
- position_x_max = 0;
- position_y_max = 0;
+ columnMax = 0;
+ rowMax = 0;
loop+=4;
}
@@ -102,26 +102,26 @@ void pcboard(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output
// cursor position
if (inputFileBuffer[loop+6]=='@')
{
- position_x=((inputFileBuffer[loop+5])-48)-1;
+ column=((inputFileBuffer[loop+5])-48)-1;
loop+=5;
}
else
{
- position_x = (10 * ((inputFileBuffer[loop+5])-48) + (inputFileBuffer[loop+6])-48)-1;
+ column = (10 * ((inputFileBuffer[loop+5])-48) + (inputFileBuffer[loop+6])-48)-1;
loop+=6;
}
}
else if (current_character != 10 && current_character != 13 && current_character != 9)
{
// record number of columns and lines used
- if (position_x > position_x_max)
+ if (column > columnMax)
{
- position_x_max = position_x;
+ columnMax = column;
}
- if (position_y > position_y_max)
+ if (row > rowMax)
{
- position_y_max = position_y;
+ rowMax = row;
}
// reallocate structure array memory
@@ -129,22 +129,22 @@ void pcboard(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output
pcboard_buffer = temp;
// write current character in pcbChar structure
- pcboard_buffer[structIndex].position_x = position_x;
- pcboard_buffer[structIndex].position_y = position_y;
+ pcboard_buffer[structIndex].column = column;
+ pcboard_buffer[structIndex].row = row;
pcboard_buffer[structIndex].background = background;
pcboard_buffer[structIndex].foreground = foreground;
pcboard_buffer[structIndex].current_character = current_character;
- position_x++;
+ column++;
structIndex++;
}
loop++;
}
- position_x_max++;
- position_y_max++;
+ columnMax++;
+ rowMax++;
// allocate buffer image memory
- canvas = gdImageCreate(columns * bits, (position_y_max)*fontData.height);
+ canvas = gdImageCreate(columns * bits, (rowMax)*fontData.height);
// allocate black color and create background canvas
gdImageColorAllocate(canvas, 0, 0, 0);
@@ -177,14 +177,14 @@ void pcboard(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output
for (loop = 0; loop < pcbBufferItems; loop++)
{
// grab our chars out of the structure
- position_x = pcboard_buffer[loop].position_x;
- position_y = pcboard_buffer[loop].position_y;
+ column = pcboard_buffer[loop].column;
+ row = pcboard_buffer[loop].row;
background = pcboard_buffer[loop].background;
foreground = pcboard_buffer[loop].foreground;
character = pcboard_buffer[loop].current_character;
drawchar(canvas, fontData.font_data, bits, fontData.height,
- position_x, position_y, colors[background], colors[foreground], character);
+ column, row, colors[background], colors[foreground], character);
}
// create output image
diff --git a/src/loaders/pcboard.h b/src/loaders/pcboard.h
@@ -16,8 +16,8 @@
// Character structure
struct pcbChar {
- int32_t position_x;
- int32_t position_y;
+ int32_t column;
+ int32_t row;
int32_t background;
int32_t foreground;
int32_t current_character;
diff --git a/src/loaders/tundra.c b/src/loaders/tundra.c
@@ -37,27 +37,27 @@ void tundra(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputF
// read tundra file a first time to find the image size
int32_t character, background = 0, foreground = 0;
- int32_t loop = 0, position_x = 0, position_y = 0;
+ int32_t loop = 0, column = 0, row = 0;
loop=9;
while (loop < inputFileSize)
{
- if (position_x == 80)
+ if (column == 80)
{
- position_x = 0;
- position_y++;
+ column = 0;
+ row++;
}
character = inputFileBuffer[loop];
if (character == 1)
{
- position_y =
+ row =
(inputFileBuffer[loop + 1] << 24) + (inputFileBuffer[loop + 2] << 16) +
(inputFileBuffer[loop + 3] << 8) + inputFileBuffer[loop+4];
- position_x =
+ column =
(inputFileBuffer[loop + 5] << 24) + (inputFileBuffer[loop + 6] << 16) +
(inputFileBuffer[loop + 7] << 8) + inputFileBuffer[loop+8];
@@ -87,15 +87,15 @@ void tundra(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputF
if (character !=1 && character !=2 && character !=4 && character != 6)
{
- position_x++;
+ column++;
}
loop++;
}
- position_y++;
+ row++;
// allocate buffer image memory
- canvas = gdImageCreateTrueColor(columns * bits , (position_y) * fontData.height);
+ canvas = gdImageCreateTrueColor(columns * bits , (row) * fontData.height);
if (!canvas) {
perror("Error, can't allocate buffer image memory");
@@ -103,28 +103,28 @@ void tundra(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputF
}
// process tundra
- position_x = 0;
- position_y = 0;
+ column = 0;
+ row = 0;
loop = 9;
while (loop < inputFileSize)
{
- if (position_x == 80)
+ if (column == 80)
{
- position_x = 0;
- position_y++;
+ column = 0;
+ row++;
}
character = inputFileBuffer[loop];
if (character == 1)
{
- position_y =
+ row =
(inputFileBuffer[loop + 1] << 24) + (inputFileBuffer[loop + 2] << 16) +
(inputFileBuffer[loop + 3] << 8) + inputFileBuffer[loop + 4];
- position_x =
+ column =
(inputFileBuffer[loop + 5] << 24) + (inputFileBuffer[loop + 6] << 16) +
(inputFileBuffer[loop + 7] << 8) + inputFileBuffer[loop + 8];
@@ -170,9 +170,9 @@ void tundra(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputF
if (character !=1 && character !=2 && character !=4 && character !=6)
{
drawchar(canvas, fontData.font_data, bits, fontData.height,
- position_x, position_y, background, foreground, character);
+ column, row, background, foreground, character);
- position_x++;
+ column++;
}
loop++;
diff --git a/src/loaders/xbin.c b/src/loaders/xbin.c
@@ -96,12 +96,12 @@ void xbin(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil
font_data = font_pc_80x25;
}
- int32_t position_x = 0, position_y = 0;
+ int32_t column = 0, row = 0;
int32_t character, attribute, foreground, background;
// read compressed xbin
if( (xbin_flags & 4) == 4) {
- while(offset < inputFileSize && position_y != xbin_height )
+ while(offset < inputFileSize && row != xbin_height )
{
int32_t ctype = inputFileBuffer[ offset ] & 0xC0;
int32_t counter = ( inputFileBuffer[ offset ] & 0x3F ) + 1;
@@ -150,26 +150,26 @@ void xbin(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil
background = (attribute & 240) >> 4;
foreground = attribute & 15;
- drawchar(canvas, font_data, 8, 16, position_x, position_y, colors[background], colors[foreground], character);
+ drawchar(canvas, font_data, 8, 16, column, row, colors[background], colors[foreground], character);
- position_x++;
+ column++;
- if (position_x == xbin_width)
+ if (column == xbin_width)
{
- position_x = 0;
- position_y++;
+ column = 0;
+ row++;
}
}
}
}
// read uncompressed xbin
else {
- while(offset < inputFileSize && position_y != xbin_height )
+ while(offset < inputFileSize && row != xbin_height )
{
- if (position_x == xbin_width)
+ if (column == xbin_width)
{
- position_x = 0;
- position_y++;
+ column = 0;
+ row++;
}
character = inputFileBuffer[offset];
@@ -178,9 +178,9 @@ void xbin(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil
background = (attribute & 240) >> 4;
foreground = attribute & 15;
- drawchar(canvas, font_data, 8, xbin_fontsize, position_x, position_y, colors[background], colors[foreground], character);
+ drawchar(canvas, font_data, 8, xbin_fontsize, column, row, colors[background], colors[foreground], character);
- position_x++;
+ column++;
offset+=2;
}
}