rem: int wxGetPreference(const char *name, char *res, long len)
add: int wxGetPreference(const char *name, int *res)
context: int wxGetPreference(const char *name, char *res, long len){  int offset, depth, c;  /* This function duplicates a lot of work that's elsewhere,     unfornatunately, due to timing constraints (i.e., it's called     especially early during startup). */  /******************************************/  /* Step 1: load the pref file into memory */  /******************************************/  if (!pref_file_cache) {    FILE *fp;    char *home, *s;    int l, ends_in_slash;    wxREGGLOB(pref_file_cache);    /*************** Unix ***************/#if defined(wx_xt) || defined(OS_X)# ifdef wx_mac    home = scheme_expand_filename("~/Library/Preferences/", -1, NULL, NULL, 0);# else    home = scheme_expand_filename("~/.plt-scheme/", -1, NULL, NULL, 0);# endif         l = strlen(home);    ends_in_slash = (home[l] == '/');        s = new char[l + 30];    memcpy(s, home, l);    if (!ends_in_slash)      s[l++] = '/';# ifdef wx_mac    memcpy(s + l, "org.plt-scheme.prefs.ss", 24);# else    memcpy(s + l, "plt-prefs.ss", 13);# endif#endif    /*************** Windows ***************/#ifdef wx_msw    home = win_find_home();    l = strlen(home);    ends_in_slash = ((home[l] == '/') || (home[l] == '\\'));      s = new char[l + 20];    memcpy(s, home, l);    if (!ends_in_slash)      s[l++] = '\\';    memcpy(s + l, "plt-prefs.ss", 13);#endif    /*************** Mac OS Classic ***************/#if defined(wx_mac) && !defined(OS_X)    {      OSType t;      FSSpec spec;      SInt16 vRefNum;      SInt32 dirID;      const Str255 fileName = "\p";      if (!FindFolder(kOnSystemDisk, 'pref', kCreateFolder, &vRefNum, &dirID) == noErr) {	FSMakeFSSpec(vRefNum,dirID,fileName,&spec);	home = scheme_mac_spec_to_path(&spec);      } else if (wxmac_startup_directory) {	home = wxmac_startup_directory;      } else {	home = scheme_os_getcwd(NULL, 0, NULL, 1);      }          l = strlen(home);      ends_in_slash = (home[l] == ':');        s = new char[l + 30];      memcpy(s, home, l);      if (!ends_in_slash)	s[l++] = ':';      memcpy(s + l, "org.plt-scheme.prefs.ss", 24);    }#endif    /*************** Common ***************/    fp = fopen(s, "rb");    if (!fp)      return 0;    pref_file_cache_size = PREF_CACHE_SEG;    pref_file_cache = new char[pref_file_cache_size];    offset = 0;    while (!feof(fp)) {      long got;      if (offset + PREF_CACHE_SEG > pref_file_cache_size) {	s = new char[2 * pref_file_cache_size];	memcpy(s, pref_file_cache, pref_file_cache_size);	pref_file_cache_size *= 2;	pref_file_cache = s;      }      got = fread(pref_file_cache + offset, 1, PREF_CACHE_SEG, fp);      offset += got;    }    pref_file_cache_size = offset;    fclose(fp);  }#define cgetc() ((offset < pref_file_cache_size) ? pref_file_cache[offset++] : -1)  /*******************************************/  /* Step 2: a lightweight `read'.           */  /* Assume a real `read' would succeed, and */  /* assume there are no comments.           */  /*******************************************/  offset = 0;  depth = 0;  while (offset < pref_file_cache_size) {    do {      c = cgetc();    } while ((c > 0) && isspace(c));  top:        switch (c) {    case '(':      depth++;      if (depth == 2) {	/* Maybe the entry we're looking for: */	do {	  c = cgetc();	} while ((c > 0) && isspace(c));		if (c == '|') {	  char *prefix = "MrEd:";	  int i;	  for (i = 0; prefix[i]; i++) {	    c = cgetc();	    if (c != prefix[i])	      break;	  }	  if (!prefix[i]) {	    for (i = 0; name[i]; i++) {	      c = cgetc();	      if (c != name[i])		break;	    }	    if (!name[i]) {	      c = cgetc();	      if (c == '|') {		c = cgetc();		if ((c > 0) && isspace(c)) {		  int closer = ')';		  		  do {		    c = cgetc();		  } while ((c > 0) && isspace(c));		  if (c == '"') {		    closer = '"';		    i = 0;		  } else {		    res[0] = c;		    if (c == '\\')		      res[0] = cgetc();		    i = 1;		  }		  		  /* Read until closing parenthesis */		  for (; i < len; i++) {		    res[i] = cgetc();		    if (res[i] == '\\') {		      res[i] = cgetc();		    } else {		      if (res[i] == closer) {			res[i] = 0;			break;		      }		    }		  }		  res[len - 1] =0;		  		  return 1;		}		return 0;	      }	    }	  }	  /* Need closing | */	  if (c != '|') {	    do {	      c = cgetc();	    } while (c != '|');	  }	  c = cgetc();	}	goto top;      }      break;    case ')':      --depth;      break;    case '"':      do {	c = cgetc();	if (c == '\\')	  cgetc();      } while ((c != '"') && (c != -1));      break;    case '\\':      cgetc();      break;    case '|':      do {	c = cgetc();      } while ((c != '|') && (c != -1));      break;    }  }  return 0;}