--- /dev/null
+//========================================================================
+//
+// BaseFile.h
+//
+// Copyright 1999 Derek B. Noonburg assigned by Michael Meeks.
+//
+//========================================================================
+
+#ifndef BASEFILE_H
+#define BASEFILE_H
+
+#include <stdio.h>
+#include <stdarg.h>
+
+#include "Error.h"
+
+//#ifdef BONOBO_IO
+# include "BonoboFile.h"
+/*#else
+
+typedef FILE * BaseFile;
+
+static inline BaseFile
+bxpdfopen (GString *fileName1)
+{
+ GString *fileName2;
+ // try to open file
+ fileName2 = NULL;
+ BaseFile file;
+
+#ifdef VMS
+ if (!(file = fopen(fileName->getCString(), "rb", "ctx=stm"))) {
+ error(-1, "Couldn't open file '%s'", fileName->getCString());
+ return NULL;
+ }
+#else
+ if (!(file = fopen(fileName1->getCString(), "rb"))) {
+ fileName2 = fileName1->copy();
+ fileName2->lowerCase();
+ if (!(file = fopen(fileName2->getCString(), "rb"))) {
+ fileName2->upperCase();
+ if (!(file = fopen(fileName2->getCString(), "rb"))) {
+ error(-1, "Couldn't open file '%s'", fileName1->getCString());
+ delete fileName2;
+ return NULL;
+ }
+ }
+ delete fileName2;
+ }
+#endif
+ return file;
+}
+
+static inline void
+bfclose (BaseFile file)
+{
+ fclose (file);
+}
+
+static inline size_t
+bfread (void *ptr, size_t size, size_t nmemb, BaseFile file)
+{
+ return fread (ptr, size, nmemb, file);
+}
+
+static inline int
+bfseek (BaseFile file, long offset, int whence)
+{
+ return fseek (file, offset, whence);
+}
+
+static inline void
+brewind (BaseFile file)
+{
+ rewind (file);
+}
+
+static inline long
+bftell (BaseFile file)
+{
+ return ftell (file);
+}*/
+
+//#endif /* BONOBO_IO not defined */
+#endif /* BASEFILE_H */
+
+
--- /dev/null
+//========================================================================
+//
+// BonoboFile.cc
+//
+// Copyright 1999 Derek B. Noonburg assigned by Michael Meeks.
+//
+//========================================================================
+
+#ifdef __GNUC__
+#pragma implementation
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+#include <string.h>
+#include <ctype.h>
+
+#include "BaseFile.h"
+
+//#define HARD_DEBUG
+
+/* The open/close is done for you by the Bonobo server */
+
+void
+bfclose (BaseFile file)
+{
+}
+
+size_t
+bfread (void *ptr, size_t size, size_t nmemb, BaseFile file)
+{
+ CORBA_long len;
+ CORBA_Environment ev;
+ GNOME_Stream_iobuf *buffer = NULL;
+
+ g_return_val_if_fail (ptr != NULL, 0);
+
+#ifdef HARD_DEBUG
+ printf ("read %p %d %d to %p\n", file, size, nmemb, ptr);
+#endif
+ len = GNOME_Stream_read (file, size*nmemb, &buffer, &ev);
+ g_return_val_if_fail (ev._major == CORBA_NO_EXCEPTION, 0);
+
+#ifdef HARD_DEBUG
+ printf ("Read %d bytes %p %d\n", len, buffer->_buffer, buffer->_length);
+#endif
+ memcpy (ptr, buffer->_buffer, buffer->_length);
+
+ return len;
+}
+
+int
+bfseek (BaseFile file, long offset, int whence)
+{
+ CORBA_Environment ev;
+#ifdef HARD_DEBUG
+ printf ("Seek %p %d %d\n", file, offset, whence);
+#endif
+ return GNOME_Stream_seek (file, offset, whence, &ev);
+}
+
+void
+brewind (BaseFile file)
+{
+ CORBA_Environment ev;
+#ifdef HARD_DEBUG
+ printf ("rewind %p\n", file);
+#endif
+ GNOME_Stream_seek (file, 0, SEEK_SET, &ev);
+}
+
+long
+bftell (BaseFile file)
+{
+ CORBA_Environment ev;
+ CORBA_long pos;
+#ifdef HARD_DEBUG
+ printf ("tell %p\n", file);
+#endif
+ pos = GNOME_Stream_seek (file, 0, SEEK_CUR, &ev);
+#ifdef HARD_DEBUG
+ printf ("tell returns %d\n", pos);
+#endif
+
+ return pos;
+}
--- /dev/null
+//========================================================================
+//
+// BonoboFile.h
+//
+// Copyright 1999 Derek B. Noonburg assigned by Michael Meeks.
+//
+//========================================================================
+
+#ifndef BONOBOFILE_H
+#define BONOBOFILE_H
+
+extern "C" {
+#define GString G_String
+#include <gnome.h>
+#include <libgnorba/gnorba.h>
+#include <bonobo/gnome-bonobo.h>
+#undef GString
+}
+
+typedef GNOME_Stream BaseFile;
+
+/* The open/close is done for you by the Bonobo server */
+
+extern void bfclose (BaseFile file);
+extern size_t bfread (void *ptr, size_t size, size_t nmemb, BaseFile file);
+extern int bfseek (BaseFile file, long offset, int whence);
+extern void brewind (BaseFile file);
+extern long bftell (BaseFile file);
+
+#endif /* BONOBOFILE_H */