s[0] = '\0';
}
-GString::GString(char *s1) {
+GString::GString(const char *s1) {
int n = strlen(s1);
s = NULL;
memcpy(s, s1, n + 1);
}
-GString::GString(char *s1, int length1) {
+GString::GString(const char *s1, int length1) {
s = NULL;
resize(length = length1);
memcpy(s, s1, length * sizeof(char));
GString();
// Create a string from a C string.
- GString(char *s1);
+ GString(const char *s1);
// Create a string from <length1> chars at <s1>. This string
// can contain null characters.
- GString (char *s1, int length1);
+ GString (const char *s1, int length1);
// Copy a string.
GString(GString *str);
//
//========================================================================
-#ifdef WIN32
extern "C" {
-#include <sys/stat.h>
-#include <kpathsea/win32lib.h>
-}
+#ifdef WIN32
+# include <sys/stat.h>
+# ifndef _MSC_VER
+# include <kpathsea/win32lib.h>
+# endif
#else // !WIN32
-#include <sys/stat.h>
-#include <limits.h>
-#include <string.h>
-#ifndef VMS
-#include <pwd.h>
-#endif
+# ifndef ACORN
+# include <sys/types.h>
+# include <sys/stat.h>
+# endif
+# include <limits.h>
+# include <string.h>
+# if !defined(VMS) && !defined(ACORN)
+# include <pwd.h>
+# endif
+# if defined(VMS) && (__DECCXX_VER < 50200000)
+# include <unixlib.h>
+# endif
#endif // WIN32
-#if defined(VMS) && (__DECCXX_VER < 50200000)
-#include <unixlib.h>
-#endif
+}
#include "GString.h"
#include "gfile.h"
ret = new GString(".");
return ret;
+#elif defined(ACORN)
+ //---------- RISCOS ----------
+ return new GString("@");
+
#else
//---------- Unix ----------
char *s;
char buf[PATH_MAX+1];
#if defined(__EMX__)
- if (!_getcwd2(buf, sizeof(buf)))
+ if (_getcwd2(buf, sizeof(buf)))
#elif defined(WIN32)
- if (!GetCurrentDirectory(sizeof(buf), buf))
+ if (GetCurrentDirectory(sizeof(buf), buf))
+#elif defined(ACORN)
+ if (strcpy(buf, "@"))
#else
- if (!getcwd(buf, sizeof(buf)))
+ if (getcwd(buf, sizeof(buf)))
#endif
- return new GString();
- return new GString(buf);
+ return new GString(buf);
+ return new GString();
}
GString *appendToPath(GString *path, char *fileName) {
path->append(buf);
return path;
-#else
- //---------- Unix and OS/2+EMX ----------
+#elif defined(ACORN)
+ //---------- RISCOS ----------
+ char *p;
+ int i;
+
+ path->append(".");
+ i = path->getLength();
+ path->append(fileName);
+ for (p = path->getCString() + i; *p; ++p) {
+ if (*p == '/') {
+ *p = '.';
+ } else if (*p == '.') {
+ *p = '/';
+ }
+ }
+ return path;
+
+#elif defined(__EMX__)
+ //---------- OS/2+EMX ----------
int i;
// appending "." does nothing
// appending ".." goes up one directory
if (!strcmp(fileName, "..")) {
for (i = path->getLength() - 2; i >= 0; --i) {
-#ifdef __EMX__
if (path->getChar(i) == '/' || path->getChar(i) == '\\' ||
path->getChar(i) == ':')
-#else
- if (path->getChar(i) == '/')
-#endif
break;
}
if (i <= 0) {
-#ifdef __EMX__
- if (path->getChar[0] == '/' || path->getChar[0] == '\\') {
+ if (path->getChar(0) == '/' || path->getChar(0) == '\\') {
path->del(1, path->getLength() - 1);
- } else if (path->getLength() >= 2 && path->getChar[1] == ':') {
+ } else if (path->getLength() >= 2 && path->getChar(1) == ':') {
path->del(2, path->getLength() - 2);
} else {
path->clear();
path->append("..");
}
+ } else {
+ if (path->getChar(i-1) == ':')
+ ++i;
+ path->del(i, path->getLength() - i);
+ }
+ return path;
+ }
+
+ // otherwise, append "/" and new path component
+ if (path->getLength() > 0 &&
+ path->getChar(path->getLength() - 1) != '/' &&
+ path->getChar(path->getLength() - 1) != '\\')
+ path->append('/');
+ path->append(fileName);
+ return path;
+
#else
+ //---------- Unix ----------
+ int i;
+
+ // appending "." does nothing
+ if (!strcmp(fileName, "."))
+ return path;
+
+ // appending ".." goes up one directory
+ if (!strcmp(fileName, "..")) {
+ for (i = path->getLength() - 2; i >= 0; --i) {
+ if (path->getChar(i) == '/')
+ break;
+ }
+ if (i <= 0) {
if (path->getChar(0) == '/') {
path->del(1, path->getLength() - 1);
} else {
path->clear();
path->append("..");
}
-#endif
} else {
-#ifdef __EMX__
- if (path->getChar(i) == ':')
- ++i;
-#endif
path->del(i, path->getLength() - i);
}
return path;
}
// otherwise, append "/" and new path component
-#ifdef __EMX__
- if (path->getLength() > 0 &&
- path->getChar(path->getLength() - 1) != '/' &&
- path->getChar(path->getLength() - 1) != '\\')
-#else
if (path->getLength() > 0 &&
path->getChar(path->getLength() - 1) != '/')
-#endif
path->append('/');
path->append(fileName);
return path;
return new GString(fileName, p + 1 - fileName);
return new GString();
+#elif defined(ACORN)
+ //---------- RISCOS ----------
+ char *p;
+
+ if ((p = strrchr(fileName, '.')))
+ return new GString(fileName, p - fileName);
+ return new GString();
+
#else
//---------- Unix ----------
char *p;
//---------- OS/2+EMX and Win32 ----------
return path[0] == '/' || path[0] == '\\' || path[1] == ':';
+#elif defined(ACORN)
+ //---------- RISCOS ----------
+ return path[0] == '$';
+
#else
//---------- Unix ----------
return path[0] == '/';
}
return path;
-#elif WIN32
+#elif defined(WIN32)
//---------- Win32 ----------
char buf[_MAX_PATH];
char *fp;
path->append(buf);
return path;
+#elif defined(ACORN)
+ //---------- RISCOS ----------
+ path->insert(0, '@');
+ return path;
+
#else
//---------- Unix and OS/2+EMX ----------
struct passwd *pw;
}
} else if (!isAbsolutePath(path->getCString())) {
if (getcwd(buf, sizeof(buf))) {
+#ifndef __EMX__
path->insert(0, '/');
+#endif
path->insert(0, buf);
}
}
GDirEntry::GDirEntry(char *dirPath, char *name1, GBool doStat) {
#ifdef VMS
char *p;
-#elif WIN32
+#elif defined(WIN32)
int fa;
GString *s;
+#elif defined(ACORN)
#else
struct stat st;
GString *s;
if (!strcmp(name1, "-") ||
((p = strrchr(name1, '.')) && !strncmp(p, ".DIR;", 5)))
dir = gTrue;
+#elif defined(ACORN)
#else
s = new GString(dirPath);
appendToPath(s, name1);
GDir::GDir(char *name, GBool doStat1) {
path = new GString(name);
doStat = doStat1;
-#ifdef WIN32
+#if defined(WIN32)
GString *tmp;
tmp = path->copy();
tmp->append("/*.*");
hnd = FindFirstFile(tmp->getCString(), &ffd);
delete tmp;
+#elif defined(ACORN)
#else
dir = opendir(name);
-#endif
#ifdef VMS
needParent = strchr(name, '[') != NULL;
#endif
+#endif
}
GDir::~GDir() {
delete path;
-#ifdef WIN32
+#if defined(WIN32)
if (hnd) {
FindClose(hnd);
hnd = NULL;
}
+#elif defined(ACORN)
#else
if (dir)
closedir(dir);
GDirEntry *e;
e = NULL;
-#ifdef WIN32
+#if defined(WIN32)
e = new GDirEntry(path->getCString(), ffd.cFileName, doStat);
if (hnd && !FindNextFile(hnd, &ffd)) {
FindClose(hnd);
hnd = NULL;
}
+#elif defined(ACORN)
#else
if (dir) {
#ifdef VMS
tmp = path->copy();
tmp->append("/*.*");
hnd = FindFirstFile(tmp->getCString(), &ffd);
+#elif defined(ACORN)
#else
if (dir)
rewinddir(dir);
-#endif
#ifdef VMS
needParent = strchr(path->getCString(), '[') != NULL;
#endif
+#endif
}
#ifndef GFILE_H
#define GFILE_H
+extern "C" {
#include <stdlib.h>
#include <stddef.h>
-#ifdef WIN32
-# include <kpathsea/win32lib.h>
+#if defined(WIN32)
+# ifdef _MSC_VER
+# include <windows.h>
+# else
+# include <kpathsea/win32lib.h>
+# endif
+#elif defined(ACORN)
#else
# include <unistd.h>
# include <sys/types.h>
# endif
# endif
#endif
+}
#include "gtypes.h"
class GString;
GString *path; // directory path
GBool doStat; // call stat() for each entry?
-#ifdef VMS
- GBool needParent; // need to return an entry for [-]
-#endif
-#ifdef WIN32
+#if defined(WIN32)
WIN32_FIND_DATA ffd;
HANDLE hnd;
+#elif defined(ACORN)
#else
DIR *dir; // the DIR structure from opendir()
+#ifdef VMS
+ GBool needParent; // need to return an entry for [-]
+#endif
#endif
};
#include "gmem.h"
#ifdef DEBUG_MEM
+
typedef struct _GMemHdr {
int size;
int index;
#define gMemDeadVal 0xdeadbeefdeadbeef
#else
#define gMemDeadVal 0xdeadbeef
+#endif
/* round data size so trailer will be aligned */
#define gMemDataSize(size) \
((((size) + gMemTrlSize - 1) / gMemTrlSize) * gMemTrlSize)
-#endif
+#define gMemNLists 64
+#define gMemListShift 4
+#define gMemListMask (gMemNLists - 1)
+static GMemHdr *gMemList[gMemNLists] = {
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+};
-static GMemHdr *gMemList = NULL;
static int gMemIndex = 0;
static int gMemAlloc = 0;
-#endif
+
+#endif /* DEBUG_MEM */
void *gmalloc(int size) {
-#if DEBUG_MEM
+#ifdef DEBUG_MEM
int size1;
char *mem;
GMemHdr *hdr;
void *data;
+ int lst;
long *trl, *p;
if (size == 0)
trl = (long *)(mem + gMemHdrSize + size1);
hdr->size = size;
hdr->index = gMemIndex++;
- hdr->next = gMemList;
- gMemList = hdr;
+ lst = ((int)hdr >> gMemListShift) & gMemListMask;
+ hdr->next = gMemList[lst];
+ gMemList[lst] = hdr;
++gMemAlloc;
for (p = (long *)data; p <= trl; ++p)
*p = gMemDeadVal;
}
void *grealloc(void *p, int size) {
-#if DEBUG_MEM
+#ifdef DEBUG_MEM
GMemHdr *hdr;
void *q;
int oldSize;
int size;
GMemHdr *hdr;
GMemHdr *prevHdr, *q;
+ int lst;
long *trl, *clr;
if (p) {
hdr = (GMemHdr *)((char *)p - gMemHdrSize);
- for (prevHdr = NULL, q = gMemList; q; prevHdr = q, q = q->next) {
+ lst = ((int)hdr >> gMemListShift) & gMemListMask;
+ for (prevHdr = NULL, q = gMemList[lst]; q; prevHdr = q, q = q->next) {
if (q == hdr)
break;
}
if (prevHdr)
prevHdr->next = hdr->next;
else
- gMemList = hdr->next;
+ gMemList[lst] = hdr->next;
--gMemAlloc;
size = gMemDataSize(hdr->size);
trl = (long *)((char *)hdr + gMemHdrSize + size);
#ifdef DEBUG_MEM
void gMemReport(FILE *f) {
GMemHdr *p;
+ int lst;
fprintf(f, "%d memory allocations in all\n", gMemIndex);
if (gMemAlloc > 0) {
fprintf(f, "%d memory blocks left allocated:\n", gMemAlloc);
fprintf(f, " index size\n");
fprintf(f, "-------- --------\n");
- for (p = gMemList; p; p = p->next)
- fprintf(f, "%8d %8d\n", p->index, p->size);
+ for (lst = 0; lst < gMemNLists; ++lst) {
+ for (p = gMemList[lst]; p; p = p->next)
+ fprintf(f, "%8d %8d\n", p->index, p->size);
+ }
} else {
fprintf(f, "No memory blocks left allocated\n");
}
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1 },
- { 0x0000, 0x0000, 0x0000( 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000( 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
#include "GString.h"
#include "FontEncoding.h"
-//-----------------------------------------------)------------------------
+//------------------------------------------------------------------------
// FontFile
//------------------------------------------------------------------------
class Array;
class Dict;
class Stream;
-class XRef;
//------------------------------------------------------------------------
// Ref
inline Dict *Object::streamGetDict()
{ return stream->getDict(); }
-#include "XRef.h"
-
#endif
writePS("/F%d_%d /%s %g\n",
font->getID().num, font->getID().gen, psName, scale);
for (i = 0; i < 256; i += 8) {
- writePS((i == 0) ? (char *)"[ " : (char *)" ");
+ writePS((i == 0) ? "[ " : " ");
for (j = 0; j < 8; ++j) {
charName = font->getCharName(i+j);
- writePS("/%s", charName ? charName : (char *)".notdef");
+ writePS("/%s", charName ? charName : ".notdef");
}
- writePS((i == 256-8) ? (char *)"]\n" : (char *)"\n");
+ writePS((i == 256-8) ? "]\n" : "\n");
}
writePS("pdfMakeFont\n");
}
"zacute",
"hungarumlaut",
"zcaron",
- "zdotaccenp",
+ "zdotaccent",
"Racute",
"Aacute",
"Acircumflex",
new LTKEmpty()
)
),
- new LTKBox(NULL, 14, 1, 0, 0, 0, 0, ltkBorderNone, 1, 0,
+ new LTKBox(NULL, 15, 1, 0, 0, 0, 0, ltkBorderNone, 1, 0,
+ new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0,
+ new LTKButton(NULL, 0, backArrow_bits, backArrow_width, backArrow_height, ltkButtonClick, &backCbk)
+ ),
new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0,
new LTKButton(NULL, 0, dblLeftArrow_bits, dblLeftArrow_width, dblLeftArrow_height, ltkButtonClick, &prevTenPageCbk)
),
} else {
dpi = zoomDPI[zoom - minZoom];
}
- doc->displayPage(out, page, (double)dpi, rotate, gTrue);
+ doc->displayPage(out, page, dpi, rotate, gTrue);
updateScrollbars();
// update page number display