Example #1
0
File: include.c Project: pdo/aldor
/*
 * Given the list fnames [z,...,b,a] and punct "->",
 * allocate the string "'a'->'b'->...->'z'".
 */
local String	 
inclActiveFileChain(StringList fnames, String punct)
{
	StringList sl0, sl;
	Buffer	   buf;
	String	   s;
	int	   i;

	buf = bufNew();
	sl0 = listReverse(String)(fnames);

	for (sl = sl0, i = 0; sl; sl = cdr(sl), i++) {
		if (i > 0) bufPuts(buf, punct);
		bufPrintf(buf, "'%s'", car(sl));
	}
	s = bufLiberate(buf);
	listFree(String)(sl0);

	return s;
}
Example #2
0
/* Evalute all lines in the edit box "id"  b/ween "fromLine" and "toLine" */
local void
wglEvalLines(int editBox, int fromLine, int toLine)
{
    int     i;
    LPSTR   lineStr;
    Buffer  evalBuf = bufNew();
    
    for (i = fromLine; i < toLine; i++) {
        lineStr = pfcGetLine(editBox, i);
        if (lineStr[0] == NULL) continue;  /* Skip blank lines */
        bufPuts(evalBuf, lineStr);
        bufPutc(evalBuf, '\n');
    }

    bufPutc(evalBuf, EOF);    
    bufStart(evalBuf);
    osSetStdinBuffer(evalBuf);
    
    compGLoopEval(osStdin, osStdout, finfo);
    
    wglShowOutput(editBox);
    bufFree(evalBuf);

}