-
-
Notifications
You must be signed in to change notification settings - Fork 85
/
xs.scroll
125 lines (104 loc) · 3.28 KB
/
xs.scroll
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
import ../code/conceptPage.scroll
id xs
name XS
appeared 2002
tags pl
fileType text
rosettaCode http://www.rosettacode.org/wiki/Category:XS
centralPackageRepositoryCount 0
multiLineCommentTokens /* */
hasMultiLineComments true
/* A comment
*/
hasComments true
/* A comment
*/
hasSemanticIndentation false
wikipedia https://en.wikipedia.org/wiki/XS_(Perl)
related perl c pod
summary XS is a Perl foreign function interface through which a program can call a C or C++ subroutine. XS or xsub is an abbreviation of "eXternal Subroutine", where external refers to programming languages external to Perl. XS also refers to a glue language for specifying calling interfaces supporting such interfaces (see below).
pageId 1557123
created 2005
backlinksCount 9
revisionCount 52
dailyPageViews 13
appeared 2002
githubBigQuery XS
repos 1945
users 1767
linguistGrammarRepo https://github.com/textmate/c.tmbundle
firstCommit 2005
lastCommit 2018
committerCount 23
commitCount 359
sampleCount 1
example
/*
* This software is copyright (C) by Nick Wellnhofer <wellnhofer@aevum.de>.
*
* This is free software; you can redistribute it and/or modify it under
* the same terms as the Perl 5 programming language system itself.
*
* Terms of the Perl programming language system itself
*
* a) the GNU General Public License as published by the Free
* Software Foundation; either version 1, or (at your option) any
* later version, or
* b) the "Artistic License"
*/
/*
* Notes on memory management
*
* - A pointer to the Perl SV representing a node is stored in the
* user data slot of `struct cmark_node`, so there's a 1:1 mapping
* between Perl and C objects.
* - Every node SV keeps a reference to the parent SV. This is done
* indirectly by looking up the parent SV and increasing its refcount.
* - This makes sure that a document isn't freed if the last reference
* from Perl to the root node is dropped, as references to child nodes
* might still exist.
* - As a consequence, as long as a node is referenced from Perl, all its
* ancestor nodes will also be associated with a Perl object.
*/
#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include <stdlib.h>
#include <cmark.h>
#if CMARK_VERSION < 0x001000
#error libcmark 0.16.0 is required.
#endif
/* Fix prefixes of render functions. */
#define cmark_node_render_html cmark_render_html
#define cmark_node_render_xml cmark_render_xml
#define cmark_node_render_man cmark_render_man
static SV*
S_create_or_incref_node_sv(pTHX_ cmark_node *node) {
SV *new_obj = NULL;
while (node) {
SV *obj;
HV *stash;
/* Look for existing object. */
obj = (SV*)cmark_node_get_user_data(node);
if (obj) {
/* Incref if found. */
SvREFCNT_inc_simple_void_NN(obj);
if (!new_obj) {
new_obj = obj;
}
break;
}
/* Create a new SV. */
o
isbndb 0
githubLanguage XS
fileExtensions xs
trendingProjectsCount 0
type programming
aceMode c_cpp
codemirrorMode clike
codemirrorMimeType text/x-csrc
tmScope source.c
repos 532
semanticScholar 0