kvamemolibxml.h
Go to the documentation of this file.
1 /*
2  * Copyright 2005-2017 by KVASER AB, SWEDEN
3  * WWW: http://www.kvaser.com
4  *
5  * This software is furnished under a license and may be used and copied
6  * only in accordance with the terms of such license.
7  *
8  */
9 
10 #ifndef KVAMEMOLIBXML_H
11 #define KVAMEMOLIBXML_H
12 
39 #include <windows.h>
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
54 #define XML_ERROR_MESSAGE_LENGTH 2048
55 
67 typedef enum {
81 } KvaXmlStatus;
94 typedef enum {
112 
133 KvaXmlStatus WINAPI kvaXmlInitialize (void);
134 
152 KvaXmlStatus WINAPI kvaXmlGetLastError (char *buf, unsigned int len, KvaXmlStatus *err);
153 
175 KvaXmlStatus WINAPI kvaXmlToBuffer (const char *xmlbuf, unsigned int xmllen, char *outbuf, unsigned int *outlen, long *version);
176 
192 KvaXmlStatus WINAPI kvaXmlToFile (const char *infile, const char *outfile);
193 
209 KvaXmlStatus WINAPI kvaFileToXml(const char * parfile, const char * xmlfile);
210 
223 KvaXmlStatus WINAPI kvaXmlDebugOutput (int on);
224 
246 KvaXmlStatus WINAPI kvaBufferToXml (const char *inbuf, unsigned int inlen, char *xmlbuf, unsigned int *xmllen, long *version, const char * scriptpath);
247 
262 KvaXmlStatus WINAPI kvaXmlValidate (const char *xmlbuf, unsigned int xmllen);
263 
278 KvaXmlStatus WINAPI kvaXmlGetValidationStatusCount (int *countErr, int *countWarn);
279 
296 KvaXmlStatus WINAPI kvaXmlGetValidationError (KvaXmlValidationStatus *status, char *buf, unsigned int len);
297 
314 KvaXmlStatus WINAPI kvaXmlGetValidationWarning (KvaXmlValidationStatus *status, char *buf, unsigned int len);
315 
331 KvaXmlStatus WINAPI kvaXmlGetErrorText (KvaXmlStatus status, char *buf, unsigned int len);
332 
349 KvaXmlStatus WINAPI kvaXmlGetValidationText (KvaXmlValidationStatus status, char *buf, unsigned int len);
350 
363 unsigned short WINAPI kvaXmlGetVersion (void);
364 
365 
366 // Functions and definitions provided by kv_parser, used for going back and
367 // forth between infix and postfix notation.
368 
375 typedef struct tag_token {
376  int type; // T_xxx
377  char *name; // Name for identifiers
378  struct tag_token *left; // Left part of expr if this is an op
379  struct tag_token *right; // Right dito
380  int start_pos; // Token's start pos
381  int end_pos; // Token's end pos
382  struct tag_token *next; // For later memory deallocation
383  int errCode; // ERR_xxx if this is a T_ERROR
384 } Token;
385 
391 typedef struct {
393 } KvParseHandle;
394 
405 KvParseHandle* WINAPI kvaToolsParseCreate(void);
406 
414 void WINAPI kvaToolsParseDestroy(KvParseHandle *h);
415 
426 void WINAPI kvaToolsExprGetErrorString(int errCode, char *s, size_t bufsiz);
427 
440 int WINAPI kvaToolsParseExpr(KvParseHandle *h, char* expr, Token **t);
441 
452 int WINAPI kvaToolsFreeExpr(KvParseHandle *h, Token *t);
453 
465 int WINAPI kvaToolsDumpExpr(KvParseHandle *h, Token *t);
466 
479 int WINAPI kvaToolsExprHasErrors(KvParseHandle *h, Token *t);
480 
494 int WINAPI kvaToolsExprGetError(KvParseHandle *h, Token *t, int *errCode, int *pos);
495 
527 #ifdef __cplusplus
528 }
529 #endif
530 
531 #endif //KVAMEMOLIBXML_H
The trigger expression could not be parsed.
Definition: kvamemolibxml.h:76
t-script related errors, e.g. file not found.
Definition: kvamemolibxml.h:79
Using more than one external trigger requires firmware version 3.7 or better.
Definition: kvamemolibxml.h:117
The value is not unique; usually idx attributes.
Definition: kvamemolibxml.h:74
OK.
Definition: kvamemolibxml.h:95
No active logging detected.
Definition: kvamemolibxml.h:114
The values are not consecutive; usually idx attributes.
Definition: kvamemolibxml.h:75
This XML element was ignored.
Definition: kvamemolibxml.h:116
KvaXmlStatus kvaXmlValidate(const char *xmlbuf, unsigned int xmllen)
The XML settings contain syntax errors.
Definition: kvamemolibxml.h:77
An undefined trigger is used in an expression.
Definition: kvamemolibxml.h:99
Too many or too few elements of this type.
Definition: kvamemolibxml.h:108
char * name
Definition: kvamemolibxml.h:377
OK.
Definition: kvamemolibxml.h:68
Failed to find an attribute in a node.
Definition: kvamemolibxml.h:70
unsigned short kvaXmlGetVersion(void)
int kvaToolsFreeExpr(KvParseHandle *h, Token *t)
struct tag_token * right
Definition: kvamemolibxml.h:379
KvaXmlStatus kvaXmlInitialize(void)
KvaXmlStatus kvaXmlToBuffer(const char *xmlbuf, unsigned int xmllen, char *outbuf, unsigned int *outlen, long *version)
KvaXmlStatus kvaXmlGetValidationError(KvaXmlValidationStatus *status, char *buf, unsigned int len)
Too many warnings, validation aborted.
Definition: kvamemolibxml.h:113
int kvaToolsDumpExpr(KvParseHandle *h, Token *t)
KvaXmlStatus kvaXmlGetValidationWarning(KvaXmlValidationStatus *status, char *buf, unsigned int len)
Could not find a required element.
Definition: kvamemolibxml.h:72
There are more than one external trigger defined.
Definition: kvamemolibxml.h:100
KvaXmlStatus kvaFileToXml(const char *parfile, const char *xmlfile)
void kvaToolsParseDestroy(KvParseHandle *h)
struct tag_token Token
Token used when parsing postfix expressions (deprecated):
int errCode
Definition: kvamemolibxml.h:383
Handle used when parsing postfix expressions (deprecated):
Definition: kvamemolibxml.h:391
KvaXmlStatus kvaXmlToFile(const char *infile, const char *outfile)
KvParseHandle * kvaToolsParseCreate(void)
struct tag_token * next
Definition: kvamemolibxml.h:382
A general trigger expression found during parsing.
Definition: kvamemolibxml.h:111
KvaXmlValidationStatus
Definition: kvamemolibxml.h:94
A trigger on disk full starts the logging.
Definition: kvamemolibxml.h:102
Generic error.
Definition: kvamemolibxml.h:96
Internal errors, e.g. null pointers.
Definition: kvamemolibxml.h:80
Token * next
Definition: kvamemolibxml.h:392
Too many active t-scripts for selected device.
Definition: kvamemolibxml.h:106
There are more than one start up trigger defined.
Definition: kvamemolibxml.h:101
The XML settings do not follow the DTD.
Definition: kvamemolibxml.h:78
A numerical value is out of range.
Definition: kvamemolibxml.h:103
int kvaToolsParseExpr(KvParseHandle *h, char *expr, Token **t)
KvaXmlStatus
Definition: kvamemolibxml.h:67
KvaXmlStatus kvaXmlGetValidationText(KvaXmlValidationStatus status, char *buf, unsigned int len)
KvaXmlStatus kvaXmlDebugOutput(int on)
More than one active script is set as &#39;primary&#39;.
Definition: kvamemolibxml.h:107
struct tag_token * left
Definition: kvamemolibxml.h:378
int type
Definition: kvamemolibxml.h:376
Transmit lists used in silent mode.
Definition: kvamemolibxml.h:98
A general t-script error found during parsing.
Definition: kvamemolibxml.h:110
int end_pos
Definition: kvamemolibxml.h:381
int start_pos
Definition: kvamemolibxml.h:380
Generic error.
Definition: kvamemolibxml.h:69
A t-script is too large for the configuration.
Definition: kvamemolibxml.h:105
int kvaToolsExprHasErrors(KvParseHandle *h, Token *t)
Token used when parsing postfix expressions (deprecated):
Definition: kvamemolibxml.h:375
A trigger on disk full used with FIFO mode.
Definition: kvamemolibxml.h:115
A general error found during parsing.
Definition: kvamemolibxml.h:109
The value is outside the allowed range.
Definition: kvamemolibxml.h:73
A t-script file could not be opened.
Definition: kvamemolibxml.h:104
KvaXmlStatus kvaXmlGetValidationStatusCount(int *countErr, int *countWarn)
int kvaToolsExprGetError(KvParseHandle *h, Token *t, int *errCode, int *pos)
The attribute value is not correct, e.g. whitespace after a number.
Definition: kvamemolibxml.h:71
KvaXmlStatus kvaBufferToXml(const char *inbuf, unsigned int inlen, char *xmlbuf, unsigned int *xmllen, long *version, const char *scriptpath)
KvaXmlStatus kvaXmlGetLastError(char *buf, unsigned int len, KvaXmlStatus *err)
Too many errors, validation aborted.
Definition: kvamemolibxml.h:97
KvaXmlStatus kvaXmlGetErrorText(KvaXmlStatus status, char *buf, unsigned int len)
void kvaToolsExprGetErrorString(int errCode, char *s, size_t bufsiz)