File: simplugin.py

package info (click to toggle)
gnucap-python 0.0.2-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 2,672 kB
  • sloc: python: 7,873; sh: 4,384; cpp: 1,786; makefile: 252
file content (42 lines) | stat: -rw-r--r-- 924 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Copyright (C) 2018 Felix Salfelder
# Author: Felix Salfelder <felix@salfelder.org>

# a simulation plugin written in python...
# load from gnucap with "python simplugin.py",
# then run "mysim".

from sys import stdout
from gnucap import out
from gnucap import install_command
from gnucap import SIM
out("... OK\n")

import sys

class mysim(SIM):
	def do_it(self, cmd, scope):
#		print("running mysim...")
		out("running mysim...\n")
	def setup(self, cmd):
		pass
		#out = IO.mstdout;
		#out.reset(); # BUG// don't know why this is needed
	def sweep(self):
		pass

sim = mysim()

d1 = install_command("test", sim)
#del(d1) #what does it do?
d1 = install_command("test", sim)

out("installing again\n")
d2 = install_command("test", sim)
out("installing again\n")
d3 = install_command("mysim", sim)

#BUG: that does not work as expected.
# it just breaks "mysim". why?
#d3 = install_command("mysim", sim)

sys.stdout.flush()