Real Software Forums
http://forums.realsoftware.com/

iOS Compiler from VB to RB
http://forums.realsoftware.com/viewtopic.php?f=13&t=40043
Page 1 of 5

Author:  simulanics [ Thu Jul 28, 2011 1:57 am ]
Post subject:  iOS Compiler from VB to RB

I have a compiler which I've developed to create apps on Windows for iPhone and iPad, in Visual Basic. I have ported about 80% of the code to RB so that iOS compiling will be possible on Windows, Mac, and Linux in a smaller than XCode..but XCode similar environment which can be stored on a flash drive or other portable media..in order to finish the project (which is yes, free) I need to convert the following code from Visual Basic 6.0 to Real Studio 2011 but have no idea where to begin with this one..the Resource lines are an array..but writing the array in the necessary sequence and appending correctly has me baffled :-)


'=============================================
' iOS Compiler with 4.0 Optimization
' Module: NIB Creation
' By: Matthew Combatti
' http://www.oh-darn.com
'=============================================
Dim ResourceData(4)

If Dir(".\MainWindow.nib") <> "" Then
Kill ".\MainWindow.nib"
End If

ResourceData(1) = "4E4942417263686976651 0 0 0 9 0 0 0 120 0 0 320 0 0 190 0 0 680 0 0 2E0 0 0 F51 0 0 8 0 0 0 3F3"
ResourceData(2) = "55494E6962456E636F646572456D7074794B6579875549477265656E885943656E"
ResourceData(3) = "658AA 2 0 0 0 82A 4 0 0 0 90A 9 0 0 0 95A 1 0 0 0 86A 1 0 0 0 835 835 87A 8 0 0 0 87A"
ResourceData(4) = "0 4 916 0 0 803F886 0 0 803F816 0 0 803F936 0 0 803F8F8 9A57656256696577547"
DF = FreeFile
Open ".\MainWindow.nib" For Output As #DF
For i = 1 To 4
a$ = ResourceData$(i)
While Len(a$) > 0
b$ = "&H" & Left$(a$, 2)
a$ = Right$(a$, Len(a$) - 2)
Print #DF, Chr$(Val(b$));
Wend
Next i
Close #DF

Author:  PeDre [ Thu Jul 28, 2011 8:32 am ]
Post subject:  Re: iOS Compiler from VB to RB

Hello,

is not well tested, but should work.

Peter

Sub Test()
Dim ResourceData(4) As String

Dim f as FolderItem
f = GetFolderItem("E:\MainWindow.nib")
If (f <> Nil) And f.Exists Then
f.Delete
End If

ResourceData(1) = "4E4942417263686976651 0 0 0 9 0 0 0 120 0 0 320 0 0 190 0 0 680 0 0 2E0 0 0 F51 0 0 8 0 0 0 3F3"
ResourceData(2) = "55494E6962456E636F646572456D7074794B6579875549477265656E885943656E"
ResourceData(3) = "658AA 2 0 0 0 82A 4 0 0 0 90A 9 0 0 0 95A 1 0 0 0 86A 1 0 0 0 835 835 87A 8 0 0 0 87A"
ResourceData(4) = "0 4 916 0 0 803F886 0 0 803F816 0 0 803F936 0 0 803F8F8 9A57656256696577547"

Dim c,k, iLen As Integer
Dim iByte As Integer
Dim s As String
Dim b as BinaryStream
f = GetFolderItem("E:\MainWindow.nib")
If f <> Nil then
b = BinaryStream.Create(f, True)
For c = 1 To 4
iLen = ResourceData(c).Len
For k = 1 To iLen Step 2
s = Mid(ResourceData(c), k, 2)
iByte = Val("&h" + s)
b.WriteByte(iByte)
Next k
Next c
b.Close
End if
End Sub

Author:  DaveS [ Thu Jul 28, 2011 9:58 am ]
Post subject:  Re: iOS Compiler from VB to RB

to make this work on a Mac you might want to look into your filename structures.... "E:\xxxx" won't work

Author:  simulanics [ Thu Jul 28, 2011 3:05 pm ]
Post subject:  Re: iOS Compiler from VB to RB

Could I still use a "./MainWindow.nib" for the current or same directory? Or would it be wiser to use the FolderParent/Child options of the Folder object for file locations on Mac? So far the interface builder and such work great, kind of like the RB of iOS programming :-) but I'm use to c/c++ code, figure this project could make the app development for iOS much faster and more available OS wise... The compiler translates a self-made language(almost the same as RB/vb) into pure C-Object and compiles with a platform ARM GCC 4.2, to ensure no problems if cocoa or other feature SDKs are added. I've written a number of compilers and assemblers, and IDE builders from scratch in pure C, JavaScript/query, python n some others... But I'm still getting use to this RAD programming.. For me a notepad, terminal prompt, and a few header files work much quicker..:-p

Author:  simulanics [ Thu Jul 28, 2011 3:35 pm ]
Post subject:  Re: iOS Compiler from VB to RB

btw, code works great! and yes ./ does work mac :-) I will post updates or any more questions here as I complete the project as well as the finished source and binaries :-)

THANK YOU FOR THE CODE AND HELP! YOUR'RE AWESOME!

Author:  simulanics [ Sat Jul 30, 2011 9:50 pm ]
Post subject:  Re: iOS Compiler from VB to RB

Ok, so now I'm stumped on using RB to create a folder...the .parent and .child have me confused and ive combed multiple resources. in VB one can simply use mkdir(destination).

Author:  simulanics [ Sat Jul 30, 2011 9:56 pm ]
Post subject:  Re: iOS Compiler from VB to RB

simulanics wrote:
Ok, so now I'm stumped on using RB to create a folder...the .parent and .child have me confused and ive combed multiple resources. in VB one can simply use mkdir(destination).


Ive tried

Dim f as folderitem
f = getfolderitem("./")
f.child("temp").CreateAsFolder

to create a "temp" folder in the base application directory...
it works for windows, it works for mac...it doesn't work for linux...
am I missing something...

Author:  simulanics [ Sat Jul 30, 2011 10:51 pm ]
Post subject:  Re: iOS Compiler from VB to RB

sorry for all the posts, but I'm sure they may help someone else... I have figured out everything..there was an error in the #if...#endif targeting for OS's

now my only true problem is implementing a simple cross-platform zip capability for zipping a single directory and all subdirectories and sub-files beneath it :-(

the compiler is about 90% complete at this point...

Author:  kermit [ Sun Jul 31, 2011 1:20 am ]
Post subject:  Re: iOS Compiler from VB to RB

Quote:
now my only true problem is implementing a simple cross-platform zip capability for zipping a single directory and all subdirectories and sub-files beneath it


There are a few cross platform zip utilities around.
I use the one provided by Thomas Tempelmann
http://www.tempel.org/RB/ZipPackage

Its free in the basic form, and only $35 to unlock a nifty feature called ZipFolderItem
The class is all you need in OSX, while for Windows you need to track down the zlib all (free to distribute) and bundle that with your app.

Author:  simulanics [ Sun Jul 31, 2011 4:20 am ]
Post subject:  Re: iOS Compiler from VB to RB

kermit wrote:
Quote:
now my only true problem is implementing a simple cross-platform zip capability for zipping a single directory and all subdirectories and sub-files beneath it


There are a few cross platform zip utilities around.
I use the one provided by Thomas Tempelmann
http://www.tempel.org/RB/ZipPackage

Its free in the basic form, and only $35 to unlock a nifty feature called ZipFolderItem
The class is all you need in OSX, while for Windows you need to track down the zlib all (free to distribute) and bundle that with your app.



I have tried this :-) trying to utilize zipmbs and have the app automatically "installing" zlib if not found on windows in volume(0) system folder. I can use zipmbs to class.creatfile("zipname.zip") and add single files.. But as far as recursing.. I'm experiencing files... I've played with the compression examples and keep getting an error with the item property (which is an array) :-( any code would help.. This is pretty much the only thing preventing the project from being 100% complete as iPhone/iPad/iPod touch bundles are zip folders with an "ipa" extension instead of zip. I have managed to bypass apples proprietary coding which prevents Linux and windows development without huge packages like dragonsdk or marmalade which depends on visual studio.. I've managed to use direct binary to create a vb/RB of iOS development.. Basically an assembler which is still able to be code signed with a valid apple keychain... The vb version works great and I've submitted quite a few apps to the i store without apple knowing none the wiser that the code wasn't compiled by gcc via Xcode :-) but RB has been quite a rough transition in some spots :-( but no sdk is required or comilers and linkers.. Just one program that just under 7 mb compiled and 3 mb if compressed with UPX. So I definitely appreciate all your help.

Author:  Caronte3D [ Sat Oct 22, 2011 9:30 am ]
Post subject:  Re: iOS Compiler from VB to RB

WOW! :shock:
This project looks awesome, can't wait to test it!
I hope you solve the problem soon.
Good luck! :wink:

Author:  kermit [ Sat Oct 22, 2011 9:59 am ]
Post subject:  Re: iOS Compiler from VB to RB

OK.. that was July, and nothing since?

Quote:
I've played with the compression examples and keep getting an error with the item property (which is an array) any code would help.


And the lines of code that didn't work are...?

Author:  simulanics [ Sat Oct 22, 2011 10:24 am ]
Post subject:  Re: iOS Compiler from VB to RB

The compiler works perfect... Am adding the ios5 features to the IDE at the moment... Sorry for the delay... Has been more of a hobby to prove a point than anything :-) will post an update soon.

Author:  Caronte3D [ Sat Oct 22, 2011 12:44 pm ]
Post subject:  Re: iOS Compiler from VB to RB

Good news!
If you need a beta tester before launch the app, tell me :wink:

Author:  Kyan [ Sat Oct 22, 2011 2:34 pm ]
Post subject:  Re: iOS Compiler from VB to RB

Absolutely looking forward to this!

Also: How will it work?

Page 1 of 5 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/