fixed makefile ommission
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 6 Sep 2005 15:24:48 +0000 (15:24 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 6 Sep 2005 15:24:48 +0000 (15:24 +0000)
updated the JSON api stuff in json_xml.c
added json_xml.o to the build target

git-svn-id: svn://svn.open-ils.org/ILS/trunk@1799 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/apachemods/Makefile
Open-ILS/src/apachemods/json_xml.c
Open-ILS/src/apachemods/mod_xmltools.c
OpenSRF/src/gateway/Makefile

index 5e1b9cc..380f6aa 100644 (file)
@@ -28,9 +28,9 @@ libfieldmapper.so:    fieldmapper_lookup.o
        echo $@
        $(CC) $(LDFLAGS) $(LDLIBS) -shared -W1 fieldmapper_lookup.o -o $@
 
-mod_ils_rest_gateway.so:       libfieldmapper.so ils_rest_gateway.o
+mod_ils_rest_gateway.so:       libfieldmapper.so ils_rest_gateway.o json_xml.o
        echo $@
-       $(CC) $(LDFLAGS) $(LDLIBS) -shared -W1 ils_rest_gateway.o -lfieldmapper -o $@
+       $(CC) $(LDFLAGS) $(LDLIBS) -shared -W1 json_xml.o ils_rest_gateway.o -lfieldmapper -o $@
 
 # ------------------------------------------------------
 
@@ -43,7 +43,7 @@ libfieldmapper-install:       libfieldmapper.so
 
 
 mod_ils_rest_gateway-install:
-       $(APXS2) -i -a -n mod_ils_rest_gateway mod_ils_rest_gateway.so
+       $(APXS2) -i -a -n ils_rest_gateway mod_ils_rest_gateway.so
        echo "-----------------------------------------------";
        echo -e "* Important * : Change httpd.conf from this: \n \
                LoadModule mod_ils_rest_gateway_module modules/mod_ils_rest_gateway.so \n \
index e34f89f..0cd42a4 100644 (file)
@@ -1,11 +1,11 @@
 #include "json_xml.h"
 #include "fieldmapper_lookup.h"
 
-void _rest_xml_output(growing_buffer*, object*, char*, int, int);
+void _rest_xml_output(growing_buffer*, jsonObject*, char*, int, int);
 char* _escape_xml (char*);
 
 char* json_string_to_xml(char* content) {
-       object * obj;
+       jsonObject * obj;
        growing_buffer * res_xml;
        char * output;
        int i;
@@ -18,9 +18,9 @@ char* json_string_to_xml(char* content) {
        
        buffer_add(res_xml, "<response>");
 
-       if(obj->is_array) {
+       if(obj->type == JSON_ARRAY ) {
                for( i = 0; i!= obj->size; i++ ) {
-                       _rest_xml_output(res_xml, obj->get_index(obj,i), NULL, 0,0);
+                       _rest_xml_output(res_xml, jsonObjectGetIndex(obj,i), NULL, 0,0);
                }
        } else {
                _rest_xml_output(res_xml, obj, NULL, 0,0);
@@ -30,7 +30,7 @@ char* json_string_to_xml(char* content) {
 
        output = buffer_data(res_xml);
        buffer_free(res_xml);
-       free_object(obj);
+       jsonObjectFree(obj);
 
        return output;
 }
@@ -55,7 +55,7 @@ char* _escape_xml (char* text) {
        return out;
 }
 
-void _rest_xml_output(growing_buffer* buf, object* obj, char * obj_class, int arr_index, int notag) {
+void _rest_xml_output(growing_buffer* buf, jsonObject* obj, char * obj_class, int arr_index, int notag) {
        char * tag;
        int i;
        
@@ -75,7 +75,7 @@ void _rest_xml_output(growing_buffer* buf, object* obj, char * obj_class, int ar
         
    /* add class hints if we have a class name */
    if(obj->classname) {
-       if(obj->is_null) {
+       if(obj->type == JSON_NULL) {
                        buffer_fadd(buf,"<%s><Object class_hint=\\\"%s\\\"/></%s>", tag, obj->classname, tag);
                        return;
                } else {
@@ -85,48 +85,40 @@ void _rest_xml_output(growing_buffer* buf, object* obj, char * obj_class, int ar
 
 
        /* now add the data */
-       if(obj->is_null) {
+       if(obj->type == JSON_NULL) {
                if (!notag)
                        buffer_fadd(buf, "<%s/>",tag);
-       } else if(obj->is_bool && obj->bool_value) {
+       } else if(obj->type == JSON_BOOL && obj->value.b) {
                if (notag)
                        buffer_add(buf, "true");
                else
                        buffer_fadd(buf, "<%s>true</%s>",tag,tag);
                 
-       } else if(obj->is_bool && ! obj->bool_value) {
+       } else if(obj->type == JSON_BOOL && ! obj->value.b) {
                if (notag)
                        buffer_add(buf, "false");
                else
                        buffer_fadd(buf, "<%s>false</%s>",tag,tag);
 
-       } else if (obj->is_string) {
+       } else if (obj->type == JSON_STRING) {
                if (notag) {
-                       char * t = _escape_xml(obj->string_data);
+                       char * t = _escape_xml(jsonObjectGetString(obj));
                        buffer_add(buf,t);
                        free(t);
                } else {
-                       char * t = _escape_xml(obj->string_data);
+                       char * t = _escape_xml(jsonObjectGetString(obj));
                        buffer_fadd(buf,"<%s>%s</%s>",tag,t,tag);
                        free(t);
                }
 
-       } else if(obj->is_number) {
-
-               if (notag)
-                       buffer_fadd(buf,"%ld",obj->num_value);
-               else
-                       buffer_fadd(buf,"<%s>%ld</%s>",tag,obj->num_value,tag);
-
-
-       } else if(obj->is_double) {
+       } else if(obj->type == JSON_NUMBER) {
                if (notag)
-                       buffer_fadd(buf,"%lf",tag,obj->double_value,tag);
+                       buffer_fadd(buf,"%lf",tag, jsonObjectGetNumber(obj),tag);
                else
-                       buffer_fadd(buf,"<%s>%lf</%s>",tag,obj->double_value,tag);
+                       buffer_fadd(buf,"<%s>%lf</%s>",tag, jsonObjectGetNumber(obj),tag);
 
 
-       } else if (obj->is_array) {
+       } else if (obj->type == JSON_ARRAY) {
                if (!notag) {
                        if(!isFieldmapper(obj_class))
                                buffer_add(buf,"<array>");
@@ -135,7 +127,7 @@ void _rest_xml_output(growing_buffer* buf, object* obj, char * obj_class, int ar
                }
 
                for( i = 0; i!= obj->size; i++ ) {
-                       _rest_xml_output(buf, obj->get_index(obj,i), obj->classname, i,0);
+                       _rest_xml_output(buf, jsonObjectGetIndex(obj,i), obj->classname, i,0);
                }
 
                if (!notag) {
@@ -145,7 +137,7 @@ void _rest_xml_output(growing_buffer* buf, object* obj, char * obj_class, int ar
                                        buffer_fadd(buf,"</%s>",tag);
                }
 
-        } else if (obj->is_hash) {
+        } else if (obj->type == JSON_HASH) {
 
                if (!notag) {
                        if(!obj_class)
@@ -154,9 +146,9 @@ void _rest_xml_output(growing_buffer* buf, object* obj, char * obj_class, int ar
                                        buffer_fadd(buf,"<%s>",tag);
                }
 
-                object_iterator* itr = new_iterator(obj);
-                object_node* tmp;
-                while( (tmp = itr->next(itr)) ) {
+                jsonObjectIterator* itr = jsonNewObjectIterator(obj);
+                jsonObjectNode* tmp;
+                while( (tmp = jsonObjectIteratorNext(itr)) ) {
                        if (notag) {
                                buffer_fadd(buf,"<%s>",tmp->key);
                        } else {
@@ -172,7 +164,7 @@ void _rest_xml_output(growing_buffer* buf, object* obj, char * obj_class, int ar
                                buffer_add(buf,"</value></pair>");
                        }
                 }
-                free_iterator(itr);
+                jsonObjectIteratorFree(itr);
 
                if (!notag) {
                        if(!obj_class)
index fee76e5..0eaa324 100644 (file)
@@ -77,7 +77,7 @@ static int mod_xmltools_handler (request_rec* r) {
        r->allowed |= (AP_METHOD_BIT << M_GET);
        r->allowed |= (AP_METHOD_BIT << M_POST);
 
-       ap_set_content_type(r, "text/html");
+       ap_set_content_type(r, "text/html; charset=utf-8");
 
        string_array* params = apacheParseParms(r);
 
index 10d0b3e..96b5eed 100644 (file)
@@ -1,13 +1,13 @@
 CCFLAGS        += -DASSUME_STATELESS
 LDLIBS += -lobjson -lxml2 -lopensrf
 
-all: libmod_ils_gateway.so
+all: mod_ils_gateway.so
 
 install: 
-       $(APXS2) -i -a -n ils_gateway libmod_ils_gateway.so
+       $(APXS2) -i -a -n ils_gateway mod_ils_gateway.so
 
-libmod_ils_gateway.so: mod_ils_gateway.o
-       $(CC) -shared -W1 mod_ils_gateway.o -o libmod_ils_gateway.so
+mod_ils_gateway.so:    mod_ils_gateway.o
+       $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -shared -W1 mod_ils_gateway.o -o mod_ils_gateway.so
 
 mod_ils_gateway.o: mod_ils_gateway.h mod_ils_gateway.c