View Single Post
Old 27th March 2004, 10:14   #20
TomyLobo
Major Dude
 
TomyLobo's Avatar
 
Join Date: Feb 2004
Location: Germany
Posts: 580
Nice idea Zevensoft

I picked out some advantages and disadvantages of using your program instead of mine:

advantages:
- you don't have to learn the AVS language
- you can use (parts of) existing VB6 programs directly in AVS
- easy (g)megabuf handling

disadvantages:
- you have to learn VB6
- with the easy (g)megabuf handling of your program you don't know what is in your (g)megabuf and where, so you have to write the whole code in VB6
- you have to convert AVS code to VB6 (which your program can't do yet) to use it in your program
- you don't work close to the AVS language anymore and it's hard to optimize your program's output. this is also true for my program, but you can optimize before translating as my program doesn't add any extra commands. I tested that: "a=b; c=d;" and "exec2(assign(a,b),assign(c,d));" both generate 37 bytes code
- your program always creates assign(...)+assign(...), which is slighty slower than the exec2/3() blocks my program creates (feel free to take the "mkexecs" function from my program to achieve this, it needs to be called until the array of commands has only 1 element left)
code:

While UBound(outField) > 0
outField = mkexecs(outField)
Wend
tmpExecForm = outField(0)


(assumes LBound(outField) = 0)
- your program only supports a finite number of flow control operations. For example if Nullsoft decided to implement something like While...Wend from VB6 in AVS, you have to change your program. I don't need to change mine because it accepts assignments inside all functions. you could for example write
code:

a=b;
c=getosc(
d=e
,
f=g
,
h=i
)


in my program and it would convert it to strange but working AVS code.

Bugs(or maybe not yet implemented features? ) I found:

That code example you supplied is not VB6 but it looks like VB6
VB6 needs ReDims for dynamic arrays and you write MOD instead of %
try this for the modulo problem:
code:

Temp = Join(Split(" mod ", Input, , vbTextCompare), "%")


this replaces " mod " (case insensitive) by "%", which should be enough since the VB6 IDE formats the code this way...

try to convert
code:

a=b:b=c


it won't work... multiple commands in 1 line are sometimes needed in order to preserve clarity

btw your program generates an "index out of range" error for this code:
code:

for i=1 to 2
a=b
next i


fix this

Your program doesn't support comments (yet). Try using a modified version of the FilterComments() function in my program if you want. (assume FilterAll = True and remove everything that is not executed with this assumption to leave out all the stuff i use for the Comment Codes)

btw there's a new version (1.8.01) on my page and I will put 1.9.00 there, soon, which will support easier megabuf assignments. I'm starting to write this now

[edit]
Hmm this was 2 lines of code added.
The uploading was the hardest part
[/edit]
TomyLobo is offline   Reply With Quote