content_server 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. data/bin/backup_server +8 -20
  2. data/bin/content_server +8 -20
  3. data/bin/testing_memory +60 -0
  4. data/bin/testing_server +57 -0
  5. data/ext/run_in_background/mkrf_conf.rb +34 -0
  6. data/lib/content_data/content_data.rb +613 -0
  7. data/lib/content_data/version.rb +3 -0
  8. data/lib/content_data.rb +6 -0
  9. data/lib/content_server/backup_server.rb +65 -86
  10. data/lib/content_server/content_server.rb +47 -77
  11. data/lib/content_server/file_streamer.rb +27 -33
  12. data/lib/content_server/queue_copy.rb +154 -49
  13. data/lib/content_server/queue_indexer.rb +19 -11
  14. data/lib/content_server/remote_content.rb +41 -23
  15. data/lib/content_server/server.rb +91 -0
  16. data/lib/content_server/version.rb +1 -1
  17. data/lib/content_server.rb +0 -15
  18. data/lib/email/email.rb +87 -0
  19. data/lib/email/version.rb +3 -0
  20. data/lib/email.rb +4 -0
  21. data/lib/file_copy/copy.rb +68 -0
  22. data/lib/file_copy/version.rb +4 -0
  23. data/lib/file_copy.rb +4 -0
  24. data/lib/file_indexing/index_agent.rb +170 -0
  25. data/lib/file_indexing/indexer_patterns.rb +72 -0
  26. data/lib/file_indexing/version.rb +3 -0
  27. data/lib/file_indexing.rb +9 -0
  28. data/lib/file_monitoring/file_monitoring.rb +105 -0
  29. data/lib/file_monitoring/monitor_path.rb +304 -0
  30. data/lib/file_monitoring/version.rb +3 -0
  31. data/lib/file_monitoring.rb +29 -0
  32. data/lib/file_utils/file_generator/README +97 -0
  33. data/lib/file_utils/file_generator/file_generator.rb +156 -0
  34. data/lib/file_utils/file_utils.rb +260 -0
  35. data/lib/file_utils/version.rb +3 -0
  36. data/lib/file_utils.rb +4 -0
  37. data/lib/log/version.rb +3 -0
  38. data/lib/log.rb +188 -0
  39. data/lib/networking/tcp.rb +213 -0
  40. data/lib/networking/version.rb +3 -0
  41. data/lib/networking.rb +4 -0
  42. data/lib/params/version.rb +3 -0
  43. data/lib/params.rb +419 -0
  44. data/lib/process_monitoring/monitoring.rb +85 -0
  45. data/lib/process_monitoring/monitoring_info.rb +79 -0
  46. data/lib/process_monitoring/send_email.rb +40 -0
  47. data/lib/process_monitoring/thread_safe_hash.rb +77 -0
  48. data/lib/process_monitoring/version.rb +3 -0
  49. data/lib/process_monitoring.rb +6 -0
  50. data/lib/run_in_background/version.rb +3 -0
  51. data/lib/run_in_background.rb +432 -0
  52. data/lib/testing_memory/testing_memory.rb +187 -0
  53. data/lib/testing_server/testing_server.rb +236 -0
  54. data/lib/testing_server/version.rb +3 -0
  55. data/lib/testing_server.rb +12 -0
  56. data/lib/validations/index_validations.rb +106 -0
  57. data/lib/validations/version.rb +3 -0
  58. data/lib/validations.rb +4 -0
  59. data/spec/content_data/validations_spec.rb +113 -0
  60. data/spec/file_copy/copy_spec.rb +54 -0
  61. data/spec/file_indexing/index_agent_spec.rb +53 -0
  62. data/spec/networking/tcp_spec.rb +95 -0
  63. data/spec/validations/index_validations_spec.rb +77 -0
  64. data/test/content_data/content_data_test.rb +290 -0
  65. data/test/file_generator/file_generator_spec.rb +84 -0
  66. data/test/file_indexing/index_agent_test/New.txt +0 -0
  67. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/bin/libexslt.dll +0 -0
  68. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/bin/libxslt.dll +0 -0
  69. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/bin/xsltproc.exe +0 -0
  70. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libexslt/exslt.h +102 -0
  71. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libexslt/exsltconfig.h +73 -0
  72. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libexslt/exsltexports.h +140 -0
  73. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libexslt/libexslt.h +29 -0
  74. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/attributes.h +38 -0
  75. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/documents.h +93 -0
  76. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/extensions.h +262 -0
  77. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/extra.h +80 -0
  78. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/functions.h +78 -0
  79. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/imports.h +75 -0
  80. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/keys.h +53 -0
  81. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/libxslt.h +30 -0
  82. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/namespaces.h +68 -0
  83. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/numbersInternals.h +69 -0
  84. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/pattern.h +81 -0
  85. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/preproc.h +43 -0
  86. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/security.h +104 -0
  87. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/templates.h +77 -0
  88. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/transform.h +207 -0
  89. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/trio.h +216 -0
  90. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/triodef.h +220 -0
  91. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/variables.h +91 -0
  92. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/win32config.h +101 -0
  93. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/xslt.h +103 -0
  94. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/xsltInternals.h +1967 -0
  95. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/xsltconfig.h +172 -0
  96. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/xsltexports.h +142 -0
  97. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/xsltlocale.h +57 -0
  98. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/xsltutils.h +309 -0
  99. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/include/libxslt/xsltwin32config.h +105 -0
  100. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/lib/libexslt.lib +0 -0
  101. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/lib/libexslt_a.lib +0 -0
  102. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/lib/libxslt.lib +0 -0
  103. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/lib/libxslt_a.lib +0 -0
  104. data/test/file_indexing/index_agent_test/libxslt-1.1.26.win32/readme.txt +22 -0
  105. data/test/file_indexing/index_agent_test/patterns.input +3 -0
  106. data/test/file_indexing/index_agent_test.rb +51 -0
  107. data/test/file_monitoring/file_monitoring_test/conf.yml +4 -0
  108. data/test/file_monitoring/file_monitoring_test/conf_win32.yml +5 -0
  109. data/test/file_monitoring/file_monitoring_test/log +56 -0
  110. data/test/file_monitoring/file_monitoring_test.rb +0 -0
  111. data/test/file_monitoring/monitor_path_test/dir1000/test_file.1000 +1000 -0
  112. data/test/file_monitoring/monitor_path_test/dir1000/test_file.1000.0 +1000 -0
  113. data/test/file_monitoring/monitor_path_test/dir1000/test_file.1000.1 +1000 -0
  114. data/test/file_monitoring/monitor_path_test/dir1500/test_file.1500 +1500 -0
  115. data/test/file_monitoring/monitor_path_test/dir1500/test_file.1500.0 +1500 -0
  116. data/test/file_monitoring/monitor_path_test/dir1500/test_file.1500.1 +1500 -0
  117. data/test/file_monitoring/monitor_path_test/test_file.500 +500 -0
  118. data/test/file_monitoring/monitor_path_test/test_file.500.0 +500 -0
  119. data/test/file_monitoring/monitor_path_test/test_file.500.1 +500 -0
  120. data/test/file_monitoring/monitor_path_test.rb +153 -0
  121. data/test/file_utils/fileutil_mksymlink_test/dir1000/dir1500/test_file.1500 +1500 -0
  122. data/test/file_utils/fileutil_mksymlink_test/dir1000/dir1500/test_file.1500.0 +1500 -0
  123. data/test/file_utils/fileutil_mksymlink_test/dir1000/dir1500/test_file.1500.1 +1500 -0
  124. data/test/file_utils/fileutil_mksymlink_test/dir1000/test_file.1000 +1000 -0
  125. data/test/file_utils/fileutil_mksymlink_test/dir1000/test_file.1000.0 +1000 -0
  126. data/test/file_utils/fileutil_mksymlink_test/dir1000/test_file.1000.1 +1000 -0
  127. data/test/file_utils/fileutil_mksymlink_test/test_file.500 +500 -0
  128. data/test/file_utils/fileutil_mksymlink_test/test_file.500.0 +500 -0
  129. data/test/file_utils/fileutil_mksymlink_test/test_file.500.1 +500 -0
  130. data/test/file_utils/fileutil_mksymlink_test.rb +125 -0
  131. data/test/file_utils/time_modification_test.rb +132 -0
  132. data/test/params/params_spec.rb +280 -0
  133. data/test/params/params_test.rb +43 -0
  134. data/test/run_in_background/run_in_background_test.rb +122 -0
  135. data/test/run_in_background/test_app +57 -0
  136. metadata +272 -132
  137. data/lib/content_server/globals.rb +0 -10
@@ -0,0 +1,207 @@
1
+ /*
2
+ * Summary: the XSLT engine transformation part.
3
+ * Description: This module implements the bulk of the actual
4
+ * transformation processing. Most of the xsl: element
5
+ * constructs are implemented in this module.
6
+ *
7
+ * Copy: See Copyright for the status of this software.
8
+ *
9
+ * Author: Daniel Veillard
10
+ */
11
+
12
+ #ifndef __XML_XSLT_TRANSFORM_H__
13
+ #define __XML_XSLT_TRANSFORM_H__
14
+
15
+ #include <libxml/parser.h>
16
+ #include <libxml/xmlIO.h>
17
+ #include "xsltexports.h"
18
+ #include <libxslt/xsltInternals.h>
19
+
20
+ #ifdef __cplusplus
21
+ extern "C" {
22
+ #endif
23
+
24
+ /**
25
+ * XInclude default processing.
26
+ */
27
+ XSLTPUBFUN void XSLTCALL
28
+ xsltSetXIncludeDefault (int xinclude);
29
+ XSLTPUBFUN int XSLTCALL
30
+ xsltGetXIncludeDefault (void);
31
+
32
+ /**
33
+ * Export context to users.
34
+ */
35
+ XSLTPUBFUN xsltTransformContextPtr XSLTCALL
36
+ xsltNewTransformContext (xsltStylesheetPtr style,
37
+ xmlDocPtr doc);
38
+
39
+ XSLTPUBFUN void XSLTCALL
40
+ xsltFreeTransformContext(xsltTransformContextPtr ctxt);
41
+
42
+ XSLTPUBFUN xmlDocPtr XSLTCALL
43
+ xsltApplyStylesheetUser (xsltStylesheetPtr style,
44
+ xmlDocPtr doc,
45
+ const char **params,
46
+ const char *output,
47
+ FILE * profile,
48
+ xsltTransformContextPtr userCtxt);
49
+ XSLTPUBFUN void XSLTCALL
50
+ xsltProcessOneNode (xsltTransformContextPtr ctxt,
51
+ xmlNodePtr node,
52
+ xsltStackElemPtr params);
53
+ /**
54
+ * Private Interfaces.
55
+ */
56
+ XSLTPUBFUN void XSLTCALL
57
+ xsltApplyStripSpaces (xsltTransformContextPtr ctxt,
58
+ xmlNodePtr node);
59
+ XSLTPUBFUN xmlDocPtr XSLTCALL
60
+ xsltApplyStylesheet (xsltStylesheetPtr style,
61
+ xmlDocPtr doc,
62
+ const char **params);
63
+ XSLTPUBFUN xmlDocPtr XSLTCALL
64
+ xsltProfileStylesheet (xsltStylesheetPtr style,
65
+ xmlDocPtr doc,
66
+ const char **params,
67
+ FILE * output);
68
+ XSLTPUBFUN int XSLTCALL
69
+ xsltRunStylesheet (xsltStylesheetPtr style,
70
+ xmlDocPtr doc,
71
+ const char **params,
72
+ const char *output,
73
+ xmlSAXHandlerPtr SAX,
74
+ xmlOutputBufferPtr IObuf);
75
+ XSLTPUBFUN int XSLTCALL
76
+ xsltRunStylesheetUser (xsltStylesheetPtr style,
77
+ xmlDocPtr doc,
78
+ const char **params,
79
+ const char *output,
80
+ xmlSAXHandlerPtr SAX,
81
+ xmlOutputBufferPtr IObuf,
82
+ FILE * profile,
83
+ xsltTransformContextPtr userCtxt);
84
+ XSLTPUBFUN void XSLTCALL
85
+ xsltApplyOneTemplate (xsltTransformContextPtr ctxt,
86
+ xmlNodePtr node,
87
+ xmlNodePtr list,
88
+ xsltTemplatePtr templ,
89
+ xsltStackElemPtr params);
90
+ XSLTPUBFUN void XSLTCALL
91
+ xsltDocumentElem (xsltTransformContextPtr ctxt,
92
+ xmlNodePtr node,
93
+ xmlNodePtr inst,
94
+ xsltStylePreCompPtr comp);
95
+ XSLTPUBFUN void XSLTCALL
96
+ xsltSort (xsltTransformContextPtr ctxt,
97
+ xmlNodePtr node,
98
+ xmlNodePtr inst,
99
+ xsltStylePreCompPtr comp);
100
+ XSLTPUBFUN void XSLTCALL
101
+ xsltCopy (xsltTransformContextPtr ctxt,
102
+ xmlNodePtr node,
103
+ xmlNodePtr inst,
104
+ xsltStylePreCompPtr comp);
105
+ XSLTPUBFUN void XSLTCALL
106
+ xsltText (xsltTransformContextPtr ctxt,
107
+ xmlNodePtr node,
108
+ xmlNodePtr inst,
109
+ xsltStylePreCompPtr comp);
110
+ XSLTPUBFUN void XSLTCALL
111
+ xsltElement (xsltTransformContextPtr ctxt,
112
+ xmlNodePtr node,
113
+ xmlNodePtr inst,
114
+ xsltStylePreCompPtr comp);
115
+ XSLTPUBFUN void XSLTCALL
116
+ xsltComment (xsltTransformContextPtr ctxt,
117
+ xmlNodePtr node,
118
+ xmlNodePtr inst,
119
+ xsltStylePreCompPtr comp);
120
+ XSLTPUBFUN void XSLTCALL
121
+ xsltAttribute (xsltTransformContextPtr ctxt,
122
+ xmlNodePtr node,
123
+ xmlNodePtr inst,
124
+ xsltStylePreCompPtr comp);
125
+ XSLTPUBFUN void XSLTCALL
126
+ xsltProcessingInstruction(xsltTransformContextPtr ctxt,
127
+ xmlNodePtr node,
128
+ xmlNodePtr inst,
129
+ xsltStylePreCompPtr comp);
130
+ XSLTPUBFUN void XSLTCALL
131
+ xsltCopyOf (xsltTransformContextPtr ctxt,
132
+ xmlNodePtr node,
133
+ xmlNodePtr inst,
134
+ xsltStylePreCompPtr comp);
135
+ XSLTPUBFUN void XSLTCALL
136
+ xsltValueOf (xsltTransformContextPtr ctxt,
137
+ xmlNodePtr node,
138
+ xmlNodePtr inst,
139
+ xsltStylePreCompPtr comp);
140
+ XSLTPUBFUN void XSLTCALL
141
+ xsltNumber (xsltTransformContextPtr ctxt,
142
+ xmlNodePtr node,
143
+ xmlNodePtr inst,
144
+ xsltStylePreCompPtr comp);
145
+ XSLTPUBFUN void XSLTCALL
146
+ xsltApplyImports (xsltTransformContextPtr ctxt,
147
+ xmlNodePtr node,
148
+ xmlNodePtr inst,
149
+ xsltStylePreCompPtr comp);
150
+ XSLTPUBFUN void XSLTCALL
151
+ xsltCallTemplate (xsltTransformContextPtr ctxt,
152
+ xmlNodePtr node,
153
+ xmlNodePtr inst,
154
+ xsltStylePreCompPtr comp);
155
+ XSLTPUBFUN void XSLTCALL
156
+ xsltApplyTemplates (xsltTransformContextPtr ctxt,
157
+ xmlNodePtr node,
158
+ xmlNodePtr inst,
159
+ xsltStylePreCompPtr comp);
160
+ XSLTPUBFUN void XSLTCALL
161
+ xsltChoose (xsltTransformContextPtr ctxt,
162
+ xmlNodePtr node,
163
+ xmlNodePtr inst,
164
+ xsltStylePreCompPtr comp);
165
+ XSLTPUBFUN void XSLTCALL
166
+ xsltIf (xsltTransformContextPtr ctxt,
167
+ xmlNodePtr node,
168
+ xmlNodePtr inst,
169
+ xsltStylePreCompPtr comp);
170
+ XSLTPUBFUN void XSLTCALL
171
+ xsltForEach (xsltTransformContextPtr ctxt,
172
+ xmlNodePtr node,
173
+ xmlNodePtr inst,
174
+ xsltStylePreCompPtr comp);
175
+ XSLTPUBFUN void XSLTCALL
176
+ xsltRegisterAllElement (xsltTransformContextPtr ctxt);
177
+
178
+ XSLTPUBFUN xmlNodePtr XSLTCALL
179
+ xsltCopyTextString (xsltTransformContextPtr ctxt,
180
+ xmlNodePtr target,
181
+ const xmlChar *string,
182
+ int noescape);
183
+
184
+ /* Following 2 functions needed for libexslt/functions.c */
185
+ XSLTPUBFUN void XSLTCALL
186
+ xsltLocalVariablePop (xsltTransformContextPtr ctxt,
187
+ int limitNr,
188
+ int level);
189
+ XSLTPUBFUN int XSLTCALL
190
+ xsltLocalVariablePush (xsltTransformContextPtr ctxt,
191
+ xsltStackElemPtr variable,
192
+ int level);
193
+ /*
194
+ * Hook for the debugger if activated.
195
+ */
196
+ XSLTPUBFUN void XSLTCALL
197
+ xslHandleDebugger (xmlNodePtr cur,
198
+ xmlNodePtr node,
199
+ xsltTemplatePtr templ,
200
+ xsltTransformContextPtr ctxt);
201
+
202
+ #ifdef __cplusplus
203
+ }
204
+ #endif
205
+
206
+ #endif /* __XML_XSLT_TRANSFORM_H__ */
207
+
@@ -0,0 +1,216 @@
1
+ /*************************************************************************
2
+ *
3
+ * $Id$
4
+ *
5
+ * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg.
6
+ *
7
+ * Permission to use, copy, modify, and distribute this software for any
8
+ * purpose with or without fee is hereby granted, provided that the above
9
+ * copyright notice and this permission notice appear in all copies.
10
+ *
11
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
12
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
13
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
14
+ * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
15
+ *
16
+ *************************************************************************
17
+ *
18
+ * http://ctrio.sourceforge.net/
19
+ *
20
+ ************************************************************************/
21
+
22
+ #ifndef TRIO_TRIO_H
23
+ #define TRIO_TRIO_H
24
+
25
+ #if !defined(WITHOUT_TRIO)
26
+
27
+ /*
28
+ * Use autoconf defines if present. Packages using trio must define
29
+ * HAVE_CONFIG_H as a compiler option themselves.
30
+ */
31
+ #if defined(HAVE_CONFIG_H)
32
+ # include <config.h>
33
+ #endif
34
+
35
+ #include "triodef.h"
36
+
37
+ #include <stdio.h>
38
+ #include <stdlib.h>
39
+ #if defined(TRIO_COMPILER_ANCIENT)
40
+ # include <varargs.h>
41
+ #else
42
+ # include <stdarg.h>
43
+ #endif
44
+
45
+ #ifdef __cplusplus
46
+ extern "C" {
47
+ #endif
48
+
49
+ /*
50
+ * Error codes.
51
+ *
52
+ * Remember to add a textual description to trio_strerror.
53
+ */
54
+ enum {
55
+ TRIO_EOF = 1,
56
+ TRIO_EINVAL = 2,
57
+ TRIO_ETOOMANY = 3,
58
+ TRIO_EDBLREF = 4,
59
+ TRIO_EGAP = 5,
60
+ TRIO_ENOMEM = 6,
61
+ TRIO_ERANGE = 7,
62
+ TRIO_ERRNO = 8,
63
+ TRIO_ECUSTOM = 9
64
+ };
65
+
66
+ /* Error macros */
67
+ #define TRIO_ERROR_CODE(x) ((-(x)) & 0x00FF)
68
+ #define TRIO_ERROR_POSITION(x) ((-(x)) >> 8)
69
+ #define TRIO_ERROR_NAME(x) trio_strerror(x)
70
+
71
+ typedef int (*trio_outstream_t) TRIO_PROTO((trio_pointer_t, int));
72
+ typedef int (*trio_instream_t) TRIO_PROTO((trio_pointer_t));
73
+
74
+ TRIO_CONST char *trio_strerror TRIO_PROTO((int));
75
+
76
+ /*************************************************************************
77
+ * Print Functions
78
+ */
79
+
80
+ int trio_printf TRIO_PROTO((TRIO_CONST char *format, ...));
81
+ int trio_vprintf TRIO_PROTO((TRIO_CONST char *format, va_list args));
82
+ int trio_printfv TRIO_PROTO((TRIO_CONST char *format, void **args));
83
+
84
+ int trio_fprintf TRIO_PROTO((FILE *file, TRIO_CONST char *format, ...));
85
+ int trio_vfprintf TRIO_PROTO((FILE *file, TRIO_CONST char *format, va_list args));
86
+ int trio_fprintfv TRIO_PROTO((FILE *file, TRIO_CONST char *format, void **args));
87
+
88
+ int trio_dprintf TRIO_PROTO((int fd, TRIO_CONST char *format, ...));
89
+ int trio_vdprintf TRIO_PROTO((int fd, TRIO_CONST char *format, va_list args));
90
+ int trio_dprintfv TRIO_PROTO((int fd, TRIO_CONST char *format, void **args));
91
+
92
+ int trio_cprintf TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
93
+ TRIO_CONST char *format, ...));
94
+ int trio_vcprintf TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
95
+ TRIO_CONST char *format, va_list args));
96
+ int trio_cprintfv TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
97
+ TRIO_CONST char *format, void **args));
98
+
99
+ int trio_sprintf TRIO_PROTO((char *buffer, TRIO_CONST char *format, ...));
100
+ int trio_vsprintf TRIO_PROTO((char *buffer, TRIO_CONST char *format, va_list args));
101
+ int trio_sprintfv TRIO_PROTO((char *buffer, TRIO_CONST char *format, void **args));
102
+
103
+ int trio_snprintf TRIO_PROTO((char *buffer, size_t max, TRIO_CONST char *format, ...));
104
+ int trio_vsnprintf TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format,
105
+ va_list args));
106
+ int trio_snprintfv TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format,
107
+ void **args));
108
+
109
+ int trio_snprintfcat TRIO_PROTO((char *buffer, size_t max, TRIO_CONST char *format, ...));
110
+ int trio_vsnprintfcat TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format,
111
+ va_list args));
112
+
113
+ char *trio_aprintf TRIO_PROTO((TRIO_CONST char *format, ...));
114
+ char *trio_vaprintf TRIO_PROTO((TRIO_CONST char *format, va_list args));
115
+
116
+ int trio_asprintf TRIO_PROTO((char **ret, TRIO_CONST char *format, ...));
117
+ int trio_vasprintf TRIO_PROTO((char **ret, TRIO_CONST char *format, va_list args));
118
+
119
+ /*************************************************************************
120
+ * Scan Functions
121
+ */
122
+ int trio_scanf TRIO_PROTO((TRIO_CONST char *format, ...));
123
+ int trio_vscanf TRIO_PROTO((TRIO_CONST char *format, va_list args));
124
+ int trio_scanfv TRIO_PROTO((TRIO_CONST char *format, void **args));
125
+
126
+ int trio_fscanf TRIO_PROTO((FILE *file, TRIO_CONST char *format, ...));
127
+ int trio_vfscanf TRIO_PROTO((FILE *file, TRIO_CONST char *format, va_list args));
128
+ int trio_fscanfv TRIO_PROTO((FILE *file, TRIO_CONST char *format, void **args));
129
+
130
+ int trio_dscanf TRIO_PROTO((int fd, TRIO_CONST char *format, ...));
131
+ int trio_vdscanf TRIO_PROTO((int fd, TRIO_CONST char *format, va_list args));
132
+ int trio_dscanfv TRIO_PROTO((int fd, TRIO_CONST char *format, void **args));
133
+
134
+ int trio_cscanf TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
135
+ TRIO_CONST char *format, ...));
136
+ int trio_vcscanf TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
137
+ TRIO_CONST char *format, va_list args));
138
+ int trio_cscanfv TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
139
+ TRIO_CONST char *format, void **args));
140
+
141
+ int trio_sscanf TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, ...));
142
+ int trio_vsscanf TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, va_list args));
143
+ int trio_sscanfv TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, void **args));
144
+
145
+ /*************************************************************************
146
+ * Locale Functions
147
+ */
148
+ void trio_locale_set_decimal_point TRIO_PROTO((char *decimalPoint));
149
+ void trio_locale_set_thousand_separator TRIO_PROTO((char *thousandSeparator));
150
+ void trio_locale_set_grouping TRIO_PROTO((char *grouping));
151
+
152
+ /*************************************************************************
153
+ * Renaming
154
+ */
155
+ #ifdef TRIO_REPLACE_STDIO
156
+ /* Replace the <stdio.h> functions */
157
+ #ifndef HAVE_PRINTF
158
+ # define printf trio_printf
159
+ #endif
160
+ #ifndef HAVE_VPRINTF
161
+ # define vprintf trio_vprintf
162
+ #endif
163
+ #ifndef HAVE_FPRINTF
164
+ # define fprintf trio_fprintf
165
+ #endif
166
+ #ifndef HAVE_VFPRINTF
167
+ # define vfprintf trio_vfprintf
168
+ #endif
169
+ #ifndef HAVE_SPRINTF
170
+ # define sprintf trio_sprintf
171
+ #endif
172
+ #ifndef HAVE_VSPRINTF
173
+ # define vsprintf trio_vsprintf
174
+ #endif
175
+ #ifndef HAVE_SNPRINTF
176
+ # define snprintf trio_snprintf
177
+ #endif
178
+ #ifndef HAVE_VSNPRINTF
179
+ # define vsnprintf trio_vsnprintf
180
+ #endif
181
+ #ifndef HAVE_SCANF
182
+ # define scanf trio_scanf
183
+ #endif
184
+ #ifndef HAVE_VSCANF
185
+ # define vscanf trio_vscanf
186
+ #endif
187
+ #ifndef HAVE_FSCANF
188
+ # define fscanf trio_fscanf
189
+ #endif
190
+ #ifndef HAVE_VFSCANF
191
+ # define vfscanf trio_vfscanf
192
+ #endif
193
+ #ifndef HAVE_SSCANF
194
+ # define sscanf trio_sscanf
195
+ #endif
196
+ #ifndef HAVE_VSSCANF
197
+ # define vsscanf trio_vsscanf
198
+ #endif
199
+ /* These aren't stdio functions, but we make them look similar */
200
+ #define dprintf trio_dprintf
201
+ #define vdprintf trio_vdprintf
202
+ #define aprintf trio_aprintf
203
+ #define vaprintf trio_vaprintf
204
+ #define asprintf trio_asprintf
205
+ #define vasprintf trio_vasprintf
206
+ #define dscanf trio_dscanf
207
+ #define vdscanf trio_vdscanf
208
+ #endif
209
+
210
+ #ifdef __cplusplus
211
+ } /* extern "C" */
212
+ #endif
213
+
214
+ #endif /* WITHOUT_TRIO */
215
+
216
+ #endif /* TRIO_TRIO_H */
@@ -0,0 +1,220 @@
1
+ /*************************************************************************
2
+ *
3
+ * $Id$
4
+ *
5
+ * Copyright (C) 2001 Bjorn Reese <breese@users.sourceforge.net>
6
+ *
7
+ * Permission to use, copy, modify, and distribute this software for any
8
+ * purpose with or without fee is hereby granted, provided that the above
9
+ * copyright notice and this permission notice appear in all copies.
10
+ *
11
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
12
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
13
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
14
+ * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
15
+ *
16
+ ************************************************************************/
17
+
18
+ #ifndef TRIO_TRIODEF_H
19
+ #define TRIO_TRIODEF_H
20
+
21
+ /*************************************************************************
22
+ * Platform and compiler support detection
23
+ */
24
+ #if defined(__GNUC__)
25
+ # define TRIO_COMPILER_GCC
26
+ #elif defined(__SUNPRO_C)
27
+ # define TRIO_COMPILER_SUNPRO
28
+ #elif defined(__SUNPRO_CC)
29
+ # define TRIO_COMPILER_SUNPRO
30
+ # define __SUNPRO_C __SUNPRO_CC
31
+ #elif defined(__xlC__) || defined(__IBMC__) || defined(__IBMCPP__)
32
+ # define TRIO_COMPILER_XLC
33
+ #elif defined(_AIX) && !defined(__GNUC__)
34
+ # define TRIO_COMPILER_XLC /* Workaround for old xlc */
35
+ #elif defined(__DECC) || defined(__DECCXX)
36
+ # define TRIO_COMPILER_DECC
37
+ #elif defined(__osf__) && defined(__LANGUAGE_C__)
38
+ # define TRIO_COMPILER_DECC /* Workaround for old DEC C compilers */
39
+ #elif defined(_MSC_VER)
40
+ # define TRIO_COMPILER_MSVC
41
+ #elif defined(__BORLANDC__)
42
+ # define TRIO_COMPILER_BCB
43
+ #endif
44
+
45
+ #if defined(VMS) || defined(__VMS)
46
+ /*
47
+ * VMS is placed first to avoid identifying the platform as Unix
48
+ * based on the DECC compiler later on.
49
+ */
50
+ # define TRIO_PLATFORM_VMS
51
+ #elif defined(unix) || defined(__unix) || defined(__unix__)
52
+ # define TRIO_PLATFORM_UNIX
53
+ #elif defined(TRIO_COMPILER_XLC) || defined(_AIX)
54
+ # define TRIO_PLATFORM_UNIX
55
+ #elif defined(TRIO_COMPILER_DECC) || defined(__osf___)
56
+ # define TRIO_PLATFORM_UNIX
57
+ #elif defined(__NetBSD__)
58
+ # define TRIO_PLATFORM_UNIX
59
+ #elif defined(__QNX__)
60
+ # define TRIO_PLATFORM_UNIX
61
+ # define TRIO_PLATFORM_QNX
62
+ #elif defined(__CYGWIN__)
63
+ # define TRIO_PLATFORM_UNIX
64
+ #elif defined(AMIGA) && defined(TRIO_COMPILER_GCC)
65
+ # define TRIO_PLATFORM_UNIX
66
+ #elif defined(TRIO_COMPILER_MSVC) || defined(WIN32) || defined(_WIN32)
67
+ # define TRIO_PLATFORM_WIN32
68
+ #elif defined(mpeix) || defined(__mpexl)
69
+ # define TRIO_PLATFORM_MPEIX
70
+ #endif
71
+
72
+ #if defined(_AIX)
73
+ # define TRIO_PLATFORM_AIX
74
+ #elif defined(__hpux)
75
+ # define TRIO_PLATFORM_HPUX
76
+ #elif defined(sun) || defined(__sun__)
77
+ # if defined(__SVR4) || defined(__svr4__)
78
+ # define TRIO_PLATFORM_SOLARIS
79
+ # else
80
+ # define TRIO_PLATFORM_SUNOS
81
+ # endif
82
+ #endif
83
+
84
+ #if defined(__STDC__) || defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB)
85
+ # define TRIO_COMPILER_SUPPORTS_C89
86
+ # if defined(__STDC_VERSION__)
87
+ # define TRIO_COMPILER_SUPPORTS_C90
88
+ # if (__STDC_VERSION__ >= 199409L)
89
+ # define TRIO_COMPILER_SUPPORTS_C94
90
+ # endif
91
+ # if (__STDC_VERSION__ >= 199901L)
92
+ # define TRIO_COMPILER_SUPPORTS_C99
93
+ # endif
94
+ # elif defined(TRIO_COMPILER_SUNPRO)
95
+ # if (__SUNPRO_C >= 0x420)
96
+ # define TRIO_COMPILER_SUPPORTS_C94
97
+ # endif
98
+ # endif
99
+ #endif
100
+
101
+ #if defined(_XOPEN_SOURCE)
102
+ # if defined(_XOPEN_SOURCE_EXTENDED)
103
+ # define TRIO_COMPILER_SUPPORTS_UNIX95
104
+ # endif
105
+ # if (_XOPEN_VERSION >= 500)
106
+ # define TRIO_COMPILER_SUPPORTS_UNIX98
107
+ # endif
108
+ # if (_XOPEN_VERSION >= 600)
109
+ # define TRIO_COMPILER_SUPPORTS_UNIX01
110
+ # endif
111
+ #endif
112
+
113
+ /*************************************************************************
114
+ * Generic defines
115
+ */
116
+
117
+ #if !defined(TRIO_PUBLIC)
118
+ # define TRIO_PUBLIC
119
+ #endif
120
+ #if !defined(TRIO_PRIVATE)
121
+ # define TRIO_PRIVATE static
122
+ #endif
123
+
124
+ #if !(defined(TRIO_COMPILER_SUPPORTS_C89) || defined(__cplusplus))
125
+ # define TRIO_COMPILER_ANCIENT
126
+ #endif
127
+
128
+ #if defined(TRIO_COMPILER_ANCIENT)
129
+ # define TRIO_CONST
130
+ # define TRIO_VOLATILE
131
+ # define TRIO_SIGNED
132
+ typedef double trio_long_double_t;
133
+ typedef char * trio_pointer_t;
134
+ # define TRIO_SUFFIX_LONG(x) x
135
+ # define TRIO_PROTO(x) ()
136
+ # define TRIO_NOARGS
137
+ # define TRIO_ARGS1(list,a1) list a1;
138
+ # define TRIO_ARGS2(list,a1,a2) list a1; a2;
139
+ # define TRIO_ARGS3(list,a1,a2,a3) list a1; a2; a3;
140
+ # define TRIO_ARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4;
141
+ # define TRIO_ARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5;
142
+ # define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) list a1; a2; a3; a4; a5; a6;
143
+ # define TRIO_VARGS2(list,a1,a2) list a1; a2
144
+ # define TRIO_VARGS3(list,a1,a2,a3) list a1; a2; a3
145
+ # define TRIO_VARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4
146
+ # define TRIO_VARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5
147
+ # define TRIO_VA_DECL va_dcl
148
+ # define TRIO_VA_START(x,y) va_start(x)
149
+ # define TRIO_VA_END(x) va_end(x)
150
+ #else /* ANSI C */
151
+ # define TRIO_CONST const
152
+ # define TRIO_VOLATILE volatile
153
+ # define TRIO_SIGNED signed
154
+ typedef long double trio_long_double_t;
155
+ typedef void * trio_pointer_t;
156
+ # define TRIO_SUFFIX_LONG(x) x ## L
157
+ # define TRIO_PROTO(x) x
158
+ # define TRIO_NOARGS void
159
+ # define TRIO_ARGS1(list,a1) (a1)
160
+ # define TRIO_ARGS2(list,a1,a2) (a1,a2)
161
+ # define TRIO_ARGS3(list,a1,a2,a3) (a1,a2,a3)
162
+ # define TRIO_ARGS4(list,a1,a2,a3,a4) (a1,a2,a3,a4)
163
+ # define TRIO_ARGS5(list,a1,a2,a3,a4,a5) (a1,a2,a3,a4,a5)
164
+ # define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) (a1,a2,a3,a4,a5,a6)
165
+ # define TRIO_VARGS2 TRIO_ARGS2
166
+ # define TRIO_VARGS3 TRIO_ARGS3
167
+ # define TRIO_VARGS4 TRIO_ARGS4
168
+ # define TRIO_VARGS5 TRIO_ARGS5
169
+ # define TRIO_VA_DECL ...
170
+ # define TRIO_VA_START(x,y) va_start(x,y)
171
+ # define TRIO_VA_END(x) va_end(x)
172
+ #endif
173
+
174
+ #if defined(TRIO_COMPILER_SUPPORTS_C99) || defined(__cplusplus)
175
+ # define TRIO_INLINE inline
176
+ #elif defined(TRIO_COMPILER_GCC)
177
+ # define TRIO_INLINE __inline__
178
+ #elif defined(TRIO_COMPILER_MSVC)
179
+ # define TRIO_INLINE _inline
180
+ #elif defined(TRIO_COMPILER_BCB)
181
+ # define TRIO_INLINE __inline
182
+ #else
183
+ # define TRIO_INLINE
184
+ #endif
185
+
186
+ /*************************************************************************
187
+ * Workarounds
188
+ */
189
+
190
+ #if defined(TRIO_PLATFORM_VMS)
191
+ /*
192
+ * Computations done with constants at compile time can trigger these
193
+ * even when compiling with IEEE enabled.
194
+ */
195
+ # pragma message disable (UNDERFLOW, FLOATOVERFL)
196
+
197
+ # if (__CRTL_VER < 80000000)
198
+ /*
199
+ * Although the compiler supports C99 language constructs, the C
200
+ * run-time library does not contain all C99 functions.
201
+ *
202
+ * This was the case for 70300022. Update the 80000000 value when
203
+ * it has been accurately determined what version of the library
204
+ * supports C99.
205
+ */
206
+ # if defined(TRIO_COMPILER_SUPPORTS_C99)
207
+ # undef TRIO_COMPILER_SUPPORTS_C99
208
+ # endif
209
+ # endif
210
+ #endif
211
+
212
+ /*
213
+ * Not all preprocessors supports the LL token.
214
+ */
215
+ #if defined(TRIO_COMPILER_BCB)
216
+ #else
217
+ # define TRIO_COMPILER_SUPPORTS_LL
218
+ #endif
219
+
220
+ #endif /* TRIO_TRIODEF_H */