File: markdown_rstubs.h

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 (130 lines) | stat: -rw-r--r-- 4,072 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
/*
 * markdown_rstubs.h
 * 
 * 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.
 *
 */

#ifndef MARKDOWN_RSTUBS
#define MARKDOWN_RSTUBS

#include <Rinternals.h>
#include <R_ext/Rdynload.h>
#include "markdown.h"

#ifdef __cplusplus
extern "C" {
#endif

/* bufgrow: increasing the allocated size to the given value */
int rstub_bufgrow(struct buf *, size_t);
#define bufgrow rstub_bufgrow

/* bufnew: allocation of a new buffer */
struct buf *rstub_bufnew(size_t) __attribute__ ((malloc));
#define bufnew rstub_bufnew

/* bufnullterm: NUL-termination of the string array (making a C-string) */
const char *rstub_bufcstr(struct buf *);
#define bufcstr rstub_bufcstr

/* bufprefix: compare the beginning of a buffer with a string */
int rstub_bufprefix(const struct buf *buf, const char *prefix);
#define bufprefix rstub_bufprefix

/* bufput: appends raw data to a buffer */
void rstub_bufput(struct buf *, const void *, size_t);
#define bufput rstub_bufput

/* bufputs: appends a NUL-terminated string to a buffer */
void rstub_bufputs(struct buf *, const char *);
#define bufputs rstub_bufputs

/* bufputc: appends a single char to a buffer */
void rstub_bufputc(struct buf *, int);
#define bufputc rstub_bufputc

/* bufrelease: decrease the reference count and free the buffer if needed */
void rstub_bufrelease(struct buf *);
#define bufrelease rstub_bufrelease

/* bufreset: frees internal data of the buffer */
void rstub_bufreset(struct buf *);
#define bufreset rstub_bufreset

/* bufslurp: removes a given number of bytes from the head of the array */
void rstub_bufslurp(struct buf *, size_t);
#define bufslurp rstub_bufslurp

/* bufprintf: formatted printing to a buffer */
void rstub_bufprintf(struct buf *, const char *, ...) __attribute__ ((format (printf, 2, 3)));
#define bufprintf rstub_bufprintf

extern int
rstub_sd_autolink_issafe(const uint8_t *link, size_t link_len);
#define sd_autolink_issafe rstub_sd_autolink_issafe

extern size_t
rstub_sd_autolink__www(size_t *rewind_p, struct buf *link, uint8_t *data,
                     size_t offset, size_t size);
#define sd_autolink__www rstub_sd_autolink__www

extern size_t
rstub_sd_autolink__email(size_t *rewind_p, struct buf *link, uint8_t *data,
                       size_t offset, size_t size);
#define sd_autolink__email rstub_sd_autolink__email

extern size_t
rstub_sd_autolink__url(size_t *rewind_p, struct buf *link, uint8_t *data,
                     size_t offset, size_t size);
#define sd_autolink__url rstub_sd_autolink__url

extern struct sd_markdown *
rstub_sd_markdown_new(
	unsigned int extensions,
	size_t max_nesting,
	const struct sd_callbacks *callbacks,
	void *opaque);
#define sd_markdown_new rstub_sd_markdown_new

extern void
rstub_sd_markdown_render(struct buf *ob, const uint8_t *document, size_t doc_size,
                       struct sd_markdown *md);
#define sd_markdown_render rstub_sd_markdown_render

extern void
rstub_sd_markdown_free(struct sd_markdown *md);
#define sd_markdown_free rstub_sd_markdown_free

extern void
rstub_sd_version(int *major, int *minor, int *revision);
#define sd_version rstub_sd_version

struct rmd_renderer {
   char *name;
   Rboolean (*render)(struct buf *,struct buf *, SEXP, SEXP);
};

Rboolean rstub_rmd_register_renderer(struct rmd_renderer *);
#define rmd_register_renderer rstub_rmd_register_renderer

Rboolean rstub_rmd_renderer_exists(const char *);
#define rmd_renderer_exists rstub_rmd_renderer_exists

Rboolean rstub_rmd_buf_to_output(struct buf *, SEXP, SEXP *);
#define rmd_buf_to_output rstub_rmd_buf_to_output

Rboolean rstub_rmd_input_to_buf(SEXP, SEXP, struct buf *);
#define rmd_input_to_buf rstub_rmd_input_to_buf

#ifdef __cplusplus
}
#endif

#endif // MARKDOWN_RSTUBS