commited generated parser

This commit is contained in:
Aliaksei Chapyzhenka 2021-10-10 20:29:52 -07:00
parent 7ae0d858ad
commit 104253e056
4 changed files with 2686 additions and 15 deletions

1
.gitignore vendored
View File

@ -4,5 +4,4 @@
/package-lock.json /package-lock.json
/build /build
/coverage /coverage
/vcd_parser.*
/tmp /tmp

View File

@ -2,19 +2,19 @@
'use strict'; 'use strict';
const fs = require('fs-extra'); const fs = require('fs-extra');
const cp = require('child_process'); // const cp = require('child_process');
const llparse = require('llparse'); const llparse = require('llparse');
const gyp = cb => { // const gyp = cb => {
console.log('build'); // console.log('build');
const proc = cp.spawn('node-gyp', ['configure', 'build']); // const proc = cp.spawn('node-gyp', ['configure', 'build']);
proc.stderr.on('data', data => { // proc.stderr.on('data', data => {
console.error(data.toString()); // console.error(data.toString());
}); // });
proc.on('close', (cb || (() => { // proc.on('close', (cb || (() => {
console.log('done'); // console.log('done');
}))); // })));
}; // };
const objection = lut => arg => arg.split(/\s+/).reduce((res, key) => { const objection = lut => arg => arg.split(/\s+/).reduce((res, key) => {
if (lut[key] === undefined) { if (lut[key] === undefined) {
@ -43,7 +43,7 @@ const properties = {
napi_env: 'ptr' napi_env: 'ptr'
}; };
const generate = cb => { const generate = (/* cb */) => {
// const llparseDot = require('llparse-dot'); // const llparseDot = require('llparse-dot');
const prj = 'vcd_parser'; const prj = 'vcd_parser';
@ -281,9 +281,9 @@ const generate = cb => {
// const dot = new llparseDot.Dot(); // const dot = new llparseDot.Dot();
// fs.writeFileSync(prj + '.dot', dot.build(declaration)); // fs.writeFileSync(prj + '.dot', dot.build(declaration));
cb(); // cb();
}; };
generate(gyp); generate(/* gyp */);
/* eslint camelcase: 0 */ /* eslint camelcase: 0 */

2627
vcd_parser.c Normal file

File diff suppressed because it is too large Load Diff

45
vcd_parser.h Normal file
View File

@ -0,0 +1,45 @@
#ifndef INCLUDE_VCD_PARSER_H_
#define INCLUDE_VCD_PARSER_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
typedef struct vcd_parser_s vcd_parser_t;
struct vcd_parser_s {
int32_t _index;
void* _span_pos0;
void* _span_cb0;
void* _span_pos1;
void* _span_cb1;
int32_t error;
const char* reason;
const char* error_pos;
void* data;
void* _current;
uint8_t command;
uint8_t type;
uint32_t size;
uint64_t time;
void* trigger;
void* triee;
void* lifee;
void* info;
void* value;
void* mask;
uint32_t digitCount;
void* tmpStr;
void* tmpStr2;
uint32_t stackPointer;
void* id;
void* napi_env;
};
int vcd_parser_init(vcd_parser_t* s);
int vcd_parser_execute(vcd_parser_t* s, const char* p, const char* endp);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* INCLUDE_VCD_PARSER_H_ */