fizx-ordered_json 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. data/.gitignore +29 -0
  2. data/CHANGELOG +22 -0
  3. data/README +4 -0
  4. data/Rakefile +35 -0
  5. data/ext/Makefile +149 -0
  6. data/ext/json-c-0.8/AUTHORS +2 -0
  7. data/ext/json-c-0.8/COPYING +19 -0
  8. data/ext/json-c-0.8/ChangeLog +73 -0
  9. data/ext/json-c-0.8/INSTALL +229 -0
  10. data/ext/json-c-0.8/Makefile.am +43 -0
  11. data/ext/json-c-0.8/Makefile.in +734 -0
  12. data/ext/json-c-0.8/NEWS +1 -0
  13. data/ext/json-c-0.8/README +20 -0
  14. data/ext/json-c-0.8/aclocal.m4 +8794 -0
  15. data/ext/json-c-0.8/arraylist.c +93 -0
  16. data/ext/json-c-0.8/arraylist.h +45 -0
  17. data/ext/json-c-0.8/bits.h +27 -0
  18. data/ext/json-c-0.8/config.guess +1526 -0
  19. data/ext/json-c-0.8/config.h.in +121 -0
  20. data/ext/json-c-0.8/config.sub +1658 -0
  21. data/ext/json-c-0.8/configure +14243 -0
  22. data/ext/json-c-0.8/configure.in +33 -0
  23. data/ext/json-c-0.8/debug.c +98 -0
  24. data/ext/json-c-0.8/debug.h +42 -0
  25. data/ext/json-c-0.8/depcomp +530 -0
  26. data/ext/json-c-0.8/doc/html/annotated.html +40 -0
  27. data/ext/json-c-0.8/doc/html/arraylist_8h.html +234 -0
  28. data/ext/json-c-0.8/doc/html/bits_8h.html +144 -0
  29. data/ext/json-c-0.8/doc/html/config_8h.html +606 -0
  30. data/ext/json-c-0.8/doc/html/debug_8h.html +386 -0
  31. data/ext/json-c-0.8/doc/html/doxygen.css +473 -0
  32. data/ext/json-c-0.8/doc/html/doxygen.png +0 -0
  33. data/ext/json-c-0.8/doc/html/files.html +42 -0
  34. data/ext/json-c-0.8/doc/html/functions.html +206 -0
  35. data/ext/json-c-0.8/doc/html/functions_vars.html +206 -0
  36. data/ext/json-c-0.8/doc/html/globals.html +445 -0
  37. data/ext/json-c-0.8/doc/html/globals_defs.html +200 -0
  38. data/ext/json-c-0.8/doc/html/globals_enum.html +50 -0
  39. data/ext/json-c-0.8/doc/html/globals_eval.html +135 -0
  40. data/ext/json-c-0.8/doc/html/globals_func.html +194 -0
  41. data/ext/json-c-0.8/doc/html/globals_type.html +58 -0
  42. data/ext/json-c-0.8/doc/html/globals_vars.html +50 -0
  43. data/ext/json-c-0.8/doc/html/index.html +25 -0
  44. data/ext/json-c-0.8/doc/html/json_8h.html +26 -0
  45. data/ext/json-c-0.8/doc/html/json__object_8h.html +1042 -0
  46. data/ext/json-c-0.8/doc/html/json__object__private_8h.html +69 -0
  47. data/ext/json-c-0.8/doc/html/json__tokener_8h.html +360 -0
  48. data/ext/json-c-0.8/doc/html/json__util_8h.html +100 -0
  49. data/ext/json-c-0.8/doc/html/linkhash_8h.html +734 -0
  50. data/ext/json-c-0.8/doc/html/printbuf_8h.html +171 -0
  51. data/ext/json-c-0.8/doc/html/structarray__list.html +104 -0
  52. data/ext/json-c-0.8/doc/html/structjson__object.html +141 -0
  53. data/ext/json-c-0.8/doc/html/structjson__object__iter.html +87 -0
  54. data/ext/json-c-0.8/doc/html/structjson__tokener.html +206 -0
  55. data/ext/json-c-0.8/doc/html/structjson__tokener__srec.html +104 -0
  56. data/ext/json-c-0.8/doc/html/structlh__entry.html +105 -0
  57. data/ext/json-c-0.8/doc/html/structlh__table.html +275 -0
  58. data/ext/json-c-0.8/doc/html/structprintbuf.html +87 -0
  59. data/ext/json-c-0.8/doc/html/tab_b.gif +0 -0
  60. data/ext/json-c-0.8/doc/html/tab_l.gif +0 -0
  61. data/ext/json-c-0.8/doc/html/tab_r.gif +0 -0
  62. data/ext/json-c-0.8/doc/html/tabs.css +102 -0
  63. data/ext/json-c-0.8/doc/html/unionjson__object_1_1data.html +140 -0
  64. data/ext/json-c-0.8/install-sh +519 -0
  65. data/ext/json-c-0.8/json.h +31 -0
  66. data/ext/json-c-0.8/json.pc.in +11 -0
  67. data/ext/json-c-0.8/json_object.c +511 -0
  68. data/ext/json-c-0.8/json_object.h +310 -0
  69. data/ext/json-c-0.8/json_object_private.h +44 -0
  70. data/ext/json-c-0.8/json_tokener.c +517 -0
  71. data/ext/json-c-0.8/json_tokener.h +90 -0
  72. data/ext/json-c-0.8/json_util.c +122 -0
  73. data/ext/json-c-0.8/json_util.h +23 -0
  74. data/ext/json-c-0.8/linkhash.c +218 -0
  75. data/ext/json-c-0.8/linkhash.h +264 -0
  76. data/ext/json-c-0.8/ltmain.sh +7880 -0
  77. data/ext/json-c-0.8/missing +360 -0
  78. data/ext/json-c-0.8/printbuf.c +145 -0
  79. data/ext/json-c-0.8/printbuf.h +38 -0
  80. data/ext/json-c-0.8/test1.c +164 -0
  81. data/ext/json-c-0.8/test2.c +20 -0
  82. data/ext/json-c-0.8/test3.c +22 -0
  83. data/ext/ordered_json_c.c +199 -0
  84. data/lib/ordered_json.rb +26 -0
  85. data/ordered_json.gemspec +102 -0
  86. data/test/crashing_example.rb +1 -0
  87. data/test/ordered_json_test.rb +86 -0
  88. data/test/pretty.json +11 -0
  89. metadata +91 -50
@@ -0,0 +1,93 @@
1
+ /*
2
+ * $Id: arraylist.c,v 1.4 2006/01/26 02:16:28 mclark Exp $
3
+ *
4
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
5
+ * Michael Clark <michael@metaparadigm.com>
6
+ *
7
+ * This library is free software; you can redistribute it and/or modify
8
+ * it under the terms of the MIT license. See COPYING for details.
9
+ *
10
+ */
11
+
12
+ #include "config.h"
13
+
14
+ #if STDC_HEADERS
15
+ # include <stdlib.h>
16
+ # include <string.h>
17
+ #endif /* STDC_HEADERS */
18
+
19
+ #if HAVE_STRINGS_H
20
+ # include <strings.h>
21
+ #endif /* HAVE_STRINGS_H */
22
+
23
+ #include "bits.h"
24
+ #include "arraylist.h"
25
+
26
+ struct array_list*
27
+ array_list_new(array_list_free_fn *free_fn)
28
+ {
29
+ struct array_list *this;
30
+
31
+ if(!(this = calloc(1, sizeof(struct array_list)))) return NULL;
32
+ this->size = ARRAY_LIST_DEFAULT_SIZE;
33
+ this->length = 0;
34
+ this->free_fn = free_fn;
35
+ if(!(this->array = calloc(sizeof(void*), this->size))) {
36
+ free(this);
37
+ return NULL;
38
+ }
39
+ return this;
40
+ }
41
+
42
+ extern void
43
+ array_list_free(struct array_list *this)
44
+ {
45
+ int i;
46
+ for(i = 0; i < this->length; i++)
47
+ if(this->array[i]) this->free_fn(this->array[i]);
48
+ free(this->array);
49
+ free(this);
50
+ }
51
+
52
+ void*
53
+ array_list_get_idx(struct array_list *this, int i)
54
+ {
55
+ if(i >= this->length) return NULL;
56
+ return this->array[i];
57
+ }
58
+
59
+ static int array_list_expand_internal(struct array_list *this, int max)
60
+ {
61
+ void *t;
62
+ int new_size;
63
+
64
+ if(max < this->size) return 0;
65
+ new_size = max(this->size << 1, max);
66
+ if(!(t = realloc(this->array, new_size*sizeof(void*)))) return -1;
67
+ this->array = t;
68
+ (void)memset(this->array + this->size, 0, (new_size-this->size)*sizeof(void*));
69
+ this->size = new_size;
70
+ return 0;
71
+ }
72
+
73
+ int
74
+ array_list_put_idx(struct array_list *this, int idx, void *data)
75
+ {
76
+ if(array_list_expand_internal(this, idx)) return -1;
77
+ if(this->array[idx]) this->free_fn(this->array[idx]);
78
+ this->array[idx] = data;
79
+ if(this->length <= idx) this->length = idx + 1;
80
+ return 0;
81
+ }
82
+
83
+ int
84
+ array_list_add(struct array_list *this, void *data)
85
+ {
86
+ return array_list_put_idx(this, this->length, data);
87
+ }
88
+
89
+ int
90
+ array_list_length(struct array_list *this)
91
+ {
92
+ return this->length;
93
+ }
@@ -0,0 +1,45 @@
1
+ /*
2
+ * $Id: arraylist.h,v 1.4 2006/01/26 02:16:28 mclark Exp $
3
+ *
4
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
5
+ * Michael Clark <michael@metaparadigm.com>
6
+ *
7
+ * This library is free software; you can redistribute it and/or modify
8
+ * it under the terms of the MIT license. See COPYING for details.
9
+ *
10
+ */
11
+
12
+ #ifndef _arraylist_h_
13
+ #define _arraylist_h_
14
+
15
+ #define ARRAY_LIST_DEFAULT_SIZE 32
16
+
17
+ typedef void (array_list_free_fn) (void *data);
18
+
19
+ struct array_list
20
+ {
21
+ void **array;
22
+ int length;
23
+ int size;
24
+ array_list_free_fn *free_fn;
25
+ };
26
+
27
+ extern struct array_list*
28
+ array_list_new(array_list_free_fn *free_fn);
29
+
30
+ extern void
31
+ array_list_free(struct array_list *al);
32
+
33
+ extern void*
34
+ array_list_get_idx(struct array_list *al, int i);
35
+
36
+ extern int
37
+ array_list_put_idx(struct array_list *al, int i, void *data);
38
+
39
+ extern int
40
+ array_list_add(struct array_list *al, void *data);
41
+
42
+ extern int
43
+ array_list_length(struct array_list *al);
44
+
45
+ #endif
@@ -0,0 +1,27 @@
1
+ /*
2
+ * $Id: bits.h,v 1.10 2006/01/30 23:07:57 mclark Exp $
3
+ *
4
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
5
+ * Michael Clark <michael@metaparadigm.com>
6
+ *
7
+ * This library is free software; you can redistribute it and/or modify
8
+ * it under the terms of the MIT license. See COPYING for details.
9
+ *
10
+ */
11
+
12
+ #ifndef _bits_h_
13
+ #define _bits_h_
14
+
15
+ #ifndef min
16
+ #define min(a,b) ((a) < (b) ? (a) : (b))
17
+ #endif
18
+
19
+ #ifndef max
20
+ #define max(a,b) ((a) > (b) ? (a) : (b))
21
+ #endif
22
+
23
+ #define hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x) & 7) + 9)
24
+ #define error_ptr(error) ((void*)error)
25
+ #define is_error(ptr) ((unsigned long)ptr > (unsigned long)-4000L)
26
+
27
+ #endif