static atom_t hszToAtom(HSZ hsz) { char buf[FASTBUFSIZE]; int len; if ( !(len=DdeQueryString(ddeInst, hsz, buf, sizeof(buf)-1, CP_WINANSI)) ) { dde_warning("string handle"); return NULL_ATOM; } if ( len == sizeof(buf)-1 ) { if ( (len=DdeQueryString(ddeInst, hsz, NULL, 0, CP_WINANSI)) > 0 ) { char *b2 = malloc(len+1); atom_t a; DdeQueryString(ddeInst, hsz, b2, len+1, CP_WINANSI); a = lookupAtom(b2, len); free(b2); return a; } dde_warning("string handle"); } return lookupAtom(buf, len); }
static atom_t uncachedCodeToAtom(int chrcode) { if ( chrcode < 256 ) { char tmp[2]; tmp[0] = chrcode; tmp[1] = '\0'; return lookupAtom(tmp, 1); } else { pl_wchar_t tmp[2]; tmp[0] = chrcode; tmp[1] = '\0'; return (atom_t)YAP_LookupWideAtom(tmp); } }