File: markdown_rstubs.c

package info (click to toggle)
r-cran-markdown 1.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 552 kB
  • sloc: ansic: 4,618; sh: 32; makefile: 7
file content (242 lines) | stat: -rw-r--r-- 7,753 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
/*
 * markdown_rstubs.c
 * 
 * Copyright (C) 2009-2013 by RStudio, Inc.
 * 
 * This program is licensed to you under the terms of version 2 of the
 * GNU General Public License. This program is distributed WITHOUT ANY
 * EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
 * GPL (http://www.gnu.org/licenses/gpl-2.0.txt) for more details.
 *
 */

/* Inspird by Matrix/inst/include/Matrix_stubs.c */

#include "markdown_rstubs.h"

int rstub_bufgrow(struct buf *buf, size_t sz)
{
   static int (*fun)(struct buf *, size_t) = NULL;
   if (fun==NULL)
      fun = (int (*)(struct buf *,size_t))R_GetCCallable("markdown","bufgrow");
   return fun(buf,sz);
}

struct buf *rstub_bufnew(size_t sz)
{
   static struct buf *(*fun)(size_t) = NULL;
   if (fun==NULL)
      fun = (struct buf *(*)(size_t))R_GetCCallable("markdown","bufnew");
   return fun(sz);
}

const char *rstub_bufcstr(struct buf *buf)
{
   static const char *(*fun)(struct buf *) = NULL;
   if (fun==NULL)
      fun = (const char *(*)(struct buf *))R_GetCCallable("markdown","bufcstr");
   return fun(buf);
}

int rstub_bufprefix(const struct buf *buf, const char *prefix)
{
   static int (*fun)(const struct buf *, const char *) = NULL;
   if (fun==NULL)
      fun = (int (*)(const struct buf *, const char *))R_GetCCallable("markdown","bufprefix");
   return fun(buf,prefix);
}

void rstub_bufput(struct buf *buf, const void *v, size_t sz)
{
   static void (*fun)(struct buf *, const void *, size_t) = NULL;
   if (fun==NULL)
      fun = (void (*)(struct buf *, const void *, size_t))R_GetCCallable("markdown","bufput");
   return fun(buf,v,sz);
}

void rstub_bufputs(struct buf *buf, const char *c)
{
   static void (*fun)(struct buf *, const char *) = NULL;
   if (fun==NULL)
      fun = (void (*)(struct buf *, const char *))R_GetCCallable("markdown","bufputs");
   return fun(buf,c);
}

void rstub_bufputc(struct buf *buf, int i)
{
   static void (*fun)(struct buf *, int) = NULL;
   if (fun==NULL)
      fun = (void (*)(struct buf *, int))R_GetCCallable("markdown","bufputc");
   return fun(buf,i);
}

void rstub_bufrelease(struct buf *buf)
{
   static void (*fun)(struct buf *) = NULL;
   if (fun==NULL)
      fun = (void (*)(struct buf *t))R_GetCCallable("markdown","bufrelease");
   return fun(buf);
}
   
void rstub_bufreset(struct buf *buf)
{
   static void (*fun)(struct buf *) = NULL;
   if (fun==NULL)
      fun = (void (*)(struct buf *t))R_GetCCallable("markdown","bufreset");
   return fun(buf);
}

void rstub_bufslurp(struct buf *buf, size_t sz)
{
   static int (*fun)(struct buf *, size_t) = NULL;
   if (fun==NULL)
      fun = (int (*)(struct buf *,size_t))R_GetCCallable("markdown","bufslurp");
   fun(buf,sz);
}

void rstub_bufprintf(struct buf *buf, const char *fmt, ...)
{
   va_list ap;
   static int (*fun)(struct buf *, const char *, ...) = NULL;
   if (fun==NULL)
      fun = (int (*)(struct buf *,const char *, ...))
         R_GetCCallable("markdown","bufprintf");

	va_start(ap, fmt);
   fun(buf,fmt,ap);
   va_end(ap);
}

int
rstub_sd_autolink_issafe(const uint8_t *link, size_t link_len){
   static int (*fun)(const uint8_t *, size_t) = NULL;
   if (fun==NULL)
      fun = (int (*)(const uint8_t *, size_t))
         R_GetCCallable("markdown","sd_autolink_issafe");
   return fun(link,link_len);
}

size_t
rstub_sd_autolink__www(size_t *rewind_p, struct buf *link, uint8_t *data,
                     size_t offset, size_t size)
{
   static size_t (*fun)(size_t *rewind_p, struct buf *link, uint8_t *data,
                        size_t offset, size_t size) = NULL;
   if (fun==NULL)
      fun = (size_t (*)(size_t *rewind_p, struct buf *link, uint8_t *data,
                           size_t offset, size_t size))
         R_GetCCallable("markdown","sd_autolink__www");
   return fun(rewind_p,link,data,offset,size);
}

size_t
rstub_sd_autolink__email(size_t *rewind_p, struct buf *link, uint8_t *data,
                       size_t offset, size_t size)
{
   static size_t (*fun)(size_t *rewind_p, struct buf *link, uint8_t *data,
                        size_t offset, size_t size) = NULL;
   if (fun==NULL)
      fun = (size_t (*)(size_t *rewind_p, struct buf *link, uint8_t *data,
                           size_t offset, size_t size))
         R_GetCCallable("markdown","sd_autolink__email");
   return fun(rewind_p,link,data,offset,size);
}

size_t
rstub_sd_autolink__url(size_t *rewind_p, struct buf *link, uint8_t *data,
                     size_t offset, size_t size)
{
   static size_t (*fun)(size_t *rewind_p, struct buf *link, uint8_t *data,
                        size_t offset, size_t size) = NULL;
   if (fun==NULL)
      fun = (size_t (*)(size_t *rewind_p, struct buf *link, uint8_t *data,
                           size_t offset, size_t size))
         R_GetCCallable("markdown","sd_autolink__url");
   return fun(rewind_p,link,data,offset,size);
}

struct sd_markdown *
rstub_sd_markdown_new(unsigned int extensions, size_t max_nesting,
                    const struct sd_callbacks *callbacks, void *opaque)
{
   static struct sd_markdown *(*fun)(unsigned int, size_t,
                                     const struct sd_callbacks *callbacks,
                                     void *) = NULL;
   if (fun==NULL)
      fun = (struct sd_markdown *(*)(unsigned int, size_t,
                                     const struct sd_callbacks *callbacks,
                                     void *))
         R_GetCCallable("markdown","sd_markdown_new");
   return fun(extensions,max_nesting,callbacks,opaque);
}

void
rstub_sd_markdown_render(struct buf *ob, const uint8_t *document, 
                       size_t doc_size, struct sd_markdown *md)
{
   static void (*fun)(struct buf *, const uint8_t *, size_t,
                      struct sd_markdown *) = NULL;
   if (fun==NULL)
      fun = (void (*)(struct buf *, const uint8_t *, size_t,
                      struct sd_markdown *))
         R_GetCCallable("markdown","sd_markdown_render");
   return fun(ob,document,doc_size,md);
}

void
rstub_sd_markdown_free(struct sd_markdown *md)
{
   static void (*fun)(struct sd_markdown *) = NULL;
   if (fun==NULL)
      fun = (void (*)(struct sd_markdown *))
         R_GetCCallable("markdown","sd_markdown_free");
   return fun(md);
}

void
rstub_sd_version(int *major, int *minor, int *revision)
{
   static void (*fun)(int *, int *, int *) = NULL;
   if (fun==NULL)
      fun = (void (*)(int *, int *, int *))
         R_GetCCallable("markdown","sd_version");
   return fun(major,minor,revision);
}

Rboolean rstub_rmd_register_renderer(struct rmd_renderer *renderer)
{
   static Rboolean (*fun)(struct rmd_renderer *) = NULL;
   if (fun==NULL)
      fun = (Rboolean (*)(struct rmd_renderer *))
         R_GetCCallable("markdown","rmd_register_renderer");
   return fun(renderer);
}

Rboolean rstub_rmd_renderer_exists(const char *name)
{
   static SEXP (*fun)(SEXP) = NULL;
   if (fun==NULL)
      fun = (SEXP (*)(SEXP))
         R_GetCCallable("markdown","rmd_renderer_exists");
   return fun(name);
}

Rboolean rstub_rmd_buf_to_output(struct buf *ob, SEXP Soutput, 
                                        SEXP *raw_vec)
{
   static Rboolean (*fun)(struct buf *, SEXP, SEXP *) = NULL;
   if (fun==NULL)
      fun = (Rboolean (*)(struct buf *, SEXP, SEXP *))
         R_GetCCallable("markdown","rmd_buf_to_output");
   return fun(ob,Soutput,raw_vec);
}

Rboolean rstub_rmd_input_to_buf(SEXP Sfile, SEXP Stext, struct buf *ib)
{
   static Rboolean (*fun)(SEXP, SEXP, struct buf *) = NULL;
   if (fun==NULL)
      fun = (Rboolean (*)(SEXP, SEXP, struct buf *))
         R_GetCCallable("markdown","rmd_input_to_buf");
   return fun(Sfile,Stext,ib);
}