Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
846b884eb5 | |||
3f1918ed2d | |||
1d753366d8 | |||
047f18d113 | |||
26c5b012a7 | |||
4f33600a0f | |||
2077dfb0a6 |
@ -96,11 +96,11 @@ come in a predictible order to be parsable by <em>StreamDevice</em>.
|
|||||||
<h2>Recommended Readings</h2>
|
<h2>Recommended Readings</h2>
|
||||||
<p>
|
<p>
|
||||||
IOC Application Developer's Guide:
|
IOC Application Developer's Guide:
|
||||||
<a href="https://www.aps.anl.gov/epics/base/R3-14/12-docs/AppDevGuide"
|
<a href="https://epics.anl.gov/base/R3-14/12-docs/AppDevGuide/"
|
||||||
target="ex">R3.14.12</a>,
|
target="ex">R3.14.12</a>,
|
||||||
<a href="https://www.aps.anl.gov/epics/base/R3-16/1-docs/AppDevGuide"
|
<a href="https://epics.anl.gov/base/R3-15/5-docs/AppDevGuide/AppDevGuide.html"
|
||||||
target="ex">R3.15.5</a>,
|
target="ex">R3.15.5</a>,
|
||||||
<a href="https://www.aps.anl.gov/epics/base/R3-15/5-docs/AppDevGuide"
|
<a href="https://epics.anl.gov/base/R3-16/1-docs/AppDevGuide/AppDevGuide.html"
|
||||||
target="ex">R3.16.1</a>
|
target="ex">R3.16.1</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
@ -388,7 +388,7 @@ The <code>INP</code> or <code>OUT</code> link has the form
|
|||||||
<code>"@<var>filename protocol</var>[(<var>arg1</var>,<var>arg2</var>,...)] </var>bus</var> [<var>address</var> [<var>parameters</var>]]"</code>.
|
<code>"@<var>filename protocol</var>[(<var>arg1</var>,<var>arg2</var>,...)] </var>bus</var> [<var>address</var> [<var>parameters</var>]]"</code>.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
(Elements in <code>[]</code> are optional. To not type the <code>[]</code>).
|
(Elements in <code>[]</code> are optional. Do not type the <code>[]</code>).
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Here, <code><var>filename</var></code> is the name of the protocol file and
|
Here, <code><var>filename</var></code> is the name of the protocol file and
|
||||||
|
@ -720,7 +720,7 @@ parseLink(const struct link *ioLink, char* filename,
|
|||||||
if (0 >= sscanf(ioLink->value.instio.string+n1, " %[^ \t(] %n", protocol, &n2))
|
if (0 >= sscanf(ioLink->value.instio.string+n1, " %[^ \t(] %n", protocol, &n2))
|
||||||
{
|
{
|
||||||
error("%s: Missing protocol name\n"
|
error("%s: Missing protocol name\n"
|
||||||
" expect \"@file protocol[(args)] bus [addr] [params]\"\n"
|
" expect \"@file protocol[(arg1,...)] bus [addr] [params]\"\n"
|
||||||
" in \"@%s\"\n", name(),
|
" in \"@%s\"\n", name(),
|
||||||
ioLink->value.instio.string);
|
ioLink->value.instio.string);
|
||||||
return S_dev_badInitRet;
|
return S_dev_badInitRet;
|
||||||
@ -728,15 +728,14 @@ parseLink(const struct link *ioLink, char* filename,
|
|||||||
n1+=n2;
|
n1+=n2;
|
||||||
if (ioLink->value.instio.string[n1] == '(')
|
if (ioLink->value.instio.string[n1] == '(')
|
||||||
{
|
{
|
||||||
strcat(protocol, "(");
|
n2 = 0;
|
||||||
n1++;
|
|
||||||
sscanf(ioLink->value.instio.string+n1, " %[^)] %n", protocol+strlen(protocol), &n2);
|
sscanf(ioLink->value.instio.string+n1, " %[^)] %n", protocol+strlen(protocol), &n2);
|
||||||
n1+=n2;
|
n1+=n2;
|
||||||
if (ioLink->value.instio.string[n1++] != ')')
|
if (ioLink->value.instio.string[n1++] != ')')
|
||||||
{
|
{
|
||||||
error("%s: Missing ')' after protocol '%s': '%s'\n"
|
error("%s: Missing ')' after protocol arguments '%s'\n"
|
||||||
" expect \"@file protocol(args) bus [addr] [params]\"\n"
|
" expect \"@file protocol(arg1,...) bus [addr] [params]\"\n"
|
||||||
" in \"@%s\"\n", name(), protocol, ioLink->value.instio.string+n1-1,
|
" in \"@%s\"\n", name(), protocol,
|
||||||
ioLink->value.instio.string);
|
ioLink->value.instio.string);
|
||||||
return S_dev_badInitRet;
|
return S_dev_badInitRet;
|
||||||
}
|
}
|
||||||
@ -745,7 +744,7 @@ parseLink(const struct link *ioLink, char* filename,
|
|||||||
if (0 >= sscanf(ioLink->value.instio.string+n1, "%s %i %99c", busname, addr, busparam))
|
if (0 >= sscanf(ioLink->value.instio.string+n1, "%s %i %99c", busname, addr, busparam))
|
||||||
{
|
{
|
||||||
error("%s: Missing bus name\n"
|
error("%s: Missing bus name\n"
|
||||||
" expect \"@file protocol[(args)] bus [addr] [params]\"\n"
|
" expect \"@file protocol[(arg1,...)] bus [addr] [params]\"\n"
|
||||||
" in \"@%s\"\n", name(),
|
" in \"@%s\"\n", name(),
|
||||||
ioLink->value.instio.string);
|
ioLink->value.instio.string);
|
||||||
return S_dev_badInitRet;
|
return S_dev_badInitRet;
|
||||||
|
@ -116,17 +116,11 @@ static long readData(dbCommon *record, format_t *format)
|
|||||||
if ((length = streamScanfN(record, format,
|
if ((length = streamScanfN(record, format,
|
||||||
(char *)aai->bptr, aai->nelm)) == ERROR)
|
(char *)aai->bptr, aai->nelm)) == ERROR)
|
||||||
{
|
{
|
||||||
memset(aai->bptr, 0, aai->nelm);
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
if (lval < (ssize_t)aai->nelm)
|
if (length < (ssize_t)aai->nelm)
|
||||||
{
|
{
|
||||||
memset(((char*)aai->bptr)+lval , 0, aai->nelm-lval);
|
((char*)aai->bptr)[length] = 0;
|
||||||
lval++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
((char*)aai->bptr)[aai->nelm-1] = 0;
|
|
||||||
}
|
}
|
||||||
aai->nord = (long)length;
|
aai->nord = (long)length;
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -113,17 +113,11 @@ static long readData(dbCommon *record, format_t *format)
|
|||||||
if ((length = streamScanfN(record, format,
|
if ((length = streamScanfN(record, format,
|
||||||
(char *)aao->bptr, aao->nelm)) == ERROR)
|
(char *)aao->bptr, aao->nelm)) == ERROR)
|
||||||
{
|
{
|
||||||
memset(aao->bptr, 0, aao->nelm);
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
if (length < (ssize_t)aao->nelm)
|
if (length < (ssize_t)aao->nelm)
|
||||||
{
|
{
|
||||||
memset(((char*)aao->bptr)+lval , 0, aao->nelm-lval);
|
((char*)aao->bptr)[length] = 0;
|
||||||
lval++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
((char*)aao->bptr)[aao->nelm-1] = 0;
|
|
||||||
}
|
}
|
||||||
aao->nord = (long)length;
|
aao->nord = (long)length;
|
||||||
goto end_no_check;
|
goto end_no_check;
|
||||||
|
@ -23,31 +23,28 @@
|
|||||||
static long readData(dbCommon *record, format_t *format)
|
static long readData(dbCommon *record, format_t *format)
|
||||||
{
|
{
|
||||||
lsiRecord *lsi = (lsiRecord *)record;
|
lsiRecord *lsi = (lsiRecord *)record;
|
||||||
|
ssize_t length;
|
||||||
|
|
||||||
if (format->type == DBF_STRING)
|
if (format->type != DBF_STRING) return ERROR;
|
||||||
|
if ((length = streamScanfN(record, format, lsi->val, (long)lsi->sizv)) == ERROR)
|
||||||
{
|
{
|
||||||
long len;
|
|
||||||
if ((len = streamScanfN(record, format, lsi->val, lsi->sizv) == ERROR))
|
|
||||||
{
|
|
||||||
lsi->len = 0;
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
lsi->len = len;
|
if (length < (ssize_t)lsi->sizv)
|
||||||
|
{
|
||||||
|
lsi->val[length] = 0;
|
||||||
|
}
|
||||||
|
lsi->len = length;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
return ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
static long writeData(dbCommon *record, format_t *format)
|
static long writeData(dbCommon *record, format_t *format)
|
||||||
{
|
{
|
||||||
lsiRecord *lsi = (lsiRecord *)record;
|
lsiRecord *lsi = (lsiRecord *)record;
|
||||||
|
|
||||||
if (format->type == DBF_STRING)
|
if (format->type != DBF_STRING) return ERROR;
|
||||||
{
|
|
||||||
return streamPrintf(record, format, lsi->val);
|
return streamPrintf(record, format, lsi->val);
|
||||||
}
|
}
|
||||||
return ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
static long initRecord(dbCommon *record)
|
static long initRecord(dbCommon *record)
|
||||||
{
|
{
|
||||||
|
@ -24,17 +24,19 @@
|
|||||||
static long readData(dbCommon *record, format_t *format)
|
static long readData(dbCommon *record, format_t *format)
|
||||||
{
|
{
|
||||||
lsoRecord *lso = (lsoRecord *)record;
|
lsoRecord *lso = (lsoRecord *)record;
|
||||||
long len;
|
ssize_t length;
|
||||||
unsigned short monitor_mask;
|
unsigned short monitor_mask;
|
||||||
|
|
||||||
if (format->type != DBF_STRING)
|
if (format->type != DBF_STRING) return ERROR;
|
||||||
return ERROR;
|
if ((length = streamScanfN(record, format, lso->val, lso->sizv)) == ERROR)
|
||||||
if ((len = streamScanfN(record, format, lso->val, lso->sizv) == ERROR))
|
|
||||||
{
|
{
|
||||||
lso->len = 0;
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
lso->len = len;
|
if (length < (ssize_t)lso->sizv)
|
||||||
|
{
|
||||||
|
lso->val[length] = 0;
|
||||||
|
}
|
||||||
|
lso->len = length;
|
||||||
if (record->pact) return OK;
|
if (record->pact) return OK;
|
||||||
/* In @init handler, no processing, enforce monitor updates. */
|
/* In @init handler, no processing, enforce monitor updates. */
|
||||||
monitor_mask = recGblResetAlarms(record);
|
monitor_mask = recGblResetAlarms(record);
|
||||||
@ -60,12 +62,9 @@ static long writeData(dbCommon *record, format_t *format)
|
|||||||
{
|
{
|
||||||
lsoRecord *lso = (lsoRecord *)record;
|
lsoRecord *lso = (lsoRecord *)record;
|
||||||
|
|
||||||
if (format->type == DBF_STRING)
|
if (format->type != DBF_STRING) return ERROR;
|
||||||
{
|
|
||||||
return streamPrintf(record, format, lso->val);
|
return streamPrintf(record, format, lso->val);
|
||||||
}
|
}
|
||||||
return ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
static long initRecord(dbCommon *record)
|
static long initRecord(dbCommon *record)
|
||||||
{
|
{
|
||||||
|
@ -117,17 +117,11 @@ static long readData(dbCommon *record, format_t *format)
|
|||||||
if ((length = streamScanfN(record, format,
|
if ((length = streamScanfN(record, format,
|
||||||
(char *)wf->bptr, wf->nelm)) == ERROR)
|
(char *)wf->bptr, wf->nelm)) == ERROR)
|
||||||
{
|
{
|
||||||
memset(wf->bptr, 0, wf->nelm);
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
if (length < (ssize_t)wf->nelm)
|
if (length < (ssize_t)wf->nelm)
|
||||||
{
|
{
|
||||||
memset(((char*)wf->bptr)+lval , 0, wf->nelm-lval);
|
((char*)wf->bptr)[length] = 0;
|
||||||
lval++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
((char*)wf->bptr)[wf->nelm-1] = 0;
|
|
||||||
}
|
}
|
||||||
wf->nord = (long)length;
|
wf->nord = (long)length;
|
||||||
return OK;
|
return OK;
|
||||||
|
Reference in New Issue
Block a user