This shows you the differences between two versions of the page.
|
gmfill [2011/10/21 12:10] attila |
gmfill [2012/09/29 17:01] (current) attila [Source code] |
||
|---|---|---|---|
| Line 44: | Line 44: | ||
| # GnuMericFILLer | # GnuMericFILLer | ||
| # Fills a gnumeric workbook with values | # Fills a gnumeric workbook with values | ||
| - | # Copyright (C) 2011 Amos Brocco <amos.brocco@gmail.com> | + | # Copyright (C) 2011-2012 Amos Brocco <amos.brocco@gmail.com> |
| # | # | ||
| # This program is free software: you can redistribute it and/or modify | # This program is free software: you can redistribute it and/or modify | ||
| Line 59: | Line 59: | ||
| # along with this program. If not, see <http://www.gnu.org/licenses/>. | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| - | # version 1.02, Fri Oct 21 2011,11:53 AM | + | # version 1.03, Sat Sep 29 2012,4:57 PM |
| import sys | import sys | ||
| Line 87: | Line 87: | ||
| graph "prefix" -> creates svg files of the graphs in the current directory | graph "prefix" -> creates svg files of the graphs in the current directory | ||
| ;; -> used for comments | ;; -> used for comments | ||
| + | mem -> saves stack to temp | ||
| + | restore -> restores stack | ||
| Example: | Example: | ||
| Line 125: | Line 127: | ||
| self.stack = [] | self.stack = [] | ||
| self.template = None | self.template = None | ||
| + | self.mem = [] | ||
| self.tvars = {} | self.tvars = {} | ||
| self.defaultsheet = None | self.defaultsheet = None | ||
| Line 287: | Line 290: | ||
| vname = tokens.pop() | vname = tokens.pop() | ||
| vvalue = tokens.pop() | vvalue = tokens.pop() | ||
| - | self.tvars["$$%s" % vname] = vvalue | + | self.tvars["$$%s" % vname] = vvalue |
| + | |||
| + | def doMem(self, tokens): | ||
| + | self.mem = [] | ||
| + | for e in self.stack: | ||
| + | self.mem.append(e) | ||
| + | |||
| + | def doRestore(self, tokens): | ||
| + | for e in self.mem: | ||
| + | self.stack.append(e) | ||
| def doWrite(self, tokens): | def doWrite(self, tokens): | ||
| Line 413: | Line 425: | ||
| elif (cmd == "dup"): | elif (cmd == "dup"): | ||
| self.doDup(tk) | self.doDup(tk) | ||
| + | elif (cmd == "mem"): | ||
| + | self.doMem(tk) | ||
| + | elif (cmd == "restore"): | ||
| + | self.doRestore(tk) | ||
| if len(sys.argv) < 2: | if len(sys.argv) < 2: | ||