w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

string.c
Go to the documentation of this file.
1 /*
2 ** string.c - String class
3 **
4 ** See Copyright Notice in mruby.h
5 */
6 
7 #ifdef _MSC_VER
8 # define _CRT_NONSTDC_NO_DEPRECATE
9 #endif
10 
11 #ifndef MRB_NO_FLOAT
12 #include <float.h>
13 #include <math.h>
14 #endif
15 #include <limits.h>
16 #include <stddef.h>
17 #include <stdlib.h>
18 #include <string.h>
19 #include <mruby.h>
20 #include <mruby/array.h>
21 #include <mruby/class.h>
22 #include <mruby/range.h>
23 #include <mruby/string.h>
24 #include <mruby/numeric.h>
25 #include <mruby/presym.h>
26 
27 typedef struct mrb_shared_string {
28  int refcnt;
30  char *ptr;
32 
33 const char mrb_digitmap[] = "0123456789abcdefghijklmnopqrstuvwxyz";
34 
35 #define mrb_obj_alloc_string(mrb) ((struct RString*)mrb_obj_alloc((mrb), MRB_TT_STRING, (mrb)->string_class))
36 
37 static struct RString*
39  const char *p, size_t len, size_t capa)
40 {
41  char *dst = (char *)mrb_malloc(mrb, capa + 1);
42  if (p) memcpy(dst, p, len);
43  dst[len] = '\0';
44  s->as.heap.ptr = dst;
45  s->as.heap.len = (mrb_ssize)len;
46  s->as.heap.aux.capa = (mrb_ssize)capa;
48  return s;
49 }
50 
51 static struct RString*
52 str_init_normal(mrb_state *mrb, struct RString *s, const char *p, size_t len)
53 {
54  return str_init_normal_capa(mrb, s, p, len, len);
55 }
56 
57 static struct RString*
58 str_init_embed(struct RString *s, const char *p, size_t len)
59 {
60  if (p) memcpy(RSTR_EMBED_PTR(s), p, len);
61  RSTR_EMBED_PTR(s)[len] = '\0';
62  RSTR_SET_TYPE_FLAG(s, EMBED);
64  return s;
65 }
66 
67 static struct RString*
68 str_init_nofree(struct RString *s, const char *p, size_t len)
69 {
70  s->as.heap.ptr = (char *)p;
71  s->as.heap.len = (mrb_ssize)len;
72  s->as.heap.aux.capa = 0; /* nofree */
73  RSTR_SET_TYPE_FLAG(s, NOFREE);
74  return s;
75 }
76 
77 static struct RString*
78 str_init_shared(mrb_state *mrb, const struct RString *orig, struct RString *s, mrb_shared_string *shared)
79 {
80  if (shared) {
81  shared->refcnt++;
82  }
83  else {
85  shared->refcnt = 1;
86  shared->ptr = orig->as.heap.ptr;
87  shared->capa = orig->as.heap.aux.capa;
88  }
89  s->as.heap.ptr = orig->as.heap.ptr;
90  s->as.heap.len = orig->as.heap.len;
91  s->as.heap.aux.shared = shared;
92  RSTR_SET_TYPE_FLAG(s, SHARED);
93  return s;
94 }
95 
96 static struct RString*
97 str_init_fshared(const struct RString *orig, struct RString *s, struct RString *fshared)
98 {
99  s->as.heap.ptr = orig->as.heap.ptr;
100  s->as.heap.len = orig->as.heap.len;
101  s->as.heap.aux.fshared = fshared;
102  RSTR_SET_TYPE_FLAG(s, FSHARED);
103  return s;
104 }
105 
106 static struct RString*
107 str_init_modifiable(mrb_state *mrb, struct RString *s, const char *p, size_t len)
108 {
109  if (RSTR_EMBEDDABLE_P(len)) {
110  return str_init_embed(s, p, len);
111  }
112  else {
113  return str_init_normal(mrb, s, p, len);
114  }
115 }
116 
117 static struct RString*
118 str_new_static(mrb_state *mrb, const char *p, size_t len)
119 {
120  if (RSTR_EMBEDDABLE_P(len)) {
121  return str_init_embed(mrb_obj_alloc_string(mrb), p, len);
122  }
123  if (len >= MRB_SSIZE_MAX) {
124  mrb_raise(mrb, E_ARGUMENT_ERROR, "string size too big");
125  }
126  return str_init_nofree(mrb_obj_alloc_string(mrb), p, len);
127 }
128 
129 static struct RString*
130 str_new(mrb_state *mrb, const char *p, size_t len)
131 {
132  if (RSTR_EMBEDDABLE_P(len)) {
133  return str_init_embed(mrb_obj_alloc_string(mrb), p, len);
134  }
135  if (len >= MRB_SSIZE_MAX) {
136  mrb_raise(mrb, E_ARGUMENT_ERROR, "string size too big");
137  }
138  if (p && mrb_ro_data_p(p)) {
139  return str_init_nofree(mrb_obj_alloc_string(mrb), p, len);
140  }
141  return str_init_normal(mrb, mrb_obj_alloc_string(mrb), p, len);
142 }
143 
144 static inline void
146 {
147  s->c = mrb_str_ptr(obj)->c;
148 }
149 
150 static mrb_value
152 {
153  struct RString *s = str_new(mrb, 0, 0);
154 
155  str_with_class(s, str);
156  return mrb_obj_value(s);
157 }
158 
161 {
162  struct RString *s;
163 
164  if (RSTR_EMBEDDABLE_P(capa)) {
166  }
167  else if (capa >= MRB_SSIZE_MAX) {
168  mrb_raise(mrb, E_ARGUMENT_ERROR, "string capacity size too big");
169  /* not reached */
170  s = NULL;
171  }
172  else {
174  }
175 
176  return mrb_obj_value(s);
177 }
178 
179 static void
180 resize_capa(mrb_state *mrb, struct RString *s, size_t capacity)
181 {
182 #if SIZE_MAX > MRB_SSIZE_MAX
184 #endif
185  if (RSTR_EMBED_P(s)) {
186  if (!RSTR_EMBEDDABLE_P(capacity)) {
188  }
189  }
190  else {
191  s->as.heap.ptr = (char*)mrb_realloc(mrb, RSTR_PTR(s), capacity+1);
192  s->as.heap.aux.capa = (mrb_ssize)capacity;
193  }
194 }
195 
197 mrb_str_new(mrb_state *mrb, const char *p, size_t len)
198 {
199  return mrb_obj_value(str_new(mrb, p, len));
200 }
201 
203 mrb_str_new_cstr(mrb_state *mrb, const char *p)
204 {
205  struct RString *s;
206  size_t len;
207 
208  if (p) {
209  len = strlen(p);
210  }
211  else {
212  len = 0;
213  }
214 
215  s = str_new(mrb, p, len);
216 
217  return mrb_obj_value(s);
218 }
219 
221 mrb_str_new_static(mrb_state *mrb, const char *p, size_t len)
222 {
223  struct RString *s = str_new_static(mrb, p, len);
224  return mrb_obj_value(s);
225 }
226 
227 static void
229 {
230  shared->refcnt--;
231  if (shared->refcnt == 0) {
232  mrb_free(mrb, shared->ptr);
233  mrb_free(mrb, shared);
234  }
235 }
236 
237 static void
239 {
240  if (RSTR_SHARED_P(s)) {
241  mrb_shared_string *shared = s->as.heap.aux.shared;
242 
243  if (shared->refcnt == 1 && s->as.heap.ptr == shared->ptr) {
244  s->as.heap.aux.capa = shared->capa;
245  s->as.heap.ptr[s->as.heap.len] = '\0';
247  mrb_free(mrb, shared);
248  }
249  else {
250  str_init_modifiable(mrb, s, s->as.heap.ptr, (size_t)s->as.heap.len);
251  str_decref(mrb, shared);
252  }
253  }
254  else if (RSTR_NOFREE_P(s) || RSTR_FSHARED_P(s)) {
255  str_init_modifiable(mrb, s, s->as.heap.ptr, (size_t)s->as.heap.len);
256  }
257 }
258 
259 static void
261 {
262  mrb_to_str(mrb, str);
263  if (memchr(RSTRING_PTR(str), '\0', RSTRING_LEN(str))) {
264  mrb_raise(mrb, E_ARGUMENT_ERROR, "string contains null byte");
265  }
266 }
267 
268 void
270 {
271  if (RSTR_EMBED_P(str))
272  /* no code */;
273  else if (RSTR_SHARED_P(str))
274  str_decref(mrb, str->as.heap.aux.shared);
275  else if (!RSTR_NOFREE_P(str) && !RSTR_FSHARED_P(str))
276  mrb_free(mrb, str->as.heap.ptr);
277 }
278 
279 #ifdef MRB_UTF8_STRING
280 static const char utf8len_codepage[256] =
281 {
282  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
283  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
284  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
285  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
286  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
287  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
288  1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
289  3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,1,1,1,1,1,1,1,1,1,1,1,
290 };
291 
292 #define utf8_islead(c) ((unsigned char)((c)&0xc0) != 0x80)
293 
294 mrb_int
295 mrb_utf8len(const char* p, const char* e)
296 {
297  mrb_int len;
298  mrb_int i;
299 
300  if ((unsigned char)*p < 0x80) return 1;
301  len = utf8len_codepage[(unsigned char)*p];
302  if (len == 1) return 1;
303  if (len > e - p) return 1;
304  for (i = 1; i < len; ++i)
305  if (utf8_islead(p[i]))
306  return 1;
307  return len;
308 }
309 
310 mrb_int
311 mrb_utf8_strlen(const char *str, mrb_int byte_len)
312 {
313  mrb_int len = 0;
314  const char *p = str;
315  const char *e = p + byte_len;
316 
317  while (p < e) {
318  p += mrb_utf8len(p, e);
319  len++;
320  }
321  return len;
322 }
323 
324 static mrb_int
326 {
327  struct RString *s = mrb_str_ptr(str);
328  mrb_int byte_len = RSTR_LEN(s);
329 
330  if (RSTR_ASCII_P(s)) {
331  return byte_len;
332  }
333  else {
334  mrb_int utf8_len = mrb_utf8_strlen(RSTR_PTR(s), byte_len);
335  if (byte_len == utf8_len) RSTR_SET_ASCII_FLAG(s);
336  return utf8_len;
337  }
338 }
339 
340 #define RSTRING_CHAR_LEN(s) utf8_strlen(s)
341 
342 /* map character index to byte offset index */
343 static mrb_int
345 {
346  if (RSTR_ASCII_P(mrb_str_ptr(s))) {
347  return idx;
348  }
349  else {
350  mrb_int i, b, n;
351  const char *p = RSTRING_PTR(s) + off;
352  const char *e = RSTRING_END(s);
353 
354  for (b=i=0; p<e && i<idx; i++) {
355  n = mrb_utf8len(p, e);
356  b += n;
357  p += n;
358  }
359  return b;
360  }
361 }
362 
363 /* map byte offset to character index */
364 static mrb_int
365 bytes2chars(char *p, mrb_int len, mrb_int bi)
366 {
367  const char *e = p + (size_t)len;
368  const char *pivot = p + bi;
369  mrb_int i;
370 
371  for (i = 0; p < pivot; i ++) {
372  p += mrb_utf8len(p, e);
373  }
374  if (p != pivot) return -1;
375  return i;
376 }
377 
378 static const char *
379 char_adjust(const char *beg, const char *end, const char *ptr)
380 {
381  if ((ptr > beg || ptr < end) && (*ptr & 0xc0) == 0x80) {
382  const int utf8_adjust_max = 3;
383  const char *p;
384 
385  if (ptr - beg > utf8_adjust_max) {
386  beg = ptr - utf8_adjust_max;
387  }
388 
389  p = ptr;
390  while (p > beg) {
391  p --;
392  if ((*p & 0xc0) != 0x80) {
393  int clen = mrb_utf8len(p, end);
394  if (clen > ptr - p) return p;
395  break;
396  }
397  }
398  }
399 
400  return ptr;
401 }
402 
403 static const char *
404 char_backtrack(const char *ptr, const char *end)
405 {
406  if (ptr < end) {
407  const int utf8_bytelen_max = 4;
408  const char *p;
409 
410  if (end - ptr > utf8_bytelen_max) {
411  ptr = end - utf8_bytelen_max;
412  }
413 
414  p = end;
415  while (p > ptr) {
416  p --;
417  if ((*p & 0xc0) != 0x80) {
418  int clen = utf8len_codepage[(unsigned char)*p];
419  if (clen == end - p) { return p; }
420  break;
421  }
422  }
423  }
424 
425  return end - 1;
426 }
427 
428 static mrb_int
429 str_index_str_by_char_search(mrb_state *mrb, const char *p, const char *pend, const char *s, const mrb_int slen, mrb_int off)
430 {
431  /* Based on Quick Search algorithm (Boyer-Moore-Horspool algorithm) */
432 
433  ptrdiff_t qstable[1 << CHAR_BIT];
434 
435  /* Preprocessing */
436  {
437  mrb_int i;
438 
439  for (i = 0; i < 1 << CHAR_BIT; i ++) {
440  qstable[i] = slen;
441  }
442  for (i = 0; i < slen; i ++) {
443  qstable[(unsigned char)s[i]] = slen - (i + 1);
444  }
445  }
446 
447  /* Searching */
448  while (p < pend && pend - p >= slen) {
449  const char *pivot;
450 
451  if (memcmp(p, s, slen) == 0) {
452  return off;
453  }
454 
455  pivot = p + qstable[(unsigned char)p[slen - 1]];
456  if (pivot >= pend || pivot < p /* overflowed */) { return -1; }
457 
458  do {
459  p += mrb_utf8len(p, pend);
460  off ++;
461  } while (p < pivot);
462  }
463 
464  return -1;
465 }
466 
467 static mrb_int
469 {
470  const char *p = RSTRING_PTR(str);
471  const char *pend = p + RSTRING_LEN(str);
472  const char *s = RSTRING_PTR(sub);
473  const mrb_int slen = RSTRING_LEN(sub);
474  mrb_int off = pos;
475 
476  for (; pos > 0; pos --) {
477  if (pend - p < 1) { return -1; }
478  p += mrb_utf8len(p, pend);
479  }
480 
481  if (slen < 1) { return off; }
482 
483  return str_index_str_by_char_search(mrb, p, pend, s, slen, off);
484 }
485 
486 #define BYTES_ALIGN_CHECK(pos) if (pos < 0) return mrb_nil_value();
487 #else
488 #define RSTRING_CHAR_LEN(s) RSTRING_LEN(s)
489 #define chars2bytes(p, off, ci) (ci)
490 #define bytes2chars(p, end, bi) (bi)
491 #define char_adjust(beg, end, ptr) (ptr)
492 #define char_backtrack(ptr, end) ((end) - 1)
493 #define BYTES_ALIGN_CHECK(pos)
494 #define str_index_str_by_char(mrb, str, sub, pos) str_index_str(mrb, str, sub, pos)
495 #endif
496 
497 #ifndef MRB_QS_SHORT_STRING_LENGTH
498 #define MRB_QS_SHORT_STRING_LENGTH 2048
499 #endif
500 
501 static inline mrb_int
502 mrb_memsearch_qs(const unsigned char *xs, mrb_int m, const unsigned char *ys, mrb_int n)
503 {
504  if (n + m < MRB_QS_SHORT_STRING_LENGTH) {
505  const unsigned char *y = ys;
506  const unsigned char *ye = ys+n-m+1;
507 
508  for (;;) {
509  y = (const unsigned char*)memchr(y, xs[0], (size_t)(ye-y));
510  if (y == NULL) return -1;
511  if (memcmp(xs, y, m) == 0) {
512  return (mrb_int)(y - ys);
513  }
514  y++;
515  }
516  return -1;
517  }
518  else {
519  const unsigned char *x = xs, *xe = xs + m;
520  const unsigned char *y = ys;
521  int i;
522  ptrdiff_t qstable[256];
523 
524  /* Preprocessing */
525  for (i = 0; i < 256; ++i)
526  qstable[i] = m + 1;
527  for (; x < xe; ++x)
528  qstable[*x] = xe - x;
529  /* Searching */
530  for (; y + m <= ys + n; y += *(qstable + y[m])) {
531  if (*xs == *y && memcmp(xs, y, m) == 0)
532  return (mrb_int)(y - ys);
533  }
534  return -1;
535  }
536 }
537 
538 static mrb_int
539 mrb_memsearch(const void *x0, mrb_int m, const void *y0, mrb_int n)
540 {
541  const unsigned char *x = (const unsigned char *)x0, *y = (const unsigned char *)y0;
542 
543  if (m > n) return -1;
544  else if (m == n) {
545  return memcmp(x0, y0, m) == 0 ? 0 : -1;
546  }
547  else if (m < 1) {
548  return 0;
549  }
550  else if (m == 1) {
551  const unsigned char *ys = (const unsigned char *)memchr(y, *x, n);
552 
553  if (ys)
554  return (mrb_int)(ys - y);
555  else
556  return -1;
557  }
558  return mrb_memsearch_qs((const unsigned char *)x0, m, (const unsigned char *)y0, n);
559 }
560 
561 static void
562 str_share(mrb_state *mrb, struct RString *orig, struct RString *s)
563 {
564  size_t len = (size_t)orig->as.heap.len;
565 
566  mrb_assert(!RSTR_EMBED_P(orig));
567  if (RSTR_NOFREE_P(orig)) {
568  str_init_nofree(s, orig->as.heap.ptr, len);
569  }
570  else if (RSTR_SHARED_P(orig)) {
571  str_init_shared(mrb, orig, s, orig->as.heap.aux.shared);
572  }
573  else if (RSTR_FSHARED_P(orig)) {
574  str_init_fshared(orig, s, orig->as.heap.aux.fshared);
575  }
576  else {
577  if (orig->as.heap.aux.capa > orig->as.heap.len) {
578  orig->as.heap.ptr = (char *)mrb_realloc(mrb, orig->as.heap.ptr, len+1);
579  orig->as.heap.aux.capa = (mrb_ssize)len;
580  }
581  str_init_shared(mrb, orig, s, NULL);
582  str_init_shared(mrb, orig, orig, s->as.heap.aux.shared);
583  }
584 }
585 
586 mrb_value
588 {
589  struct RString *orig, *s;
590 
591  orig = mrb_str_ptr(str);
592  s = mrb_obj_alloc_string(mrb);
593  if (RSTR_EMBEDDABLE_P(len)) {
594  str_init_embed(s, RSTR_PTR(orig)+beg, len);
595  }
596  else {
597  str_share(mrb, orig, s);
598  s->as.heap.ptr += (mrb_ssize)beg;
599  s->as.heap.len = (mrb_ssize)len;
600  }
601  RSTR_COPY_ASCII_FLAG(s, orig);
602  return mrb_obj_value(s);
603 }
604 
605 static void
607 {
608  *pos = chars2bytes(str, 0, *pos);
609  *len = chars2bytes(str, *pos, *len);
610 }
611 #ifdef MRB_UTF8_STRING
612 static inline mrb_value
614 {
615  str_range_to_bytes(str, &beg, &len);
616  return mrb_str_byte_subseq(mrb, str, beg, len);
617 }
618 #else
619 #define str_subseq(mrb, str, beg, len) mrb_str_byte_subseq(mrb, str, beg, len)
620 #endif
621 
622 mrb_bool
624 {
625  if (str_len < *begp || *lenp < 0) return FALSE;
626  if (*begp < 0) {
627  *begp += str_len;
628  if (*begp < 0) return FALSE;
629  }
630  if (*lenp > str_len - *begp)
631  *lenp = str_len - *begp;
632  if (*lenp <= 0) {
633  *lenp = 0;
634  }
635  return TRUE;
636 }
637 
638 static mrb_value
640 {
641  return mrb_str_beg_len(RSTRING_CHAR_LEN(str), &beg, &len) ?
642  str_subseq(mrb, str, beg, len) : mrb_nil_value();
643 }
644 
647 {
648  mrb_int pos;
649  char *s;
650  mrb_int len;
651 
652  len = RSTRING_LEN(str);
653  if (offset < 0) {
654  offset += len;
655  if (offset < 0) return -1;
656  }
657  if (len - offset < slen) return -1;
658  s = RSTRING_PTR(str);
659  if (offset) {
660  s += offset;
661  }
662  if (slen == 0) return offset;
663  /* need proceed one character at a time */
664  len = RSTRING_LEN(str) - offset;
665  pos = mrb_memsearch(sptr, slen, s, len);
666  if (pos < 0) return pos;
667  return pos + offset;
668 }
669 
670 static mrb_int
672 {
673  const char *ptr;
674  mrb_int len;
675 
676  ptr = RSTRING_PTR(str2);
677  len = RSTRING_LEN(str2);
678 
679  return mrb_str_index(mrb, str, ptr, len, offset);
680 }
681 
682 static mrb_value
683 str_replace(mrb_state *mrb, struct RString *s1, struct RString *s2)
684 {
685  size_t len;
686 
687  mrb_check_frozen(mrb, s1);
688  if (s1 == s2) return mrb_obj_value(s1);
690  if (RSTR_SHARED_P(s1)) {
691  str_decref(mrb, s1->as.heap.aux.shared);
692  }
693  else if (!RSTR_EMBED_P(s1) && !RSTR_NOFREE_P(s1) && !RSTR_FSHARED_P(s1)
694  && s1->as.heap.ptr) {
695  mrb_free(mrb, s1->as.heap.ptr);
696  }
697 
698  len = (size_t)RSTR_LEN(s2);
699  if (RSTR_EMBEDDABLE_P(len)) {
701  }
702  else {
703  str_share(mrb, s2, s1);
704  }
705 
706  return mrb_obj_value(s1);
707 }
708 
709 static mrb_int
711 {
712  const char *s, *sbeg, *t;
713  struct RString *ps = mrb_str_ptr(str);
715 
716  /* substring longer than string */
717  if (RSTR_LEN(ps) < len) return -1;
718  if (RSTR_LEN(ps) - pos < len) {
719  pos = RSTR_LEN(ps) - len;
720  }
721  sbeg = RSTR_PTR(ps);
722  s = RSTR_PTR(ps) + pos;
723  t = RSTRING_PTR(sub);
724  if (len) {
725  s = char_adjust(sbeg, sbeg + RSTR_LEN(ps), s);
726  while (sbeg <= s) {
727  if (memcmp(s, t, len) == 0) {
728  return (mrb_int)(s - RSTR_PTR(ps));
729  }
730  s = char_backtrack(sbeg, s);
731  }
732  return -1;
733  }
734  else {
735  return pos;
736  }
737 }
738 
741 {
742  mrb_int i, max = RSTR_LEN(s);
743  char *p = RSTR_PTR(s);
744 
745  if (!p) return 0;
746  for (i=0; i<max; i++) {
747  if (p[i] == '\0') {
748  mrb_raise(mrb, E_ARGUMENT_ERROR, "string contains null byte");
749  }
750  }
751  return max;
752 }
753 
754 #ifdef _WIN32
755 #include <windows.h>
756 
757 char*
758 mrb_utf8_from_locale(const char *str, int len)
759 {
760  wchar_t* wcsp;
761  char* mbsp;
762  int mbssize, wcssize;
763 
764  if (len == 0)
765  return strdup("");
766  if (len == -1)
767  len = (int)strlen(str);
768  wcssize = MultiByteToWideChar(GetACP(), 0, str, len, NULL, 0);
769  wcsp = (wchar_t*) malloc((wcssize + 1) * sizeof(wchar_t));
770  if (!wcsp)
771  return NULL;
772  wcssize = MultiByteToWideChar(GetACP(), 0, str, len, wcsp, wcssize + 1);
773  wcsp[wcssize] = 0;
774 
775  mbssize = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR) wcsp, -1, NULL, 0, NULL, NULL);
776  mbsp = (char*) malloc((mbssize + 1));
777  if (!mbsp) {
778  free(wcsp);
779  return NULL;
780  }
781  mbssize = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR) wcsp, -1, mbsp, mbssize, NULL, NULL);
782  mbsp[mbssize] = 0;
783  free(wcsp);
784  return mbsp;
785 }
786 
787 char*
788 mrb_locale_from_utf8(const char *utf8, int len)
789 {
790  wchar_t* wcsp;
791  char* mbsp;
792  int mbssize, wcssize;
793 
794  if (len == 0)
795  return strdup("");
796  if (len == -1)
797  len = (int)strlen(utf8);
798  wcssize = MultiByteToWideChar(CP_UTF8, 0, utf8, len, NULL, 0);
799  wcsp = (wchar_t*) malloc((wcssize + 1) * sizeof(wchar_t));
800  if (!wcsp)
801  return NULL;
802  wcssize = MultiByteToWideChar(CP_UTF8, 0, utf8, len, wcsp, wcssize + 1);
803  wcsp[wcssize] = 0;
804  mbssize = WideCharToMultiByte(GetACP(), 0, (LPCWSTR) wcsp, -1, NULL, 0, NULL, NULL);
805  mbsp = (char*) malloc((mbssize + 1));
806  if (!mbsp) {
807  free(wcsp);
808  return NULL;
809  }
810  mbssize = WideCharToMultiByte(GetACP(), 0, (LPCWSTR) wcsp, -1, mbsp, mbssize, NULL, NULL);
811  mbsp[mbssize] = 0;
812  free(wcsp);
813  return mbsp;
814 }
815 #endif
816 
817 MRB_API void
819 {
820  mrb_check_frozen(mrb, s);
821  str_modify_keep_ascii(mrb, s);
822 }
823 
824 MRB_API void
826 {
829 }
830 
833 {
834  mrb_int slen;
835  struct RString *s = mrb_str_ptr(str);
836 
837  if (len < 0) {
838  mrb_raise(mrb, E_ARGUMENT_ERROR, "negative (or overflowed) string size");
839  }
840  mrb_str_modify(mrb, s);
841  slen = RSTR_LEN(s);
842  if (len != slen) {
843  if (slen < len || slen - len > 256) {
844  resize_capa(mrb, s, len);
845  }
846  RSTR_SET_LEN(s, len);
847  RSTR_PTR(s)[len] = '\0'; /* sentinel */
848  }
849  return str;
850 }
851 
852 MRB_API char*
854 {
855  struct RString *s;
856 
857  check_null_byte(mrb, str0);
858  s = str_new(mrb, RSTRING_PTR(str0), RSTRING_LEN(str0));
859  return RSTR_PTR(s);
860 }
861 
862 MRB_API void
864 {
865  other = mrb_obj_as_string(mrb, other);
866  mrb_str_cat_str(mrb, self, other);
867 }
868 
871 {
872  struct RString *s = mrb_str_ptr(a);
873  struct RString *s2 = mrb_str_ptr(b);
874  struct RString *t;
875 
876  t = str_new(mrb, 0, RSTR_LEN(s) + RSTR_LEN(s2));
879 
880  return mrb_obj_value(t);
881 }
882 
883 /* 15.2.10.5.2 */
884 
885 /*
886  * call-seq:
887  * str + other_str -> new_str
888  *
889  * Concatenation---Returns a new <code>String</code> containing
890  * <i>other_str</i> concatenated to <i>str</i>.
891  *
892  * "Hello from " + self.to_s #=> "Hello from main"
893  */
894 static mrb_value
896 {
897  mrb_value str;
898 
899  mrb_get_args(mrb, "S", &str);
900  return mrb_str_plus(mrb, self, str);
901 }
902 
903 /* 15.2.10.5.26 */
904 /* 15.2.10.5.33 */
905 /*
906  * call-seq:
907  * "abcd".size => int
908  *
909  * Returns the length of string.
910  */
911 static mrb_value
913 {
914  mrb_int len = RSTRING_CHAR_LEN(self);
915  return mrb_fixnum_value(len);
916 }
917 
918 static mrb_value
920 {
921  mrb_int len = RSTRING_LEN(self);
922  return mrb_fixnum_value(len);
923 }
924 
925 /* 15.2.10.5.1 */
926 /*
927  * call-seq:
928  * str * integer => new_str
929  *
930  * Copy---Returns a new <code>String</code> containing <i>integer</i> copies of
931  * the receiver.
932  *
933  * "Ho! " * 3 #=> "Ho! Ho! Ho! "
934  */
935 static mrb_value
937 {
938  mrb_int n,len,times;
939  struct RString *str2;
940  char *p;
941 
942  mrb_get_args(mrb, "i", &times);
943  if (times < 0) {
944  mrb_raise(mrb, E_ARGUMENT_ERROR, "negative argument");
945  }
946  if (times && MRB_SSIZE_MAX / times < RSTRING_LEN(self)) {
947  mrb_raise(mrb, E_ARGUMENT_ERROR, "argument too big");
948  }
949 
950  len = RSTRING_LEN(self)*times;
951  str2 = str_new(mrb, 0, len);
952  str_with_class(str2, self);
953  p = RSTR_PTR(str2);
954  if (len > 0) {
955  n = RSTRING_LEN(self);
956  memcpy(p, RSTRING_PTR(self), n);
957  while (n <= len/2) {
958  memcpy(p + n, p, n);
959  n *= 2;
960  }
961  memcpy(p + n, p, len-n);
962  }
963  p[RSTR_LEN(str2)] = '\0';
965 
966  return mrb_obj_value(str2);
967 }
968 /* -------------------------------------------------------------- */
969 
970 #define lesser(a,b) (((a)>(b))?(b):(a))
971 
972 /* ---------------------------*/
973 /*
974  * call-seq:
975  * mrb_value str1 <=> mrb_value str2 => int
976  * > 1
977  * = 0
978  * < -1
979  */
980 MRB_API int
982 {
983  mrb_int len;
984  mrb_int retval;
985  struct RString *s1 = mrb_str_ptr(str1);
986  struct RString *s2 = mrb_str_ptr(str2);
987 
989  retval = memcmp(RSTR_PTR(s1), RSTR_PTR(s2), len);
990  if (retval == 0) {
991  if (RSTR_LEN(s1) == RSTR_LEN(s2)) return 0;
992  if (RSTR_LEN(s1) > RSTR_LEN(s2)) return 1;
993  return -1;
994  }
995  if (retval > 0) return 1;
996  return -1;
997 }
998 
999 /* 15.2.10.5.3 */
1000 
1001 /*
1002  * call-seq:
1003  * str <=> other_str => -1, 0, +1
1004  *
1005  * Comparison---Returns -1 if <i>other_str</i> is less than, 0 if
1006  * <i>other_str</i> is equal to, and +1 if <i>other_str</i> is greater than
1007  * <i>str</i>. If the strings are of different lengths, and the strings are
1008  * equal when compared up to the shortest length, then the longer string is
1009  * considered greater than the shorter one. If the variable <code>$=</code> is
1010  * <code>false</code>, the comparison is based on comparing the binary values
1011  * of each character in the string. In older versions of Ruby, setting
1012  * <code>$=</code> allowed case-insensitive comparisons; this is now deprecated
1013  * in favor of using <code>String#casecmp</code>.
1014  *
1015  * <code><=></code> is the basis for the methods <code><</code>,
1016  * <code><=</code>, <code>></code>, <code>>=</code>, and <code>between?</code>,
1017  * included from module <code>Comparable</code>. The method
1018  * <code>String#==</code> does not use <code>Comparable#==</code>.
1019  *
1020  * "abcdef" <=> "abcde" #=> 1
1021  * "abcdef" <=> "abcdef" #=> 0
1022  * "abcdef" <=> "abcdefg" #=> -1
1023  * "abcdef" <=> "ABCDEF" #=> 1
1024  */
1025 static mrb_value
1027 {
1028  mrb_value str2 = mrb_get_arg1(mrb);
1029  mrb_int result;
1030 
1031  if (!mrb_string_p(str2)) {
1032  return mrb_nil_value();
1033  }
1034  else {
1035  result = mrb_str_cmp(mrb, str1, str2);
1036  }
1037  return mrb_fixnum_value(result);
1038 }
1039 
1040 static mrb_bool
1042 {
1043  const mrb_int len = RSTRING_LEN(str1);
1044 
1045  if (len != RSTRING_LEN(str2)) return FALSE;
1046  if (memcmp(RSTRING_PTR(str1), RSTRING_PTR(str2), (size_t)len) == 0)
1047  return TRUE;
1048  return FALSE;
1049 }
1050 
1053 {
1054  if (!mrb_string_p(str2)) return FALSE;
1055  return str_eql(mrb, str1, str2);
1056 }
1057 
1058 /* 15.2.10.5.4 */
1059 /*
1060  * call-seq:
1061  * str == obj => true or false
1062  *
1063  * Equality---
1064  * If <i>obj</i> is not a <code>String</code>, returns <code>false</code>.
1065  * Otherwise, returns <code>false</code> or <code>true</code>
1066  *
1067  * caution:if <i>str</i> <code><=></code> <i>obj</i> returns zero.
1068  */
1069 static mrb_value
1071 {
1072  mrb_value str2 = mrb_get_arg1(mrb);
1073 
1074  return mrb_bool_value(mrb_str_equal(mrb, str1, str2));
1075 }
1076 /* ---------------------------------- */
1077 
1078 /* obslete: use RSTRING_PTR() */
1079 MRB_API const char*
1081 {
1082  str = mrb_obj_as_string(mrb, str);
1083  return RSTRING_PTR(str);
1084 }
1085 
1086 /* obslete: use RSTRING_LEN() */
1089 {
1090  mrb_to_str(mrb, ptr);
1091  return RSTRING_LEN(ptr);
1092 }
1093 
1096 {
1097  struct RString *s = mrb_str_ptr(str);
1098  struct RString *dup = str_new(mrb, 0, 0);
1099 
1101  return str_replace(mrb, dup, s);
1102 }
1103 
1105  /* `beg` and `len` are byte unit in `0 ... str.bytesize` */
1107 
1108  /* `beg` and `len` are char unit in any range */
1110 
1111  /* `beg` and `len` are char unit in `0 ... str.size` */
1113 
1114  /* `beg` is out of range */
1115  STR_OUT_OF_RANGE = -1
1116 };
1117 
1118 static enum str_convert_range
1120 {
1121  if (!mrb_undef_p(alen)) {
1122  *beg = mrb_int(mrb, indx);
1123  *len = mrb_int(mrb, alen);
1124  return STR_CHAR_RANGE;
1125  }
1126  else {
1127  switch (mrb_type(indx)) {
1128  case MRB_TT_INTEGER:
1129  *beg = mrb_integer(indx);
1130  *len = 1;
1131  return STR_CHAR_RANGE;
1132 
1133  case MRB_TT_STRING:
1134  *beg = str_index_str(mrb, str, indx, 0);
1135  if (*beg < 0) { break; }
1136  *len = RSTRING_LEN(indx);
1137  return STR_BYTE_RANGE_CORRECTED;
1138 
1139  case MRB_TT_RANGE:
1140  goto range_arg;
1141 
1142  default:
1143  indx = mrb_to_int(mrb, indx);
1144  if (mrb_integer_p(indx)) {
1145  *beg = mrb_integer(indx);
1146  *len = 1;
1147  return STR_CHAR_RANGE;
1148  }
1149 range_arg:
1150  *len = RSTRING_CHAR_LEN(str);
1151  switch (mrb_range_beg_len(mrb, indx, beg, len, *len, TRUE)) {
1152  case MRB_RANGE_OK:
1153  return STR_CHAR_RANGE_CORRECTED;
1154  case MRB_RANGE_OUT:
1155  return STR_OUT_OF_RANGE;
1156  default:
1157  break;
1158  }
1159 
1160  mrb_raise(mrb, E_TYPE_ERROR, "can't convert to Integer");
1161  }
1162  }
1163  return STR_OUT_OF_RANGE;
1164 }
1165 
1166 static mrb_value
1168 {
1169  mrb_int beg, len;
1170 
1171  switch (str_convert_range(mrb, str, indx, alen, &beg, &len)) {
1173  return str_subseq(mrb, str, beg, len);
1174  case STR_CHAR_RANGE:
1175  str = str_substr(mrb, str, beg, len);
1176  if (mrb_undef_p(alen) && !mrb_nil_p(str) && RSTRING_LEN(str) == 0) return mrb_nil_value();
1177  return str;
1179  if (mrb_string_p(indx)) {
1180  return mrb_str_dup(mrb, indx);
1181  }
1182  else {
1183  return mrb_str_byte_subseq(mrb, str, beg, len);
1184  }
1185  case STR_OUT_OF_RANGE:
1186  default:
1187  return mrb_nil_value();
1188  }
1189 }
1190 
1191 /* 15.2.10.5.6 */
1192 /* 15.2.10.5.34 */
1193 /*
1194  * call-seq:
1195  * str[fixnum] => fixnum or nil
1196  * str[fixnum, fixnum] => new_str or nil
1197  * str[range] => new_str or nil
1198  * str[other_str] => new_str or nil
1199  * str.slice(fixnum) => fixnum or nil
1200  * str.slice(fixnum, fixnum) => new_str or nil
1201  * str.slice(range) => new_str or nil
1202  * str.slice(other_str) => new_str or nil
1203  *
1204  * Element Reference---If passed a single <code>Integer</code>, returns the code
1205  * of the character at that position. If passed two <code>Integer</code>
1206  * objects, returns a substring starting at the offset given by the first, and
1207  * a length given by the second. If given a range, a substring containing
1208  * characters at offsets given by the range is returned. In all three cases, if
1209  * an offset is negative, it is counted from the end of <i>str</i>. Returns
1210  * <code>nil</code> if the initial offset falls outside the string, the length
1211  * is negative, or the beginning of the range is greater than the end.
1212  *
1213  * If a <code>String</code> is given, that string is returned if it occurs in
1214  * <i>str</i>. In both cases, <code>nil</code> is returned if there is no
1215  * match.
1216  *
1217  * a = "hello there"
1218  * a[1] #=> 101(1.8.7) "e"(1.9.2)
1219  * a[1.1] #=> "e"(1.9.2)
1220  * a[1,3] #=> "ell"
1221  * a[1..3] #=> "ell"
1222  * a[-3,2] #=> "er"
1223  * a[-4..-2] #=> "her"
1224  * a[12..-1] #=> nil
1225  * a[-2..-4] #=> ""
1226  * a["lo"] #=> "lo"
1227  * a["bye"] #=> nil
1228  */
1229 static mrb_value
1231 {
1232  mrb_value a1, a2;
1233 
1234  if (mrb_get_args(mrb, "o|o", &a1, &a2) == 1) {
1235  a2 = mrb_undef_value();
1236  }
1237 
1238  return mrb_str_aref(mrb, str, a1, a2);
1239 }
1240 
1241 static mrb_noreturn void
1243 {
1244  mrb_raisef(mrb, E_INDEX_ERROR, "index %v out of string", index);
1245 }
1246 
1247 static mrb_value
1249 {
1250  const mrb_int shrink_threshold = 256;
1251  struct RString *str = mrb_str_ptr(src);
1252  mrb_int len = RSTR_LEN(str);
1253  mrb_int replen, newlen;
1254  char *strp;
1255 
1256  if (end > len) { end = len; }
1257 
1258  if (pos < 0 || pos > len) {
1260  }
1261 
1262  replen = (mrb_nil_p(rep) ? 0 : RSTRING_LEN(rep));
1263  newlen = replen + (len - (end - pos));
1264 
1265  if (newlen >= MRB_SSIZE_MAX || newlen < replen /* overflowed */) {
1266  mrb_raise(mrb, E_RUNTIME_ERROR, "string size too big");
1267  }
1268 
1269  mrb_str_modify(mrb, str);
1270 
1271  if (len < newlen) {
1272  resize_capa(mrb, str, newlen);
1273  }
1274 
1275  strp = RSTR_PTR(str);
1276 
1277  memmove(strp + newlen - (len - end), strp + end, len - end);
1278  if (!mrb_nil_p(rep)) {
1279  memmove(strp + pos, RSTRING_PTR(rep), replen);
1280  }
1281  RSTR_SET_LEN(str, newlen);
1282  strp[newlen] = '\0';
1283 
1284  if (len - newlen >= shrink_threshold) {
1285  resize_capa(mrb, str, newlen);
1286  }
1287 
1288  return src;
1289 }
1290 
1291 #define IS_EVSTR(p,e) ((p) < (e) && (*(p) == '$' || *(p) == '@' || *(p) == '{'))
1292 
1293 static mrb_value
1295 {
1296  const char *p, *pend;
1297  char buf[4]; /* `\x??` or UTF-8 character */
1298  mrb_value result = mrb_str_new_lit(mrb, "\"");
1299 #ifdef MRB_UTF8_STRING
1300  uint32_t ascii_flag = MRB_STR_ASCII;
1301 #endif
1302 
1303  p = RSTRING_PTR(str); pend = RSTRING_END(str);
1304  for (;p < pend; p++) {
1305  unsigned char c, cc;
1306 #ifdef MRB_UTF8_STRING
1307  if (inspect) {
1308  mrb_int clen = mrb_utf8len(p, pend);
1309  if (clen > 1) {
1310  mrb_int i;
1311 
1312  for (i=0; i<clen; i++) {
1313  buf[i] = p[i];
1314  }
1315  mrb_str_cat(mrb, result, buf, clen);
1316  p += clen-1;
1317  ascii_flag = 0;
1318  continue;
1319  }
1320  }
1321 #endif
1322  c = *p;
1323  if (c == '"'|| c == '\\' || (c == '#' && IS_EVSTR(p+1, pend))) {
1324  buf[0] = '\\'; buf[1] = c;
1325  mrb_str_cat(mrb, result, buf, 2);
1326  continue;
1327  }
1328  if (ISPRINT(c)) {
1329  buf[0] = c;
1330  mrb_str_cat(mrb, result, buf, 1);
1331  continue;
1332  }
1333  switch (c) {
1334  case '\n': cc = 'n'; break;
1335  case '\r': cc = 'r'; break;
1336  case '\t': cc = 't'; break;
1337  case '\f': cc = 'f'; break;
1338  case '\013': cc = 'v'; break;
1339  case '\010': cc = 'b'; break;
1340  case '\007': cc = 'a'; break;
1341  case 033: cc = 'e'; break;
1342  default: cc = 0; break;
1343  }
1344  if (cc) {
1345  buf[0] = '\\';
1346  buf[1] = (char)cc;
1347  mrb_str_cat(mrb, result, buf, 2);
1348  continue;
1349  }
1350  else {
1351  buf[0] = '\\';
1352  buf[1] = 'x';
1353  buf[3] = mrb_digitmap[c % 16]; c /= 16;
1354  buf[2] = mrb_digitmap[c % 16];
1355  mrb_str_cat(mrb, result, buf, 4);
1356  continue;
1357  }
1358  }
1359  mrb_str_cat_lit(mrb, result, "\"");
1360 #ifdef MRB_UTF8_STRING
1361  if (inspect) {
1362  mrb_str_ptr(str)->flags |= ascii_flag;
1363  mrb_str_ptr(result)->flags |= ascii_flag;
1364  }
1365  else {
1367  }
1368 #endif
1369 
1370  return result;
1371 }
1372 
1373 static void
1375 {
1376  mrb_int beg, len, charlen;
1377 
1378  mrb_to_str(mrb, replace);
1379 
1380  switch (str_convert_range(mrb, str, indx, alen, &beg, &len)) {
1381  case STR_OUT_OF_RANGE:
1382  default:
1383  mrb_raise(mrb, E_INDEX_ERROR, "string not matched");
1384  case STR_CHAR_RANGE:
1385  if (len < 0) {
1386  mrb_raisef(mrb, E_INDEX_ERROR, "negative length %v", alen);
1387  }
1388  charlen = RSTRING_CHAR_LEN(str);
1389  if (beg < 0) { beg += charlen; }
1390  if (beg < 0 || beg > charlen) { str_out_of_index(mrb, indx); }
1391  /* fall through */
1393  str_range_to_bytes(str, &beg, &len);
1394  /* fall through */
1396  str_replace_partial(mrb, str, beg, beg + len, replace);
1397  }
1398 }
1399 
1400 /*
1401  * call-seq:
1402  * str[fixnum] = replace
1403  * str[fixnum, fixnum] = replace
1404  * str[range] = replace
1405  * str[other_str] = replace
1406  *
1407  * Modify +self+ by replacing the content of +self+.
1408  * The portion of the string affected is determined using the same criteria as +String#[]+.
1409  */
1410 static mrb_value
1412 {
1413  mrb_value indx, alen, replace;
1414 
1415  switch (mrb_get_args(mrb, "oo|S!", &indx, &alen, &replace)) {
1416  case 2:
1417  replace = alen;
1418  alen = mrb_undef_value();
1419  break;
1420  case 3:
1421  break;
1422  }
1423  mrb_str_aset(mrb, str, indx, alen, replace);
1424  return str;
1425 }
1426 
1427 /* 15.2.10.5.8 */
1428 /*
1429  * call-seq:
1430  * str.capitalize! => str or nil
1431  *
1432  * Modifies <i>str</i> by converting the first character to uppercase and the
1433  * remainder to lowercase. Returns <code>nil</code> if no changes are made.
1434  *
1435  * a = "hello"
1436  * a.capitalize! #=> "Hello"
1437  * a #=> "Hello"
1438  * a.capitalize! #=> nil
1439  */
1440 static mrb_value
1442 {
1443  char *p, *pend;
1444  mrb_bool modify = FALSE;
1445  struct RString *s = mrb_str_ptr(str);
1446 
1448  if (RSTR_LEN(s) == 0 || !RSTR_PTR(s)) return mrb_nil_value();
1449  p = RSTR_PTR(s); pend = RSTR_PTR(s) + RSTR_LEN(s);
1450  if (ISLOWER(*p)) {
1451  *p = TOUPPER(*p);
1452  modify = TRUE;
1453  }
1454  while (++p < pend) {
1455  if (ISUPPER(*p)) {
1456  *p = TOLOWER(*p);
1457  modify = TRUE;
1458  }
1459  }
1460  if (modify) return str;
1461  return mrb_nil_value();
1462 }
1463 
1464 /* 15.2.10.5.7 */
1465 /*
1466  * call-seq:
1467  * str.capitalize => new_str
1468  *
1469  * Returns a copy of <i>str</i> with the first character converted to uppercase
1470  * and the remainder to lowercase.
1471  *
1472  * "hello".capitalize #=> "Hello"
1473  * "HELLO".capitalize #=> "Hello"
1474  * "123ABC".capitalize #=> "123abc"
1475  */
1476 static mrb_value
1478 {
1479  mrb_value str;
1480 
1481  str = mrb_str_dup(mrb, self);
1483  return str;
1484 }
1485 
1486 /* 15.2.10.5.10 */
1487 /*
1488  * call-seq:
1489  * str.chomp!(separator="\n") => str or nil
1490  *
1491  * Modifies <i>str</i> in place as described for <code>String#chomp</code>,
1492  * returning <i>str</i>, or <code>nil</code> if no modifications were made.
1493  */
1494 static mrb_value
1496 {
1497  mrb_value rs;
1498  mrb_int newline;
1499  char *p, *pp;
1500  mrb_int rslen;
1501  mrb_int len;
1502  mrb_int argc;
1503  struct RString *s = mrb_str_ptr(str);
1504 
1505  argc = mrb_get_args(mrb, "|S", &rs);
1507  len = RSTR_LEN(s);
1508  if (argc == 0) {
1509  if (len == 0) return mrb_nil_value();
1510  smart_chomp:
1511  if (RSTR_PTR(s)[len-1] == '\n') {
1512  RSTR_SET_LEN(s, RSTR_LEN(s) - 1);
1513  if (RSTR_LEN(s) > 0 &&
1514  RSTR_PTR(s)[RSTR_LEN(s)-1] == '\r') {
1515  RSTR_SET_LEN(s, RSTR_LEN(s) - 1);
1516  }
1517  }
1518  else if (RSTR_PTR(s)[len-1] == '\r') {
1519  RSTR_SET_LEN(s, RSTR_LEN(s) - 1);
1520  }
1521  else {
1522  return mrb_nil_value();
1523  }
1524  RSTR_PTR(s)[RSTR_LEN(s)] = '\0';
1525  return str;
1526  }
1527 
1528  if (len == 0 || mrb_nil_p(rs)) return mrb_nil_value();
1529  p = RSTR_PTR(s);
1530  rslen = RSTRING_LEN(rs);
1531  if (rslen == 0) {
1532  while (len>0 && p[len-1] == '\n') {
1533  len--;
1534  if (len>0 && p[len-1] == '\r')
1535  len--;
1536  }
1537  if (len < RSTR_LEN(s)) {
1538  RSTR_SET_LEN(s, len);
1539  p[len] = '\0';
1540  return str;
1541  }
1542  return mrb_nil_value();
1543  }
1544  if (rslen > len) return mrb_nil_value();
1545  newline = RSTRING_PTR(rs)[rslen-1];
1546  if (rslen == 1 && newline == '\n')
1547  newline = RSTRING_PTR(rs)[rslen-1];
1548  if (rslen == 1 && newline == '\n')
1549  goto smart_chomp;
1550 
1551  pp = p + len - rslen;
1552  if (p[len-1] == newline &&
1553  (rslen <= 1 ||
1554  memcmp(RSTRING_PTR(rs), pp, rslen) == 0)) {
1555  RSTR_SET_LEN(s, len - rslen);
1556  p[RSTR_LEN(s)] = '\0';
1557  return str;
1558  }
1559  return mrb_nil_value();
1560 }
1561 
1562 /* 15.2.10.5.9 */
1563 /*
1564  * call-seq:
1565  * str.chomp(separator="\n") => new_str
1566  *
1567  * Returns a new <code>String</code> with the given record separator removed
1568  * from the end of <i>str</i> (if present). <code>chomp</code> also removes
1569  * carriage return characters (that is it will remove <code>\n</code>,
1570  * <code>\r</code>, and <code>\r\n</code>).
1571  *
1572  * "hello".chomp #=> "hello"
1573  * "hello\n".chomp #=> "hello"
1574  * "hello\r\n".chomp #=> "hello"
1575  * "hello\n\r".chomp #=> "hello\n"
1576  * "hello\r".chomp #=> "hello"
1577  * "hello \n there".chomp #=> "hello \n there"
1578  * "hello".chomp("llo") #=> "he"
1579  */
1580 static mrb_value
1582 {
1583  mrb_value str;
1584 
1585  str = mrb_str_dup(mrb, self);
1586  mrb_str_chomp_bang(mrb, str);
1587  return str;
1588 }
1589 
1590 /* 15.2.10.5.12 */
1591 /*
1592  * call-seq:
1593  * str.chop! => str or nil
1594  *
1595  * Processes <i>str</i> as for <code>String#chop</code>, returning <i>str</i>,
1596  * or <code>nil</code> if <i>str</i> is the empty string. See also
1597  * <code>String#chomp!</code>.
1598  */
1599 static mrb_value
1601 {
1602  struct RString *s = mrb_str_ptr(str);
1603 
1605  if (RSTR_LEN(s) > 0) {
1606  mrb_int len;
1607 #ifdef MRB_UTF8_STRING
1608  const char* t = RSTR_PTR(s), *p = t;
1609  const char* e = p + RSTR_LEN(s);
1610  while (p<e) {
1611  mrb_int clen = mrb_utf8len(p, e);
1612  if (p + clen>=e) break;
1613  p += clen;
1614  }
1615  len = p - t;
1616 #else
1617  len = RSTR_LEN(s) - 1;
1618 #endif
1619  if (RSTR_PTR(s)[len] == '\n') {
1620  if (len > 0 &&
1621  RSTR_PTR(s)[len-1] == '\r') {
1622  len--;
1623  }
1624  }
1625  RSTR_SET_LEN(s, len);
1626  RSTR_PTR(s)[len] = '\0';
1627  return str;
1628  }
1629  return mrb_nil_value();
1630 }
1631 
1632 /* 15.2.10.5.11 */
1633 /*
1634  * call-seq:
1635  * str.chop => new_str
1636  *
1637  * Returns a new <code>String</code> with the last character removed. If the
1638  * string ends with <code>\r\n</code>, both characters are removed. Applying
1639  * <code>chop</code> to an empty string returns an empty
1640  * string. <code>String#chomp</code> is often a safer alternative, as it leaves
1641  * the string unchanged if it doesn't end in a record separator.
1642  *
1643  * "string\r\n".chop #=> "string"
1644  * "string\n\r".chop #=> "string\n"
1645  * "string\n".chop #=> "string"
1646  * "string".chop #=> "strin"
1647  * "x".chop #=> ""
1648  */
1649 static mrb_value
1651 {
1652  mrb_value str;
1653  str = mrb_str_dup(mrb, self);
1654  mrb_str_chop_bang(mrb, str);
1655  return str;
1656 }
1657 
1658 /* 15.2.10.5.14 */
1659 /*
1660  * call-seq:
1661  * str.downcase! => str or nil
1662  *
1663  * Downcases the contents of <i>str</i>, returning <code>nil</code> if no
1664  * changes were made.
1665  */
1666 static mrb_value
1668 {
1669  char *p, *pend;
1670  mrb_bool modify = FALSE;
1671  struct RString *s = mrb_str_ptr(str);
1672 
1674  p = RSTR_PTR(s);
1675  pend = RSTR_PTR(s) + RSTR_LEN(s);
1676  while (p < pend) {
1677  if (ISUPPER(*p)) {
1678  *p = TOLOWER(*p);
1679  modify = TRUE;
1680  }
1681  p++;
1682  }
1683 
1684  if (modify) return str;
1685  return mrb_nil_value();
1686 }
1687 
1688 /* 15.2.10.5.13 */
1689 /*
1690  * call-seq:
1691  * str.downcase => new_str
1692  *
1693  * Returns a copy of <i>str</i> with all uppercase letters replaced with their
1694  * lowercase counterparts. The operation is locale insensitive---only
1695  * characters 'A' to 'Z' are affected.
1696  *
1697  * "hEllO".downcase #=> "hello"
1698  */
1699 static mrb_value
1701 {
1702  mrb_value str;
1703 
1704  str = mrb_str_dup(mrb, self);
1705  mrb_str_downcase_bang(mrb, str);
1706  return str;
1707 }
1708 
1709 /* 15.2.10.5.16 */
1710 /*
1711  * call-seq:
1712  * str.empty? => true or false
1713  *
1714  * Returns <code>true</code> if <i>str</i> has a length of zero.
1715  *
1716  * "hello".empty? #=> false
1717  * "".empty? #=> true
1718  */
1719 static mrb_value
1721 {
1722  struct RString *s = mrb_str_ptr(self);
1723 
1724  return mrb_bool_value(RSTR_LEN(s) == 0);
1725 }
1726 
1727 /* 15.2.10.5.17 */
1728 /*
1729  * call-seq:
1730  * str.eql?(other) => true or false
1731  *
1732  * Two strings are equal if the have the same length and content.
1733  */
1734 static mrb_value
1736 {
1737  mrb_value str2 = mrb_get_arg1(mrb);
1738  mrb_bool eql_p;
1739 
1740  eql_p = (mrb_string_p(str2)) && str_eql(mrb, self, str2);
1741 
1742  return mrb_bool_value(eql_p);
1743 }
1744 
1747 {
1748  return str_substr(mrb, str, beg, len);
1749 }
1750 
1751 uint32_t
1753 {
1754  /* 1-8-7 */
1755  struct RString *s = mrb_str_ptr(str);
1756  mrb_int len = RSTR_LEN(s);
1757  char *p = RSTR_PTR(s);
1758  uint32_t hash = 0;
1759 
1760  for(int i = 0; i < len; ++i) {
1761  hash += p[i];
1762  hash += (hash << 10);
1763  hash ^= (hash >> 6);
1764  }
1765  hash += (hash << 3);
1766  hash ^= (hash >> 11);
1767  hash += (hash << 15);
1768  return hash;
1769 }
1770 
1771 /* 15.2.10.5.20 */
1772 /*
1773  * call-seq:
1774  * str.hash => fixnum
1775  *
1776  * Return a hash based on the string's length and content.
1777  */
1778 static mrb_value
1780 {
1781  mrb_int key = mrb_str_hash(mrb, self);
1782  return mrb_fixnum_value(key);
1783 }
1784 
1785 /* 15.2.10.5.21 */
1786 /*
1787  * call-seq:
1788  * str.include? other_str => true or false
1789  * str.include? fixnum => true or false
1790  *
1791  * Returns <code>true</code> if <i>str</i> contains the given string or
1792  * character.
1793  *
1794  * "hello".include? "lo" #=> true
1795  * "hello".include? "ol" #=> false
1796  * "hello".include? ?h #=> true
1797  */
1798 static mrb_value
1800 {
1801  mrb_value str2;
1802 
1803  mrb_get_args(mrb, "S", &str2);
1804  if (str_index_str(mrb, self, str2, 0) < 0)
1805  return mrb_bool_value(FALSE);
1806  return mrb_bool_value(TRUE);
1807 }
1808 
1809 /* 15.2.10.5.22 */
1810 /*
1811  * call-seq:
1812  * str.index(substring [, offset]) => fixnum or nil
1813  *
1814  * Returns the index of the first occurrence of the given
1815  * <i>substring</i>. Returns <code>nil</code> if not found.
1816  * If the second parameter is present, it
1817  * specifies the position in the string to begin the search.
1818  *
1819  * "hello".index('l') #=> 2
1820  * "hello".index('lo') #=> 3
1821  * "hello".index('a') #=> nil
1822  * "hello".index('l', -2) #=> 3
1823  */
1824 static mrb_value
1826 {
1827  mrb_value sub;
1828  mrb_int pos;
1829 
1830  if (mrb_get_args(mrb, "S|i", &sub, &pos) == 1) {
1831  pos = 0;
1832  }
1833  else if (pos < 0) {
1834  mrb_int clen = RSTRING_CHAR_LEN(str);
1835  pos += clen;
1836  if (pos < 0) {
1837  return mrb_nil_value();
1838  }
1839  }
1840  pos = str_index_str_by_char(mrb, str, sub, pos);
1841 
1842  if (pos == -1) return mrb_nil_value();
1844  return mrb_fixnum_value(pos);
1845 }
1846 
1847 /* 15.2.10.5.24 */
1848 /* 15.2.10.5.28 */
1849 /*
1850  * call-seq:
1851  * str.replace(other_str) => str
1852  *
1853  * s = "hello" #=> "hello"
1854  * s.replace "world" #=> "world"
1855  */
1856 static mrb_value
1858 {
1859  mrb_value str2;
1860 
1861  mrb_get_args(mrb, "S", &str2);
1862  return str_replace(mrb, mrb_str_ptr(str), mrb_str_ptr(str2));
1863 }
1864 
1865 /* 15.2.10.5.23 */
1866 /*
1867  * call-seq:
1868  * String.new(str="") => new_str
1869  *
1870  * Returns a new string object containing a copy of <i>str</i>.
1871  */
1872 static mrb_value
1874 {
1875  mrb_value str2;
1876 
1877  if (mrb_get_args(mrb, "|S", &str2) == 0) {
1878  struct RString *s = str_new(mrb, 0, 0);
1879  str2 = mrb_obj_value(s);
1880  }
1881  str_replace(mrb, mrb_str_ptr(self), mrb_str_ptr(str2));
1882  return self;
1883 }
1884 
1885 /* 15.2.10.5.25 */
1886 /* 15.2.10.5.41 */
1887 /*
1888  * call-seq:
1889  * str.intern => symbol
1890  * str.to_sym => symbol
1891  *
1892  * Returns the <code>Symbol</code> corresponding to <i>str</i>, creating the
1893  * symbol if it did not previously exist. See <code>Symbol#id2name</code>.
1894  *
1895  * "Koala".intern #=> :Koala
1896  * s = 'cat'.to_sym #=> :cat
1897  * s == :cat #=> true
1898  * s = '@cat'.to_sym #=> :@cat
1899  * s == :@cat #=> true
1900  *
1901  * This can also be used to create symbols that cannot be represented using the
1902  * <code>:xxx</code> notation.
1903  *
1904  * 'cat and dog'.to_sym #=> :"cat and dog"
1905  */
1908 {
1909  return mrb_symbol_value(mrb_intern_str(mrb, self));
1910 }
1911 /* ---------------------------------- */
1914 {
1915  switch (mrb_type(obj)) {
1916  case MRB_TT_STRING:
1917  return obj;
1918  case MRB_TT_SYMBOL:
1919  return mrb_sym_str(mrb, mrb_symbol(obj));
1920  case MRB_TT_INTEGER:
1921  return mrb_fixnum_to_str(mrb, obj, 10);
1922  case MRB_TT_SCLASS:
1923  case MRB_TT_CLASS:
1924  case MRB_TT_MODULE:
1925  return mrb_mod_to_s(mrb, obj);
1926  default:
1927  return mrb_type_convert(mrb, obj, MRB_TT_STRING, MRB_SYM(to_s));
1928  }
1929 }
1930 
1933 {
1934  struct RString *p_str;
1935  char *p1;
1936  char *p2;
1937  uintptr_t n = (uintptr_t)p;
1938 
1939  p_str = str_new(mrb, NULL, 2 + sizeof(uintptr_t) * CHAR_BIT / 4);
1940  p1 = RSTR_PTR(p_str);
1941  *p1++ = '0';
1942  *p1++ = 'x';
1943  p2 = p1;
1944 
1945  do {
1946  *p2++ = mrb_digitmap[n % 16];
1947  n /= 16;
1948  } while (n > 0);
1949  *p2 = '\0';
1950  RSTR_SET_LEN(p_str, (mrb_int)(p2 - RSTR_PTR(p_str)));
1951 
1952  while (p1 < p2) {
1953  const char c = *p1;
1954  *p1++ = *--p2;
1955  *p2 = c;
1956  }
1957 
1958  return mrb_obj_value(p_str);
1959 }
1960 
1961 static inline void
1962 str_reverse(char *p, char *e)
1963 {
1964  char c;
1965 
1966  while (p < e) {
1967  c = *p;
1968  *p++ = *e;
1969  *e-- = c;
1970  }
1971 }
1972 
1973 /* 15.2.10.5.30 */
1974 /*
1975  * call-seq:
1976  * str.reverse! => str
1977  *
1978  * Reverses <i>str</i> in place.
1979  */
1980 static mrb_value
1982 {
1983  struct RString *s = mrb_str_ptr(str);
1984  char *p, *e;
1985 
1986 #ifdef MRB_UTF8_STRING
1987  mrb_int utf8_len = RSTRING_CHAR_LEN(str);
1988  mrb_int len = RSTR_LEN(s);
1989 
1990  if (utf8_len < 2) return str;
1991  if (utf8_len < len) {
1992  mrb_str_modify(mrb, s);
1993  p = RSTR_PTR(s);
1994  e = p + RSTR_LEN(s);
1995  while (p<e) {
1996  mrb_int clen = mrb_utf8len(p, e);
1997  str_reverse(p, p + clen - 1);
1998  p += clen;
1999  }
2000  goto bytes;
2001  }
2002 #endif
2003 
2004  if (RSTR_LEN(s) > 1) {
2005  mrb_str_modify(mrb, s);
2006  goto bytes;
2007  }
2008  return str;
2009 
2010  bytes:
2011  p = RSTR_PTR(s);
2012  e = p + RSTR_LEN(s) - 1;
2013  str_reverse(p, e);
2014  return str;
2015 }
2016 
2017 /* ---------------------------------- */
2018 /* 15.2.10.5.29 */
2019 /*
2020  * call-seq:
2021  * str.reverse => new_str
2022  *
2023  * Returns a new string with the characters from <i>str</i> in reverse order.
2024  *
2025  * "stressed".reverse #=> "desserts"
2026  */
2027 static mrb_value
2029 {
2030  mrb_value str2 = mrb_str_dup(mrb, str);
2031  mrb_str_reverse_bang(mrb, str2);
2032  return str2;
2033 }
2034 
2035 /* 15.2.10.5.31 */
2036 /*
2037  * call-seq:
2038  * str.rindex(substring [, offset]) => fixnum or nil
2039  *
2040  * Returns the index of the last occurrence of the given <i>substring</i>.
2041  * Returns <code>nil</code> if not found. If the second parameter is
2042  * present, it specifies the position in the string to end the
2043  * search---characters beyond this point will not be considered.
2044  *
2045  * "hello".rindex('e') #=> 1
2046  * "hello".rindex('l') #=> 3
2047  * "hello".rindex('a') #=> nil
2048  * "hello".rindex('l', 2) #=> 2
2049  */
2050 static mrb_value
2052 {
2053  mrb_value sub;
2055 
2056  if (mrb_get_args(mrb, "S|i", &sub, &pos) == 1) {
2057  pos = len;
2058  }
2059  else {
2060  if (pos < 0) {
2061  pos += len;
2062  if (pos < 0) {
2063  return mrb_nil_value();
2064  }
2065  }
2066  if (pos > len) pos = len;
2067  }
2068  pos = chars2bytes(str, 0, pos);
2069  pos = str_rindex(mrb, str, sub, pos);
2070  if (pos >= 0) {
2073  return mrb_fixnum_value(pos);
2074  }
2075  return mrb_nil_value();
2076 }
2077 
2078 /* 15.2.10.5.35 */
2079 
2080 /*
2081  * call-seq:
2082  * str.split(separator=nil, [limit]) => anArray
2083  *
2084  * Divides <i>str</i> into substrings based on a delimiter, returning an array
2085  * of these substrings.
2086  *
2087  * If <i>separator</i> is a <code>String</code>, then its contents are used as
2088  * the delimiter when splitting <i>str</i>. If <i>separator</i> is a single
2089  * space, <i>str</i> is split on whitespace, with leading whitespace and runs
2090  * of contiguous whitespace characters ignored.
2091  *
2092  * If <i>separator</i> is omitted or <code>nil</code> (which is the default),
2093  * <i>str</i> is split on whitespace as if ' ' were specified.
2094  *
2095  * If the <i>limit</i> parameter is omitted, trailing null fields are
2096  * suppressed. If <i>limit</i> is a positive number, at most that number of
2097  * fields will be returned (if <i>limit</i> is <code>1</code>, the entire
2098  * string is returned as the only entry in an array). If negative, there is no
2099  * limit to the number of fields returned, and trailing null fields are not
2100  * suppressed.
2101  *
2102  * " now's the time".split #=> ["now's", "the", "time"]
2103  * " now's the time".split(' ') #=> ["now's", "the", "time"]
2104  *
2105  * "mellow yellow".split("ello") #=> ["m", "w y", "w"]
2106  * "1,2,,3,4,,".split(',') #=> ["1", "2", "", "3", "4"]
2107  * "1,2,,3,4,,".split(',', 4) #=> ["1", "2", "", "3,4,,"]
2108  * "1,2,,3,4,,".split(',', -4) #=> ["1", "2", "", "3", "4", "", ""]
2109  */
2110 
2111 static mrb_value
2113 {
2114  mrb_int argc;
2115  mrb_value spat = mrb_nil_value();
2116  enum {awk, string} split_type = string;
2117  mrb_int i = 0;
2118  mrb_int beg;
2119  mrb_int end;
2120  mrb_int lim = 0;
2121  mrb_bool lim_p;
2122  mrb_value result, tmp;
2123 
2124  argc = mrb_get_args(mrb, "|oi", &spat, &lim);
2125  lim_p = (lim > 0 && argc == 2);
2126  if (argc == 2) {
2127  if (lim == 1) {
2128  if (RSTRING_LEN(str) == 0)
2129  return mrb_ary_new_capa(mrb, 0);
2130  return mrb_ary_new_from_values(mrb, 1, &str);
2131  }
2132  i = 1;
2133  }
2134 
2135  if (argc == 0 || mrb_nil_p(spat)) {
2136  split_type = awk;
2137  }
2138  else if (!mrb_string_p(spat)) {
2139  mrb_raise(mrb, E_TYPE_ERROR, "expected String");
2140  }
2141  else if (RSTRING_LEN(spat) == 1 && RSTRING_PTR(spat)[0] == ' ') {
2142  split_type = awk;
2143  }
2144 
2145  result = mrb_ary_new(mrb);
2146  beg = 0;
2147  if (split_type == awk) {
2148  mrb_bool skip = TRUE;
2149  mrb_int idx = 0;
2151  unsigned int c;
2152  int ai = mrb_gc_arena_save(mrb);
2153 
2154  idx = end = beg;
2155  while (idx < str_len) {
2156  c = (unsigned char)RSTRING_PTR(str)[idx++];
2157  if (skip) {
2158  if (ISSPACE(c)) {
2159  beg = idx;
2160  }
2161  else {
2162  end = idx;
2163  skip = FALSE;
2164  if (lim_p && lim <= i) break;
2165  }
2166  }
2167  else if (ISSPACE(c)) {
2168  mrb_ary_push(mrb, result, mrb_str_byte_subseq(mrb, str, beg, end-beg));
2169  mrb_gc_arena_restore(mrb, ai);
2170  skip = TRUE;
2171  beg = idx;
2172  if (lim_p) ++i;
2173  }
2174  else {
2175  end = idx;
2176  }
2177  }
2178  }
2179  else { /* split_type == string */
2181  mrb_int pat_len = RSTRING_LEN(spat);
2182  mrb_int idx = 0;
2183  int ai = mrb_gc_arena_save(mrb);
2184 
2185  while (idx < str_len) {
2186  if (pat_len > 0) {
2187  end = mrb_memsearch(RSTRING_PTR(spat), pat_len, RSTRING_PTR(str)+idx, str_len - idx);
2188  if (end < 0) break;
2189  }
2190  else {
2191  end = chars2bytes(str, idx, 1);
2192  }
2194  mrb_gc_arena_restore(mrb, ai);
2195  idx += end + pat_len;
2196  if (lim_p && lim <= ++i) break;
2197  }
2198  beg = idx;
2199  }
2200  if (RSTRING_LEN(str) > 0 && (lim_p || RSTRING_LEN(str) > beg || lim < 0)) {
2201  if (RSTRING_LEN(str) == beg) {
2202  tmp = mrb_str_new_empty(mrb, str);
2203  }
2204  else {
2205  tmp = mrb_str_byte_subseq(mrb, str, beg, RSTRING_LEN(str)-beg);
2206  }
2207  mrb_ary_push(mrb, result, tmp);
2208  }
2209  if (!lim_p && lim == 0) {
2210  mrb_int len;
2211  while ((len = RARRAY_LEN(result)) > 0 &&
2212  (tmp = RARRAY_PTR(result)[len-1], RSTRING_LEN(tmp) == 0))
2213  mrb_ary_pop(mrb, result);
2214  }
2215 
2216  return result;
2217 }
2218 
2219 mrb_value
2220 mrb_str_len_to_inum(mrb_state *mrb, const char *str, size_t len, mrb_int base, int badcheck)
2221 {
2222  const char *p = str;
2223  const char *pend = str + len;
2224  char sign = 1;
2225  int c;
2226  mrb_int n = 0;
2227  mrb_int val;
2228 
2229 #define conv_digit(c) \
2230  (ISDIGIT(c) ? ((c) - '0') : \
2231  ISLOWER(c) ? ((c) - 'a' + 10) : \
2232  ISUPPER(c) ? ((c) - 'A' + 10) : \
2233  -1)
2234 
2235  if (!p) {
2236  if (badcheck) goto bad;
2237  return mrb_fixnum_value(0);
2238  }
2239  while (p<pend && ISSPACE(*p))
2240  p++;
2241 
2242  if (p[0] == '+') {
2243  p++;
2244  }
2245  else if (p[0] == '-') {
2246  p++;
2247  sign = 0;
2248  }
2249  if (base <= 0) {
2250  if (p[0] == '0') {
2251  switch (p[1]) {
2252  case 'x': case 'X':
2253  base = 16;
2254  break;
2255  case 'b': case 'B':
2256  base = 2;
2257  break;
2258  case 'o': case 'O':
2259  base = 8;
2260  break;
2261  case 'd': case 'D':
2262  base = 10;
2263  break;
2264  default:
2265  base = 8;
2266  break;
2267  }
2268  }
2269  else if (base < -1) {
2270  base = -base;
2271  }
2272  else {
2273  base = 10;
2274  }
2275  }
2276  switch (base) {
2277  case 2:
2278  if (p[0] == '0' && (p[1] == 'b'||p[1] == 'B')) {
2279  p += 2;
2280  }
2281  break;
2282  case 3:
2283  break;
2284  case 8:
2285  if (p[0] == '0' && (p[1] == 'o'||p[1] == 'O')) {
2286  p += 2;
2287  }
2288  case 4: case 5: case 6: case 7:
2289  break;
2290  case 10:
2291  if (p[0] == '0' && (p[1] == 'd'||p[1] == 'D')) {
2292  p += 2;
2293  }
2294  case 9: case 11: case 12: case 13: case 14: case 15:
2295  break;
2296  case 16:
2297  if (p[0] == '0' && (p[1] == 'x'||p[1] == 'X')) {
2298  p += 2;
2299  }
2300  break;
2301  default:
2302  if (base < 2 || 36 < base) {
2303  mrb_raisef(mrb, E_ARGUMENT_ERROR, "illegal radix %i", base);
2304  }
2305  break;
2306  } /* end of switch (base) { */
2307  if (p>=pend) {
2308  if (badcheck) goto bad;
2309  return mrb_fixnum_value(0);
2310  }
2311  if (*p == '0') { /* squeeze preceding 0s */
2312  p++;
2313  while (p<pend) {
2314  c = *p++;
2315  if (c == '_') {
2316  if (p<pend && *p == '_') {
2317  if (badcheck) goto bad;
2318  break;
2319  }
2320  continue;
2321  }
2322  if (c != '0') {
2323  p--;
2324  break;
2325  }
2326  }
2327  if (*(p - 1) == '0')
2328  p--;
2329  }
2330  if (p == pend || *p == '_') {
2331  if (badcheck) goto bad;
2332  return mrb_fixnum_value(0);
2333  }
2334  for ( ;p<pend;p++) {
2335  if (*p == '_') {
2336  p++;
2337  if (p==pend) {
2338  if (badcheck) goto bad;
2339  continue;
2340  }
2341  if (*p == '_') {
2342  if (badcheck) goto bad;
2343  break;
2344  }
2345  }
2346  if (badcheck && *p == '\0') {
2347  goto nullbyte;
2348  }
2349  c = conv_digit(*p);
2350  if (c < 0 || c >= base) {
2351  break;
2352  }
2353  if (mrb_int_mul_overflow(n, base, &n)) goto overflow;
2354  if (MRB_INT_MAX - c < n) {
2355  if (sign == 0 && MRB_INT_MAX - n == c - 1) {
2356  n = MRB_INT_MIN;
2357  sign = 1;
2358  break;
2359  }
2360  overflow:
2361  mrb_raisef(mrb, E_RANGE_ERROR, "string (%l) too big for integer", str, pend-str);
2362  }
2363  n += c;
2364  }
2365  val = (mrb_int)n;
2366  if (badcheck) {
2367  if (p == str) goto bad; /* no number */
2368  if (*(p - 1) == '_') goto bad; /* trailing '_' */
2369  while (p<pend && ISSPACE(*p)) p++;
2370  if (p<pend) goto bad; /* trailing garbage */
2371  }
2372 
2373  return mrb_int_value(mrb, sign ? val : -val);
2374  nullbyte:
2375  mrb_raise(mrb, E_ARGUMENT_ERROR, "string contains null byte");
2376  /* not reached */
2377  bad:
2378  mrb_raisef(mrb, E_ARGUMENT_ERROR, "invalid string for number(%!l)", str, pend-str);
2379  /* not reached */
2380  return mrb_fixnum_value(0);
2381 }
2382 
2384 mrb_cstr_to_inum(mrb_state *mrb, const char *str, mrb_int base, mrb_bool badcheck)
2385 {
2386  return mrb_str_len_to_inum(mrb, str, strlen(str), base, badcheck);
2387 }
2388 
2389 /* obslete: use RSTRING_CSTR() or mrb_string_cstr() */
2390 MRB_API const char*
2392 {
2393  struct RString *ps;
2394  const char *p;
2395  mrb_int len;
2396 
2397  check_null_byte(mrb, *ptr);
2398  ps = mrb_str_ptr(*ptr);
2399  p = RSTR_PTR(ps);
2400  len = RSTR_LEN(ps);
2401  if (p[len] == '\0') {
2402  return p;
2403  }
2404 
2405  /*
2406  * Even after str_modify_keep_ascii(), NULL termination is not ensured if
2407  * RSTR_SET_LEN() is used explicitly (e.g. String#delete_suffix!).
2408  */
2409  str_modify_keep_ascii(mrb, ps);
2410  RSTR_PTR(ps)[len] = '\0';
2411  return RSTR_PTR(ps);
2412 }
2413 
2414 MRB_API const char*
2416 {
2417  return mrb_string_value_cstr(mrb, &str);
2418 }
2419 
2422 {
2423  const char *s;
2424  mrb_int len;
2425 
2426  mrb_to_str(mrb, str);
2427  s = RSTRING_PTR(str);
2428  len = RSTRING_LEN(str);
2429  return mrb_str_len_to_inum(mrb, s, len, base, badcheck);
2430 }
2431 
2432 /* 15.2.10.5.38 */
2433 /*
2434  * call-seq:
2435  * str.to_i(base=10) => integer
2436  *
2437  * Returns the result of interpreting leading characters in <i>str</i> as an
2438  * integer base <i>base</i> (between 2 and 36). Extraneous characters past the
2439  * end of a valid number are ignored. If there is not a valid number at the
2440  * start of <i>str</i>, <code>0</code> is returned. This method never raises an
2441  * exception.
2442  *
2443  * "12345".to_i #=> 12345
2444  * "99 red balloons".to_i #=> 99
2445  * "0a".to_i #=> 0
2446  * "0a".to_i(16) #=> 10
2447  * "hello".to_i #=> 0
2448  * "1100101".to_i(2) #=> 101
2449  * "1100101".to_i(8) #=> 294977
2450  * "1100101".to_i(10) #=> 1100101
2451  * "1100101".to_i(16) #=> 17826049
2452  */
2453 static mrb_value
2455 {
2456  mrb_int base = 10;
2457 
2458  mrb_get_args(mrb, "|i", &base);
2459  if (base < 0) {
2460  mrb_raisef(mrb, E_ARGUMENT_ERROR, "illegal radix %i", base);
2461  }
2462  return mrb_str_to_inum(mrb, self, base, FALSE);
2463 }
2464 
2465 #ifndef MRB_NO_FLOAT
2466 double
2467 mrb_str_len_to_dbl(mrb_state *mrb, const char *s, size_t len, mrb_bool badcheck)
2468 {
2469  char buf[DBL_DIG * 4 + 20];
2470  const char *p = s, *p2;
2471  const char *pend = p + len;
2472  char *end;
2473  char *n;
2474  char prev = 0;
2475  double d;
2476  mrb_bool dot = FALSE;
2477 
2478  if (!p) return 0.0;
2479  while (p<pend && ISSPACE(*p)) p++;
2480  p2 = p;
2481 
2482  if (pend - p > 2 && p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) {
2483  mrb_value x;
2484 
2485  if (!badcheck) return 0.0;
2486  x = mrb_str_len_to_inum(mrb, p, pend-p, 0, badcheck);
2487  if (mrb_integer_p(x))
2488  d = (double)mrb_integer(x);
2489  else /* if (mrb_float_p(x)) */
2490  d = mrb_float(x);
2491  return d;
2492  }
2493  while (p < pend) {
2494  if (!*p) {
2495  if (badcheck) {
2496  mrb_raise(mrb, E_ARGUMENT_ERROR, "string for Float contains null byte");
2497  /* not reached */
2498  }
2499  pend = p;
2500  p = p2;
2501  goto nocopy;
2502  }
2503  if (!badcheck && *p == ' ') {
2504  pend = p;
2505  p = p2;
2506  goto nocopy;
2507  }
2508  if (*p == '_') break;
2509  p++;
2510  }
2511  p = p2;
2512  n = buf;
2513  while (p < pend) {
2514  char c = *p++;
2515  if (c == '.') dot = TRUE;
2516  if (c == '_') {
2517  /* remove an underscore between digits */
2518  if (n == buf || !ISDIGIT(prev) || p == pend) {
2519  if (badcheck) goto bad;
2520  break;
2521  }
2522  }
2523  else if (badcheck && prev == '_' && !ISDIGIT(c)) goto bad;
2524  else {
2525  const char *bend = buf+sizeof(buf)-1;
2526  if (n==bend) { /* buffer overflow */
2527  if (dot) break; /* cut off remaining fractions */
2528  return INFINITY;
2529  }
2530  *n++ = c;
2531  }
2532  prev = c;
2533  }
2534  *n = '\0';
2535  p = buf;
2536  pend = n;
2537 nocopy:
2538  d = mrb_float_read(p, &end);
2539  if (p == end) {
2540  if (badcheck) {
2541 bad:
2542  mrb_raisef(mrb, E_ARGUMENT_ERROR, "invalid string for float(%!s)", s);
2543  /* not reached */
2544  }
2545  return d;
2546  }
2547  if (badcheck) {
2548  if (!end || p == end) goto bad;
2549  while (end<pend && ISSPACE(*end)) end++;
2550  if (end<pend) goto bad;
2551  }
2552  return d;
2553 }
2554 
2555 MRB_API double
2556 mrb_cstr_to_dbl(mrb_state *mrb, const char *s, mrb_bool badcheck)
2557 {
2558  return mrb_str_len_to_dbl(mrb, s, strlen(s), badcheck);
2559 }
2560 
2561 MRB_API double
2563 {
2564  return mrb_str_len_to_dbl(mrb, RSTRING_PTR(str), RSTRING_LEN(str), badcheck);
2565 }
2566 
2567 /* 15.2.10.5.39 */
2568 /*
2569  * call-seq:
2570  * str.to_f => float
2571  *
2572  * Returns the result of interpreting leading characters in <i>str</i> as a
2573  * floating point number. Extraneous characters past the end of a valid number
2574  * are ignored. If there is not a valid number at the start of <i>str</i>,
2575  * <code>0.0</code> is returned. This method never raises an exception.
2576  *
2577  * "123.45e1".to_f #=> 1234.5
2578  * "45.67 degrees".to_f #=> 45.67
2579  * "thx1138".to_f #=> 0.0
2580  */
2581 static mrb_value
2583 {
2584  return mrb_float_value(mrb, mrb_str_to_dbl(mrb, self, FALSE));
2585 }
2586 #endif
2587 
2588 /* 15.2.10.5.40 */
2589 /*
2590  * call-seq:
2591  * str.to_s => str
2592  *
2593  * Returns the receiver.
2594  */
2595 static mrb_value
2597 {
2598  if (mrb_obj_class(mrb, self) != mrb->string_class) {
2599  return mrb_str_dup(mrb, self);
2600  }
2601  return self;
2602 }
2603 
2604 /* 15.2.10.5.43 */
2605 /*
2606  * call-seq:
2607  * str.upcase! => str or nil
2608  *
2609  * Upcases the contents of <i>str</i>, returning <code>nil</code> if no changes
2610  * were made.
2611  */
2612 static mrb_value
2614 {
2615  struct RString *s = mrb_str_ptr(str);
2616  char *p, *pend;
2617  mrb_bool modify = FALSE;
2618 
2620  p = RSTRING_PTR(str);
2621  pend = RSTRING_END(str);
2622  while (p < pend) {
2623  if (ISLOWER(*p)) {
2624  *p = TOUPPER(*p);
2625  modify = TRUE;
2626  }
2627  p++;
2628  }
2629 
2630  if (modify) return str;
2631  return mrb_nil_value();
2632 }
2633 
2634 /* 15.2.10.5.42 */
2635 /*
2636  * call-seq:
2637  * str.upcase => new_str
2638  *
2639  * Returns a copy of <i>str</i> with all lowercase letters replaced with their
2640  * uppercase counterparts. The operation is locale insensitive---only
2641  * characters 'a' to 'z' are affected.
2642  *
2643  * "hEllO".upcase #=> "HELLO"
2644  */
2645 static mrb_value
2647 {
2648  mrb_value str;
2649 
2650  str = mrb_str_dup(mrb, self);
2651  mrb_str_upcase_bang(mrb, str);
2652  return str;
2653 }
2654 
2655 /*
2656  * call-seq:
2657  * str.dump -> new_str
2658  *
2659  * Produces a version of <i>str</i> with all nonprinting characters replaced by
2660  * <code>\nnn</code> notation and all special characters escaped.
2661  */
2662 mrb_value
2664 {
2665  return str_escape(mrb, str, FALSE);
2666 }
2667 
2669 mrb_str_cat(mrb_state *mrb, mrb_value str, const char *ptr, size_t len)
2670 {
2671  struct RString *s = mrb_str_ptr(str);
2672  size_t capa;
2673  size_t total;
2674  ptrdiff_t off = -1;
2675 
2676  if (len == 0) return str;
2677  mrb_str_modify(mrb, s);
2678  if (ptr >= RSTR_PTR(s) && ptr <= RSTR_PTR(s) + (size_t)RSTR_LEN(s)) {
2679  off = ptr - RSTR_PTR(s);
2680  }
2681 
2682  capa = RSTR_CAPA(s);
2683  total = RSTR_LEN(s)+len;
2684  if (total >= MRB_SSIZE_MAX) {
2685  size_error:
2686  mrb_raise(mrb, E_ARGUMENT_ERROR, "string size too big");
2687  }
2688  if (capa <= total) {
2689  if (capa == 0) capa = 1;
2690  while (capa <= total) {
2691  if (capa <= MRB_SSIZE_MAX / 2) {
2692  capa *= 2;
2693  }
2694  else {
2695  capa = total+1;
2696  }
2697  }
2698  if (capa <= total || capa > MRB_SSIZE_MAX) {
2699  goto size_error;
2700  }
2701  resize_capa(mrb, s, capa);
2702  }
2703  if (off != -1) {
2704  ptr = RSTR_PTR(s) + off;
2705  }
2706  memcpy(RSTR_PTR(s) + RSTR_LEN(s), ptr, len);
2708  RSTR_SET_LEN(s, total);
2709  RSTR_PTR(s)[total] = '\0'; /* sentinel */
2710  return str;
2711 }
2712 
2715 {
2716  return mrb_str_cat(mrb, str, ptr, ptr ? strlen(ptr) : 0);
2717 }
2718 
2721 {
2722  if (mrb_str_ptr(str) == mrb_str_ptr(str2)) {
2724  }
2725  return mrb_str_cat(mrb, str, RSTRING_PTR(str2), RSTRING_LEN(str2));
2726 }
2727 
2730 {
2731  mrb_to_str(mrb, str2);
2732  return mrb_str_cat_str(mrb, str1, str2);
2733 }
2734 
2735 /*
2736  * call-seq:
2737  * str.inspect -> string
2738  *
2739  * Returns a printable version of _str_, surrounded by quote marks,
2740  * with special characters escaped.
2741  *
2742  * str = "hello"
2743  * str[3] = "\b"
2744  * str.inspect #=> "\"hel\\bo\""
2745  */
2746 mrb_value
2748 {
2749  return str_escape(mrb, str, TRUE);
2750 }
2751 
2752 /*
2753  * call-seq:
2754  * str.bytes -> array of fixnums
2755  *
2756  * Returns an array of bytes in _str_.
2757  *
2758  * str = "hello"
2759  * str.bytes #=> [104, 101, 108, 108, 111]
2760  */
2761 static mrb_value
2763 {
2764  struct RString *s = mrb_str_ptr(str);
2766  unsigned char *p = (unsigned char *)(RSTR_PTR(s)), *pend = p + RSTR_LEN(s);
2767 
2768  while (p < pend) {
2769  mrb_ary_push(mrb, a, mrb_fixnum_value(p[0]));
2770  p++;
2771  }
2772  return a;
2773 }
2774 
2775 /*
2776  * call-seq:
2777  * str.getbyte(index) -> 0 .. 255
2778  *
2779  * returns the <i>index</i>th byte as an integer.
2780  */
2781 static mrb_value
2783 {
2784  mrb_int pos;
2785  mrb_get_args(mrb, "i", &pos);
2786 
2787  if (pos < 0)
2788  pos += RSTRING_LEN(str);
2789  if (pos < 0 || RSTRING_LEN(str) <= pos)
2790  return mrb_nil_value();
2791 
2792  return mrb_fixnum_value((unsigned char)RSTRING_PTR(str)[pos]);
2793 }
2794 
2795 /*
2796  * call-seq:
2797  * str.setbyte(index, integer) -> integer
2798  *
2799  * modifies the <i>index</i>th byte as <i>integer</i>.
2800  */
2801 static mrb_value
2803 {
2804  mrb_int pos, byte;
2805  mrb_int len;
2806 
2807  mrb_get_args(mrb, "ii", &pos, &byte);
2808 
2809  len = RSTRING_LEN(str);
2810  if (pos < -len || len <= pos)
2811  mrb_raisef(mrb, E_INDEX_ERROR, "index %i out of string", pos);
2812  if (pos < 0)
2813  pos += len;
2814 
2816  byte &= 0xff;
2817  RSTRING_PTR(str)[pos] = (unsigned char)byte;
2818  return mrb_fixnum_value((unsigned char)byte);
2819 }
2820 
2821 /*
2822  * call-seq:
2823  * str.byteslice(integer) -> new_str or nil
2824  * str.byteslice(integer, integer) -> new_str or nil
2825  * str.byteslice(range) -> new_str or nil
2826  *
2827  * Byte Reference---If passed a single Integer, returns a
2828  * substring of one byte at that position. If passed two Integer
2829  * objects, returns a substring starting at the offset given by the first, and
2830  * a length given by the second. If given a Range, a substring containing
2831  * bytes at offsets given by the range is returned. In all three cases, if
2832  * an offset is negative, it is counted from the end of <i>str</i>. Returns
2833  * <code>nil</code> if the initial offset falls outside the string, the length
2834  * is negative, or the beginning of the range is greater than the end.
2835  * The encoding of the resulted string keeps original encoding.
2836  *
2837  * "hello".byteslice(1) #=> "e"
2838  * "hello".byteslice(-1) #=> "o"
2839  * "hello".byteslice(1, 2) #=> "el"
2840  * "\x80\u3042".byteslice(1, 3) #=> "\u3042"
2841  * "\x03\u3042\xff".byteslice(1..3) #=> "\u3042"
2842  */
2843 static mrb_value
2845 {
2846  mrb_value a1;
2847  mrb_int str_len = RSTRING_LEN(str), beg, len;
2848  mrb_bool empty = TRUE;
2849 
2850  len = mrb_get_argc(mrb);
2851  switch (len) {
2852  case 2:
2853  mrb_get_args(mrb, "ii", &beg, &len);
2854  break;
2855  case 1:
2856  a1 = mrb_get_arg1(mrb);
2857  if (mrb_range_p(a1)) {
2858  if (mrb_range_beg_len(mrb, a1, &beg, &len, str_len, TRUE) != MRB_RANGE_OK) {
2859  return mrb_nil_value();
2860  }
2861  }
2862  else {
2863  beg = mrb_integer(mrb_to_int(mrb, a1));
2864  len = 1;
2865  empty = FALSE;
2866  }
2867  break;
2868  default:
2869  mrb_argnum_error(mrb, len, 1, 2);
2870  break;
2871  }
2872  if (mrb_str_beg_len(str_len, &beg, &len) && (empty || len != 0)) {
2873  return mrb_str_byte_subseq(mrb, str, beg, len);
2874  }
2875  else {
2876  return mrb_nil_value();
2877  }
2878 }
2879 
2880 /* ---------------------------*/
2881 void
2883 {
2884  struct RClass *s;
2885 
2887  "pointer size too big for embedded string");
2888 
2889  mrb->string_class = s = mrb_define_class(mrb, "String", mrb->object_class); /* 15.2.10 */
2891 
2892  mrb_define_method(mrb, s, "bytesize", mrb_str_bytesize, MRB_ARGS_NONE());
2893 
2894  mrb_define_method(mrb, s, "<=>", mrb_str_cmp_m, MRB_ARGS_REQ(1)); /* 15.2.10.5.1 */
2895  mrb_define_method(mrb, s, "==", mrb_str_equal_m, MRB_ARGS_REQ(1)); /* 15.2.10.5.2 */
2896  mrb_define_method(mrb, s, "+", mrb_str_plus_m, MRB_ARGS_REQ(1)); /* 15.2.10.5.4 */
2897  mrb_define_method(mrb, s, "*", mrb_str_times, MRB_ARGS_REQ(1)); /* 15.2.10.5.5 */
2898  mrb_define_method(mrb, s, "[]", mrb_str_aref_m, MRB_ARGS_ANY()); /* 15.2.10.5.6 */
2900  mrb_define_method(mrb, s, "capitalize", mrb_str_capitalize, MRB_ARGS_NONE()); /* 15.2.10.5.7 */
2901  mrb_define_method(mrb, s, "capitalize!", mrb_str_capitalize_bang, MRB_ARGS_NONE()); /* 15.2.10.5.8 */
2902  mrb_define_method(mrb, s, "chomp", mrb_str_chomp, MRB_ARGS_ANY()); /* 15.2.10.5.9 */
2903  mrb_define_method(mrb, s, "chomp!", mrb_str_chomp_bang, MRB_ARGS_ANY()); /* 15.2.10.5.10 */
2904  mrb_define_method(mrb, s, "chop", mrb_str_chop, MRB_ARGS_NONE()); /* 15.2.10.5.11 */
2905  mrb_define_method(mrb, s, "chop!", mrb_str_chop_bang, MRB_ARGS_NONE()); /* 15.2.10.5.12 */
2906  mrb_define_method(mrb, s, "downcase", mrb_str_downcase, MRB_ARGS_NONE()); /* 15.2.10.5.13 */
2907  mrb_define_method(mrb, s, "downcase!", mrb_str_downcase_bang, MRB_ARGS_NONE()); /* 15.2.10.5.14 */
2908  mrb_define_method(mrb, s, "empty?", mrb_str_empty_p, MRB_ARGS_NONE()); /* 15.2.10.5.16 */
2909  mrb_define_method(mrb, s, "eql?", mrb_str_eql, MRB_ARGS_REQ(1)); /* 15.2.10.5.17 */
2910 
2911  mrb_define_method(mrb, s, "hash", mrb_str_hash_m, MRB_ARGS_NONE()); /* 15.2.10.5.20 */
2912  mrb_define_method(mrb, s, "include?", mrb_str_include, MRB_ARGS_REQ(1)); /* 15.2.10.5.21 */
2913  mrb_define_method(mrb, s, "index", mrb_str_index_m, MRB_ARGS_ARG(1,1)); /* 15.2.10.5.22 */
2914  mrb_define_method(mrb, s, "initialize", mrb_str_init, MRB_ARGS_REQ(1)); /* 15.2.10.5.23 */
2915  mrb_define_method(mrb, s, "initialize_copy", mrb_str_replace, MRB_ARGS_REQ(1)); /* 15.2.10.5.24 */
2916  mrb_define_method(mrb, s, "intern", mrb_str_intern, MRB_ARGS_NONE()); /* 15.2.10.5.25 */
2917  mrb_define_method(mrb, s, "length", mrb_str_size, MRB_ARGS_NONE()); /* 15.2.10.5.26 */
2918  mrb_define_method(mrb, s, "replace", mrb_str_replace, MRB_ARGS_REQ(1)); /* 15.2.10.5.28 */
2919  mrb_define_method(mrb, s, "reverse", mrb_str_reverse, MRB_ARGS_NONE()); /* 15.2.10.5.29 */
2920  mrb_define_method(mrb, s, "reverse!", mrb_str_reverse_bang, MRB_ARGS_NONE()); /* 15.2.10.5.30 */
2921  mrb_define_method(mrb, s, "rindex", mrb_str_rindex, MRB_ARGS_ANY()); /* 15.2.10.5.31 */
2922  mrb_define_method(mrb, s, "size", mrb_str_size, MRB_ARGS_NONE()); /* 15.2.10.5.33 */
2923  mrb_define_method(mrb, s, "slice", mrb_str_aref_m, MRB_ARGS_ANY()); /* 15.2.10.5.34 */
2924  mrb_define_method(mrb, s, "split", mrb_str_split_m, MRB_ARGS_ANY()); /* 15.2.10.5.35 */
2925 
2926 #ifndef MRB_NO_FLOAT
2927  mrb_define_method(mrb, s, "to_f", mrb_str_to_f, MRB_ARGS_NONE()); /* 15.2.10.5.38 */
2928 #endif
2929  mrb_define_method(mrb, s, "to_i", mrb_str_to_i, MRB_ARGS_ANY()); /* 15.2.10.5.39 */
2930  mrb_define_method(mrb, s, "to_s", mrb_str_to_s, MRB_ARGS_NONE()); /* 15.2.10.5.40 */
2931  mrb_define_method(mrb, s, "to_str", mrb_str_to_s, MRB_ARGS_NONE());
2932  mrb_define_method(mrb, s, "to_sym", mrb_str_intern, MRB_ARGS_NONE()); /* 15.2.10.5.41 */
2933  mrb_define_method(mrb, s, "upcase", mrb_str_upcase, MRB_ARGS_NONE()); /* 15.2.10.5.42 */
2934  mrb_define_method(mrb, s, "upcase!", mrb_str_upcase_bang, MRB_ARGS_NONE()); /* 15.2.10.5.43 */
2935  mrb_define_method(mrb, s, "inspect", mrb_str_inspect, MRB_ARGS_NONE()); /* 15.2.10.5.46(x) */
2936  mrb_define_method(mrb, s, "bytes", mrb_str_bytes, MRB_ARGS_NONE());
2937 
2938  mrb_define_method(mrb, s, "getbyte", mrb_str_getbyte, MRB_ARGS_REQ(1));
2939  mrb_define_method(mrb, s, "setbyte", mrb_str_setbyte, MRB_ARGS_REQ(2));
2940  mrb_define_method(mrb, s, "byteslice", mrb_str_byteslice, MRB_ARGS_ARG(1,1));
2941 }
2942 
2943 #ifndef MRB_NO_FLOAT
2944 /*
2945  * Source code for the "strtod" library procedure.
2946  *
2947  * Copyright (c) 1988-1993 The Regents of the University of California.
2948  * Copyright (c) 1994 Sun Microsystems, Inc.
2949  *
2950  * Permission to use, copy, modify, and distribute this
2951  * software and its documentation for any purpose and without
2952  * fee is hereby granted, provided that the above copyright
2953  * notice appear in all copies. The University of California
2954  * makes no representations about the suitability of this
2955  * software for any purpose. It is provided "as is" without
2956  * express or implied warranty.
2957  *
2958  * RCS: @(#) $Id: strtod.c 11708 2007-02-12 23:01:19Z shyouhei $
2959  */
2960 
2961 #include <ctype.h>
2962 #include <errno.h>
2963 
2964 static const int maxExponent = 511; /* Largest possible base 10 exponent. Any
2965  * exponent larger than this will already
2966  * produce underflow or overflow, so there's
2967  * no need to worry about additional digits.
2968  */
2969 static const double powersOf10[] = {/* Table giving binary powers of 10. Entry */
2970  10., /* is 10^2^i. Used to convert decimal */
2971  100., /* exponents into floating-point numbers. */
2972  1.0e4,
2973  1.0e8,
2974  1.0e16,
2975  1.0e32,
2976  1.0e64,
2977  1.0e128,
2978  1.0e256
2979 };
2980 
2981 MRB_API double
2982 mrb_float_read(const char *string, char **endPtr)
2983 /* const char *string; A decimal ASCII floating-point number,
2984  * optionally preceded by white space.
2985  * Must have form "-I.FE-X", where I is the
2986  * integer part of the mantissa, F is the
2987  * fractional part of the mantissa, and X
2988  * is the exponent. Either of the signs
2989  * may be "+", "-", or omitted. Either I
2990  * or F may be omitted, or both. The decimal
2991  * point isn't necessary unless F is present.
2992  * The "E" may actually be an "e". E and X
2993  * may both be omitted (but not just one).
2994  */
2995 /* char **endPtr; If non-NULL, store terminating character's
2996  * address here. */
2997 {
2998  int sign, expSign = FALSE;
2999  double fraction, dblExp;
3000  const double *d;
3001  const char *p;
3002  int c;
3003  int exp = 0; /* Exponent read from "EX" field. */
3004  int fracExp = 0; /* Exponent that derives from the fractional
3005  * part. Under normal circumstances, it is
3006  * the negative of the number of digits in F.
3007  * However, if I is very long, the last digits
3008  * of I get dropped (otherwise a long I with a
3009  * large negative exponent could cause an
3010  * unnecessary overflow on I alone). In this
3011  * case, fracExp is incremented one for each
3012  * dropped digit. */
3013  int mantSize; /* Number of digits in mantissa. */
3014  int decPt; /* Number of mantissa digits BEFORE decimal
3015  * point. */
3016  const char *pExp; /* Temporarily holds location of exponent
3017  * in string. */
3018 
3019  /*
3020  * Strip off leading blanks and check for a sign.
3021  */
3022 
3023  p = string;
3024  while (ISSPACE(*p)) {
3025  p += 1;
3026  }
3027  if (*p == '-') {
3028  sign = TRUE;
3029  p += 1;
3030  }
3031  else {
3032  if (*p == '+') {
3033  p += 1;
3034  }
3035  sign = FALSE;
3036  }
3037 
3038  /*
3039  * Count the number of digits in the mantissa (including the decimal
3040  * point), and also locate the decimal point.
3041  */
3042 
3043  decPt = -1;
3044  for (mantSize = 0; ; mantSize += 1)
3045  {
3046  c = *p;
3047  if (!ISDIGIT(c)) {
3048  if ((c != '.') || (decPt >= 0)) {
3049  break;
3050  }
3051  decPt = mantSize;
3052  }
3053  p += 1;
3054  }
3055 
3056  /*
3057  * Now suck up the digits in the mantissa. Use two integers to
3058  * collect 9 digits each (this is faster than using floating-point).
3059  * If the mantissa has more than 18 digits, ignore the extras, since
3060  * they can't affect the value anyway.
3061  */
3062 
3063  pExp = p;
3064  p -= mantSize;
3065  if (decPt < 0) {
3066  decPt = mantSize;
3067  }
3068  else {
3069  mantSize -= 1; /* One of the digits was the point. */
3070  }
3071  if (mantSize > 18) {
3072  if (decPt - 18 > 29999) {
3073  fracExp = 29999;
3074  }
3075  else {
3076  fracExp = decPt - 18;
3077  }
3078  mantSize = 18;
3079  }
3080  else {
3081  fracExp = decPt - mantSize;
3082  }
3083  if (mantSize == 0) {
3084  fraction = 0.0;
3085  p = string;
3086  goto done;
3087  }
3088  else {
3089  int frac1, frac2;
3090  frac1 = 0;
3091  for ( ; mantSize > 9; mantSize -= 1)
3092  {
3093  c = *p;
3094  p += 1;
3095  if (c == '.') {
3096  c = *p;
3097  p += 1;
3098  }
3099  frac1 = 10*frac1 + (c - '0');
3100  }
3101  frac2 = 0;
3102  for (; mantSize > 0; mantSize -= 1)
3103  {
3104  c = *p;
3105  p += 1;
3106  if (c == '.') {
3107  c = *p;
3108  p += 1;
3109  }
3110  frac2 = 10*frac2 + (c - '0');
3111  }
3112  fraction = (1.0e9 * frac1) + frac2;
3113  }
3114 
3115  /*
3116  * Skim off the exponent.
3117  */
3118 
3119  p = pExp;
3120  if ((*p == 'E') || (*p == 'e')) {
3121  p += 1;
3122  if (*p == '-') {
3123  expSign = TRUE;
3124  p += 1;
3125  }
3126  else {
3127  if (*p == '+') {
3128  p += 1;
3129  }
3130  expSign = FALSE;
3131  }
3132  while (ISDIGIT(*p)) {
3133  exp = exp * 10 + (*p - '0');
3134  if (exp > 19999) {
3135  exp = 19999;
3136  }
3137  p += 1;
3138  }
3139  }
3140  if (expSign) {
3141  exp = fracExp - exp;
3142  }
3143  else {
3144  exp = fracExp + exp;
3145  }
3146 
3147  /*
3148  * Generate a floating-point number that represents the exponent.
3149  * Do this by processing the exponent one bit at a time to combine
3150  * many powers of 2 of 10. Then combine the exponent with the
3151  * fraction.
3152  */
3153 
3154  if (exp < 0) {
3155  expSign = TRUE;
3156  exp = -exp;
3157  }
3158  else {
3159  expSign = FALSE;
3160  }
3161  if (exp > maxExponent) {
3162  exp = maxExponent;
3163  errno = ERANGE;
3164  }
3165  dblExp = 1.0;
3166  for (d = powersOf10; exp != 0; exp >>= 1, d += 1) {
3167  if (exp & 01) {
3168  dblExp *= *d;
3169  }
3170  }
3171  if (expSign) {
3172  fraction /= dblExp;
3173  }
3174  else {
3175  fraction *= dblExp;
3176  }
3177 
3178 done:
3179  if (endPtr != NULL) {
3180  *endPtr = (char *) p;
3181  }
3182 
3183  if (sign) {
3184  return -fraction;
3185  }
3186  return fraction;
3187 }
3188 #endif
double __cdecl exp(double _X)
return _Result< 0 ? -1 :_Result;} #line 1069 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vsnwprintf_s_l(wchar_t *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsnwprintf_s((*__local_stdio_printf_options()), _Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1091 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vsnwprintf_s(wchar_t *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const *const _Format, va_list _ArgList) { return _vsnwprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);} #line 1108 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwprintf(wchar_t *_Buffer, size_t _BufferCount, wchar_t const *_Format,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnwprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnwprintf(wchar_t *_Buffer, size_t _BufferCount, wchar_t const *_Format, va_list _Args);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnwprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnwprintf(wchar_t *_Buffer, size_t _BufferCount, wchar_t const *_Format, va_list _ArgList) { return _vsnwprintf_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1133 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_c_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1163 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_c(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1179 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);} #line 1196 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl __vswprintf_l(wchar_t *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vswprintf_l(_Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 1212 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf(wchar_t *const _Buffer, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_l(_Buffer,(size_t) -1, _Format,((void *) 0), _ArgList);} #line 1227 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl vswprintf(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1243 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_s_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf_s((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1264 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl vswprintf_s(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1281 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #line 1283 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_p_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf_p((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1312 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_p(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_p_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1328 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vscwprintf_l(wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf((*__local_stdio_printf_options())|(1ULL<< 1),((void *) 0), 0, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1347 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vscwprintf(wchar_t const *const _Format, va_list _ArgList) { return _vscwprintf_l(_Format,((void *) 0), _ArgList);} #line 1361 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vscwprintf_p_l(wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf_p((*__local_stdio_printf_options())|(1ULL<< 1),((void *) 0), 0, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1380 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vscwprintf_p(wchar_t const *const _Format, va_list _ArgList) { return _vscwprintf_p_l(_Format,((void *) 0), _ArgList);} #line 1394 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl __swprintf_l(wchar_t *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__vswprintf_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1414 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1435 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf(wchar_t *const _Buffer, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__vswprintf_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1454 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl swprintf(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1474 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "__swprintf_l_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl __swprintf_l(wchar_t *_Buffer, wchar_t const *_Format, _locale_t _Locale,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vswprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl __vswprintf_l(wchar_t *_Buffer, wchar_t const *_Format, _locale_t _Locale, va_list _Args);__declspec(deprecated("This function or variable may be unsafe. Consider using " "swprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _swprintf(wchar_t *_Buffer, wchar_t const *_Format,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "vswprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vswprintf(wchar_t *_Buffer, wchar_t const *_Format, va_list _Args);__inline int __cdecl _swprintf_s_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1511 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl swprintf_s(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1532 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #line 1534 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_p_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_p_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1562 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_p(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_p_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1582 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_c_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1603 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_c(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1623 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwprintf_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwprintf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1646 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwprintf(wchar_t *_Buffer, size_t _BufferCount, wchar_t const *_Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwprintf_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1668 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwprintf_s_l(wchar_t *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1690 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwprintf_s(wchar_t *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1711 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _scwprintf_l(wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscwprintf_l(_Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1737 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _scwprintf(wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscwprintf_l(_Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1755 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _scwprintf_p_l(wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscwprintf_p_l(_Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1774 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _scwprintf_p(wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscwprintf_p_l(_Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1792 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #pragma warning(push) #pragma warning(disable:4141 6054) #pragma warning(pop) #line 1856 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" int __cdecl __stdio_common_vswscanf(unsigned __int64 _Options, wchar_t const *_Buffer, size_t _BufferCount, wchar_t const *_Format, _locale_t _Locale, va_list _ArgList);__inline int __cdecl _vswscanf_l(wchar_t const *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vswscanf((*__local_stdio_scanf_options()), _Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 1897 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl vswscanf(wchar_t const *_Buffer, wchar_t const *_Format, va_list _ArgList) { return _vswscanf_l(_Buffer, _Format,((void *) 0), _ArgList);} #line 1912 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswscanf_s_l(wchar_t const *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vswscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 1930 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl vswscanf_s(wchar_t const *const _Buffer, wchar_t const *const _Format, va_list _ArgList) { return _vswscanf_s_l(_Buffer, _Format,((void *) 0), _ArgList);} #line 1947 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #line 1949 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnwscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnwscanf_l(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vswscanf((*__local_stdio_scanf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);} #line 1976 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vsnwscanf_s_l(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vswscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer, _BufferCount, _Format, _Locale, _ArgList);} #line 1995 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_swscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _swscanf_l(wchar_t const *const _Buffer, wchar_t const *const _Format, _locale_t _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswscanf_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2015 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "swscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl swscanf(wchar_t const *const _Buffer, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswscanf_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2034 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swscanf_s_l(wchar_t const *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswscanf_s_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2054 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl swscanf_s(wchar_t const *const _Buffer, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswscanf_s_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2075 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #line 2077 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwscanf_l(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwscanf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2100 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwscanf(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwscanf_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2122 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwscanf_s_l(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwscanf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2143 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwscanf_s(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwscanf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2163 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __pragma(pack(pop))#pragma warning(pop) #pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) typedef __int64 fpos_t;errno_t __cdecl _get_stream_buffer_pointers(FILE *_Stream, char ***_Base, char ***_Pointer, int **_Count);errno_t __cdecl clearerr_s(FILE *_Stream);errno_t __cdecl fopen_s(FILE **_Stream, char const *_FileName, char const *_Mode);size_t __cdecl fread_s(void *_Buffer, size_t _BufferSize, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);errno_t __cdecl freopen_s(FILE **_Stream, char const *_FileName, char const *_Mode, FILE *_OldStream);char *__cdecl gets_s(char *_Buffer, rsize_t _Size);errno_t __cdecl tmpfile_s(FILE **_Stream);errno_t __cdecl tmpnam_s(char *_Buffer, rsize_t _Size);#line 145 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" void __cdecl clearerr(FILE *_Stream);int __cdecl fclose(FILE *_Stream);int __cdecl _fcloseall(void);FILE *__cdecl _fdopen(int _FileHandle, char const *_Mode);int __cdecl feof(FILE *_Stream);int __cdecl ferror(FILE *_Stream);int __cdecl fflush(FILE *_Stream);int __cdecl fgetc(FILE *_Stream);int __cdecl _fgetchar(void);int __cdecl fgetpos(FILE *_Stream, fpos_t *_Position);char *__cdecl fgets(char *_Buffer, int _MaxCount, FILE *_Stream);int __cdecl _fileno(FILE *_Stream);int __cdecl _flushall(void);__declspec(deprecated("This function or variable may be unsafe. Consider using " "fopen_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) FILE *__cdecl fopen(char const *_FileName, char const *_Mode);int __cdecl fputc(int _Character, FILE *_Stream);int __cdecl _fputchar(int _Character);int __cdecl fputs(char const *_Buffer, FILE *_Stream);size_t __cdecl fread(void *_Buffer, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);__declspec(deprecated("This function or variable may be unsafe. Consider using " "freopen_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) FILE *__cdecl freopen(char const *_FileName, char const *_Mode, FILE *_Stream);FILE *__cdecl _fsopen(char const *_FileName, char const *_Mode, int _ShFlag);int __cdecl fsetpos(FILE *_Stream, fpos_t const *_Position);int __cdecl fseek(FILE *_Stream, long _Offset, int _Origin);int __cdecl _fseeki64(FILE *_Stream, __int64 _Offset, int _Origin);long __cdecl ftell(FILE *_Stream);__int64 __cdecl _ftelli64(FILE *_Stream);size_t __cdecl fwrite(void const *_Buffer, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);int __cdecl getc(FILE *_Stream);int __cdecl getchar(void);int __cdecl _getmaxstdio(void);int __cdecl _getw(FILE *_Stream);void __cdecl perror(char const *_ErrorMessage);int __cdecl _pclose(FILE *_Stream);FILE *__cdecl _popen(char const *_Command, char const *_Mode);#line 344 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl putc(int _Character, FILE *_Stream);int __cdecl putchar(int _Character);int __cdecl puts(char const *_Buffer);int __cdecl _putw(int _Word, FILE *_Stream);int __cdecl remove(char const *_FileName);int __cdecl rename(char const *_OldFileName, char const *_NewFileName);int __cdecl _unlink(char const *_FileName);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_unlink" ". See online help for details.")) int __cdecl unlink(char const *_FileName);#line 391 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" void __cdecl rewind(FILE *_Stream);int __cdecl _rmtmp(void);__declspec(deprecated("This function or variable may be unsafe. Consider using " "setvbuf" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) void __cdecl setbuf(FILE *_Stream, char *_Buffer);int __cdecl _setmaxstdio(int _Maximum);int __cdecl setvbuf(FILE *_Stream, char *_Buffer, int _Mode, size_t _Size);__declspec(allocator) char *__cdecl _tempnam(char const *_DirectoryName, char const *_FilePrefix);__declspec(deprecated("This function or variable may be unsafe. Consider using " "tmpfile_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) FILE *__cdecl tmpfile(void);__declspec(deprecated("This function or variable may be unsafe. Consider using " "tmpnam_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl tmpnam(char *_Buffer);int __cdecl ungetc(int _Character, FILE *_Stream);void __cdecl _lock_file(FILE *_Stream);void __cdecl _unlock_file(FILE *_Stream);int __cdecl _fclose_nolock(FILE *_Stream);int __cdecl _fflush_nolock(FILE *_Stream);int __cdecl _fgetc_nolock(FILE *_Stream);int __cdecl _fputc_nolock(int _Character, FILE *_Stream);size_t __cdecl _fread_nolock(void *_Buffer, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);size_t __cdecl _fread_nolock_s(void *_Buffer, size_t _BufferSize, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);int __cdecl _fseek_nolock(FILE *_Stream, long _Offset, int _Origin);int __cdecl _fseeki64_nolock(FILE *_Stream, __int64 _Offset, int _Origin);long __cdecl _ftell_nolock(FILE *_Stream);__int64 __cdecl _ftelli64_nolock(FILE *_Stream);size_t __cdecl _fwrite_nolock(void const *_Buffer, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);int __cdecl _getc_nolock(FILE *_Stream);int __cdecl _putc_nolock(int _Character, FILE *_Stream);int __cdecl _ungetc_nolock(int _Character, FILE *_Stream);int *__cdecl __p__commode(void);#line 596 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl __stdio_common_vfprintf(unsigned __int64 _Options, FILE *_Stream, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vfprintf_s(unsigned __int64 _Options, FILE *_Stream, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vfprintf_p(unsigned __int64 _Options, FILE *_Stream, char const *_Format, _locale_t _Locale, va_list _ArgList);__inline int __cdecl _vfprintf_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfprintf((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList);} #line 648 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vfprintf(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfprintf_l(_Stream, _Format,((void *) 0), _ArgList);} #line 662 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vfprintf_s_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfprintf_s((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList);} #line 677 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vfprintf_s(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfprintf_s_l(_Stream, _Format,((void *) 0), _ArgList);} #line 693 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 695 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vfprintf_p_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfprintf_p((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList);} #line 710 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vfprintf_p(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfprintf_p_l(_Stream, _Format,((void *) 0), _ArgList);} #line 724 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vprintf_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfprintf_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);} #line 738 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vprintf(char const *const _Format, va_list _ArgList) { return _vfprintf_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);} #line 751 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vprintf_s_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfprintf_s_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);} #line 765 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vprintf_s(char const *const _Format, va_list _ArgList) { return _vfprintf_s_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);} #line 780 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 782 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vprintf_p_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfprintf_p_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);} #line 796 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vprintf_p(char const *const _Format, va_list _ArgList) { return _vfprintf_p_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);} #line 809 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _fprintf_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 828 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl fprintf(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 846 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl _set_printf_count_output(int _Value);int __cdecl _get_printf_count_output(void);__inline int __cdecl _fprintf_s_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_s_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 871 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl fprintf_s(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_s_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 891 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 893 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _fprintf_p_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_p_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 912 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _fprintf_p(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_p_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 930 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _printf_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 948 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl printf(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 965 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _printf_s_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_s_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 983 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl printf_s(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_s_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1002 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1004 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _printf_p_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_p_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1022 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _printf_p(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_p_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1039 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl __stdio_common_vfscanf(unsigned __int64 _Options, FILE *_Stream, char const *_Format, _locale_t _Locale, va_list _Arglist);__inline int __cdecl _vfscanf_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfscanf((*__local_stdio_scanf_options()), _Stream, _Format, _Locale, _ArgList);} #line 1070 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vfscanf(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfscanf_l(_Stream, _Format,((void *) 0), _ArgList);} #line 1084 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vfscanf_s_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Stream, _Format, _Locale, _ArgList);} #line 1101 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vfscanf_s(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfscanf_s_l(_Stream, _Format,((void *) 0), _ArgList);} #line 1118 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1120 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscanf_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfscanf_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList);} #line 1134 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vscanf(char const *const _Format, va_list _ArgList) { return _vfscanf_l((__acrt_iob_func(0)), _Format,((void *) 0), _ArgList);} #line 1147 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscanf_s_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfscanf_s_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList);} #line 1161 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vscanf_s(char const *const _Format, va_list _ArgList) { return _vfscanf_s_l((__acrt_iob_func(0)), _Format,((void *) 0), _ArgList);} #line 1176 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1178 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_fscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _fscanf_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1197 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "fscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl fscanf(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1215 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _fscanf_s_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_s_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1234 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl fscanf_s(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_s_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1254 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1256 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_scanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _scanf_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1274 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "scanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl scanf(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_l((__acrt_iob_func(0)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1291 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scanf_s_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_s_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1309 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl scanf_s(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_s_l((__acrt_iob_func(0)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1328 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1330 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl __stdio_common_vsprintf(unsigned __int64 _Options, char *_Buffer, size_t _BufferCount, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vsprintf_s(unsigned __int64 _Options, char *_Buffer, size_t _BufferCount, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vsnprintf_s(unsigned __int64 _Options, char *_Buffer, size_t _BufferCount, size_t _MaxCount, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vsprintf_p(unsigned __int64 _Options, char *_Buffer, size_t _BufferCount, char const *_Format, _locale_t _Locale, va_list _ArgList);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnprintf_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf((*__local_stdio_printf_options())|(1ULL<< 0), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1399 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { return _vsnprintf_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1415 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vsnprintf(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { int const _Result=__stdio_common_vsprintf((*__local_stdio_printf_options())|(1ULL<< 1), _Buffer, _BufferCount, _Format,((void *) 0), _ArgList);return _Result< 0 ? -1 :_Result;} #line 1446 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsprintf_l(char *const _Buffer, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vsnprintf_l(_Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 1462 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "vsprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl vsprintf(char *const _Buffer, char const *const _Format, va_list _ArgList) { return _vsnprintf_l(_Buffer,(size_t) -1, _Format,((void *) 0), _ArgList);} #line 1477 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsprintf_s_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf_s((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1498 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vsprintf_s(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { return _vsprintf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1516 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1526 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsprintf_p_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf_p((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1547 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsprintf_p(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { return _vsprintf_p_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1563 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf_s_l(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsnprintf_s((*__local_stdio_printf_options()), _Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1585 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf_s(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format, va_list _ArgList) { return _vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);} #line 1602 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vsnprintf_s(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format, va_list _ArgList) { return _vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);} #line 1630 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1641 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscprintf_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf((*__local_stdio_printf_options())|(1ULL<< 1),((void *) 0), 0, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1659 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscprintf(char const *const _Format, va_list _ArgList) { return _vscprintf_l(_Format,((void *) 0), _ArgList);} #line 1672 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscprintf_p_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf_p((*__local_stdio_printf_options())|(1ULL<< 1),((void *) 0), 0, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1690 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscprintf_p(char const *const _Format, va_list _ArgList) { return _vscprintf_p_l(_Format,((void *) 0), _ArgList);} #line 1703 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf_c_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1723 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf_c(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { return _vsnprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1739 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_sprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _sprintf_l(char *const _Buffer, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1761 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl sprintf(char *const _Buffer, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1782 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "sprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl sprintf(char *_Buffer, char const *_Format,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "vsprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl vsprintf(char *_Buffer, char const *_Format, va_list _Args);__inline int __cdecl _sprintf_s_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1810 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl sprintf_s(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1832 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1834 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _sprintf_p_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_p_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1862 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _sprintf_p(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_p_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1882 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snprintf_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1905 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl snprintf(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=vsnprintf(_Buffer, _BufferCount, _Format, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1936 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snprintf(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf(_Buffer, _BufferCount, _Format, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1956 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl _snprintf(char *_Buffer, size_t _BufferCount, char const *_Format,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl _vsnprintf(char *_Buffer, size_t _BufferCount, char const *_Format, va_list _Args);__inline int __cdecl _snprintf_c_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1986 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snprintf_c(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2006 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snprintf_s_l(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2028 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snprintf_s(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2049 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scprintf_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscprintf_l(_Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2075 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scprintf(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscprintf_l(_Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2092 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scprintf_p_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscprintf_p_l(_Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2110 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scprintf_p(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscprintf_p(_Format, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2127 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl __stdio_common_vsscanf(unsigned __int64 _Options, char const *_Buffer, size_t _BufferCount, char const *_Format, _locale_t _Locale, va_list _ArgList);__inline int __cdecl _vsscanf_l(char const *const _Buffer, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vsscanf((*__local_stdio_scanf_options()), _Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 2158 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vsscanf(char const *const _Buffer, char const *const _Format, va_list _ArgList) { return _vsscanf_l(_Buffer, _Format,((void *) 0), _ArgList);} #line 2172 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsscanf_s_l(char const *const _Buffer, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vsscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 2189 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #pragma warning(push) #pragma warning(disable:6530) __inline int __cdecl vsscanf_s(char const *const _Buffer, char const *const _Format, va_list _ArgList) { return _vsscanf_s_l(_Buffer, _Format,((void *) 0), _ArgList);} #line 2208 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #pragma warning(pop) #line 2219 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_sscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _sscanf_l(char const *const _Buffer, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsscanf_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2238 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "sscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl sscanf(char const *const _Buffer, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsscanf_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2256 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _sscanf_s_l(char const *const _Buffer, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsscanf_s_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2275 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl sscanf_s(char const *const _Buffer, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=vsscanf_s(_Buffer, _Format, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2297 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 2299 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #pragma warning(push) #pragma warning(disable:6530) __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snscanf_l(char const *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__stdio_common_vsscanf((*__local_stdio_scanf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2326 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snscanf(char const *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__stdio_common_vsscanf((*__local_stdio_scanf_options()), _Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2349 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snscanf_s_l(char const *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__stdio_common_vsscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2374 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snscanf_s(char const *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__stdio_common_vsscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2397 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #pragma warning(pop) __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_tempnam" ". See online help for details.")) char *__cdecl tempnam(char const *_Directory, char const *_FilePrefix);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fcloseall" ". See online help for details.")) int __cdecl fcloseall(void);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fdopen" ". See online help for details.")) FILE *__cdecl fdopen(int _FileHandle, char const *_Format);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fgetchar" ". See online help for details.")) int __cdecl fgetchar(void);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fileno" ". See online help for details.")) int __cdecl fileno(FILE *_Stream);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_flushall" ". See online help for details.")) int __cdecl flushall(void);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fputchar" ". See online help for details.")) int __cdecl fputchar(int _Ch);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_getw" ". See online help for details.")) int __cdecl getw(FILE *_Stream);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_putw" ". See online help for details.")) int __cdecl putw(int _Ch, FILE *_Stream);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_rmtmp" ". See online help for details.")) int __cdecl rmtmp(void);#line 2441 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h"__pragma(pack(pop))#pragma warning(pop) #pragma once#pragma once#pragma once#pragma once#pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) int *__cdecl _errno(void);errno_t __cdecl _set_errno(int _Value);errno_t __cdecl _get_errno(int *_Value);unsigned long *__cdecl __doserrno(void);errno_t __cdecl _set_doserrno(unsigned long _Value);errno_t __cdecl _get_doserrno(unsigned long *_Value);__pragma(pack(pop))#pragma warning(pop) #pragma once#pragma warning(push)#pragma warning(disable:4514 4820) __pragma(pack(push, 8)) void *__cdecl memchr(void const *_Buf, int _Val, size_t _MaxCount);int __cdecl memcmp(void const *_Buf1, void const *_Buf2, size_t _Size);void *__cdecl memcpy(void *_Dst, void const *_Src, size_t _Size);void *__cdecl memmove(void *_Dst, void const *_Src, size_t _Size);void *__cdecl memset(void *_Dst, int _Val, size_t _Size);char *__cdecl strchr(char const *_Str, int _Val);char *__cdecl strrchr(char const *_Str, int _Ch);char *__cdecl strstr(char const *_Str, char const *_SubStr);wchar_t *__cdecl wcschr(wchar_t const *_Str, wchar_t _Ch);wchar_t *__cdecl wcsrchr(wchar_t const *_Str, wchar_t _Ch);wchar_t *__cdecl wcsstr(wchar_t const *_Str, wchar_t const *_SubStr);__pragma(pack(pop))#pragma warning(pop) #pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) static __inline errno_t __cdecl memcpy_s(void *const _Destination, rsize_t const _DestinationSize, void const *const _Source, rsize_t const _SourceSize) { if(_SourceSize==0) { return 0;} { int _Expr_val=!!(_Destination !=((void *) 0));if(!(_Expr_val)) {(*_errno())=22;_invalid_parameter_noinfo();return 22;} } ;if(_Source==((void *) 0)||_DestinationSize< _SourceSize) { memset(_Destination, 0, _DestinationSize);{ int _Expr_val=!!(_Source !=((void *) 0));if(!(_Expr_val)) {(*_errno())=22;_invalid_parameter_noinfo();return 22;} } ;{ int _Expr_val=!!(_DestinationSize >=_SourceSize);if(!(_Expr_val)) {(*_errno())=34;_invalid_parameter_noinfo();return 34;} } ;return 22 ;} memcpy(_Destination, _Source, _SourceSize);return 0;} static __inline errno_t __cdecl memmove_s(void *const _Destination, rsize_t const _DestinationSize, void const *const _Source, rsize_t const _SourceSize) { if(_SourceSize==0) { return 0;} { int _Expr_val=!!(_Destination !=((void *) 0));if(!(_Expr_val)) {(*_errno())=22;_invalid_parameter_noinfo();return 22;} } ;{ int _Expr_val=!!(_Source !=((void *) 0));if(!(_Expr_val)) {(*_errno())=22;_invalid_parameter_noinfo();return 22;} } ;{ int _Expr_val=!!(_DestinationSize >=_SourceSize);if(!(_Expr_val)) {(*_errno())=34;_invalid_parameter_noinfo();return 34;} } ;memmove(_Destination, _Source, _SourceSize);return 0;}#pragma warning(pop) __pragma(pack(pop))#pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) int __cdecl _memicmp(void const *_Buf1, void const *_Buf2, size_t _Size);int __cdecl _memicmp_l(void const *_Buf1, void const *_Buf2, size_t _Size, _locale_t _Locale);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_memccpy" ". See online help for details.")) void *__cdecl memccpy(void *_Dst, void const *_Src, int _Val, size_t _Size);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_memicmp" ". See online help for details.")) int __cdecl memicmp(void const *_Buf1, void const *_Buf2, size_t _Size);__pragma(pack(pop))#pragma warning(pop) #pragma once#pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) errno_t __cdecl wcscat_s(wchar_t *_Destination, rsize_t _SizeInWords, wchar_t const *_Source);errno_t __cdecl wcscpy_s(wchar_t *_Destination, rsize_t _SizeInWords, wchar_t const *_Source);errno_t __cdecl wcsncat_s(wchar_t *_Destination, rsize_t _SizeInWords, wchar_t const *_Source, rsize_t _MaxCount);errno_t __cdecl wcsncpy_s(wchar_t *_Destination, rsize_t _SizeInWords, wchar_t const *_Source, rsize_t _MaxCount);wchar_t *__cdecl wcstok_s(wchar_t *_String, wchar_t const *_Delimiter, wchar_t **_Context);__declspec(allocator) wchar_t *__cdecl _wcsdup(wchar_t const *_String);__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcscat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcscat(wchar_t *_Destination, wchar_t const *_Source);int __cdecl wcscmp(wchar_t const *_String1, wchar_t const *_String2);__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcscpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcscpy(wchar_t *_Destination, wchar_t const *_Source);size_t __cdecl wcscspn(wchar_t const *_String, wchar_t const *_Control);size_t __cdecl wcslen(wchar_t const *_String);size_t __cdecl wcsnlen(wchar_t const *_Source, size_t _MaxCount);static __inline size_t __cdecl wcsnlen_s(wchar_t const *_Source, size_t _MaxCount) { return(_Source==0) ? 0 :wcsnlen(_Source, _MaxCount);}__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcsncat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcsncat(wchar_t *_Destination, wchar_t const *_Source, size_t _Count);int __cdecl wcsncmp(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcsncpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcsncpy(wchar_t *_Destination, wchar_t const *_Source, size_t _Count);wchar_t *__cdecl wcspbrk(wchar_t const *_String, wchar_t const *_Control);size_t __cdecl wcsspn(wchar_t const *_String, wchar_t const *_Control);__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcstok_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcstok(wchar_t *_String, wchar_t const *_Delimiter, wchar_t **_Context);#line 237 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstring.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "wcstok_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) static __inline wchar_t *__cdecl _wcstok(wchar_t *const _String, wchar_t const *const _Delimiter) { return wcstok(_String, _Delimiter, 0);} __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcserror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcserror(int _ErrorNumber);errno_t __cdecl _wcserror_s(wchar_t *_Buffer, size_t _SizeInWords, int _ErrorNumber);__declspec(deprecated("This function or variable may be unsafe. Consider using " "__wcserror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl __wcserror(wchar_t const *_String);errno_t __cdecl __wcserror_s(wchar_t *_Buffer, size_t _SizeInWords, wchar_t const *_ErrorMessage);int __cdecl _wcsicmp(wchar_t const *_String1, wchar_t const *_String2);int __cdecl _wcsicmp_l(wchar_t const *_String1, wchar_t const *_String2, _locale_t _Locale);int __cdecl _wcsnicmp(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);int __cdecl _wcsnicmp_l(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount, _locale_t _Locale);errno_t __cdecl _wcsnset_s(wchar_t *_Destination, size_t _SizeInWords, wchar_t _Value, size_t _MaxCount);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsnset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcsnset(wchar_t *_String, wchar_t _Value, size_t _MaxCount);wchar_t *__cdecl _wcsrev(wchar_t *_String);errno_t __cdecl _wcsset_s(wchar_t *_Destination, size_t _SizeInWords, wchar_t _Value);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcsset(wchar_t *_String, wchar_t _Value);errno_t __cdecl _wcslwr_s(wchar_t *_String, size_t _SizeInWords);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcslwr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcslwr(wchar_t *_String);errno_t __cdecl _wcslwr_s_l(wchar_t *_String, size_t _SizeInWords, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcslwr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcslwr_l(wchar_t *_String, _locale_t _Locale);errno_t __cdecl _wcsupr_s(wchar_t *_String, size_t _Size);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsupr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcsupr(wchar_t *_String);errno_t __cdecl _wcsupr_s_l(wchar_t *_String, size_t _Size, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsupr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcsupr_l(wchar_t *_String, _locale_t _Locale);size_t __cdecl wcsxfrm(wchar_t *_Destination, wchar_t const *_Source, size_t _MaxCount);size_t __cdecl _wcsxfrm_l(wchar_t *_Destination, wchar_t const *_Source, size_t _MaxCount, _locale_t _Locale);int __cdecl wcscoll(wchar_t const *_String1, wchar_t const *_String2);int __cdecl _wcscoll_l(wchar_t const *_String1, wchar_t const *_String2, _locale_t _Locale);int __cdecl _wcsicoll(wchar_t const *_String1, wchar_t const *_String2);int __cdecl _wcsicoll_l(wchar_t const *_String1, wchar_t const *_String2, _locale_t _Locale);int __cdecl _wcsncoll(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);int __cdecl _wcsncoll_l(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount, _locale_t _Locale);int __cdecl _wcsnicoll(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);int __cdecl _wcsnicoll_l(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount, _locale_t _Locale);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsdup" ". See online help for details.")) wchar_t *__cdecl wcsdup(wchar_t const *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsicmp" ". See online help for details.")) int __cdecl wcsicmp(wchar_t const *_String1, wchar_t const *_String2);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsnicmp" ". See online help for details.")) int __cdecl wcsnicmp(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsnset" ". See online help for details.")) wchar_t *__cdecl wcsnset(wchar_t *_String, wchar_t _Value, size_t _MaxCount);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsrev" ". See online help for details.")) wchar_t *__cdecl wcsrev(wchar_t *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsset" ". See online help for details.")) wchar_t *__cdecl wcsset(wchar_t *_String, wchar_t _Value);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcslwr" ". See online help for details.")) wchar_t *__cdecl wcslwr(wchar_t *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsupr" ". See online help for details.")) wchar_t *__cdecl wcsupr(wchar_t *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsicoll" ". See online help for details.")) int __cdecl wcsicoll(wchar_t const *_String1, wchar_t const *_String2);__pragma(pack(pop))#pragma warning(pop) #pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) errno_t __cdecl strcpy_s(char *_Destination, rsize_t _SizeInBytes, char const *_Source);errno_t __cdecl strcat_s(char *_Destination, rsize_t _SizeInBytes, char const *_Source);errno_t __cdecl strerror_s(char *_Buffer, size_t _SizeInBytes, int _ErrorNumber);errno_t __cdecl strncat_s(char *_Destination, rsize_t _SizeInBytes, char const *_Source, rsize_t _MaxCount);errno_t __cdecl strncpy_s(char *_Destination, rsize_t _SizeInBytes, char const *_Source, rsize_t _MaxCount);char *__cdecl strtok_s(char *_String, char const *_Delimiter, char **_Context);void *__cdecl _memccpy(void *_Dst, void const *_Src, int _Val, size_t _MaxCount);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strcat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strcat(char *_Destination, char const *_Source);int __cdecl strcmp(char const *_Str1, char const *_Str2);int __cdecl _strcmpi(char const *_String1, char const *_String2);int __cdecl strcoll(char const *_String1, char const *_String2);int __cdecl _strcoll_l(char const *_String1, char const *_String2, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strcpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strcpy(char *_Destination, char const *_Source);size_t __cdecl strcspn(char const *_Str, char const *_Control);__declspec(allocator) char *__cdecl _strdup(char const *_Source);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strerror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strerror(char const *_ErrorMessage);errno_t __cdecl _strerror_s(char *_Buffer, size_t _SizeInBytes, char const *_ErrorMessage);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strerror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strerror(int _ErrorMessage);int __cdecl _stricmp(char const *_String1, char const *_String2);int __cdecl _stricoll(char const *_String1, char const *_String2);int __cdecl _stricoll_l(char const *_String1, char const *_String2, _locale_t _Locale);int __cdecl _stricmp_l(char const *_String1, char const *_String2, _locale_t _Locale);size_t __cdecl strlen(char const *_Str);errno_t __cdecl _strlwr_s(char *_String, size_t _Size);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strlwr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strlwr(char *_String);errno_t __cdecl _strlwr_s_l(char *_String, size_t _Size, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strlwr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strlwr_l(char *_String, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strncat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strncat(char *_Destination, char const *_Source, size_t _Count);int __cdecl strncmp(char const *_Str1, char const *_Str2, size_t _MaxCount);int __cdecl _strnicmp(char const *_String1, char const *_String2, size_t _MaxCount);int __cdecl _strnicmp_l(char const *_String1, char const *_String2, size_t _MaxCount, _locale_t _Locale);int __cdecl _strnicoll(char const *_String1, char const *_String2, size_t _MaxCount);int __cdecl _strnicoll_l(char const *_String1, char const *_String2, size_t _MaxCount, _locale_t _Locale);int __cdecl _strncoll(char const *_String1, char const *_String2, size_t _MaxCount);int __cdecl _strncoll_l(char const *_String1, char const *_String2, size_t _MaxCount, _locale_t _Locale);size_t __cdecl __strncnt(char const *_String, size_t _Count);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strncpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strncpy(char *_Destination, char const *_Source, size_t _Count);size_t __cdecl strnlen(char const *_String, size_t _MaxCount);static __inline size_t __cdecl strnlen_s(char const *_String, size_t _MaxCount) { return _String==0 ? 0 :strnlen(_String, _MaxCount);} errno_t __cdecl _strnset_s(char *_String, size_t _SizeInBytes, int _Value, size_t _MaxCount);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strnset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strnset(char *_Destination, int _Value, size_t _Count);char *__cdecl strpbrk(char const *_Str, char const *_Control);char *__cdecl _strrev(char *_Str);errno_t __cdecl _strset_s(char *_Destination, size_t _DestinationSize, int _Value);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strset(char *_Destination, int _Value);size_t __cdecl strspn(char const *_Str, char const *_Control);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strtok_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strtok(char *_String, char const *_Delimiter);errno_t __cdecl _strupr_s(char *_String, size_t _Size);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strupr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strupr(char *_String);errno_t __cdecl _strupr_s_l(char *_String, size_t _Size, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strupr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strupr_l(char *_String, _locale_t _Locale);size_t __cdecl strxfrm(char *_Destination, char const *_Source, size_t _MaxCount);size_t __cdecl _strxfrm_l(char *_Destination, char const *_Source, size_t _MaxCount, _locale_t _Locale);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strdup" ". See online help for details.")) char *__cdecl strdup(char const *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strcmpi" ". See online help for details.")) int __cdecl strcmpi(char const *_String1, char const *_String2);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_stricmp" ". See online help for details.")) int __cdecl stricmp(char const *_String1, char const *_String2);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strlwr" ". See online help for details.")) char *__cdecl strlwr(char *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strnicmp" ". See online help for details.")) int __cdecl strnicmp(char const *_String1, char const *_String2, size_t _MaxCount);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strnset" ". See online help for details.")) char *__cdecl strnset(char *_String, int _Value, size_t _MaxCount);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strrev" ". See online help for details.")) char *__cdecl strrev(char *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strset" ". See online help for details.")) char *__cdecl strset(char *_String, int _Value);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strupr" ". See online help for details.")) char *__cdecl strupr(char *_String);__pragma(pack(pop))#pragma warning(pop) #pragma once#pragma warning(push)#pragma warning(disable:4514 4820) __pragma(pack(push, 8)) __pragma(pack(pop))#pragma warning(pop) #pragma once#pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) typedef unsigned short _ino_t;typedef _ino_t ino_t;#line 24 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\sys/types.h" typedef unsigned int _dev_t;typedef _dev_t dev_t;#line 36 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\sys/types.h" typedef long _off_t;typedef _off_t off_t;#line 48 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\sys/types.h"#pragma warning(pop) typedef char *sds;#pragma pack(push, 1) struct sdshdr5 { unsigned char flags;char buf[];};struct sdshdr8 { uint8_t len;uint8_t alloc;unsigned char flags;char buf[];};struct sdshdr16 { uint16_t len;uint16_t alloc;unsigned char flags;char buf[];};struct sdshdr32 { uint32_t len;uint32_t alloc;unsigned char flags;char buf[];};struct sdshdr64 { uint64_t len;uint64_t alloc;unsigned char flags;char buf[];};#pragma pack(pop) static inline size_t sdslen(const sds s) { unsigned char flags=s[-1];switch(flags &7) { case 0 :return((flags) >> 3) ;case 1 :return((struct sdshdr8 *)((s) -(sizeof(struct sdshdr8)))) ->len;case 2 :return((struct sdshdr16 *)((s) -(sizeof(struct sdshdr16)))) ->len;case 3 :return((struct sdshdr32 *)((s) -(sizeof(struct sdshdr32)))) ->len;case 4 :return((struct sdshdr64 *)((s) -(sizeof(struct sdshdr64)))) ->len;} return 0;}static inline size_t sdsavail(const sds s) { unsigned char flags=s[-1];switch(flags &7) { case 0 :{ return 0;} case 1 :{ struct sdshdr8 *sh=(void *)((s) -(sizeof(struct sdshdr8)));;return sh->alloc - sh->len;} case 2 :{ struct sdshdr16 *sh=(void *)((s) -(sizeof(struct sdshdr16)));;return sh->alloc - sh->len;} case 3 :{ struct sdshdr32 *sh=(void *)((s) -(sizeof(struct sdshdr32)));;return sh->alloc - sh->len;} case 4 :{ struct sdshdr64 *sh=(void *)((s) -(sizeof(struct sdshdr64)));;return sh->alloc - sh->len;} } return 0;}static inline void sdssetlen(sds s, size_t newlen) { unsigned char flags=s[-1];switch(flags &7) { case 0 :{ unsigned char *fp=((unsigned char *) s) - 1;*fp=0|(newlen<< 3);} break;case 1 :((struct sdshdr8 *)((s) -(sizeof(struct sdshdr8)))) ->len=(uint8_t) newlen;break;case 2 :((struct sdshdr16 *)((s) -(sizeof(struct sdshdr16)))) ->len=(uint16_t) newlen;break;case 3 :((struct sdshdr32 *)((s) -(sizeof(struct sdshdr32)))) -> len
Definition: CPAL.d:15583
int ptrdiff_t
Definition: CPAL.d:3845
#define CHAR_BIT
Definition: ChkTeX.h:91
#define strdup
Definition: Utility.h:167
#define empty
Definition: aptex-macros.h:52
#define y0
#define x0
#define hash
Definition: aptex.h:388
char * p2
Definition: bmpfont.h:62
char * p1
Definition: bmpfont.h:62
#define mrb_symbol(o)
Definition: boxing_nan.h:72
#define mrb_integer(o)
Definition: boxing_nan.h:71
#define mrb_string_p(o)
Definition: boxing_word.h:153
#define mrb_integer_p(o)
Definition: boxing_word.h:139
#define mrb_undef_p(o)
Definition: boxing_word.h:145
#define mrb_nil_p(o)
Definition: boxing_word.h:146
MRB_INLINE enum mrb_vtype mrb_type(mrb_value o)
Definition: boxing_word.h:195
#define mrb_range_p(o)
Definition: boxing_word.h:164
#define INFINITY
#define MRB_SET_INSTANCE_TT(c, tt)
Definition: class.h:73
mrb_value mrb_mod_to_s(mrb_state *, mrb_value)
Definition: class.c:2247
#define n
Definition: t4ht.c:1290
#define b
Definition: jpegint.h:372
@ FALSE
Definition: dd.h:101
@ TRUE
Definition: dd.h:102
#define free(a)
Definition: decNumber.cpp:310
#define MRB_SYM(name)
Definition: disable.h:20
#define TOLOWER
Definition: dospecial.c:240
#define skip(p, c)
Definition: ptexmac.h:70
void replace(char *, char *)
Definition: dvispc.c:2100
int sptr
Definition: dvistuff.c:186
Integer_T bad
mpz_t pp
Definition: gen-psqr.c:108
#define a1
#define a2
#define s
Definition: afcover.h:80
#define t
Definition: afcover.h:96
static FIELD_PTR prev
Definition: genind.c:36
#define dot
Definition: globals.h:56
#define c(n)
Definition: gpos-common.c:150
#define a(n)
Definition: gpos-common.c:148
#define d(n)
Definition: gpos-common.c:151
int base
Definition: gsftopk.c:1502
#define memcmp(s1, s2, n)
Definition: gsftopk.c:66
#define memmove(d, s, n)
Definition: gsftopk.c:65
#define memcpy(d, s, n)
Definition: gsftopk.c:64
#define slen
Definition: hpcdtoppm.c:1329
#define byte
Definition: in_pcx.cpp:28
#define NULL
Definition: ftobjs.h:61
small capitals from c petite p
Definition: afcover.h:72
small capitals from c petite p scientific i
Definition: afcover.h:80
FT_UInt idx
Definition: cffcmap.c:135
kerning y
Definition: ttdriver.c:212
unsigned int uint32_t
Definition: stdint.h:80
unsigned int uintptr_t
Definition: stdint.h:119
int errno
#define buf
int capacity
Definition: pdfcolor.c:1335
#define ISUPPER(c)
Definition: c-ctype.h:41
#define TOUPPER(c)
Definition: c-ctype.h:45
#define ISDIGIT(c)
Definition: c-ctype.h:35
#define ISLOWER(c)
Definition: c-ctype.h:37
#define ISSPACE(c)
Definition: c-ctype.h:40
#define ISPRINT(c)
Definition: c-ctype.h:38
#define string
Definition: ctangleboot.c:111
void overflow(const char *)
Definition: cwebboot.c:1385
#define malloc
Definition: alloca.c:91
const int * pos
Definition: combiners.h:905
#define size_t
Definition: glob.c:257
char * memchr(char *s, int c, size_t n) const
Definition: memchr.c:58
mrb_sym mrb_intern_str(mrb_state *, mrb_value)
Definition: symbol.c:251
mrb_int mrb_get_argc(mrb_state *mrb)
Definition: class.c:814
#define E_TYPE_ERROR
Definition: mruby.h:1308
void mrb_argnum_error(mrb_state *mrb, mrb_int argc, int min, int max)
Definition: error.c:547
mrb_value mrb_to_str(mrb_state *mrb, mrb_value val)
Definition: object.c:594
void mrb_raisef(mrb_state *mrb, struct RClass *c, const char *fmt,...)
Definition: error.c:400
#define E_RANGE_ERROR
Definition: mruby.h:1312
#define mrb_assert_int_fit(t1, n, t2, max)
Definition: mruby.h:66
#define E_INDEX_ERROR
Definition: mruby.h:1311
#define MRB_ARGS_ARG(n1, n2)
Definition: mruby.h:855
void * mrb_realloc(mrb_state *, void *, size_t)
Definition: gc.c:238
#define mrb_str_new_lit(mrb, lit)
Definition: mruby.h:1136
static void mrb_gc_arena_restore(mrb_state *mrb, int idx)
Definition: mruby.h:1239
static int mrb_gc_arena_save(mrb_state *mrb)
Definition: mruby.h:1233
mrb_value mrb_get_arg1(mrb_state *mrb)
Definition: class.c:840
#define mrb_assert(p)
Definition: mruby.h:65
mrb_int mrb_get_args(mrb_state *mrb, mrb_args_format format,...)
Definition: class.c:891
void mrb_raise(mrb_state *mrb, struct RClass *c, const char *msg)
Definition: error.c:214
#define MRB_ARGS_ANY()
Definition: mruby.h:874
#define mrb_utf8_from_locale(p, l)
Definition: mruby.h:1150
#define mrb_locale_from_utf8(p, l)
Definition: mruby.h:1151
void mrb_free(mrb_state *, void *)
Definition: gc.c:288
#define MRB_ARGS_NONE()
Definition: mruby.h:879
#define MRB_ARGS_REQ(n)
Definition: mruby.h:837
#define E_RUNTIME_ERROR
Definition: mruby.h:1307
struct RClass * mrb_obj_class(mrb_state *mrb, mrb_value obj)
Definition: class.c:2186
static void mrb_check_frozen(mrb_state *mrb, void *o)
Definition: mruby.h:1348
void * mrb_malloc(mrb_state *, size_t)
Definition: gc.c:256
mrb_value mrb_to_int(mrb_state *mrb, mrb_value val)
Definition: object.c:510
mrb_value mrb_sym_str(mrb_state *, mrb_sym)
Definition: symbol.c:584
mrb_value mrb_type_convert(mrb_state *mrb, mrb_value val, enum mrb_vtype type, mrb_sym method)
Definition: object.c:373
#define E_ARGUMENT_ERROR
Definition: mruby.h:1310
@ other
Definition: mtxline.h:22
float x
Definition: cordic.py:15
dictionary off
Definition: fc-lang.py:226
utf< uint8 > utf8
Definition: UtfCodec.h:249
mrb_value mrb_fixnum_to_str(mrb_state *mrb, mrb_value x, mrb_int base)
Definition: numeric.c:1394
static mrb_bool mrb_int_mul_overflow(mrb_int a, mrb_int b, mrb_int *c)
Definition: numeric.h:116
#define max(a, b)
Definition: pbmto4425.c:11
static bool ps
Definition: pdftocairo.cc:91
#define sign(x)
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF base if bpp PF set rept prefetch_distance PF set OFFSET endr endif endm macro preload_leading_step2 base if bpp ifc DST PF PF else if bpp lsl PF PF lsl PF sub
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF base if bpp PF set rept prefetch_distance PF set OFFSET endr endif endm macro preload_leading_step2 base if bpp ifc DST PF PF else if bpp lsl PF PF lsl PF PF lsl PF PF PF else PF lsl PF lsl PF lsl PF endif SIZE macro preload_middle scratch_holds_offset if bpp else PF PF endif endif endif endm macro preload_trailing base if bpp if bpp *pix_per_block PF PF lsl PF PF PF PF PF else PF lsl PF lsl PF PF PF PF PF base if bpp if narrow_case &&bpp<=dst_w_bpp) PF bic, WK0, base, #31 PF pld,[WK0] PF add, WK1, base, X, LSL #bpp_shift PF sub, WK1, WK1, #1 PF bic, WK1, WK1, #31 PF cmp, WK1, WK0 PF beq, 90f PF pld,[WK1]90:.else PF bic, WK0, base, #31 PF pld,[WK0] PF add, WK1, base, X, lsl #bpp_shift PF sub, WK1, WK1, #1 PF bic, WK1, WK1, #31 PF cmp, WK1, WK0 PF beq, 92f91:PF add, WK0, WK0, #32 PF cmp, WK0, WK1 PF pld,[WK0] PF bne, 91b92:.endif .endif.endm.macro conditional_process1_helper cond, process_head, process_tail, numbytes, firstreg, unaligned_src, unaligned_mask, decrementx process_head cond, numbytes, firstreg, unaligned_src, unaligned_mask, 0 .if decrementx sub &cond X, X, #8 *numbytes/dst_w_bpp .endif process_tail cond, numbytes, firstreg .if !((flags) &FLAG_PROCESS_DOES_STORE) pixst cond, numbytes, firstreg, DST .endif.endm.macro conditional_process1 cond, process_head, process_tail, numbytes, firstreg, unaligned_src, unaligned_mask, decrementx .if(flags) &FLAG_BRANCH_OVER .ifc cond, mi bpl 100f .endif .ifc cond, cs bcc 100f .endif .ifc cond, ne beq 100f .endif conditional_process1_helper, process_head, process_tail, numbytes, firstreg, unaligned_src, unaligned_mask, decrementx100:.else conditional_process1_helper cond, process_head, process_tail, numbytes, firstreg, unaligned_src, unaligned_mask, decrementx .endif.endm.macro conditional_process2 test, cond1, cond2, process_head, process_tail, numbytes1, numbytes2, firstreg1, firstreg2, unaligned_src, unaligned_mask, decrementx .if(flags) &(FLAG_DST_READWRITE|FLAG_BRANCH_OVER|FLAG_PROCESS_CORRUPTS_PSR|FLAG_PROCESS_DOES_STORE) test conditional_process1 cond1, process_head, process_tail, numbytes1, firstreg1, unaligned_src, unaligned_mask, decrementx .if(flags) &FLAG_PROCESS_CORRUPTS_PSR test .endif conditional_process1 cond2, process_head, process_tail, numbytes2, firstreg2, unaligned_src, unaligned_mask, decrementx .else test process_head cond1, numbytes1, firstreg1, unaligned_src, unaligned_mask, 0 process_head cond2, numbytes2, firstreg2, unaligned_src, unaligned_mask, 0 .if decrementx sub &cond1 X, X, #8 *numbytes1/dst_w_bpp sub &cond2 X, X, #8 *numbytes2/dst_w_bpp .endif process_tail cond1, numbytes1, firstreg1 process_tail cond2, numbytes2, firstreg2 pixst cond1, numbytes1, firstreg1, DST pixst cond2, numbytes2, firstreg2, DST .endif.endm.macro test_bits_1_0_ptr .if(flags) &FLAG_PROCESS_CORRUPTS_WK0 movs SCRATCH, X, lsl #32-1 .else movs SCRATCH, WK0, lsl #32-1 .endif.endm.macro test_bits_3_2_ptr .if(flags) &FLAG_PROCESS_CORRUPTS_WK0 movs SCRATCH, X, lsl #32-3 .else movs SCRATCH, WK0, lsl #32-3 .endif.endm.macro leading_15bytes process_head, process_tail .set DECREMENT_X, 1 .if(flags) &FLAG_PROCESS_CORRUPTS_WK0 .set DECREMENT_X, 0 sub X, X, WK0, lsr #dst_bpp_shift str X,[sp, #LINE_SAVED_REG_COUNT *4] mov X, WK0 .endif .if dst_w_bpp==8 conditional_process2 test_bits_1_0_ptr, mi, cs, process_head, process_tail, 1, 2, 1, 2, 1, 1, DECREMENT_X .elseif dst_w_bpp==16 test_bits_1_0_ptr conditional_process1 cs, process_head, process_tail, 2, 2, 1, 1, DECREMENT_X .endif conditional_process2 test_bits_3_2_ptr, mi, cs, process_head, process_tail, 4, 8, 1, 2, 1, 1, DECREMENT_X .if(flags) &FLAG_PROCESS_CORRUPTS_WK0 ldr X,[sp, #LINE_SAVED_REG_COUNT *4] .endif.endm.macro test_bits_3_2_pix movs SCRATCH, X, lsl #dst_bpp_shift+32-3.endm.macro test_bits_1_0_pix .if dst_w_bpp==8 movs SCRATCH, X, lsl #dst_bpp_shift+32-1 .else movs SCRATCH, X, lsr #1 .endif.endm.macro trailing_15bytes process_head, process_tail, unaligned_src, unaligned_mask conditional_process2 test_bits_3_2_pix, cs, mi, process_head, process_tail, 8, 4, 0, 2, unaligned_src, unaligned_mask, 0 .if dst_w_bpp==16 test_bits_1_0_pix conditional_process1 cs, process_head, process_tail, 2, 0, unaligned_src, unaligned_mask, 0 .elseif dst_w_bpp==8 conditional_process2 test_bits_1_0_pix, cs, mi, process_head, process_tail, 2, 1, 0, 1, unaligned_src, unaligned_mask, 0 .endif.endm.macro wide_case_inner_loop process_head, process_tail, unaligned_src, unaligned_mask, dst_alignment110:.set SUBBLOCK, 0 .rept pix_per_block *dst_w_bpp/128 process_head, 16, 0, unaligned_src, unaligned_mask, 1 .if(src_bpp > 0) &&(mask_bpp==0) &&((flags) &FLAG_PROCESS_PRESERVES_SCRATCH) preload_middle src_bpp, SRC, 1 .elseif(src_bpp==0) &&(mask_bpp > 0) &&((flags) &FLAG_PROCESS_PRESERVES_SCRATCH) preload_middle mask_bpp, MASK, 1 .else preload_middle src_bpp, SRC, 0 preload_middle mask_bpp, MASK, 0 .endif .if(dst_r_bpp > 0) &&((SUBBLOCK % 2)==0) &&(((flags) &FLAG_NO_PRELOAD_DST)==0) PF pld,[DST, #32 *prefetch_distance - dst_alignment] .endif process_tail, 16, 0 .if !((flags) &FLAG_PROCESS_DOES_STORE) pixst, 16, 0, DST .endif .set SUBBLOCK, SUBBLOCK+1 .endr subs X, X, #pix_per_block bhs 110b.endm.macro wide_case_inner_loop_and_trailing_pixels process_head, process_tail, process_inner_loop, exit_label, unaligned_src, unaligned_mask .if dst_r_bpp > tst bne process_inner_loop DST_PRELOAD_BIAS endif preload_trailing SRC preload_trailing MASK DST endif add medium_case_inner_loop_and_trailing_pixels unaligned_mask endm macro medium_case_inner_loop_and_trailing_pixels DST endif subs bhs tst beq exit_label trailing_15bytes unaligned_mask endm macro narrow_case_inner_loop_and_trailing_pixels unaligned_mask tst conditional_process1 trailing_15bytes unaligned_mask endm macro switch_on_alignment exit_label if bne endif if bne endif action if endif if bne endif action if endif endif endm macro end_of_line last_one if vars_spilled word LINE_SAVED_REGS endif subs if vars_spilled endif endif add STRIDE_D if src_bpp add STRIDE_S endif if mask_bpp add STRIDE_M endif if restore_x mov ORIG_W endif bhs loop_label ifc if vars_spilled b else b endif else newline
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF ptr
static int offset
Definition: ppmtogif.c:642
static long bytes
Definition: psutil.c:35
long utf8_strlen(const char *utf8_str)
Definition: ustring.c:781
#define RARRAY_LEN(a)
Definition: array.h:70
mrb_value mrb_ary_new(mrb_state *mrb)
Definition: array.c:53
#define RARRAY_PTR(a)
Definition: array.h:71
mrb_value mrb_ary_new_from_values(mrb_state *mrb, mrb_int size, const mrb_value *vals)
Definition: array.c:94
mrb_value mrb_ary_new_capa(mrb_state *, mrb_int)
Definition: array.c:46
void mrb_ary_push(mrb_state *mrb, mrb_value array, mrb_value value)
Definition: array.c:495
mrb_value mrb_ary_pop(mrb_state *mrb, mrb_value ary)
Definition: array.c:535
mrb_static_assert(((mrb_int)(sizeof(void *) *3/sizeof(mrb_value))) > 0, "MRB_ARY_EMBED_LEN_MAX > 0")
#define MRB_API
Definition: common.h:73
#define mrb_noreturn
Definition: common.h:44
#define mrb_define_method(mrb, c, name, f, a)
Definition: scanning.h:15
#define mrb_define_class(mrb, name, s)
Definition: scanning.h:18
static int str_len(lua_State *L)
Definition: lstrlib.c:54
mrb_range_beg_len
Definition: range.h:67
@ MRB_RANGE_OK
Definition: range.h:69
@ MRB_RANGE_OUT
Definition: range.h:70
#define str(s)
Definition: sh6.c:399
ShellFileEnvironment e
Definition: sh6.c:388
static void str_with_class(struct RString *s, mrb_value obj)
Definition: string.c:145
static struct RString * str_new_static(mrb_state *mrb, const char *p, size_t len)
Definition: string.c:118
const char mrb_digitmap[]
Definition: string.c:33
mrb_value mrb_str_new_static(mrb_state *mrb, const char *p, size_t len)
Definition: string.c:221
mrb_bool mrb_str_beg_len(mrb_int str_len, mrb_int *begp, mrb_int *lenp)
Definition: string.c:623
mrb_value mrb_str_cat(mrb_state *mrb, mrb_value str, const char *ptr, size_t len)
Definition: string.c:2669
static const double powersOf10[]
Definition: string.c:2969
mrb_value mrb_cstr_to_inum(mrb_state *mrb, const char *str, mrb_int base, mrb_bool badcheck)
Definition: string.c:2384
static mrb_value mrb_str_byteslice(mrb_state *mrb, mrb_value str)
Definition: string.c:2844
static mrb_value mrb_str_reverse_bang(mrb_state *mrb, mrb_value str)
Definition: string.c:1981
static mrb_value mrb_str_hash_m(mrb_state *mrb, mrb_value self)
Definition: string.c:1779
static void check_null_byte(mrb_state *mrb, mrb_value str)
Definition: string.c:260
static struct RString * str_init_normal_capa(mrb_state *mrb, struct RString *s, const char *p, size_t len, size_t capa)
Definition: string.c:38
double mrb_cstr_to_dbl(mrb_state *mrb, const char *s, mrb_bool badcheck)
Definition: string.c:2556
mrb_value mrb_str_to_inum(mrb_state *mrb, mrb_value str, mrb_int base, mrb_bool badcheck)
Definition: string.c:2421
static mrb_value mrb_str_index_m(mrb_state *mrb, mrb_value str)
Definition: string.c:1825
static mrb_value mrb_str_to_s(mrb_state *mrb, mrb_value self)
Definition: string.c:2596
mrb_value mrb_str_plus(mrb_state *mrb, mrb_value a, mrb_value b)
Definition: string.c:870
static mrb_value mrb_str_downcase_bang(mrb_state *mrb, mrb_value str)
Definition: string.c:1667
const char * mrb_string_value_cstr(mrb_state *mrb, mrb_value *ptr)
Definition: string.c:2391
static void mrb_str_aset(mrb_state *mrb, mrb_value str, mrb_value indx, mrb_value alen, mrb_value replace)
Definition: string.c:1374
mrb_value mrb_str_new_cstr(mrb_state *mrb, const char *p)
Definition: string.c:203
static void str_range_to_bytes(mrb_value str, mrb_int *pos, mrb_int *len)
Definition: string.c:606
mrb_value mrb_str_resize(mrb_state *mrb, mrb_value str, mrb_int len)
Definition: string.c:832
#define BYTES_ALIGN_CHECK(pos)
Definition: string.c:493
mrb_bool mrb_str_equal(mrb_state *mrb, mrb_value str1, mrb_value str2)
Definition: string.c:1052
#define lesser(a, b)
Definition: string.c:970
static mrb_value mrb_str_empty_p(mrb_state *mrb, mrb_value self)
Definition: string.c:1720
mrb_value mrb_str_cat_cstr(mrb_state *mrb, mrb_value str, const char *ptr)
Definition: string.c:2714
#define bytes2chars(p, end, bi)
Definition: string.c:490
mrb_value mrb_obj_as_string(mrb_state *mrb, mrb_value obj)
Definition: string.c:1913
static mrb_value mrb_str_upcase(mrb_state *mrb, mrb_value self)
Definition: string.c:2646
mrb_int mrb_str_index(mrb_state *mrb, mrb_value str, const char *sptr, mrb_int slen, mrb_int offset)
Definition: string.c:646
mrb_value mrb_str_substr(mrb_state *mrb, mrb_value str, mrb_int beg, mrb_int len)
Definition: string.c:1746
static mrb_value mrb_str_downcase(mrb_state *mrb, mrb_value self)
Definition: string.c:1700
static void str_share(mrb_state *mrb, struct RString *orig, struct RString *s)
Definition: string.c:562
mrb_value mrb_str_append(mrb_state *mrb, mrb_value str1, mrb_value str2)
Definition: string.c:2729
#define chars2bytes(p, off, ci)
Definition: string.c:489
mrb_value mrb_str_intern(mrb_state *mrb, mrb_value self)
Definition: string.c:1907
static mrb_value mrb_str_new_empty(mrb_state *mrb, mrb_value str)
Definition: string.c:151
static void resize_capa(mrb_state *mrb, struct RString *s, size_t capacity)
Definition: string.c:180
static mrb_value str_escape(mrb_state *mrb, mrb_value str, mrb_bool inspect)
Definition: string.c:1294
static mrb_value mrb_str_chop_bang(mrb_state *mrb, mrb_value str)
Definition: string.c:1600
static mrb_value mrb_str_reverse(mrb_state *mrb, mrb_value str)
Definition: string.c:2028
static mrb_value mrb_str_setbyte(mrb_state *mrb, mrb_value str)
Definition: string.c:2802
static mrb_value mrb_str_size(mrb_state *mrb, mrb_value self)
Definition: string.c:912
static mrb_value mrb_str_to_i(mrb_state *mrb, mrb_value self)
Definition: string.c:2454
static struct RString * str_init_normal(mrb_state *mrb, struct RString *s, const char *p, size_t len)
Definition: string.c:52
static mrb_value mrb_str_getbyte(mrb_state *mrb, mrb_value str)
Definition: string.c:2782
static mrb_value mrb_str_times(mrb_state *mrb, mrb_value self)
Definition: string.c:936
void mrb_str_modify(mrb_state *mrb, struct RString *s)
Definition: string.c:825
struct mrb_shared_string mrb_shared_string
static struct RString * str_new(mrb_state *mrb, const char *p, size_t len)
Definition: string.c:130
static mrb_value mrb_str_split_m(mrb_state *mrb, mrb_value str)
Definition: string.c:2112
static void str_out_of_index(mrb_state *mrb, mrb_value index)
Definition: string.c:1242
static mrb_value mrb_str_equal_m(mrb_state *mrb, mrb_value str1)
Definition: string.c:1070
static mrb_value str_replace_partial(mrb_state *mrb, mrb_value src, mrb_int pos, mrb_int end, mrb_value rep)
Definition: string.c:1248
static mrb_int str_rindex(mrb_state *mrb, mrb_value str, mrb_value sub, mrb_int pos)
Definition: string.c:710
void mrb_init_string(mrb_state *mrb)
Definition: string.c:2882
#define str_index_str_by_char(mrb, str, sub, pos)
Definition: string.c:494
#define IS_EVSTR(p, e)
Definition: string.c:1291
#define char_adjust(beg, end, ptr)
Definition: string.c:491
static void str_reverse(char *p, char *e)
Definition: string.c:1962
mrb_value mrb_str_new_capa(mrb_state *mrb, size_t capa)
Definition: string.c:160
static mrb_value str_substr(mrb_state *mrb, mrb_value str, mrb_int beg, mrb_int len)
Definition: string.c:639
static mrb_value mrb_str_capitalize_bang(mrb_state *mrb, mrb_value str)
Definition: string.c:1441
#define RSTRING_CHAR_LEN(s)
Definition: string.c:488
void mrb_str_modify_keep_ascii(mrb_state *mrb, struct RString *s)
Definition: string.c:818
static mrb_value mrb_str_aref(mrb_state *mrb, mrb_value str, mrb_value indx, mrb_value alen)
Definition: string.c:1167
static mrb_value mrb_str_plus_m(mrb_state *mrb, mrb_value self)
Definition: string.c:895
const char * mrb_string_value_ptr(mrb_state *mrb, mrb_value str)
Definition: string.c:1080
static mrb_value mrb_str_include(mrb_state *mrb, mrb_value self)
Definition: string.c:1799
mrb_int mrb_str_strlen(mrb_state *mrb, struct RString *s)
Definition: string.c:740
void mrb_gc_free_str(mrb_state *mrb, struct RString *str)
Definition: string.c:269
mrb_value mrb_str_new(mrb_state *mrb, const char *p, size_t len)
Definition: string.c:197
mrb_value mrb_str_dup(mrb_state *mrb, mrb_value str)
Definition: string.c:1095
double mrb_str_len_to_dbl(mrb_state *mrb, const char *s, size_t len, mrb_bool badcheck)
Definition: string.c:2467
mrb_value mrb_ptr_to_str(mrb_state *mrb, void *p)
Definition: string.c:1932
uint32_t mrb_str_hash(mrb_state *mrb, mrb_value str)
Definition: string.c:1752
void mrb_str_concat(mrb_state *mrb, mrb_value self, mrb_value other)
Definition: string.c:863
mrb_value mrb_str_dump(mrb_state *mrb, mrb_value str)
Definition: string.c:2663
static struct RString * str_init_modifiable(mrb_state *mrb, struct RString *s, const char *p, size_t len)
Definition: string.c:107
mrb_value mrb_str_cat_str(mrb_state *mrb, mrb_value str, mrb_value str2)
Definition: string.c:2720
static struct RString * str_init_shared(mrb_state *mrb, const struct RString *orig, struct RString *s, mrb_shared_string *shared)
Definition: string.c:78
#define MRB_QS_SHORT_STRING_LENGTH
Definition: string.c:498
static struct RString * str_init_fshared(const struct RString *orig, struct RString *s, struct RString *fshared)
Definition: string.c:97
char * mrb_str_to_cstr(mrb_state *mrb, mrb_value str0)
Definition: string.c:853
static mrb_value mrb_str_init(mrb_state *mrb, mrb_value self)
Definition: string.c:1873
mrb_value mrb_str_inspect(mrb_state *mrb, mrb_value str)
Definition: string.c:2747
double mrb_float_read(const char *string, char **endPtr)
Definition: string.c:2982
static mrb_value mrb_str_bytesize(mrb_state *mrb, mrb_value self)
Definition: string.c:919
static struct RString * str_init_embed(struct RString *s, const char *p, size_t len)
Definition: string.c:58
static void str_modify_keep_ascii(mrb_state *mrb, struct RString *s)
Definition: string.c:238
static mrb_value mrb_str_upcase_bang(mrb_state *mrb, mrb_value str)
Definition: string.c:2613
static mrb_value mrb_str_capitalize(mrb_state *mrb, mrb_value self)
Definition: string.c:1477
static mrb_value mrb_str_eql(mrb_state *mrb, mrb_value self)
Definition: string.c:1735
#define str_subseq(mrb, str, beg, len)
Definition: string.c:619
#define mrb_obj_alloc_string(mrb)
Definition: string.c:35
#define char_backtrack(ptr, end)
Definition: string.c:492
static mrb_value mrb_str_chop(mrb_state *mrb, mrb_value self)
Definition: string.c:1650
mrb_value mrb_str_len_to_inum(mrb_state *mrb, const char *str, size_t len, mrb_int base, int badcheck)
Definition: string.c:2220
static mrb_value mrb_str_chomp(mrb_state *mrb, mrb_value self)
Definition: string.c:1581
static mrb_int mrb_memsearch(const void *x0, mrb_int m, const void *y0, mrb_int n)
Definition: string.c:539
double mrb_str_to_dbl(mrb_state *mrb, mrb_value str, mrb_bool badcheck)
Definition: string.c:2562
str_convert_range
Definition: string.c:1104
@ STR_CHAR_RANGE_CORRECTED
Definition: string.c:1112
@ STR_CHAR_RANGE
Definition: string.c:1109
@ STR_BYTE_RANGE_CORRECTED
Definition: string.c:1106
@ STR_OUT_OF_RANGE
Definition: string.c:1115
static mrb_bool str_eql(mrb_state *mrb, const mrb_value str1, const mrb_value str2)
Definition: string.c:1041
const char * mrb_string_cstr(mrb_state *mrb, mrb_value str)
Definition: string.c:2415
static struct RString * str_init_nofree(struct RString *s, const char *p, size_t len)
Definition: string.c:68
static mrb_value mrb_str_to_f(mrb_state *mrb, mrb_value self)
Definition: string.c:2582
static mrb_int mrb_memsearch_qs(const unsigned char *xs, mrb_int m, const unsigned char *ys, mrb_int n)
Definition: string.c:502
static mrb_value mrb_str_bytes(mrb_state *mrb, mrb_value str)
Definition: string.c:2762
#define conv_digit(c)
static mrb_int str_index_str(mrb_state *mrb, mrb_value str, mrb_value str2, mrb_int offset)
Definition: string.c:671
static mrb_value mrb_str_rindex(mrb_state *mrb, mrb_value str)
Definition: string.c:2051
static mrb_value mrb_str_aset_m(mrb_state *mrb, mrb_value str)
Definition: string.c:1411
static void str_decref(mrb_state *mrb, mrb_shared_string *shared)
Definition: string.c:228
mrb_int mrb_string_value_len(mrb_state *mrb, mrb_value ptr)
Definition: string.c:1088
static mrb_value mrb_str_chomp_bang(mrb_state *mrb, mrb_value str)
Definition: string.c:1495
mrb_value mrb_str_byte_subseq(mrb_state *mrb, mrb_value str, mrb_int beg, mrb_int len)
Definition: string.c:587
static mrb_value mrb_str_aref_m(mrb_state *mrb, mrb_value str)
Definition: string.c:1230
static const int maxExponent
Definition: string.c:2964
static mrb_value mrb_str_replace(mrb_state *mrb, mrb_value str)
Definition: string.c:1857
int mrb_str_cmp(mrb_state *mrb, mrb_value str1, mrb_value str2)
Definition: string.c:981
static mrb_value str_replace(mrb_state *mrb, struct RString *s1, struct RString *s2)
Definition: string.c:683
static mrb_value mrb_str_cmp_m(mrb_state *mrb, mrb_value str1)
Definition: string.c:1026
#define wchar_t
Definition: stddef.in.h:81
#define uintptr_t
Definition: stdint.in.h:321
#define mrb_str_ptr(s)
Definition: string.h:98
#define RSTR_SET_LEN(s, n)
Definition: string.h:52
#define RSTR_SHARED_P(s)
Definition: string.h:69
#define RSTR_COPY_ASCII_FLAG(dst, src)
Definition: string.h:92
#define RSTR_FSHARED_P(s)
Definition: string.h:73
#define mrb_str_cat_lit(mrb, str, lit)
Definition: string.h:417
#define RSTR_LEN(s)
Definition: string.h:66
#define RSTR_ASCII_P(s)
Definition: string.h:88
#define RSTRING_LEN(s)
Definition: string.h:102
#define RSTRING_PTR(s)
Definition: string.h:100
#define MRB_STR_EMBED_LEN_BIT
Definition: string.h:114
#define RSTR_UNSET_ASCII_FLAG(s)
Definition: string.h:90
#define RSTR_CAPA(s)
Definition: string.h:67
#define RSTRING_EMBED_LEN_MAX
Definition: string.h:19
#define RSTRING_END(s)
Definition: string.h:104
#define RSTR_SET_ASCII_FLAG(s)
Definition: string.h:89
#define RSTR_SET_TYPE_FLAG(s, type)
Definition: string.h:41
#define RSTR_EMBEDDABLE_P(len)
Definition: string.h:63
#define RSTR_SET_EMBED_LEN(s, n)
Definition: string.h:47
#define RSTR_UNSET_TYPE_FLAG(s)
Definition: string.h:42
#define RSTR_EMBED_P(s)
Definition: string.h:44
#define RSTR_NOFREE_P(s)
Definition: string.h:77
#define RSTR_EMBED_PTR(s)
Definition: string.h:60
#define RSTR_EMBED_LEN(s)
Definition: string.h:61
#define RSTR_UNSET_SHARED_FLAG(s)
Definition: string.h:71
#define RSTR_PTR(s)
Definition: string.h:65
#define MRB_STR_ASCII
Definition: string.h:112
Definition: class.h:17
Definition: string.h:22
mrb_ssize len
Definition: string.h:26
union RString::@1665::@1666::@1667 aux
union RString::@1665 as
mrb_ssize capa
Definition: string.h:28
char * ptr
Definition: string.h:32
struct mrb_shared_string * shared
Definition: string.h:29
struct RString::@1665::@1666 heap
struct RString * fshared
Definition: string.h:30
Definition: ttf.h:33
Definition: mendex.h:20
mrb_ssize capa
Definition: string.c:29
char * ptr
Definition: string.c:30
struct RClass * object_class
Definition: mruby.h:242
struct RClass * string_class
Definition: mruby.h:246
Definition: dvips.h:235
Definition: strexpr.c:21
s1
Definition: t4ht.c:1059
const char * str2
Definition: t4ht.c:1410
char * s2
Definition: t4ht.c:1062
*job_name strlen((char *) job_name) - 4)
#define key
Definition: tex2xindy.c:753
str1
Definition: tex4ht.c:2099
val
Definition: tex4ht.c:3227
m
Definition: tex4ht.c:3990
return() int(((double) *(font_tbl[cur_fnt].wtbl+(int)(*(font_tbl[cur_fnt].char_wi+(int)(ch - font_tbl[cur_fnt].char_f)% 256)))/(double)(1L<< 20)) *(double) font_tbl[cur_fnt].scale)
#define mrb_ro_data_p(p)
Definition: value.h:395
int32_t mrb_int
Definition: value.h:35
static mrb_value mrb_nil_value(void)
Definition: value.h:332
static mrb_value mrb_bool_value(mrb_bool boolean)
Definition: value.h:360
static mrb_value mrb_float_value(struct mrb_state *mrb, mrb_float f)
Definition: value.h:273
double mrb_float
Definition: value.h:85
@ MRB_TT_SCLASS
Definition: value.h:120
@ MRB_TT_CLASS
Definition: value.h:117
@ MRB_TT_STRING
Definition: value.h:124
@ MRB_TT_RANGE
Definition: value.h:125
@ MRB_TT_MODULE
Definition: value.h:118
@ MRB_TT_SYMBOL
Definition: value.h:112
@ MRB_TT_INTEGER
Definition: value.h:111
static mrb_value mrb_fixnum_value(mrb_int i)
Definition: value.h:301
mrb_int mrb_ssize
Definition: value.h:175
static mrb_value mrb_undef_value(void)
Definition: value.h:368
#define MRB_SSIZE_MAX
Definition: value.h:176
#define MRB_INT_MAX
Definition: value.h:68
static mrb_value mrb_symbol_value(mrb_sym i)
Definition: value.h:309
static mrb_value mrb_int_value(struct mrb_state *mrb, mrb_int i)
Definition: value.h:294
static mrb_value mrb_obj_value(void *p)
Definition: value.h:317
#define MRB_INT_MIN
Definition: value.h:67
#define argc
Definition: xmain.c:269
#define end(cp)
Definition: zic.c:71