Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
libvilistextum: get rid of global variable zeilen_pos
Browse files Browse the repository at this point in the history
Update lists.h

Update html_tag.c

include headers in c-files to let compiler check function headers
  • Loading branch information
jangernert committed Sep 1, 2017
1 parent 86a7000 commit 1171648
Show file tree
Hide file tree
Showing 17 changed files with 182 additions and 171 deletions.
1 change: 1 addition & 0 deletions libVilistextum/charset.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "vilistextum.h"
#include "text.h"
#include "multibyte.h"
#include "charset.h"

char *default_charset = "iso-8859-1";
char iconv_charset[DEF_STR_LEN];
Expand Down
7 changes: 4 additions & 3 deletions libVilistextum/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "charset.h"
#include "multibyte.h"
#include "vilistextum.h"
#include "fileio.h"

#include <iconv.h>
#include <locale.h>
Expand Down Expand Up @@ -104,12 +105,12 @@ char* getOutput(size_t input_length, int error)

/* ------------------------------------------------ */

void finalize(int nooutput, int spaces, int breite, int error, int zeilen_len, int zeilen_len_old)
void finalize(int nooutput, int spaces, int breite, int error, int zeilen_len, int zeilen_len_old, int zeilen_pos)
{
if (!is_zeile_empty())
{
wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old);
print_zeile(nooutput, breite, error, zeilen_len, zeilen_len_old);
wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old, zeilen_pos);
print_zeile(nooutput, breite, error, zeilen_len, zeilen_len_old, zeilen_pos);
}
}

Expand Down
4 changes: 2 additions & 2 deletions libVilistextum/fileio.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
#include "multibyte.h"

void init_buffer(char *input, int error);
void output_string(CHAR *str, int error);
void output_string(CHAR *str);

int get_current_char();
int read_char(int error);
void putback_char(CHAR c);
void finalize(int nooutput, int spaces, int breite, int error, int zeilen_len, int zeilen_len_old);
void finalize(int nooutput, int spaces, int breite, int error, int zeilen_len, int zeilen_len_old, int zeilen_pos);
char* getOutput();

struct TextBuffer
Expand Down
53 changes: 27 additions & 26 deletions libVilistextum/html.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "fileio.h"
#include "charset.h"
#include "util.h"
#include "html.h"

int pre=0; /* for PRE-Tag */
int processed_meta=0; /* only parse meta tags once */
Expand Down Expand Up @@ -136,7 +137,7 @@ int get_attr(int error)

/* ------------------------------------------------ */

void html(int extractText, int nooutput, int spaces, int paragraph, int breite, int error, int zeilen_len, int zeilen_len_old)
void html(int extractText, int nooutput, int spaces, int paragraph, int breite, int error, int zeilen_len, int zeilen_len_old, int zeilen_pos)
{
int i;
CHAR str[DEF_STR_LEN];
Expand All @@ -151,13 +152,13 @@ void html(int extractText, int nooutput, int spaces, int paragraph, int breite,
//printf("'%ls'\n", &ch);
if(ch == EOF)
{
wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old);
wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old, zeilen_pos);
return;
}
switch (ch)
{
case '<':
html_tag(nooutput, spaces, paragraph, breite, error, zeilen_len, zeilen_len_old);
html_tag(nooutput, spaces, paragraph, breite, error, zeilen_len, zeilen_len_old, zeilen_pos);
break;

/* Entities */
Expand Down Expand Up @@ -194,14 +195,14 @@ void html(int extractText, int nooutput, int spaces, int paragraph, int breite,
if (pre) {
wort_plus_ch(0x09);
} else {
wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old);
wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old, zeilen_pos);
}
break;

case 13: /* CR */
case '\n':
wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old);
if (pre) { line_break(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old); }
wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old, zeilen_pos);
if (pre) { line_break(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old, zeilen_pos); }
break;

/* Microsoft ... */
Expand All @@ -214,7 +215,7 @@ void html(int extractText, int nooutput, int spaces, int paragraph, int breite,

default:
if (pre==0) {
if (ch==' ') { wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old); }
if (ch==' ') { wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old, zeilen_pos); }
else { wort_plus_ch(ch); }
}
else { wort_plus_ch(ch); }
Expand All @@ -229,7 +230,7 @@ void html(int extractText, int nooutput, int spaces, int paragraph, int breite,
ch = read_char(error);
if(ch == EOF)
{
wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old);
wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old, zeilen_pos);
return;
}
switch (ch)
Expand Down Expand Up @@ -268,14 +269,14 @@ void html(int extractText, int nooutput, int spaces, int paragraph, int breite,
if (pre) {
wort_plus_ch(0x09);
} else {
wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old);
wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old, zeilen_pos);
}
break;

case 13: /* CR */
case '\n':
wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old);
if (pre) { line_break(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old); }
wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old, zeilen_pos);
if (pre) { line_break(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old, zeilen_pos); }
break;

/* Microsoft ... */
Expand All @@ -288,7 +289,7 @@ void html(int extractText, int nooutput, int spaces, int paragraph, int breite,

default:
if (pre==0) {
if (ch==' ') { wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old); }
if (ch==' ') { wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old, zeilen_pos); }
else { wort_plus_ch(ch); }
}
else { wort_plus_ch(ch); }
Expand Down Expand Up @@ -323,30 +324,30 @@ void check_for_center(int error)

/* ------------------------------------------------ */

void start_p(int nooutput, int spaces, int paragraph, int breite, int error, int zeilen_len, int zeilen_len_old)
void start_p(int nooutput, int spaces, int paragraph, int breite, int error, int zeilen_len, int zeilen_len_old, int zeilen_pos)
{
push_align(LEFT);
neuer_paragraph(nooutput, spaces, paragraph, breite, error, zeilen_len, zeilen_len_old);
neuer_paragraph(nooutput, spaces, paragraph, breite, error, zeilen_len, zeilen_len_old, zeilen_pos);
check_for_center(error);
}

/* ------------------------------------------------ */

void start_div(int a, int nooutput, int spaces, int breite, int error, int zeilen_len, int zeilen_len_old)
void start_div(int a, int nooutput, int spaces, int breite, int error, int zeilen_len, int zeilen_len_old, int zeilen_pos)
{
line_break(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old);
line_break(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old, zeilen_pos);
if (a!=0) { push_align(a); }
else { check_for_center(error); }
}

/* ------------------------------------------------ */

void end_div(int nooutput, int spaces, int paragraph, int breite, int error, int zeilen_len, int zeilen_len_old)
void end_div(int nooutput, int spaces, int paragraph, int breite, int error, int zeilen_len, int zeilen_len_old, int zeilen_pos)
{
wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old);
wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old, zeilen_pos);

if (paragraph!=0) { paragraphen_ende(nooutput, spaces, paragraph, breite, error, zeilen_len, zeilen_len_old); }
else { print_zeile(nooutput, breite, error, zeilen_len, zeilen_len_old); }
if (paragraph!=0) { paragraphen_ende(nooutput, spaces, paragraph, breite, error, zeilen_len, zeilen_len_old, zeilen_pos); }
else { print_zeile(nooutput, breite, error, zeilen_len, zeilen_len_old, zeilen_pos); }
pop_align(); /* einer für start_div */
}

Expand Down Expand Up @@ -453,10 +454,10 @@ CHAR friss_kommentar(int error)

/* ------------------------------------------------ */

int start_nooutput(int nooutput, int spaces, int breite, int error, int zeilen_len, int zeilen_len_old)
int start_nooutput(int nooutput, int spaces, int breite, int error, int zeilen_len, int zeilen_len_old, int zeilen_pos)
{
wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old);
print_zeile(nooutput, breite, error, zeilen_len, zeilen_len_old);
wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old, zeilen_pos);
print_zeile(nooutput, breite, error, zeilen_len, zeilen_len_old, zeilen_pos);
nooutput = 1;

while (ch!='>' && ch!=EOF)
Expand All @@ -471,10 +472,10 @@ int start_nooutput(int nooutput, int spaces, int breite, int error, int zeilen_l
return nooutput;
}

int end_nooutput(int nooutput, int spaces, int breite, int error, int zeilen_len, int zeilen_len_old)
int end_nooutput(int nooutput, int spaces, int breite, int error, int zeilen_len, int zeilen_len_old, int zeilen_pos)
{
wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old);
print_zeile(nooutput, breite, error, zeilen_len, zeilen_len_old);
wort_ende(nooutput, spaces, breite, error, zeilen_len, zeilen_len_old, zeilen_pos);
print_zeile(nooutput, breite, error, zeilen_len, zeilen_len_old, zeilen_pos);
nooutput = 0;
return nooutput;
}
Expand Down
12 changes: 6 additions & 6 deletions libVilistextum/html.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ int get_new_attr(CHAR *name, CHAR *content);
CHAR attr_name[DEF_STR_LEN];
CHAR attr_ctnt[DEF_STR_LEN];

void html(int extractText, int nooutput, int spaces, int paragraph, int breite, int error, int zeilen_len, int zeilen_len_old);
void html(int extractText, int nooutput, int spaces, int paragraph, int breite, int error, int zeilen_len, int zeilen_len_old, int zeilen_pos);
void check_for_center(int error);
void start_p(int nooutput, int spaces, int paragraph, int breite, int error, int zeilen_len);
void start_div(int a, int nooutput, int spaces, int breite, int error, int zeilen_len, int zeilen_len_old);
void end_div(int nooutput, int spaces, int paragraph, int breite, int error, int zeilen_len, int zeilen_len_old);
void start_p(int nooutput, int spaces, int paragraph, int breite, int error, int zeilen_len, int zeilen_len_old, int zeilen_pos);
void start_div(int a, int nooutput, int spaces, int breite, int error, int zeilen_len, int zeilen_len_old, int zeilen_pos);
void end_div(int nooutput, int spaces, int paragraph, int breite, int error, int zeilen_len, int zeilen_len_old, int zeilen_pos);
CHAR friss_kommentar(int error);

void find_encoding(int error);
void find_xml_encoding(int error);

void href_link_inline_output();

void start_nooutput(int nooutput, int spaces, int breite, int error, int zeilen_len, int zeilen_len_old);
void end_nooutput(int nooutput, int spaces, int breite, int error, int zeilen_len, int zeilen_len_old);
int start_nooutput(int nooutput, int spaces, int breite, int error, int zeilen_len, int zeilen_len_old, int zeilen_pos);
int end_nooutput(int nooutput, int spaces, int breite, int error, int zeilen_len, int zeilen_len_old, int zeilen_pos);
#endif
Loading

0 comments on commit 1171648

Please sign in to comment.