#include <pro_ext.h>
void putLong(unsigned long n)
{
Value val;
val.ev_type = 'I';
val.ev_long = n;
val.ev_width = 6;
_PutValue(&val);
}
FAR Example(ParamBlk FAR *parm)
{
#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))
WHANDLE wh;
EDENV EdEnv;
EDPOS edpos;
EDLINE edlin, original;
if (!_SetHandSize(parm->p[0].val.ev_handle,
parm->p[0].val.ev_length+1))
{
_Error(182); // "Insufficient memory"
}
pFILENAME[parm->p[0].val.ev_length] = '\0';
_HLock(parm->p[0].val.ev_handle);
wh = _EdOpenFile(pFILENAME, FO_READONLY);
_HUnLock(parm->p[0].val.ev_handle);
edpos = _EdGetLinePos(wh, 12);
_PutStr("\n_EdGetLinePos(wh, 12) =");
putLong(edpos);
original = edlin = _EdGetLineNum(wh, edpos);
for (;;)
{
_PutStr("\n_EdGetLineNum(wh,");
putLong(edpos);
_PutStr(") = ");
putLong(edlin);
if (edlin != original)
{
break;
}
edpos++;
edlin = _EdGetLineNum(wh, edpos);
}
edpos = _EdGetLinePos(wh, 13);
_PutStr("\n_EdGetLinePos(wh, 13) ="); putLong(edpos);
}
FoxInfo myFoxInfo[] = {
{"EDGETLPOS", (FPFI) Example, 1, "C"},
};
FoxTable _FoxTable = {
(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
}; |