mathematical 1.6.20 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +26 -16
- data/Rakefile +80 -17
- data/ext/mathematical/CMakeLists.txt +23 -43
- data/ext/mathematical/extconf.rb +70 -24
- data/ext/mathematical/mtex2MML/CMakeLists.txt +5 -5
- data/ext/mathematical/mtex2MML/README.md +19 -19
- data/ext/mathematical/mtex2MML/deps/uthash/package.json +2 -1
- data/ext/mathematical/mtex2MML/deps/uthash/utarray.h +35 -22
- data/ext/mathematical/mtex2MML/deps/uthash/uthash.h +524 -458
- data/ext/mathematical/mtex2MML/deps/uthash/utlist.h +255 -74
- data/ext/mathematical/mtex2MML/deps/uthash/utringbuffer.h +14 -14
- data/ext/mathematical/mtex2MML/deps/uthash/utstack.h +88 -0
- data/ext/mathematical/mtex2MML/deps/uthash/utstring.h +34 -25
- data/ext/mathematical/mtex2MML/script/cibuild +5 -48
- data/ext/mathematical/mtex2MML/script/test-quick +48 -0
- data/ext/mathematical/mtex2MML/src/environment.c +5 -1
- data/ext/mathematical/mtex2MML/tests/mathjax.c +591 -591
- data/ext/pulldown-latex/Cargo.lock +1833 -0
- data/fonts/cmex10.ttf +0 -0
- data/fonts/cmmi10.ttf +0 -0
- data/fonts/cmr10.ttf +0 -0
- data/fonts/cmsy10.ttf +0 -0
- data/fonts/eufm10.ttf +0 -0
- data/fonts/fonts.conf +11 -0
- data/fonts/msam10.ttf +0 -0
- data/fonts/msbm10.ttf +0 -0
- data/lib/mathematical/version.rb +1 -1
- data/lib/mathematical.rb +16 -1
- data/mathematical.gemspec +6 -2
- metadata +34 -11
- data/ext/mathematical/mtex2MML/appveyor.yml +0 -35
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright (c) 2008-
|
|
2
|
+
Copyright (c) 2008-2022, Troy D. Hanson https://troydhanson.github.io/uthash/
|
|
3
3
|
All rights reserved.
|
|
4
4
|
|
|
5
5
|
Redistribution and use in source and binary forms, with or without
|
|
@@ -26,21 +26,20 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
26
26
|
#ifndef UTARRAY_H
|
|
27
27
|
#define UTARRAY_H
|
|
28
28
|
|
|
29
|
-
#define UTARRAY_VERSION 2.0
|
|
30
|
-
|
|
31
|
-
#ifdef __GNUC__
|
|
32
|
-
#define _UNUSED_ __attribute__ ((__unused__))
|
|
33
|
-
#else
|
|
34
|
-
#define _UNUSED_
|
|
35
|
-
#endif
|
|
29
|
+
#define UTARRAY_VERSION 2.3.0
|
|
36
30
|
|
|
37
31
|
#include <stddef.h> /* size_t */
|
|
38
32
|
#include <string.h> /* memset, etc */
|
|
39
33
|
#include <stdlib.h> /* exit */
|
|
40
|
-
#include "../../src/string_dup.h"
|
|
41
34
|
|
|
42
|
-
#
|
|
43
|
-
#define
|
|
35
|
+
#ifdef __GNUC__
|
|
36
|
+
#define UTARRAY_UNUSED __attribute__((__unused__))
|
|
37
|
+
#else
|
|
38
|
+
#define UTARRAY_UNUSED
|
|
39
|
+
#endif
|
|
40
|
+
|
|
41
|
+
#ifndef utarray_oom
|
|
42
|
+
#define utarray_oom() exit(-1)
|
|
44
43
|
#endif
|
|
45
44
|
|
|
46
45
|
typedef void (ctor_f)(void *dst, const void *src);
|
|
@@ -79,7 +78,9 @@ typedef struct {
|
|
|
79
78
|
|
|
80
79
|
#define utarray_new(a,_icd) do { \
|
|
81
80
|
(a) = (UT_array*)malloc(sizeof(UT_array)); \
|
|
82
|
-
if ((a) == NULL)
|
|
81
|
+
if ((a) == NULL) { \
|
|
82
|
+
utarray_oom(); \
|
|
83
|
+
} \
|
|
83
84
|
utarray_init(a,_icd); \
|
|
84
85
|
} while(0)
|
|
85
86
|
|
|
@@ -93,7 +94,9 @@ typedef struct {
|
|
|
93
94
|
char *utarray_tmp; \
|
|
94
95
|
while (((a)->i+(by)) > (a)->n) { (a)->n = ((a)->n ? (2*(a)->n) : 8); } \
|
|
95
96
|
utarray_tmp=(char*)realloc((a)->d, (a)->n*(a)->icd.sz); \
|
|
96
|
-
if (utarray_tmp == NULL)
|
|
97
|
+
if (utarray_tmp == NULL) { \
|
|
98
|
+
utarray_oom(); \
|
|
99
|
+
} \
|
|
97
100
|
(a)->d=utarray_tmp; \
|
|
98
101
|
} \
|
|
99
102
|
} while(0)
|
|
@@ -119,7 +122,7 @@ typedef struct {
|
|
|
119
122
|
#define utarray_len(a) ((a)->i)
|
|
120
123
|
|
|
121
124
|
#define utarray_eltptr(a,j) (((j) < (a)->i) ? _utarray_eltptr(a,j) : NULL)
|
|
122
|
-
#define _utarray_eltptr(a,j) ((a)->d + ((a)->icd.sz * (j)))
|
|
125
|
+
#define _utarray_eltptr(a,j) ((void*)((a)->d + ((a)->icd.sz * (j))))
|
|
123
126
|
|
|
124
127
|
#define utarray_insert(a,p,j) do { \
|
|
125
128
|
if ((j) > (a)->i) utarray_resize(a,j); \
|
|
@@ -217,23 +220,33 @@ typedef struct {
|
|
|
217
220
|
#define utarray_find(a,v,cmp) bsearch((v),(a)->d,(a)->i,(a)->icd.sz,cmp)
|
|
218
221
|
|
|
219
222
|
#define utarray_front(a) (((a)->i) ? (_utarray_eltptr(a,0)) : NULL)
|
|
220
|
-
#define utarray_next(a,e) (((e)==NULL) ? utarray_front(a) : (((
|
|
221
|
-
#define utarray_prev(a,e) (((e)==NULL) ? utarray_back(a) : ((utarray_eltidx(a,e)
|
|
223
|
+
#define utarray_next(a,e) (((e)==NULL) ? utarray_front(a) : (((a)->i != utarray_eltidx(a,e)+1) ? _utarray_eltptr(a,utarray_eltidx(a,e)+1) : NULL))
|
|
224
|
+
#define utarray_prev(a,e) (((e)==NULL) ? utarray_back(a) : ((utarray_eltidx(a,e) != 0) ? _utarray_eltptr(a,utarray_eltidx(a,e)-1) : NULL))
|
|
222
225
|
#define utarray_back(a) (((a)->i) ? (_utarray_eltptr(a,(a)->i-1)) : NULL)
|
|
223
|
-
#define utarray_eltidx(a,e) (((char*)(e)
|
|
226
|
+
#define utarray_eltidx(a,e) (((char*)(e) - (a)->d) / (a)->icd.sz)
|
|
224
227
|
|
|
225
228
|
/* last we pre-define a few icd for common utarrays of ints and strings */
|
|
226
229
|
static void utarray_str_cpy(void *dst, const void *src) {
|
|
227
|
-
char
|
|
228
|
-
|
|
230
|
+
char *const *srcc = (char *const *)src;
|
|
231
|
+
char **dstc = (char**)dst;
|
|
232
|
+
if (*srcc == NULL) {
|
|
233
|
+
*dstc = NULL;
|
|
234
|
+
} else {
|
|
235
|
+
*dstc = (char*)malloc(strlen(*srcc) + 1);
|
|
236
|
+
if (*dstc == NULL) {
|
|
237
|
+
utarray_oom();
|
|
238
|
+
} else {
|
|
239
|
+
strcpy(*dstc, *srcc);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
229
242
|
}
|
|
230
243
|
static void utarray_str_dtor(void *elt) {
|
|
231
244
|
char **eltc = (char**)elt;
|
|
232
245
|
if (*eltc != NULL) free(*eltc);
|
|
233
246
|
}
|
|
234
|
-
static const UT_icd ut_str_icd
|
|
235
|
-
static const UT_icd ut_int_icd
|
|
236
|
-
static const UT_icd ut_ptr_icd
|
|
247
|
+
static const UT_icd ut_str_icd UTARRAY_UNUSED = {sizeof(char*),NULL,utarray_str_cpy,utarray_str_dtor};
|
|
248
|
+
static const UT_icd ut_int_icd UTARRAY_UNUSED = {sizeof(int),NULL,NULL,NULL};
|
|
249
|
+
static const UT_icd ut_ptr_icd UTARRAY_UNUSED = {sizeof(void*),NULL,NULL,NULL};
|
|
237
250
|
|
|
238
251
|
|
|
239
252
|
#endif /* UTARRAY_H */
|