aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <unknown>2000-12-10 08:52:00 +0000
committernyamatongwe <unknown>2000-12-10 08:52:00 +0000
commitca20fa0b96e059e98b853268835faaebec70c3b1 (patch)
tree7d239f5bfd24fc7193814ea7b63988fccac1069d /src
parent8c4a40255a8645a3ee49872ea0b35753660f92cf (diff)
downloadscintilla-mirror-ca20fa0b96e059e98b853268835faaebec70c3b1.tar.gz
Removed file IO code from PropSet to SciTE.
Updated make files to know about SString being moved into its own header.
Diffstat (limited to 'src')
-rw-r--r--src/PropSet.cxx78
1 files changed, 4 insertions, 74 deletions
diff --git a/src/PropSet.cxx b/src/PropSet.cxx
index 48b6cc782..caa8c6b2c 100644
--- a/src/PropSet.cxx
+++ b/src/PropSet.cxx
@@ -36,40 +36,10 @@ inline unsigned int HashString(const char *s) {
return ret;
}
-// Get a line of input. If end of line escaped with '\\' then continue reading.
-static bool GetFullLine(const char *&fpc, int &lenData, char *s, int len) {
- bool continuation = true;
- s[0] = '\0';
- while ((len > 1) && lenData > 0) {
- char ch = *fpc;
- fpc++;
- lenData--;
- if ((ch == '\r') || (ch == '\n')) {
- if (!continuation) {
- if ((lenData > 0) && (ch == '\r') && ((*fpc) == '\n')) {
- // munch the second half of a crlf
- fpc++;
- lenData--;
- }
- *s = '\0';
- return true;
- }
- } else if ((ch == '\\') && (lenData > 0) && ((*fpc == '\r') || (*fpc == '\n'))) {
- continuation = true;
- } else {
- continuation = false;
- *s++ = ch;
- *s = '\0';
- len--;
- }
- }
- return false;
-}
-
PropSet::PropSet() {
superPS = 0;
- for (int root=0; root < hashRoots; root++)
- props[root] = 0;
+ for (int root=0; root < hashRoots; root++)
+ props[root] = 0;
}
PropSet::~PropSet() {
@@ -162,7 +132,7 @@ int PropSet::GetInt(const char *key, int defaultValue) {
return defaultValue;
}
-inline bool isprefix(const char *target, const char *prefix) {
+bool isprefix(const char *target, const char *prefix) {
while (*target && *prefix) {
if (*target != *prefix)
return false;
@@ -288,47 +258,6 @@ void PropSet::Clear() {
}
}
-void PropSet::ReadFromMemory(const char *data, int len, const char *directoryForImports) {
- const char *pd = data;
- char linebuf[60000];
- bool ifIsTrue = true;
- while (len > 0) {
- GetFullLine(pd, len, linebuf, sizeof(linebuf));
- if (isalpha(linebuf[0])) // If clause ends with first non-indented line
- ifIsTrue = true;
- if (isprefix(linebuf, "if ")) {
- const char *expr = linebuf + strlen("if") + 1;
- ifIsTrue = GetInt(expr);
- } else if (isprefix(linebuf, "import ") && directoryForImports) {
- char importPath[1024];
- strcpy(importPath, directoryForImports);
- strcat(importPath, linebuf + strlen("import") + 1);
- strcat(importPath, ".properties");
- Read(importPath,directoryForImports);
- } else if (isalpha(linebuf[0])) {
- Set(linebuf);
- } else if (isspace(linebuf[0]) && ifIsTrue) {
- Set(linebuf);
- }
- }
-}
-
-void PropSet::Read(const char *filename, const char *directoryForImports) {
- char propsData[60000];
-#ifdef __vms
- FILE *rcfile = fopen(filename, "r");
-#else
- FILE *rcfile = fopen(filename, "rb");
-#endif
- if (rcfile) {
- int lenFile = fread(propsData, 1, sizeof(propsData), rcfile);
- fclose(rcfile);
- ReadFromMemory(propsData, lenFile, directoryForImports);
- } else {
- //printf("Could not open <%s>\n", filename);
- }
-}
-
static bool iswordsep(char ch, bool onlyLineEnds) {
if (!isspace(ch))
return false;
@@ -744,3 +673,4 @@ char *WordList::GetNearestWords(const char *wordStart, int searchLen /*= -1*/, b
free(buffer);
return NULL;
}
+