Commit Graph

11404 Commits

Author SHA1 Message Date
Andrew Johnson cd49e245c2 Added JLink reporting infrastructure
Command 'dbjlr <record|*> <level>' calls the report method for
all JSON links in all records, or in one named record.
Added level and indent arguments to the jlif::report() method.

Added jlif::map_children() method for recursing through all
JSON links, plus dbJLinkMapChildren() and dbJLinkMapAll() APIs.

Implemented the report and map_children methods in the const
and calc link types.
2016-09-05 14:25:33 -05:00
Andrew Johnson 19447dc7ff Make the long-string buffer for link fields bigger
When representing a link field as a long string (.INP$)
we have to pick some size limit for the buffer.
Previously this was the max length of a PV name + 12 chars,
but with JSON links that's not big enough.

This commit sets it to 1KB and defines a macro so it will be
easier to change in the future if necessary.
2016-09-04 16:56:15 -05:00
Andrew Johnson dd311be319 JLink: Convert parser->linkDepth into jlink->parseDepth
This counter is indicates when we've finished parsing a link,
and needs to be stored with link rather than the parser so it
keeps its value while parsing embedded links. This fixes the
embedded links bug.

Also removed the limit on a link name's length.
2016-09-04 16:33:10 -05:00
Andrew Johnson 4448317d73 Add lnkConst_remove, fix debug messages 2016-09-04 16:02:59 -05:00
Andrew Johnson ec6d86c91c Fix jlink memory leak in dbStaticLib
Added dbFreeLinkInfo(), use everywhere to release dbLinkInfo resources.

Renamed link_type => expected_type in db[Can]SetLink(),
my brain understands this name faster.
2016-09-04 15:56:39 -05:00
Andrew Johnson 4302da3628 Minor fixes to the calc link-type 2016-09-03 22:24:55 -05:00
Andrew Johnson 25315882ec Clean up JSON_LINKs in doCloseLinks 2016-09-03 22:22:12 -05:00
Andrew Johnson f8d6cd98a0 Minor cleanups 2016-09-03 19:44:49 -05:00
Andrew Johnson 5fe3e8bfb5 Added calc link-type 2016-09-03 19:22:55 -05:00
Andrew Johnson 8d1c416551 Moved PV_LINK-specific code out of dbLink.c into link types
This required a change to the lset::getValue arguments, removing
the pstat and psevr pointers. Links can still return a non-zero
value from getValue and trigger a LINK:INVALID alarm, but for any
other alarm settings they must manipulate the record themselves.
2016-09-03 19:21:11 -05:00
Andrew Johnson 07b09eed1f Fixes to dbJLink, added dbJLinkFree()
Moved the clearing of key_is_link to the right place,
embedded links now parse correctly.
2016-09-03 13:36:17 -05:00
Andrew Johnson 1e1c52cb69 Use new epicsStrnDup() API 2016-09-03 13:27:30 -05:00
Andrew Johnson 6e88d48615 Added epicsStrnDup() and dbmfStrndup() routines
The JSON parser passes string arguments with a length
instead or nil-terminating them. These routines make it
simple to copy such strings into either permanent or
temporary storage.
2016-09-03 13:25:19 -05:00
Andrew Johnson 23c71e9965 Various improvements
* Added new lset::openLink() method, called on JSON_LINKs only
* Cleanup in dbJLink.c to prevent memory leaks.
* Removed jlif::start_parse() method.
* Renamed jlif::end_parse() to end_child, which will be called on
the parent link when a child link has succesfully finished parsing.
2016-09-01 23:21:23 -05:00
Andrew Johnson 3992d4b92a Split dbJLinkInit, JLinks are now parsed at load-time 2016-09-01 00:56:26 -05:00
Andrew Johnson 40a3a66745 Added loadLS routine to lset
The long string in/out records use a different initializer
for constant links. The new loadLS method allows a constant
link type to initialize such a long string field.

NB: This routine was added in the middle of the lset table.
Any external link support implementations must be adjusted.
2016-08-31 00:36:23 -05:00
Andrew Johnson d0dcd61b23 Add code for arrays of strings 2016-08-30 23:03:08 -05:00
Andrew Johnson 5ec0633282 Pass link dbfType to jlif allocator; needed! 2016-08-30 01:13:15 -05:00
Andrew Johnson 33e565b67d Fix build warning from clang 2016-08-29 10:41:51 -05:00
Andrew Johnson 7edc0c67ca JSON Links implementation
The lnkConst.c implementation is not yet complete, no support for arrays of
strings (JMOP).

Link error messages should display their record & field name, which is not yet
possible.

The ability to embed links as parameters to other link types is not complete
yet; this will be required for the calc link type.

This code currently passes all existing tests, but additional tests are needed
for the new functionality.
2016-08-29 01:12:09 -05:00
Andrew Johnson 056edc0d8a Undo buggy change 2016-08-28 23:41:35 -05:00
Andrew Johnson 37b6cbb50c Use new dbLink APIs instead of checking link.type 2016-08-27 16:30:48 -05:00
Andrew Johnson cca6a5d05a Add isConstant and isVolatile to LSET 2016-08-27 16:26:55 -05:00
Andrew Johnson 82385c9f1b Missed a spot handling JSON_LINK field values 2016-08-18 00:18:41 -05:00
Andrew Johnson cbc7af0ef8 Remove 2 obsolete dbStatic routines (forms) 2016-08-15 20:19:19 -05:00
Andrew Johnson bed1c618a8 Use dbPutLinkAsync() in all output SoftCallback dev's 2016-08-13 21:53:31 -05:00
Andrew Johnson 7df97f074e Add lset::dbPutLinkAsync and S_db_noLSET 2016-08-13 21:42:23 -05:00
Andrew Johnson fe71fc98b8 Undo a small & unnecessary behaviour change 2016-08-12 23:53:42 -05:00
Andrew Johnson d3a9ba7701 Fix issues related to const array initialization 2016-08-12 23:21:26 -05:00
Andrew Johnson bb58598eba A cleaner way to close CA & DB links 2016-08-12 23:20:24 -05:00
Michael Davidsaver 899feb24b2 iocInit: close CA_LINKs through lset 2016-08-12 19:50:17 -04:00
Andrew Johnson fb785e45c7 Adjust record and device support for array constants 2016-08-10 12:53:39 -05:00
Andrew Johnson 519208833f Add lset::loadArray and JSON parsing
Replace lset::loadLink with lset::loadScalar, add lset::loadArray
Add dbLoadLinkArray() routine to dbLink.h API
New dbConvertJSON.h API for use by dbConstLoadArray()
2016-08-10 12:49:49 -05:00
Andrew Johnson ae2180f5b5 Comments in Makefile 2016-08-10 12:21:03 -05:00
Andrew Johnson dafe2a83a3 libCom: Make yajl_alloc.h usable 2016-08-10 12:19:53 -05:00
Andrew Johnson c01967d64f Remove spurious include dbCa.h 2016-06-02 22:29:45 -05:00
Andrew Johnson d1986edd9e Simplify link-type checks in record supports 2016-06-02 22:22:11 -05:00
Andrew Johnson 7627454f63 Simplify link-type checks in soft device supports 2016-06-02 22:02:54 -05:00
Andrew Johnson 667f74759d Allow (discard) comments inside JSON 2016-06-01 15:46:24 -05:00
Andrew Johnson 1f726c8760 Recognize arrays as constant links 2016-05-24 12:01:38 +02:00
Andrew Johnson 08b7802009 Recognize numbers before barewords 2016-05-24 11:59:08 +02:00
Andrew Johnson f6c4099634 Make info tags also JSON objects 2016-05-23 12:00:11 +02:00
Andrew Johnson c76041b14c Rename JSON_STR to JSON_LINK 2016-05-20 20:32:39 -05:00
Andrew Johnson 7ea544673a Accept bareword JSON strings, quote them 2016-05-20 00:02:45 -05:00
Andrew Johnson 6e6ae4354b Fix warnings from dbmfStrdup() change 2016-05-19 14:01:05 -05:00
Andrew Johnson 61e82ee1ae Fix memory allocation bugs 2016-05-19 01:32:12 -05:00
Andrew Johnson 28b3b1678c ioc/dbStatic: Add JSON parsing of field values
The parsing removes all white-space outside of quotes from the JSON.
dbRecordField() now strips quotes from simple string values itself.
2016-05-19 01:15:33 -05:00
Andrew Johnson efb5ba27ae libCom/dbmf: Add dbmfStrcat3() for JSON parsing
Also removed all epicsShareAPI attributes
Made string arguments const char *
2016-05-19 00:58:45 -05:00
Andrew Johnson 574db56740 Make antelope's error messages slightly nicer 2016-05-19 00:51:23 -05:00
Andrew Johnson 6a592dc2c0 Support "link(name, lset)" syntax in DBD files
Both Perl and dbStaticLib support included.
Also added a new std/link directory for link types.
Nothing looks up the registered link support tables yet.
2016-05-08 22:57:42 -05:00