moving functions
This commit is contained in:
parent
4696810e4b
commit
f86e34f88c
1 changed files with 19 additions and 14 deletions
33
cmarkdown.c
33
cmarkdown.c
|
@ -24,7 +24,6 @@ struct Tag {
|
||||||
|
|
||||||
|
|
||||||
void eprint(const char *format, ...); /* Prints error and exits */
|
void eprint(const char *format, ...); /* Prints error and exits */
|
||||||
void hprint(const char *begin, const char *end); /* escapes HTML and prints it to stdout*/
|
|
||||||
unsigned int doamp(const char *begin, const char *end, int first);
|
unsigned int doamp(const char *begin, const char *end, int first);
|
||||||
/* Parser for & */
|
/* Parser for & */
|
||||||
unsigned int dohtml(const char *begin, const char *end, int first);
|
unsigned int dohtml(const char *begin, const char *end, int first);
|
||||||
|
@ -45,6 +44,7 @@ unsigned int dosurround(const char *begin, const char *end, int first);
|
||||||
/* Parser for surrounding tags */
|
/* Parser for surrounding tags */
|
||||||
unsigned int dounderline(const char *begin, const char *end, int first);
|
unsigned int dounderline(const char *begin, const char *end, int first);
|
||||||
/* Parser for underline tags */
|
/* Parser for underline tags */
|
||||||
|
void hprint(const char *begin, const char *end); /* escapes HTML and prints it to stdout*/
|
||||||
void process(const char *begin, const char *end, int isblock);
|
void process(const char *begin, const char *end, int isblock);
|
||||||
/* Processes range between begin and end. */
|
/* Processes range between begin and end. */
|
||||||
|
|
||||||
|
@ -117,19 +117,6 @@ eprint(const char *format, ...) {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
hprint(const char *begin, const char *end) {
|
|
||||||
const char *p;
|
|
||||||
|
|
||||||
for(p = begin; p && p != end; p++) {
|
|
||||||
if(*p == '&') fputs("&",stdout);
|
|
||||||
else if(*p == '"') fputs(""",stdout);
|
|
||||||
else if(*p == '>') fputs(">",stdout);
|
|
||||||
else if(*p == '<') fputs("<",stdout);
|
|
||||||
else putchar(*p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
doamp(const char *begin, const char *end, int first) {
|
doamp(const char *begin, const char *end, int first) {
|
||||||
const char *p;
|
const char *p;
|
||||||
|
@ -475,6 +462,24 @@ dounderline(const char *begin, const char *end, int first) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
hprint(const char *begin, const char *end) {
|
||||||
|
const char *p;
|
||||||
|
|
||||||
|
for(p = begin; p && p != end; p++) {
|
||||||
|
if(*p == '&')
|
||||||
|
fputs("&",stdout);
|
||||||
|
else if(*p == '"')
|
||||||
|
fputs(""",stdout);
|
||||||
|
else if(*p == '>')
|
||||||
|
fputs(">",stdout);
|
||||||
|
else if(*p == '<')
|
||||||
|
fputs("<",stdout);
|
||||||
|
else
|
||||||
|
putchar(*p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
process(const char *begin, const char *end, int isblock) {
|
process(const char *begin, const char *end, int isblock) {
|
||||||
const char *p, *q;
|
const char *p, *q;
|
||||||
|
|
Loading…
Add table
Reference in a new issue