mirror of
https://github.com/Orc/discount.git
synced 2026-09-25 04:10:00 +03:00
create a typedef for the function argument to mkd_string_to_anchor, because some
compilers (and by some compilers, I mean "gcc") whine bitterly when you pass a function argument with with a more specific pointer in place of a void*. And if I can't trust the compiler to emit sensible warnings, I'll just cast the damned argument to a type that makes it stfu. In addition, I needed to add prototypes for the html5 tag adder and the two functions that spit out a list of the flags that the code was compiled with.
This commit is contained in:
+4
-2
@@ -1342,7 +1342,9 @@ printheader(Paragraph *pp, MMIOT *f)
|
||||
{
|
||||
if ( f->flags & MKD_TOC ) {
|
||||
Qstring("<a name=\"", f);
|
||||
mkd_string_to_anchor(T(pp->text->text), S(pp->text->text), Qchar, f, 1);
|
||||
mkd_string_to_anchor(T(pp->text->text),
|
||||
S(pp->text->text),
|
||||
(mkd_sta_function_t)Qchar, f, 1);
|
||||
Qstring("\"></a>\n", f);
|
||||
}
|
||||
Qprintf(f, "<h%d>", pp->hnumber);
|
||||
@@ -1648,7 +1650,7 @@ display(Paragraph *p, MMIOT *f)
|
||||
static void
|
||||
mkd_extra_footnotes(MMIOT *m)
|
||||
{
|
||||
int j, i, prefix=0;
|
||||
int j, i;
|
||||
Footnote *t;
|
||||
|
||||
if ( m->reference == 0 )
|
||||
|
||||
@@ -39,7 +39,7 @@ char *pgm = "markdown";
|
||||
static struct {
|
||||
char *name;
|
||||
int off;
|
||||
int flag;
|
||||
mkd_flag_t flag;
|
||||
} opts[] = {
|
||||
{ "tabstop", 0, MKD_TABSTOP },
|
||||
{ "image", 1, MKD_NOIMAGE },
|
||||
@@ -72,7 +72,7 @@ static struct {
|
||||
|
||||
|
||||
void
|
||||
set(int *flags, char *optionstring)
|
||||
set(mkd_flag_t *flags, char *optionstring)
|
||||
{
|
||||
int i;
|
||||
int enable;
|
||||
@@ -119,7 +119,7 @@ main(int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
int rc;
|
||||
int flags = 0;
|
||||
mkd_flag_t flags = 0;
|
||||
int debug = 0;
|
||||
int toc = 0;
|
||||
int version = 0;
|
||||
|
||||
+3
-1
@@ -149,7 +149,9 @@ extern int mkd_line(char *, int, char **, DWORD);
|
||||
extern int mkd_generateline(char *, int, FILE*, DWORD);
|
||||
#define mkd_text mkd_generateline
|
||||
extern void mkd_basename(Document*, char *);
|
||||
extern void mkd_string_to_anchor(char*,int, void(*)(int,void*), void*, int);
|
||||
|
||||
typedef int (*mkd_sta_function_t)(const int,const void*);
|
||||
extern void mkd_string_to_anchor(char*,int, mkd_sta_function_t, void*, int);
|
||||
|
||||
extern Document *mkd_in(FILE *, DWORD);
|
||||
extern Document *mkd_string(char*,int, DWORD);
|
||||
|
||||
@@ -215,7 +215,7 @@ markdown(Document *document, FILE *out, int flags)
|
||||
/* write out a Cstring, mangled into a form suitable for `<a href=` or `<a id=`
|
||||
*/
|
||||
void
|
||||
mkd_string_to_anchor(char *s, int len, void(*outchar)(int,void*),
|
||||
mkd_string_to_anchor(char *s, int len, mkd_sta_function_t outchar,
|
||||
void *out, int labelformat)
|
||||
{
|
||||
unsigned char c;
|
||||
|
||||
+6
-1
@@ -15,6 +15,7 @@ MMIOT *mkd_string(char*,int,mkd_flag_t); /* assemble input from a buffer */
|
||||
void mkd_basename(MMIOT*,char*);
|
||||
|
||||
void mkd_initialize();
|
||||
void mkd_with_html5_tags();
|
||||
void mkd_shlib_destructor();
|
||||
|
||||
/* compilation, debugging, cleanup
|
||||
@@ -27,7 +28,8 @@ int mkd_cleanup(MMIOT*);
|
||||
int mkd_dump(MMIOT*, FILE*, int, char*);
|
||||
int markdown(MMIOT*, FILE*, mkd_flag_t);
|
||||
int mkd_line(char *, int, char **, mkd_flag_t);
|
||||
void mkd_string_to_anchor(char *, int, int (*)(int,void*), void*, int);
|
||||
typedef int (*mkd_sta_function_t)(const int,const void*);
|
||||
void mkd_string_to_anchor(char *, int, mkd_sta_function_t, void*, int);
|
||||
int mkd_xhtmlpage(MMIOT*,int,FILE*);
|
||||
|
||||
/* header block access
|
||||
@@ -66,6 +68,9 @@ void mkd_e_data(void *, void *);
|
||||
/* version#.
|
||||
*/
|
||||
extern char markdown_version[];
|
||||
void mkd_mmiot_flags(FILE *, MMIOT *, int);
|
||||
void mkd_flags_are(FILE*, mkd_flag_t, int);
|
||||
|
||||
|
||||
/* special flags for markdown() and mkd_text()
|
||||
*/
|
||||
|
||||
@@ -52,10 +52,12 @@ mkd_toc(Document *p, char **doc)
|
||||
}
|
||||
Csprintf(&res, "%*s<li><a href=\"#", srcp->hnumber, "");
|
||||
mkd_string_to_anchor(T(srcp->text->text),
|
||||
S(srcp->text->text), Csputc, &res,1);
|
||||
S(srcp->text->text),
|
||||
(mkd_sta_function_t)Csputc, &res,1);
|
||||
Csprintf(&res, "\">");
|
||||
mkd_string_to_anchor(T(srcp->text->text),
|
||||
S(srcp->text->text), Csputc, &res,0);
|
||||
S(srcp->text->text),
|
||||
(mkd_sta_function_t)Csputc, &res,0);
|
||||
Csprintf(&res, "</a>");
|
||||
Csprintf(&res, "</li>\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user