ming_node 3.0.2 → 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. package/extlib/MingExcelTool.js +75 -0
  2. package/index.js +4 -10
  3. package/output/ming_api_mock/ming_api_mock.js +3251 -0
  4. package/output/ming_api_mock/mock.bat +21 -0
  5. package/output/ming_api_mock/mock.sh +15 -0
  6. package/output/npr/npr.bat +7 -0
  7. package/output/npr/npr_plugins/MakeModelsim/index.js +157 -0
  8. package/output/npr/npr_plugins/Modelsim/index.js +72 -0
  9. package/output/npr/npr_plugins/common/ming_node.js +58 -0
  10. package/output/npr/npr_plugins/demo/index.js +1 -0
  11. package/output/npr/npr_plugins/hello/index.js +1 -0
  12. package/output/npr/npr_plugins/install/index.js +27 -0
  13. package/output/npr/npr_plugins/list/index.js +20 -0
  14. package/output/npr/npr_plugins/verilog/Readme.md +1 -0
  15. package/output/npr/npr_plugins/verilog/breath_led/breath_led.v +99 -0
  16. package/output/npr/npr_plugins/verilog/breath_led/tb.v +39 -0
  17. package/output/npr/npr_plugins/verilog/demo/led.v +12 -0
  18. package/output/npr/npr_plugins/verilog/demo/sims/Makefile +25 -0
  19. package/output/npr/npr_plugins/verilog/demo/sims/filelist.f +1 -0
  20. package/output/npr/npr_plugins/verilog/demo/sims/run.do +3 -0
  21. package/output/npr/npr_plugins/verilog/demo/tb.v +30 -0
  22. package/output/npr/npr_plugins/verilog/index.js +25 -0
  23. package/output/npr/npr_plugins/verilog/key_led/key_debounce.v +57 -0
  24. package/output/npr/npr_plugins/verilog/key_led/tb.v +78 -0
  25. package/output/npr/npr_plugins/verilog/key_led/toggle_pin.v +35 -0
  26. package/output/npr/npr_plugins/verilog/led/led.v +12 -0
  27. package/output/npr/npr_plugins/verilog/led/tb.v +30 -0
  28. package/output/npr/npr_plugins/verilog/modelsim_tcl/filelist.f +2 -0
  29. package/output/npr/npr_plugins/verilog/modelsim_tcl/restart.tcl +1 -0
  30. package/output/npr/npr_plugins/verilog/modelsim_tcl/run.do +3 -0
  31. package/output/npr/npr_plugins/verilog/modelsim_tcl//346/216/247/345/210/266/345/217/260_Makefile +24 -0
  32. package/output/npr/npr_plugins/verilog/modelsim_tcl//347/252/227/345/217/243_Makefile +24 -0
  33. package/output/npr/npr_plugins/verilog/simple_verilog/sims/C_Makefile +27 -0
  34. package/output/npr/npr_plugins/verilog/simple_verilog/sims/Makefile +25 -0
  35. package/output/npr/npr_plugins/verilog/simple_verilog/sims/W_Makefile +24 -0
  36. package/output/npr/npr_plugins/verilog/simple_verilog/sims/filelist.f +1 -0
  37. package/output/npr/npr_plugins/verilog/simple_verilog/sims/run.do +3 -0
  38. package/output/npr/npr_plugins/verilog/simple_verilog/tb/led.sv +72 -0
  39. package/output/npr/npr_plugins/verilog/simple_verilog/tb/tb.sv +54 -0
  40. package/output/npr/npr_plugins/verilog/smg/HC_FPGA_Demo_Top.v +29 -0
  41. package/output/npr/npr_plugins/verilog/smg/digital_tube.v +93 -0
  42. package/output/npr/npr_plugins/verilog/smg/tb.v +56 -0
  43. package/output/npr/npr_plugins/verilog/uart/calc.js +4 -0
  44. package/output/npr/npr_plugins/verilog/uart/tb.v +35 -0
  45. package/output/npr/npr_plugins/verilog/uart/top_UART_RX.v +37 -0
  46. package/output/npr/npr_plugins/verilog/uart/top_UART_TX.v +41 -0
  47. package/output/npr/npr_plugins/verilog/uart/uart_rx.v +148 -0
  48. package/output/npr/npr_plugins/verilog/uart/uart_rx_led.v +23 -0
  49. package/output/npr/npr_plugins/verilog/uart/uart_tx.v +121 -0
  50. package/output/npr/npr_plugins/verilog/uart/uart_tx_count.v +72 -0
  51. package/output/npr/readme.md +7 -0
  52. package/package.json +1 -1
  53. package/plugins/Modelsim/Modelsim.js +29 -0
  54. package/plugins/Modelsim/run.bat +6 -0
  55. package/plugins/Modelsim/top.do +6 -0
@@ -0,0 +1,75 @@
1
+ const ExcelJS = require('exceljs');
2
+
3
+ class MingExcelTool {
4
+ worksheet;
5
+ constructor(path,indexOrName) {
6
+ this.path=path;
7
+ this.indexOrName=indexOrName;
8
+ }
9
+ async init(){
10
+ const workbook = new ExcelJS.Workbook();
11
+ this.workbook=workbook;
12
+ await workbook.xlsx.readFile(this.path);
13
+ this.worksheet = workbook.getWorksheet(this.indexOrName);
14
+ }
15
+
16
+ getCell(cellName){
17
+ const cell =this.worksheet.getCell(cellName);
18
+ return cell.value;
19
+ }
20
+
21
+ getColumn(indexOrKey){
22
+ const col =this.worksheet.getColumn(indexOrKey);
23
+ let r=[];
24
+ col.eachCell((cell, rowNumber) => {
25
+ if( "object"==typeof cell.value ){
26
+ if(cell.value==null){
27
+ r.push("");
28
+ }else{
29
+ r.push(cell.value.result);
30
+ }
31
+ }else {
32
+ r.push(cell.value);
33
+ }
34
+ });
35
+ return r;
36
+ }
37
+
38
+ getRow(indexOrKey){
39
+ const col =this.worksheet.getRow(indexOrKey);
40
+ let r=[];
41
+ col.eachCell((cell, rowNumber) => {
42
+ if( "object"==typeof cell.value ){
43
+ r.push(cell.value.result);
44
+ }else {
45
+ r.push(cell.value);
46
+ }
47
+ });
48
+ return r;
49
+ }
50
+
51
+ setCell(cellName,val){
52
+ this.worksheet.getCell(cellName).value = val;
53
+ }
54
+
55
+ async save(fileName){
56
+ await this.workbook.xlsx.writeFile(fileName);
57
+ }
58
+
59
+ }
60
+
61
+
62
+ function test(){
63
+ const me= new MingExcelTool('hq.xlsx',1 );
64
+ async function main(){
65
+ await me.init();
66
+ let c= me.getColumn(3);
67
+ me.setCell("H4","wer")
68
+ await me.save("D:/ming.xlsx")
69
+ console.log(c);
70
+ }
71
+ main()
72
+ }
73
+
74
+ test()
75
+ module.exports = MingExcelTool;
package/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * By : Minglie
4
4
  * QQ: 934031452
5
5
  * Date :2021.12.01
6
- * version :3.0.2
6
+ * version :3.0.3
7
7
  */
8
8
  const http = require('http');
9
9
  const https = require('https');
@@ -189,8 +189,6 @@ M.get = function (url, callback, data, headers) {
189
189
  });
190
190
  req.on('error', function (err) {
191
191
  reject(err);
192
- console.error(err);
193
-
194
192
  });
195
193
  req.end();
196
194
  })
@@ -276,8 +274,7 @@ M._request = function (url, callback, data, headers,methed) {
276
274
  });
277
275
 
278
276
  req.on('error', function (err) {
279
- console.error(err);
280
- throw err;
277
+ reject(err);
281
278
  });
282
279
  if(methed !="GET") req.write(postData);
283
280
  req.end();
@@ -361,8 +358,7 @@ M.postJson = function (url, callback, data, headers) {
361
358
  });
362
359
 
363
360
  req.on('error', function (err) {
364
- console.error(err);
365
- throw err;
361
+ reject(err);
366
362
  });
367
363
  req.write(postData);
368
364
  req.end();
@@ -393,7 +389,6 @@ M.require =async function (url,noCache) {
393
389
  console.log("req require remote url:", url);
394
390
  let promise = new Promise(function (reslove, reject) {
395
391
  require(ht).get(url, function (req, res) {
396
- res.setEncoding('utf-8');
397
392
  let d = '';
398
393
  req.on('data', (data) => {
399
394
  d += data;
@@ -2112,8 +2107,7 @@ M.axios = function (axiosConfig) {
2112
2107
 
2113
2108
  });
2114
2109
  req.on('error', function (err) {
2115
- console.error(err);
2116
- throw err;
2110
+ reject(err);
2117
2111
  });
2118
2112
  req.write(axiosConfig.body);
2119
2113
  req.end();