circuitscript 0.0.35 → 0.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,7 +28,6 @@ export declare class BaseVisitor extends CircuitScriptVisitor<ComplexType | Refe
28
28
  };
29
29
  constructor(silent: boolean | undefined, onErrorHandler: OnErrorCallback | null | undefined, currentDirectory: string | null, defaultLibsPath: string);
30
30
  getExecutor(): ExecutionContext;
31
- protected toString(obj: any): string;
32
31
  protected setupPrintFunction(context: ExecutionContext): void;
33
32
  createNetResolver(executionStack: ExecutionContext[]): (netName: string, netNamespace: string) => {
34
33
  found: boolean;
@@ -886,7 +886,8 @@ export declare class While_exprContext extends antlr.ParserRuleContext {
886
886
  export declare class For_exprContext extends antlr.ParserRuleContext {
887
887
  constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
888
888
  For(): antlr.TerminalNode;
889
- ID(): antlr.TerminalNode;
889
+ ID(): antlr.TerminalNode[];
890
+ ID(i: number): antlr.TerminalNode | null;
890
891
  In(): antlr.TerminalNode;
891
892
  data_expr(): Data_exprContext;
892
893
  expressions_block(): Expressions_blockContext;
@@ -0,0 +1,3 @@
1
+ import { BaseVisitor } from "./BaseVisitor";
2
+ import { ExecutionContext } from "./execute";
3
+ export declare function linkBuiltInMethods(context: ExecutionContext, visitor: BaseVisitor): void;
@@ -67,7 +67,8 @@ export declare enum ComponentTypes {
67
67
  gnd = "gnd",
68
68
  net = "net",
69
69
  label = "label",
70
- point = "point"
70
+ point = "point",
71
+ frame = "frame"
71
72
  }
72
73
  export declare enum ReferenceTypes {
73
74
  function = "function",
@@ -13,7 +13,6 @@ export type ScriptOptions = {
13
13
  defaultLibsPath: string;
14
14
  dumpNets: boolean;
15
15
  dumpData: boolean;
16
- kicadNetlistPath: string | null;
17
16
  showStats: boolean;
18
17
  };
19
18
  export declare function prepareFile(textData: string): {
@@ -13,7 +13,7 @@ export declare enum FrameParamKeys {
13
13
  Width = "width",
14
14
  Height = "height",
15
15
  PaperSize = "paper_size",
16
- SheetFrame = "sheet_frame"
16
+ SheetType = "sheet_type"
17
17
  }
18
18
  export declare enum FramePlotDirection {
19
19
  Row = "row",
package/libs/lib.cst CHANGED
@@ -221,45 +221,9 @@ def arrow_point():
221
221
  path: ("M", -5, 0, "L", -20, 0)
222
222
  hpin: 1, 0, 0, 0, display_pin_id=false
223
223
 
224
- def frame_generator(paper_size_name, paper_width, paper_height, margin_x, margin_y):
225
- inner_frame_margin = 50
226
- return create component:
227
- type: "frame"
228
- display: create graphic:
229
- fill: "none"
230
-
231
- # outer rect
232
- lineColor: "#cccccc"
233
- rect: paper_width/2, paper_height/2, paper_width, paper_height
234
-
235
- # inner rect
236
- lineColor: "#111111"
237
- rect: paper_width/2, paper_height/2, paper_width - 2 * margin_x, paper_height - 2 * margin_y
238
-
239
- rect: (paper_width/2, paper_height/2,
240
- paper_width - 2 * margin_x + inner_frame_margin * 2,
241
- paper_height - 2 * margin_y + inner_frame_margin * 2)
242
-
243
- params:
244
- paper_size: paper_size_name
245
- paper_width: paper_width
246
- paper_height: paper_height
247
-
248
- offset_x: margin_x
249
- offset_y: margin_y
250
-
251
- grid_width: paper_width - 2 * margin_x
252
- grid_height: paper_height - 2 * margin_y
253
-
254
-
255
- def frame_A4 ():
256
- paper_width = 297 / 25.4 * 1000
257
- paper_height = 210 / 25.4 * 1000
258
- margin_x = 400
259
- margin_y = 400
260
-
261
- inner_frame_margin = 50
262
-
224
+ def sheet_generator(paper_size_name, paper_width, paper_height, margin_x, margin_y,
225
+ col_display_value, row_display_value, inner_frame_margin = 50):
226
+
263
227
  horizontal_1 = margin_x - inner_frame_margin
264
228
  horizontal_2 = paper_width - margin_x + inner_frame_margin
265
229
 
@@ -274,8 +238,11 @@ def frame_A4 ():
274
238
 
275
239
  fontSize = 30
276
240
 
277
- ratio_x = 0.16667
278
- ratio_y = 0.25
241
+ num_columns = len(col_display_value)
242
+ num_rows = len(row_display_value)
243
+
244
+ ratio_x = 1 / num_columns
245
+ ratio_y = 1 / num_rows
279
246
 
280
247
  return create component:
281
248
  type: "frame"
@@ -294,170 +261,47 @@ def frame_A4 ():
294
261
  paper_width - 2 * margin_x + inner_frame_margin * 2,
295
262
  paper_height - 2 * margin_y + inner_frame_margin * 2)
296
263
 
297
- hline: horizontal_1, (tmp_y + tmp_height * ratio_y), inner_frame_margin
298
- hline: horizontal_1, (tmp_y + tmp_height * ratio_y * 2), inner_frame_margin
299
- hline: horizontal_1, (tmp_y + tmp_height * ratio_y * 3), inner_frame_margin
300
-
301
- hline: horizontal_2, (tmp_y + tmp_height * ratio_y), -inner_frame_margin
302
- hline: horizontal_2, (tmp_y + tmp_height * ratio_y * 2), -inner_frame_margin
303
- hline: horizontal_2, (tmp_y + tmp_height * ratio_y * 3), -inner_frame_margin
304
-
305
- vline: (tmp_x + tmp_width * ratio_x), vertical_1, inner_frame_margin
306
- vline: (tmp_x + tmp_width * ratio_x * 2), vertical_1, inner_frame_margin
307
- vline: (tmp_x + tmp_width * ratio_x * 3), vertical_1, inner_frame_margin
308
- vline: (tmp_x + tmp_width * ratio_x * 4), vertical_1, inner_frame_margin
309
- vline: (tmp_x + tmp_width * ratio_x * 5), vertical_1, inner_frame_margin
264
+ for i in range(1, num_rows):
265
+ hline: horizontal_1, (tmp_y + tmp_height * ratio_y * i), inner_frame_margin
266
+ hline: horizontal_2, (tmp_y + tmp_height * ratio_y * i), -inner_frame_margin
310
267
 
311
- vline: (tmp_x + tmp_width * ratio_x), vertical_2, -inner_frame_margin
312
- vline: (tmp_x + tmp_width * ratio_x * 2), vertical_2, -inner_frame_margin
313
- vline: (tmp_x + tmp_width * ratio_x * 3), vertical_2, -inner_frame_margin
314
- vline: (tmp_x + tmp_width * ratio_x * 4), vertical_2, -inner_frame_margin
315
- vline: (tmp_x + tmp_width * ratio_x * 5), vertical_2, -inner_frame_margin
268
+ for i in range(1, num_columns):
269
+ vline: (tmp_x + tmp_width * ratio_x * i), vertical_1, inner_frame_margin
270
+ vline: (tmp_x + tmp_width * ratio_x * i), vertical_2, -inner_frame_margin
316
271
 
317
272
  # labels on the columns
318
- text:
319
- content: "1"
320
- offset: tmp_x + tmp_width * ratio_x * 0.5, tmp_y + inner_frame_margin * 0.5 + 2
321
- fontSize: fontSize
322
- anchor: "middle"
323
- vanchor: "middle"
324
-
325
- text:
326
- content: "1"
327
- offset: tmp_x + tmp_width * ratio_x * 0.5, tmp_y + tmp_height - inner_frame_margin * 0.5 + 2
328
- fontSize: fontSize
329
- anchor: "middle"
330
- vanchor: "middle"
331
-
332
- text:
333
- content: "2"
334
- offset: tmp_x + tmp_width * ratio_x * 1.5, tmp_y + inner_frame_margin * 0.5 + 2
335
- fontSize: fontSize
336
- anchor: "middle"
337
- vanchor: "middle"
338
-
339
- text:
340
- content: "2"
341
- offset: tmp_x + tmp_width * ratio_x * 1.5, tmp_y + tmp_height - inner_frame_margin * 0.5 + 2
342
- fontSize: fontSize
343
- anchor: "middle"
344
- vanchor: "middle"
345
-
346
- text:
347
- content: "3"
348
- offset: tmp_x + tmp_width * ratio_x * 2.5, tmp_y + inner_frame_margin * 0.5 + 2
349
- fontSize: fontSize
350
- anchor: "middle"
351
- vanchor: "middle"
352
-
353
- text:
354
- content: "3"
355
- offset: tmp_x + tmp_width * ratio_x * 2.5, tmp_y + tmp_height - inner_frame_margin * 0.5 + 2
356
- fontSize: fontSize
357
- anchor: "middle"
358
- vanchor: "middle"
359
-
360
- text:
361
- content: "4"
362
- offset: tmp_x + tmp_width * ratio_x * 3.5, tmp_y + inner_frame_margin * 0.5 + 2
363
- fontSize: fontSize
364
- anchor: "middle"
365
- vanchor: "middle"
366
-
367
- text:
368
- content: "4"
369
- offset: tmp_x + tmp_width * ratio_x * 3.5, tmp_y + tmp_height - inner_frame_margin * 0.5 + 2
370
- fontSize: fontSize
371
- anchor: "middle"
372
- vanchor: "middle"
373
-
374
- text:
375
- content: "5"
376
- offset: tmp_x + tmp_width * ratio_x * 4.5, tmp_y + inner_frame_margin * 0.5 + 2
377
- fontSize: fontSize
378
- anchor: "middle"
379
- vanchor: "middle"
380
-
381
- text:
382
- content: "5"
383
- offset: tmp_x + tmp_width * ratio_x * 4.5, tmp_y + tmp_height - inner_frame_margin * 0.5 + 2
384
- fontSize: fontSize
385
- anchor: "middle"
386
- vanchor: "middle"
387
-
388
- text:
389
- content: "6"
390
- offset: tmp_x + tmp_width * ratio_x * 5.5, tmp_y + inner_frame_margin * 0.5 + 2
391
- fontSize: fontSize
392
- anchor: "middle"
393
- vanchor: "middle"
394
-
395
- text:
396
- content: "6"
397
- offset: tmp_x + tmp_width * ratio_x * 5.5, tmp_y + tmp_height - inner_frame_margin * 0.5 + 2
398
- fontSize: fontSize
399
- anchor: "middle"
400
- vanchor: "middle"
401
-
402
- # labels on the rows
403
- text:
404
- content: "A"
405
- offset: tmp_x + inner_frame_margin * 0.5, tmp_y + tmp_height * ratio_y * 0.5
406
- fontSize: fontSize
407
- anchor: "middle"
408
- vanchor: "middle"
409
-
410
- text:
411
- content: "A"
412
- offset: tmp_x + tmp_width - inner_frame_margin * 0.5, tmp_y + tmp_height * ratio_y * 0.5
413
- fontSize: fontSize
414
- anchor: "middle"
415
- vanchor: "middle"
416
-
417
- text:
418
- content: "B"
419
- offset: tmp_x + inner_frame_margin * 0.5, tmp_y + tmp_height * ratio_y * 1.5
420
- fontSize: fontSize
421
- anchor: "middle"
422
- vanchor: "middle"
423
-
424
- text:
425
- content: "B"
426
- offset: tmp_x + tmp_width - inner_frame_margin * 0.5, tmp_y + tmp_height * ratio_y * 1.5
427
- fontSize: fontSize
428
- anchor: "middle"
429
- vanchor: "middle"
430
-
431
- text:
432
- content: "C"
433
- offset: tmp_x + inner_frame_margin * 0.5, tmp_y + tmp_height * ratio_y * 2.5
434
- fontSize: fontSize
435
- anchor: "middle"
436
- vanchor: "middle"
437
-
438
- text:
439
- content: "C"
440
- offset: tmp_x + tmp_width - inner_frame_margin * 0.5, tmp_y + tmp_height * ratio_y * 2.5
441
- fontSize: fontSize
442
- anchor: "middle"
443
- vanchor: "middle"
444
-
445
- text:
446
- content: "D"
447
- offset: tmp_x + inner_frame_margin * 0.5, tmp_y + tmp_height * ratio_y * 3.5
448
- fontSize: fontSize
449
- anchor: "middle"
450
- vanchor: "middle"
451
-
452
- text:
453
- content: "D"
454
- offset: tmp_x + tmp_width - inner_frame_margin * 0.5, tmp_y + tmp_height * ratio_y * 3.5
455
- fontSize: fontSize
456
- anchor: "middle"
457
- vanchor: "middle"
273
+ for i in col_display_value:
274
+ text:
275
+ content: i
276
+ offset: tmp_x + tmp_width * ratio_x * (0.5 + (i-1)), tmp_y + inner_frame_margin * 0.5 + 2
277
+ fontSize: fontSize
278
+ anchor: "middle"
279
+ vanchor: "middle"
280
+
281
+ text:
282
+ content: i
283
+ offset: tmp_x + tmp_width * ratio_x * (0.5 + (i-1)), tmp_y + tmp_height - inner_frame_margin * 0.5 + 2
284
+ fontSize: fontSize
285
+ anchor: "middle"
286
+ vanchor: "middle"
287
+
288
+ for index, val in enumerate(row_display_value):
289
+ text:
290
+ content: val
291
+ offset: tmp_x + inner_frame_margin * 0.5, tmp_y + tmp_height * ratio_y * (0.5 + index)
292
+ fontSize: fontSize
293
+ anchor: "middle"
294
+ vanchor: "middle"
295
+
296
+ text:
297
+ content: val
298
+ offset: tmp_x + tmp_width - inner_frame_margin * 0.5, tmp_y + tmp_height * ratio_y * (0.5 + index)
299
+ fontSize: fontSize
300
+ anchor: "middle"
301
+ vanchor: "middle"
458
302
 
459
303
  params:
460
- paper_size: "A4"
304
+ paper_size: paper_size_name
461
305
  paper_width: paper_width
462
306
  paper_height: paper_height
463
307
 
@@ -467,39 +311,48 @@ def frame_A4 ():
467
311
  grid_width: paper_width - 2 * margin_x
468
312
  grid_height: paper_height - 2 * margin_y
469
313
 
314
+ def sheet_A1():
315
+ paper_width = toMils(841)
316
+ paper_height = toMils(594)
317
+ margin = 400
470
318
 
471
- def frame_generator(paper_size_name, paper_width, paper_height, margin_x, margin_y, inner_frame_margin = 50):
472
- return create component:
473
- type: "frame"
474
- display: create graphic:
475
- fill: "none"
319
+ return sheet_generator("A1", paper_width, paper_height, margin, margin,
320
+ range(1, 17), ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"])
476
321
 
477
- # outer rect
478
- lineColor: "#cccccc"
479
- rect: paper_width/2, paper_height/2, paper_width, paper_height
322
+ def sheet_A2():
323
+ paper_width = toMils(594)
324
+ paper_height = toMils(420)
325
+ margin = 400
480
326
 
481
- # inner rect
482
- lineColor: "#111111"
483
- rect: paper_width/2, paper_height/2, paper_width - 2 * margin_x, paper_height - 2 * margin_y
327
+ return sheet_generator("A2", paper_width, paper_height, margin, margin,
328
+ range(1, 13), ["A", "B", "C", "D", "E", "F", "G", "H"])
484
329
 
485
- rect: (paper_width/2, paper_height/2,
486
- paper_width - 2 * margin_x + inner_frame_margin * 2,
487
- paper_height - 2 * margin_y + inner_frame_margin * 2)
330
+ def sheet_A3():
331
+ paper_width = toMils(420)
332
+ paper_height = toMils(297)
333
+ margin = 400
488
334
 
489
- params:
490
- paper_size: paper_size_name
491
- paper_width: paper_width
492
- paper_height: paper_height
493
-
494
- offset_x: margin_x
495
- offset_y: margin_y
496
-
497
- grid_width: paper_width - 2 * margin_x
498
- grid_height: paper_height - 2 * margin_y
335
+ return sheet_generator("A3", paper_width, paper_height, margin, margin,
336
+ range(1, 9), ["A", "B", "C", "D", "E", "F"])
337
+
338
+ def sheet_A4():
339
+ paper_width = toMils(297)
340
+ paper_height = toMils(210)
341
+ margin = 400
342
+
343
+ return sheet_generator("A4", paper_width, paper_height, margin, margin,
344
+ range(1, 7), ["A", "B", "C", "D"])
345
+
346
+ def sheet_A5():
347
+ paper_width = toMils(210)
348
+ paper_height = toMils(148)
349
+ margin = 400
350
+
351
+ return sheet_generator("A5", paper_width, paper_height, margin, margin, range(1, 5), ["A", "B", "C"])
499
352
 
500
- def frame_A6():
501
- paper_width = 148 / 25.4 * 1000
502
- paper_height = 105 / 25.4 * 1000
353
+ def sheet_A6():
354
+ paper_width = toMils(148)
355
+ paper_height = toMils(105)
503
356
  margin = 400
504
357
 
505
- return frame_generator("A6", paper_width, paper_height, margin, margin, 20)
358
+ return sheet_generator("A6", paper_width, paper_height, margin, margin, range(1, 4), ["A", "B"])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "circuitscript",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "description": "Interpreter for the circuitscript language",
5
5
  "homepage": "https://circuitscript.net",
6
6
  "engines": {
@@ -68,7 +68,8 @@
68
68
  "profile": "node --prof build/src/main.js examples/example_garden_pump.cst",
69
69
  "profile-flame": "node --prof-process --preprocess -j isolate*.log | flamebearer",
70
70
  "server": "node server.js",
71
- "pack-local": "npm pack; rm circuitscript-install.tgz; mv `ls | grep circuitscript` circuitscript-install.tgz; cp circuitscript-install.tgz ../circuitscript-vscode/client; cp circuitscript-install.tgz ../circuitscript-vscode/server"
71
+ "pack-local": "npm pack; rm circuitscript-install.tgz; mv `ls | grep circuitscript` circuitscript-install.tgz; cp circuitscript-install.tgz ../circuitscript-vscode/client; cp circuitscript-install.tgz ../circuitscript-vscode/server",
72
+ "changelog": "auto-changelog --handlebars-setup ../changelog/helper.js"
72
73
  },
73
74
  "boilerplate_author": "Jakub Synowiec <jsynowiec@users.noreply.github.com>",
74
75
  "license": "MIT",
@@ -90,5 +91,10 @@
90
91
  },
91
92
  "volta": {
92
93
  "node": "18.12.1"
94
+ },
95
+ "auto-changelog": {
96
+ "output": "CHANGELOG.md",
97
+ "commitLimit": false,
98
+ "template": "../changelog/template.hbs"
93
99
  }
94
100
  }