00001
00002 #include <sxpath.h>
00003 #include <stdio.h>
00004 #include <sys/types.h>
00005 #include <sys/stat.h>
00006 #include <fcntl.h>
00007 #include <unistd.h>
00008 #include <dirent.h>
00009 #include <string.h>
00010 #include <search.h>
00011 #include <pwd.h>
00012
00013 #include "xpsh_attr.h"
00014
00015 #define PN_HISTORY 2
00016
00019 typedef struct pn_entries_i {
00021 node_xpsh *node;
00023 char path_of_node[1024];
00025 int history;
00026 } pn_entries;
00027
00030 typedef struct mime_type_i {
00032 char ending[8];
00034 char type[32];
00036 struct mime_type_i *next;
00037 } mime_type;
00038
00039
00040 SXP_NodeType getNodeType_i( SXP_Node );
00041 const SXP_char* getNodeName_i( SXP_Node );
00042 const SXP_char* getNodeNameURI_i( SXP_Node );
00043 const SXP_char* getNodeNameLocal_i( SXP_Node );
00044 const SXP_char* getNodeValue_i( SXP_Node );
00045 SXP_Node getNextSibling_i( SXP_Node );
00046 SXP_Node getPreviousSibling_i( SXP_Node );
00047 int getChildCount_i( SXP_Node );
00048 int getAttributeCount_i( SXP_Node );
00049 int getNamespaceCount_i( SXP_Node );
00050 SXP_Node getChildNo_i( SXP_Node, int );
00051 SXP_Node getAttributeNo_i( SXP_Node, int );
00052 SXP_Node getNamespaceNo_i( SXP_Node, int );
00053 SXP_Node getParent_i( SXP_Node );
00054 SXP_Document getOwnerDocument_i( SXP_Node );
00055 int compareNodes_i( SXP_Node, SXP_Node );
00056
00057 node_xpsh *createNewNode( node_xpsh*, node_type, char*,
00058 char*, node_xpsh*, node_xpsh* );
00059
00060
00061 SXP_Node genParents( const char *pathname );
00062
00063
00064 char *pathname( SXP_Node );
00065 void append_path( char*, node_xpsh* );
00066
00067 node_type getDirentType( struct dirent*, char* );
00068
00069
00070 char *getMimeType( node_xpsh *node, char dest[] );
00071 void loadMimeTypes( void );
00072
00073 FILE *openConfigFile( void );
00074
00075 void clearLastpn( void );
00076
00077
00078 void xpsh_clear( void );
00079 void xpsh_clear_internal( node_xpsh *node );
00080 void xpsh_clear_mime( mime_type *mt );
00081
00082 void declareNamespaces( QueryContext Q );
00083
00084 node_xpsh *root;
00085
00086 mime_type *first_mime;
00087 static int mime_loaded = 0;
00088
00089 pn_entries last_four_pn[PN_HISTORY];
00090
00091 DOMHandler xpsh_domhandler = {
00092 &getNodeType_i,
00093 &getNodeName_i,
00094 &getNodeNameURI_i,
00095 &getNodeNameLocal_i,
00096 &getNodeValue_i,
00097 &getNextSibling_i,
00098 &getPreviousSibling_i,
00099 &getNextAttrNS_i,
00100 &getPreviousAttrNS_i,
00101 &getChildCount_i,
00102 &getAttributeCount_i,
00103 &getNamespaceCount_i,
00104 &getChildNo_i,
00105 &getAttributeNo_i,
00106 &getNamespaceNo_i,
00107 &getParent_i,
00108 &getOwnerDocument_i,
00109 &compareNodes_i
00110 };