Home | Reviews | GUIpedia | Forum | Fun500
aguma | Spark v4Well so far I have a basic command set and multitasking - the multitasking is different, though: because the script engine (Frontier) can only execute one program at a time, we save all the stuff about all the programs in a big array, and set the current program variable to the value in the array when we run it. So like this:
[code]
dim Prog as ProgType
dim AllProgs(1 to 20) as ProgType
for x = 1 to 20
Prog = AllProgs(x)
Execute
next x
[/code]
So much easier to code! | 2009-04-13 | 10:09 PM |
pharoah | Re:Spark v4That's more or less how Coblat works. Since I use allocate & deallocate, I can have what amounts to dynamic arrays inside dynamic arrays, so I can have an unlimited number of scripts each with an unlimited number of variables.
I'll bet it's a lot easier... the sheer number of globals made trying to figure out your spark code very difficult. | 2009-04-13 | 11:05 PM |
ksr | Re:Spark v4[b]Pharoah wrote:[/b]
[quote]I can have an unlimited number of scripts each with an unlimited number of variables.[/quote]
*envies*
This is my application prototype:
[code]
type application
'tnt
variables as integer 'no. of variables
variable(500) as variable 'variable array
funcs as integer 'no. of functions
func(50) as variable 'function array
funcargs as stack 'function arguments
lines as integer 'no. of lines
lineptr as integer 'current line
linen(500) as string 'line array
repeatline as integer 'repeat line flag
control as stack 'i forget
lastif as integer 'ptr to last if
kbuffer as string 'keyboard buffer
'reflow
filename as string
fileid as integer
declare sub execute()
declare function cmd(cmdstring as string) as string
declare function parsearg(cmdstring as string, arg as integer) as string
declare function resolve(s as string) as string
end type[/code]
As you can see, there is a fixed number of variables, functions and script lines (which probably need changing) for each program, because FreeBASIC doesn't like you redimming arrays within types. Does anyone know of a way around this? | 2009-04-14 | 1:29 PM |
pharoah | Re:Spark v4Let's say you want each app to have unlimited string variables. In your app type definition you'd have something like:
vars as integer
var as zstring ptr ptr
Var points to
---->an array of pointers to
---------->zstrings (null terminated strings)
you use var instead of a simple array of pointers so you can add new vars
You need a second level because strings can be different sizes, so you can't make an array of strings be contiguous in memnory.
Then you use realloc to resize the various array levels.
Edit:
You don't need an array to store all the script lines, store the whole script in a single string (use binary get to read it from the file). Then locations that store positions of labels or functions or whatever can use character number in string instead of line. | 2009-04-14 | 3:15 PM |
ksr | Re:Spark v4I see, thanks a lot for that. | 2009-04-14 | 5:25 PM |
aguma | Re:Spark v4Quick question: does FB's mouse stuff work in text mode? It doesn't want to turn on, and I'm pretty sure it's not the script's fault. | 2009-04-14 | 8:08 PM |
pharoah | Re:Spark v4I've wondered about that myself. Anyone know? | 2009-04-14 | 8:24 PM |
aguma | Re:Spark v4Looked it up, you can't. :( | 2009-04-14 | 11:11 PM |
aguma | Re:Spark v4Should the windowing engine be written in my scripting language, or should it be in FB? | 2009-04-14 | 11:30 PM |
Brandon | Re:Spark v4FB is faster, scripter is cooler. | 2009-04-15 | 7:47 AM |
pharoah | Re:Spark v4It depends on how complex and full featured your inter-process communication is and whether you have arrays and the like in your scripting language. As Brandon said, FB will always be faster. The scripting route means you'll basically have a microkernel GUI. Scripts that need a window will have to communicate with the running window manager script and ask for a place to draw things, and they'll have to tell it what to draw so that windows can be composited. The cool thing is that if you do it right, you might be able to have one window session inside another.
It's basically windows vs linux architecture. | 2009-04-15 | 10:11 AM |
aguma | Re:Spark v4Well I think I'm going to code it in my scripting language, because I'm getting very bored with the way I have to code it normally. | 2009-04-15 | 6:00 PM |
Other
2021 Brandon Cornell