[open-ils-commits] r9441 - in trunk/Open-ILS/src: . apachemods
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Apr 23 11:53:08 EDT 2008
Author: erickson
Date: 2008-04-23 11:13:45 -0400 (Wed, 23 Apr 2008)
New Revision: 9441
Removed:
trunk/Open-ILS/src/apachemods/fieldmapper_lookup-gen.pl
trunk/Open-ILS/src/apachemods/fieldmapper_lookup.h
trunk/Open-ILS/src/apachemods/json_xml.c
trunk/Open-ILS/src/apachemods/json_xml.h
trunk/Open-ILS/src/apachemods/mod_xmlbuilder.h
Modified:
trunk/Open-ILS/src/Makefile
trunk/Open-ILS/src/apachemods/Makefile
Log:
Removing dead code and their makefile counterparts
Modified: trunk/Open-ILS/src/Makefile
===================================================================
--- trunk/Open-ILS/src/Makefile 2008-04-23 12:23:10 UTC (rev 9440)
+++ trunk/Open-ILS/src/Makefile 2008-04-23 15:13:45 UTC (rev 9441)
@@ -36,14 +36,6 @@
@echo $@
make -C apachemods mod_xmlent.so
-oils_cgi:
- @echo $@
- make -C apachemods oils_cgi.so
-
-oils_cgi-install:
- @echo $@
- make -C apachemods oils_cgi-install
-
mod_xmlent-install:
@echo $@
make -C apachemods mod_xmlent-install
@@ -91,12 +83,6 @@
mkdir -p $(WEBDIR)/opac/extras/slimpac/
-libfieldmapper:
- make -C apachemods libfieldmapper.so
-
-libfieldmapper-install:
- make -C apachemods libfieldmapper-install
-
c_apps:
@echo $@
make -C c-apps
Modified: trunk/Open-ILS/src/apachemods/Makefile
===================================================================
--- trunk/Open-ILS/src/apachemods/Makefile 2008-04-23 12:23:10 UTC (rev 9440)
+++ trunk/Open-ILS/src/apachemods/Makefile 2008-04-23 15:13:45 UTC (rev 9441)
@@ -1,49 +1,14 @@
-
LDLIBS += -lxml2 -lopensrf -lxslt
-all: mod_xmlent.so libfieldmapper.so
+all: mod_xmlent.so
-install: libfieldmapper-install mod_xmlent-install
+install: mod_xmlent-install
-
-apachetools.o:
- cp ../../../OpenSRF/src/gateway/apachetools.o .
-
-json_xml.o: json_xml.c json_xml.h
-
-fieldmapper_lookup.o: fieldmapper_lookup.c fieldmapper_lookup.h
-
-
-fieldmapper_lookup.c:
- ./fieldmapper_lookup-gen.pl fieldmapper_lookup.c
-
-
mod_xmlent.o: mod_xmlent.c
mod_xmlent.so: mod_xmlent.o
@echo $@
$(CC) $(LDFLAGS) $(LDLIBS) -shared -W1 mod_xmlent.o -lexpat -o $@
-
-# ------------------------------------------------------
-
-libfieldmapper.so: fieldmapper_lookup.o
- @echo $@
- mkdir -p $(TMPDIR)/openils/
- cp fieldmapper_lookup.h $(TMPDIR)/openils/
- $(CC) $(LDFLAGS) $(LDLIBS) -shared -W1 fieldmapper_lookup.o -o $@
- cp libfieldmapper.so $(TMPDIR)/libfieldmapper.so
-
-# ------------------------------------------------------
-
-
-libfieldmapper-install: libfieldmapper.so
- echo installing libfieldmapper.so
- mkdir -p $(INCDIR)/
- @echo "Copying fieldmapper_lookup.h to $(INCDIR)"
- cp fieldmapper_lookup.h $(INCDIR)/
- cp libfieldmapper.so $(LIBDIR)/libfieldmapper.so
-
-
mod_xmlent-install:
$(APXS2) -i -a -n xmlent mod_xmlent.so
@@ -51,6 +16,3 @@
clean:
echo $@
/bin/rm -f *.o *.so
- /bin/rm -f fieldmapper_lookup.c
-
-
Deleted: trunk/Open-ILS/src/apachemods/fieldmapper_lookup-gen.pl
===================================================================
--- trunk/Open-ILS/src/apachemods/fieldmapper_lookup-gen.pl 2008-04-23 12:23:10 UTC (rev 9440)
+++ trunk/Open-ILS/src/apachemods/fieldmapper_lookup-gen.pl 2008-04-23 15:13:45 UTC (rev 9441)
@@ -1,106 +0,0 @@
-#!/usr/bin/perl
-use strict;
-use lib qw(../perlmods/OpenILS/Utils/ ../../../OpenSRF/src/perlmods);
-
-use Fieldmapper (IDL => '../../examples/fm_IDL.xml');
-
-my $map = {};
-$map = $Fieldmapper::fieldmap unless ($@);
-
-die $@ if ($@);
-
-
-if(!$ARGV[0]) {
- print "usage: $0 <source_file>\n";
- exit;
-}
-
-warn "Generating fieldmapper-c code...\n";
-
-
-print $ARGV[0] . "\n";
-
-open(SOURCE, ">$ARGV[0]");
-
-print SOURCE <<C;
-#include "fieldmapper_lookup.h"
-
-
-char * fm_pton(char * class, int pos) {
- if (class == NULL) return NULL;
-C
-
-
-for my $object (keys %$map) {
- my $short_name= $map->{$object}->{hint};
- print SOURCE <<" C";
- else if (!strcmp(class, "$short_name")) {
- switch (pos) {
- C
- for my $field (keys %{$map->{$object}->{fields}}) {
- my $position = $map->{$object}->{fields}->{$field}->{position};
- print SOURCE <<" C";
- case $position:
- return strdup("$field");
- break;
- C
- }
- print SOURCE " }\n";
- print SOURCE " }\n";
-}
-print SOURCE <<C;
- return NULL;
-}
-
-int isFieldmapper(char* class) {
- if (class == NULL) return 0;
-C
-
-for my $object (keys %$map) {
- my $short_name= $map->{$object}->{hint};
- print SOURCE " else if (!strcmp(class, \"$short_name\")) return 1;\n";
-}
-print SOURCE <<C;
- return 0;
-}
-
-int fm_ntop(char* class, char* field) {
- if (class == NULL) return -1;
-C
-
-
-for my $object (keys %$map) {
- my $short_name= $map->{$object}->{hint};
- print SOURCE " else if (!strcmp(class, \"$short_name\")) {\n";
- for my $field (keys %{$map->{$object}->{fields}}) {
- my $position = $map->{$object}->{fields}->{$field}->{position};
- print SOURCE " if (!strcmp(field,\"$field\")) return $position;\n";
- }
- print SOURCE " }\n"
-}
-
-print SOURCE " return -1;\n}\n";
-
-
-
-print SOURCE <<C;
-static osrfList* __fm_classes = NULL;
-osrfList* fm_classes() {
- if(__fm_classes) return __fm_classes;
- __fm_classes = osrfNewList();
-C
-
-for my $object (keys %$map) {
- my $short_name= $map->{$object}->{hint};
- $object =~ s/Fieldmapper:://o;
- $object =~ s/::/./og;
- print SOURCE "\tosrfListPush(__fm_classes, \"$short_name\");\n";
- print SOURCE "\tosrfListPush(__fm_classes, \"$object\");\n";
-}
-
-print SOURCE <<C;
- return __fm_classes;
-}
-C
-
-
Deleted: trunk/Open-ILS/src/apachemods/fieldmapper_lookup.h
===================================================================
--- trunk/Open-ILS/src/apachemods/fieldmapper_lookup.h 2008-04-23 12:23:10 UTC (rev 9440)
+++ trunk/Open-ILS/src/apachemods/fieldmapper_lookup.h 2008-04-23 15:13:45 UTC (rev 9441)
@@ -1,16 +0,0 @@
-
-#include <string.h>
-#include <stdio.h>
-#include "opensrf/osrf_list.h"
-#include "opensrf/osrf_hash.h"
-
-int isFieldmapper(char*);
-char * fm_pton(char *, int);
-int fm_ntop(char *, char *);
-
-/**
- * Returns a list of class names with the
- * form [ hint, apiname, hint, apiname, ...]
- * This list is static and should *not* be freed by the caller
- */
-osrfList* fm_classes();
Deleted: trunk/Open-ILS/src/apachemods/json_xml.c
===================================================================
--- trunk/Open-ILS/src/apachemods/json_xml.c 2008-04-23 12:23:10 UTC (rev 9440)
+++ trunk/Open-ILS/src/apachemods/json_xml.c 2008-04-23 15:13:45 UTC (rev 9441)
@@ -1,185 +0,0 @@
-#include "json_xml.h"
-#include "fieldmapper_lookup.h"
-
-static void _rest_xml_output(growing_buffer*, const jsonObject*, char*, int, int);
-static char* _escape_xml (const char*);
-
-char* json_string_to_xml(char* content) {
- jsonObject * obj;
- growing_buffer * res_xml;
- int i;
-
- obj = json_parse_string( content );
-
- if (!obj)
- return NULL;
-
- res_xml = buffer_init(1024);
- buffer_add(res_xml, "<response>");
-
- if(obj->type == JSON_ARRAY ) {
- for( i = 0; i!= obj->size; i++ ) {
- _rest_xml_output(res_xml, jsonObjectGetIndex(obj,i), NULL, 0,0);
- }
- } else {
- _rest_xml_output(res_xml, obj, NULL, 0,0);
- }
-
- buffer_add(res_xml, "</response>");
-
- jsonObjectFree(obj);
- return buffer_release(res_xml);
-}
-
-char* _escape_xml (const char* text) {
- growing_buffer* b = buffer_init(256);
- int len = strlen(text);
- int i;
- for (i = 0; i < len; i++) {
- if (text[i] == '&')
- buffer_add(b,"&");
- else if (text[i] == '<')
- buffer_add(b,"<");
- else if (text[i] == '>')
- buffer_add(b,">");
- else
- buffer_add_char(b,text[i]);
- }
- return buffer_release(b);
-}
-
-static void _rest_xml_output(growing_buffer* buf, const jsonObject* obj,
- char * obj_class, int arr_index, int notag) {
- char * tag;
- int i;
-
- if(!obj) return;
-
- if (obj->classname)
- notag = 1;
-
- if(isFieldmapper(obj_class)) {
- tag = fm_pton(obj_class,arr_index);
- } else if(obj_class) {
- tag = strdup(obj_class);
- } else {
- tag = strdup("datum");
- }
-
-
- /* add class hints if we have a class name */
- if(obj->classname) {
- if(obj->type == JSON_NULL) {
- buffer_fadd(buf,"<%s><Object class_hint=\"%s\"/></%s>", tag, obj->classname, tag);
- free(tag);
- return;
- } else {
- buffer_fadd(buf,"<%s><Object class_hint=\"%s\">", tag, obj->classname);
- }
- }
-
-
- /* now add the data */
- if(obj->type == JSON_NULL) {
- if (!notag)
- buffer_fadd(buf, "<%s/>",tag);
- } 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->type == JSON_BOOL && ! obj->value.b) {
- if (notag)
- buffer_add(buf, "false");
- else
- buffer_fadd(buf, "<%s>false</%s>",tag,tag);
-
- } else if (obj->type == JSON_STRING) {
- if (notag) {
- char * t = _escape_xml(jsonObjectGetString(obj));
- buffer_add(buf,t);
- free(t);
- } else {
- char * t = _escape_xml(jsonObjectGetString(obj));
- buffer_fadd(buf,"<%s>%s</%s>",tag,t,tag);
- free(t);
- }
-
- } else if(obj->type == JSON_NUMBER) {
- double x = jsonObjectGetNumber(obj);
- if (notag) {
- if (x == (int)x)
- buffer_fadd(buf,"%d",(int)x);
- else
- buffer_fadd(buf,"%f",x);
- } else {
- if (x == (int)x)
- buffer_fadd(buf,"<%s>%d</%s>",tag, (int)x,tag);
- else
- buffer_fadd(buf,"<%s>%f</%s>",tag, x,tag);
- }
-
- } else if (obj->type == JSON_ARRAY) {
- if (!notag) {
- if(!isFieldmapper(obj_class))
- buffer_add(buf,"<array>");
- else
- buffer_fadd(buf,"<%s>",tag);
- }
-
- for( i = 0; i!= obj->size; i++ ) {
- _rest_xml_output(buf, jsonObjectGetIndex(obj,i), obj->classname, i,0);
- }
-
- if (!notag) {
- if(!isFieldmapper(obj_class))
- buffer_add(buf,"</array>");
- else
- buffer_fadd(buf,"</%s>",tag);
- }
-
- } else if (obj->type == JSON_HASH) {
-
- if (!notag) {
- if(!obj_class)
- buffer_add(buf,"<hash>");
- else
- buffer_fadd(buf,"<%s>",tag);
- }
-
- jsonObjectIterator* itr = jsonNewObjectIterator(obj);
- jsonObjectNode* tmp;
- while( (tmp = jsonObjectIteratorNext(itr)) ) {
- if (notag) {
- buffer_fadd(buf,"<%s>",tmp->key);
- } else {
- buffer_add(buf,"<pair>");
- buffer_fadd(buf,"<key>%s</key><value>",tmp->key);
- }
-
- _rest_xml_output(buf, tmp->item, NULL,0,notag);
-
- if (notag) {
- buffer_fadd(buf,"</%s>",tmp->key);
- } else {
- buffer_add(buf,"</value></pair>");
- }
- }
- jsonObjectIteratorFree(itr);
-
- if (!notag) {
- if(!obj_class)
- buffer_add(buf,"</hash>");
- else
- buffer_fadd(buf,"</%s>",tag);
- }
-
- }
-
- if (obj->classname)
- buffer_fadd(buf,"</Object></%s>",tag);
-
- free(tag);
-}
-
Deleted: trunk/Open-ILS/src/apachemods/json_xml.h
===================================================================
--- trunk/Open-ILS/src/apachemods/json_xml.h 2008-04-23 12:23:10 UTC (rev 9440)
+++ trunk/Open-ILS/src/apachemods/json_xml.h 2008-04-23 15:13:45 UTC (rev 9441)
@@ -1,9 +0,0 @@
-
-#include <string.h>
-#include <stdio.h>
-
-/* the JSON parser, so we can read the response we're XMLizing */
-#include <opensrf/osrf_json.h>
-#include <opensrf/utils.h>
-
-char* json_string_to_xml(char*);
Deleted: trunk/Open-ILS/src/apachemods/mod_xmlbuilder.h
===================================================================
--- trunk/Open-ILS/src/apachemods/mod_xmlbuilder.h 2008-04-23 12:23:10 UTC (rev 9440)
+++ trunk/Open-ILS/src/apachemods/mod_xmlbuilder.h 2008-04-23 15:13:45 UTC (rev 9441)
@@ -1,111 +0,0 @@
-#include "apachetools.h"
-#include "opensrf/xml_utils.h"
-#include "opensrf/osrf_hash.h"
-#include "opensrf/osrf_list.h"
-#include <libxslt/xslt.h>
-#include <libxslt/transform.h>
-#include <libxslt/xsltutils.h>
-
-#define MODULE_NAME "xmlbuilder_module" /* our module name */
-
-/* ------------------------------------------------------------------------------ */
-/* Apache config items. These are defaults which are only used if they are not
- overriden by the Apache config or URL where appropriate */
-/* ------------------------------------------------------------------------------ */
-/* The default directory where the DTD files are stored */
-#define MODXMLB_DEFAULT_LOCALE_PARAM "locale"
-#define MODXMLB_DEFAULT_BASE_DIR "/openils/var/web/locale"
-#define MODXMLB_DEFAULT_LOCALE "en-US"
-#define MODXMLB_DEFAULT_DTD NULL /* if defined, use this DTD only */
-/* ------------------------------------------------------------------------------ */
-
-#define MODXMLB_CONFIG_LOCALE "XMLBuilderDefaultLocale"
-#define MODXMLB_CONFIG_BASE_DIR "XMLBuilderBaseDir"
-#define MODXMLB_CONFIG_POST_XSL "XMLBuilderPostXSL"
-#define MODXMLB_CONFIG_DEFAULT_DTD "XMLBuilderDefaultDTD"
-#define MODXMLB_CONFIG_LOCALE_PARAM "XMLBuilderLocaleParam"
-#define MODXMLB_CONFIG_CONTENT_TYPE "XMLBuilderContentType"
-
-
-
-/* This module */
-module AP_MODULE_DECLARE_DATA xmlbuilder_module;
-
-
-/* our config structure */
-typedef struct {
-
- char* baseDir; /* directory on disk where the DTD files live */
- char* defaultLocale; /* locale dir from config or default */
- char* defaultDtd; /* if defined, we load this DTD only */
- char* localeParam; /* the CGI param used to choose the locale dir dynamically */
- char* contentType; /* what content type to serve our files as (derfault is text/html) */
- xsltStylesheetPtr postXSL; /* if defined, run this XSL after parsing */
-
-} xmlBuilderConfig;
-
-typedef struct {
- xmlBuilderConfig* config;
- xmlDocPtr doc;
- osrfHash* entHash;
- osrfHash* dtdHash;
- osrfList* nodeList;
- int xmlError;
- char* xmlFile;
-} xmlBuilderContext;
-
-
-
-xmlDocPtr xmlBuilderProcessFile( char* XMLFile, xmlBuilderConfig* config );
-
-void xmlBuilderAddDtd( const char* sysId, xmlBuilderContext* context );
-void xmlBuilderAddAtts( xmlBuilderContext* ctx, xmlNodePtr ptr, const xmlChar** atts );
-
-/* SAX Callbacks */
-void xmlBuilderStartElement( void* blob, const xmlChar *name, const xmlChar **atts );
-void xmlBuilderEndElement( void* blob, const xmlChar* name );
-void xmlBuilderHandleCharacter(void* blob, const xmlChar *ch, int len);
-void xmlBuilderParseError( void* blob, const char* msg, ... );
-xmlEntityPtr xmlBuilderGetEntity( void* blob, const xmlChar* name );
-void xmlBuilderExtSubset( void* blob, const xmlChar* name, const xmlChar* extId, const xmlChar* sysId );
-void xmlBuilderProcInstruction( void* blob, const xmlChar* name, const xmlChar* data );
-void xmlBuilderComment( void* blob, const xmlChar* data );
-
-
-static xmlSAXHandler xmlBuilderSaxHandlerStruct = {
- NULL, /* internalSubset */
- NULL, /* isStandalone */
- NULL, /* hasInternalSubset */
- NULL, /* hasExternalSubset */
- NULL, /* resolveEntity */
- xmlBuilderGetEntity, /* getEntity */
- NULL, /* entityDecl */
- NULL, /* notationDecl */
- NULL, /* attributeDecl */
- NULL, /* elementDecl */
- NULL, /* unparsedEntityDecl */
- NULL, /* setDocumentLocator */
- NULL, /* startDocument */
- NULL, /* endDocument */
- xmlBuilderStartElement, /* startElement */
- xmlBuilderEndElement, /* endElement */
- NULL, /* reference */
- xmlBuilderHandleCharacter, /* characters */
- NULL, /* ignorableWhitespace */
- xmlBuilderProcInstruction, /* processingInstruction */
- xmlBuilderComment, /* comment */
- xmlBuilderParseError, /* xmlParserWarning */
- xmlBuilderParseError, /* xmlParserError */
- NULL, /* xmlParserFatalError : unused */
- NULL, /* getParameterEntity */
- NULL, /* cdataBlock; */
- xmlBuilderExtSubset, /* externalSubset; */
- 1,
- NULL,
- NULL, /* startElementNs */
- NULL, /* endElementNs */
- NULL /* xmlStructuredErrorFunc */
-};
-static const xmlSAXHandlerPtr xmlBuilderSaxHandler = &xmlBuilderSaxHandlerStruct;
-
-
More information about the open-ils-commits
mailing list