Skip to content

Commit 93f493e

Browse files
author
giraffedata
committed
rebase advanced branch to current trunk - Release 1.22.00
git-svn-id: https://xmlrpc-c.svn.sourceforge.net/svnroot/xmlrpc-c/advanced@1901 adbb7d4b-a73a-0410-a071-c5f57c452bd4
1 parent 6866ac6 commit 93f493e

30 files changed

+1973
-223
lines changed

GNUmakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ version.h: $(SRCDIR)/version.mk
8383
echo "#define XMLRPC_VERSION_MINOR $(MINOR)" >>$@
8484
echo "#define XMLRPC_VERSION_POINT $(POINT)" >>$@
8585

86-
include transport_config.make
86+
include transport_config.mk
8787

8888
# shell_config is a fragment to place inside a Bourne shell program that
8989
# sets variables that tell how the build is configured.

Windows/xmlrpc_win32_config.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,20 @@
180180
*/
181181
#pragma warning(disable:4996)
182182
#endif
183+
/* Warning C4090 is "different 'const' qualifiers".
184+
185+
We disable this warning because MSVC erroneously issues it when there is
186+
in fact no difference in const qualifiers:
187+
188+
const char ** p;
189+
void * q;
190+
q = p;
191+
192+
Note that both p and q are pointers to non-const.
193+
194+
We have seen this in MSVC 7.1, 8, and 9 (but not 6).
195+
*/
196+
#pragma warning(disable:4090)
183197

184198
#if HAVE_STRTOLL
185199
# define XMLRPC_STRTOLL strtoll

common.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,19 @@ $(TARGET_STATIC_LIBRARIES):
9898
##############################################################################
9999

100100
ifeq ($(SHARED_LIB_TYPE),unix)
101-
include $(SRCDIR)/unix-common.make
101+
include $(SRCDIR)/unix-common.mk
102102
endif
103103

104104
ifeq ($(SHARED_LIB_TYPE),irix)
105-
include $(SRCDIR)/irix-common.make
105+
include $(SRCDIR)/irix-common.mk
106106
endif
107107

108108
ifeq ($(SHARED_LIB_TYPE),dll)
109-
include $(SRCDIR)/dll-common.make
109+
include $(SRCDIR)/dll-common.mk
110110
endif
111111

112112
ifeq ($(SHARED_LIB_TYPE),dylib)
113-
include $(SRCDIR)/dylib-common.make
113+
include $(SRCDIR)/dylib-common.mk
114114
endif
115115

116116
ifeq ($(SHARED_LIB_TYPE),NONE)

config.mk.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,12 @@ endif
326326
##############################################################################
327327

328328
# BUILDTOOL_CC is the compiler to use to generate build tools, which we
329-
# will then run to build product. The typical reason this would be
329+
# will then run to build the product. The typical reason this would be
330330
# different from CC is that you're cross-compiling: the product will run
331331
# in Environment A, but you're building in Environment B, so you must
332-
# build the build toos for Environment B.
332+
# build the build tools for Environment B.
333333

334-
# The cross compiling user can update Makefile.config or override
334+
# The cross compiling user can update config.mk or override
335335
# BUILDTOOL_CC on a make command.
336336

337337
BUILDTOOL_CC = $(CC)

dll-common.make renamed to dll-common.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*-makefile-*- <-- an Emacs control
22

3-
# See unix-common.make for an explanation of this file. This file is
4-
# analogous to unix-common.make, but is for a Windows system
3+
# See unix-common.mk for an explanation of this file. This file is
4+
# analogous to unix-common.mk, but is for a Windows system
55

66
SONAME = $@
77
IMPLIB = $(@:%:%.dll.a)

doc/INSTALL

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,44 @@ you have to have a -f option and set SRCDIR and BLDDIR on your 'make'
8282
command.
8383

8484

85+
CROSS-COMPILING
86+
---------------
87+
88+
Cross compiling is building code on one machine to be run on another,
89+
particularly when the two machines are different enough that it matters,
90+
e.g. one executes x86 instructions and the other executes PowerPC
91+
instructions.
92+
93+
The machine that will run the code is called the target machine. The one
94+
that will build the code is the build machine.
95+
96+
To cross-compile, you set up nearly all of the build environment for the
97+
target machine (that includes such things as the default include file search
98+
path for the compiler and library search path for the linker). On your
99+
'configure' command, you use a --host option to identify the kind of target
100+
machine (rather than let it default to the kind of machine on which
101+
'configure' is running). It's a nontrivial task, and beyond the scope of
102+
this document as it is not specific to Xmlrpc-c.
103+
104+
There is one area that requires special attention and is specific to Xmlrpc-c:
105+
The Xmlrpc-c build does part of its job by compiling a program from C source
106+
code and running that program as part of the build. That compile, unlike all
107+
the regular ones, must be done for the build machine, not the target
108+
machine.
109+
110+
To facilitate that, there are the BUILDTOOL_CC and BUILDTOOL_CCLD make
111+
variables. BUILDTOOL_CC is the command name for the appropriate compiler
112+
which which to build a build tool, i.e. a compiler that generates code to run
113+
on the build system. BUILDTOOL_CCLD is similarly for the linker, and should
114+
be the kind of linker command that invokes a combined compiler/linker,
115+
e.g. "gcc" instead of "ld".
116+
117+
You can set these make variables on the Make command line, or if you prefer,
118+
by modifying the file 'config.mk' after 'configure' creates it. The default
119+
value of these variables (as set in 'config.mk') is the same compile and link
120+
commands as for building target code.
121+
122+
85123
COMMON PROBLEMS
86124
---------------
87125

dylib-common.make renamed to dylib-common.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*-makefile-*- <-- an Emacs control
22

3-
# See unix-common.make for an explanation of this file. This file is
4-
# analogous to unix-common.make, but is for an Irix system.
3+
# See unix-common.mk for an explanation of this file. This file is
4+
# analogous to unix-common.mk, but is for an Irix system.
55

66
SONAME = $(@:%.$(MIN)=%)
77

examples/Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,19 @@ SERVERPROGS_ABYSS = \
4444
xmlrpc_sample_add_server \
4545
xmlrpc_server_validatee \
4646

47+
BASIC_PROGS = \
48+
json \
49+
gen_sample_add_xml \
50+
4751
# Build up PROGS:
4852
PROGS =
4953

54+
PROGS += $(BASIC_PROGS)
55+
5056
ifeq ($(ENABLE_ABYSS_SERVER),yes)
5157
PROGS += $(SERVERPROGS_ABYSS)
5258
endif
5359

54-
PROGS += gen_sample_add_xml
55-
5660
ifeq ($(MUST_BUILD_CLIENT),yes)
5761
PROGS += $(CLIENTPROGS)
5862
endif
@@ -98,9 +102,10 @@ $(SERVERPROGS_CGI):%.cgi:%_cgi.o
98102
$(SERVERPROGS_ABYSS):%:%.o
99103
$(CCLD) -o $@ $^ $(LIBS_SERVER_ABYSS) $(LDFLAGS)
100104

101-
gen_sample_add_xml:%:%.o
105+
$(BASIC_PROGS):%:%.o
102106
$(CCLD) -o $@ $^ $(LIBS_BASE) $(LDFLAGS)
103107

108+
104109
OBJECTS = $(patsubst %,%.o,$(patsubst %.cgi,%_cgi,$(PROGS)))
105110

106111
$(OBJECTS):%.o:%.c

examples/json.c

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/*
2+
This example program demonstrates the JSON parsing and generating
3+
capabilities of Xmlrpc-c.
4+
5+
The program reads JSON text from Standard Input and displays its value as
6+
XML-RPC XML text. It then re-generates JSON from the intermediate
7+
parsed information and displays that.
8+
*/
9+
#include <stdio.h>
10+
11+
#include <xmlrpc-c/json.h>
12+
13+
14+
15+
static void
16+
dieIfFaultOccurred(xmlrpc_env * const envP) {
17+
if (envP->fault_occurred) {
18+
fprintf(stderr, "ERROR: %s (%d)\n",
19+
envP->fault_string, envP->fault_code);
20+
exit(1);
21+
}
22+
}
23+
24+
25+
26+
void
27+
printAsXml(xmlrpc_value * const valP) {
28+
29+
xmlrpc_env env;
30+
xmlrpc_mem_block out;
31+
32+
xmlrpc_env_init(&env);
33+
34+
XMLRPC_MEMBLOCK_INIT(char, &env, &out, 0);
35+
36+
dieIfFaultOccurred(&env);
37+
38+
xmlrpc_serialize_value(&env, &out, valP);
39+
40+
printf("XML-RPC XML:\n");
41+
42+
printf("%s\n", XMLRPC_MEMBLOCK_CONTENTS(char, &out));
43+
44+
XMLRPC_MEMBLOCK_CLEAN(char, &out);
45+
xmlrpc_env_clean(&env);
46+
}
47+
48+
49+
50+
void
51+
printAsJson(xmlrpc_value * const valP) {
52+
53+
xmlrpc_env env;
54+
xmlrpc_mem_block out;
55+
xmlrpc_value * val2P;
56+
57+
xmlrpc_env_init(&env);
58+
59+
XMLRPC_MEMBLOCK_INIT(char, &env, &out, 0);
60+
61+
dieIfFaultOccurred(&env);
62+
63+
xmlrpc_serialize_json(&env, valP, &out);
64+
65+
dieIfFaultOccurred(&env);
66+
67+
printf("JSON:\n");
68+
69+
printf("%s\n", XMLRPC_MEMBLOCK_CONTENTS(char, &out));
70+
71+
XMLRPC_MEMBLOCK_CLEAN(char, &out);
72+
xmlrpc_env_clean(&env);
73+
}
74+
75+
76+
77+
int
78+
main(int argc, const char *argv[]) {
79+
80+
xmlrpc_env env;
81+
char buf[1024];
82+
xmlrpc_value * valP;
83+
size_t bytesRead;
84+
85+
xmlrpc_env_init(&env);
86+
87+
if (argc-1 > 0) {
88+
fprintf(stderr, "This program has no arguments. "
89+
"JSON input is from Standard Input\n");
90+
exit(1);
91+
}
92+
93+
bytesRead = fread(buf, 1, sizeof(buf), stdin);
94+
buf[bytesRead] = '\0';
95+
96+
valP = xmlrpc_parse_json(&env, buf);
97+
98+
dieIfFaultOccurred(&env);
99+
100+
printAsXml(valP);
101+
102+
printAsJson(valP);
103+
104+
xmlrpc_DECREF(valP);
105+
xmlrpc_env_clean(&env);
106+
107+
return 0;
108+
}
109+
110+

examples/xmlrpc_loop_server.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* A simple standalone XML-RPC server based on Abyss that contains a
22
simple one-thread request processing loop.
33
4+
This uses the "provide your own Abyss server" mode of operation.
5+
46
xmlrpc_sample_add_server.c is a server that does the same thing, but
57
does it by running a full Abyss daemon in the background, so it has
68
less control over how the requests are served.

examples/xmlrpc_sample_add_client.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
#define VERSION "1.0"
1717

1818
static void
19-
die_if_fault_occurred (xmlrpc_env * const envP) {
19+
dieIfFaultOccurred (xmlrpc_env * const envP) {
2020
if (envP->fault_occurred) {
21-
fprintf(stderr, "XML-RPC Fault: %s (%d)\n",
21+
fprintf(stderr, "ERROR: %s (%d)\n",
2222
envP->fault_string, envP->fault_code);
2323
exit(1);
2424
}
@@ -46,7 +46,7 @@ main(int const argc,
4646

4747
/* Start up our XML-RPC client library. */
4848
xmlrpc_client_init2(&env, XMLRPC_CLIENT_NO_FLAGS, NAME, VERSION, NULL, 0);
49-
die_if_fault_occurred(&env);
49+
dieIfFaultOccurred(&env);
5050

5151
printf("Making XMLRPC call to server url '%s' method '%s' "
5252
"to request the sum "
@@ -55,11 +55,11 @@ main(int const argc,
5555
/* Make the remote procedure call */
5656
resultP = xmlrpc_client_call(&env, serverUrl, methodName,
5757
"(ii)", (xmlrpc_int32) 5, (xmlrpc_int32) 7);
58-
die_if_fault_occurred(&env);
58+
dieIfFaultOccurred(&env);
5959

6060
/* Get our sum and print it out. */
6161
xmlrpc_read_int(&env, resultP, &sum);
62-
die_if_fault_occurred(&env);
62+
dieIfFaultOccurred(&env);
6363
printf("The sum is %d\n", sum);
6464

6565
/* Dispose of our result value. */

0 commit comments

Comments
 (0)