yaP - yet another Portablizer

If you are currently developing portable freeware or planning to do so, use this forum to discuss technical implementation, seek out like-minded developers for partnership, or solicit interested users for beta testing.
Post Reply
Message
Author
User avatar
tproli
Posts: 1172
Joined: Sat Sep 09, 2006 10:14 am
Location: Hungary
Contact:

Re: yaP - yet another Portablizer

#76 Post by tproli »

Thanks for the snippet. Things got complicated enough to exceed my knowledge so I think I will concentrate on other things, at least for a while.

Btw, I don't get this unicode thing - if it is actually that important why there's no widespread implementation in these "new" BASIC languages? I can't believe everyone has English OS who uses these applications.

User avatar
Midas
Posts: 6727
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: yaP - yet another Portablizer

#77 Post by Midas »

I, for one, never use localized Windows; local keyboard, yes, but the OS and interface is always en-US...

User avatar
Ascend4nt
Posts: 61
Joined: Fri Nov 19, 2010 10:37 am
Location: NJ, USA
Contact:

Re: yaP - yet another Portablizer

#78 Post by Ascend4nt »

tproli,
The thing you have to realize is.. well, these are 'Basic' programming languages hehe. They are retaining compatibility with a language as old as DOS* (and still maintaining support for it!), which itself never had unicode support. And most of the Basic variants out there support Linux, which uses a nice backwards-compatible UTF-8 standard (char* operations work fine with utf-8). Some people choose to deal with ANSI code pages and the like, but thats just cumbersome, problematic and impossible in some places.

Since you do work with web pages, I'm sure you must be aware that the most common format for web page content is the 'UTF-8' charset. UTF-8 is the probably the easiest unicode format to work with as far as older code and programming languages go - the string type is still 'char' (not wide char), and regular ASCII takes up the same space as always. Things look different with unicode chars (2-4 bytes), but it is still processed by the same old character string routines (well, up to a point).

Also, from what I've gleaned from the web, it *appears* that the Mac uses UTF-8 encoding in their O/S too, which means Windows is the only 'weird' language when it comes to Unicode support. If they had simply adopted UTF-8, there would be no need to do all this wide-string heavywork, but alas Windows history was made (a long 10+ years ago).

This wide-string issue is probably the thing that pisses people off the most who do cross-platform development. (including those who are working on these cross-platform languages)

Anyway.. it'd be nice to ignore it, but its still there. It'd be great to handle things as UTF-8 all over (which you probably can if you are working with any non-Windows O/S), but Windows.. well, she's a bitch!

*edit: not as old as DOS - much much older than DOS :O

User avatar
Midas
Posts: 6727
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: yaP - yet another Portablizer

#79 Post by Midas »

In the light of the issues raised here, maybe the dev gurus here at TPFC will find this interesting...

http://www.swi-prolog.org/

User avatar
Ascend4nt
Posts: 61
Joined: Fri Nov 19, 2010 10:37 am
Location: NJ, USA
Contact:

Re: yaP - yet another Portablizer

#80 Post by Ascend4nt »

Midas, I don't believe Prolog compiles to native executable..

In the meantime, I've put up two other FreeBASIC examples on PasteBin just to see if it tickles anyones fancy:

Registry Query Empty Key Example
RunWait Example

and the two prior examples:

Get Executable Filename
ShellExWait Example

All the code I've put up is pretty much just ports of stuff I've developed in C/C++. It's actually not that painful to port functions between the two..

User avatar
Midas
Posts: 6727
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: yaP - yet another Portablizer

#81 Post by Midas »

Ascend4nt wrote:Midas, I don't believe Prolog compiles to native executable...
So sorry, my knowledge is rather faint about this; I read this to mean it did:
SWI-Prolog author wrote:Portable to many platforms, including almost all Unix/Linux platforms, Windows (NT/2000/XP/Vista, including 64-bit editions), MacOS X (using X11 for graphics) and many more. Both 32-bits and 64-bits hardware is supported. Sources are plain C99, configured automatically using GNU autoconf (configure, make, make install).

User avatar
Ascend4nt
Posts: 61
Joined: Fri Nov 19, 2010 10:37 am
Location: NJ, USA
Contact:

Re: yaP - yet another Portablizer

#82 Post by Ascend4nt »

The C99 sources they are talking about - at least my interpreation of it - is what's used to build the Prolog environment (portably) on other systems.

However, I was wrong about compilation.. there is 'GNU Prolog' compiler.

But y'know.. looking briefly over the language, it doesn't look like it interacts at a low level like we need with portablizers.. at least not without some addons or plugins? Meh, either way I can't really give in to learning the syntax of another language right now though.. I'm juggling 4 or so at the moment, with C++ at the top of my heap.

I'd be curious to see someone who has learned prolog (or is willing to) to give a nice example of what it is really capable of though. I nominate Midas :)

User avatar
Midas
Posts: 6727
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: yaP - yet another Portablizer

#83 Post by Midas »

Ascend4nt wrote:I'd be curious to see someone who has learned prolog (or is willing to) to give a nice example of what it is really capable of though. I nominate Midas :)
I'm somewhat handicapped in this department, as my persistent lack of programing skills demonstrates. So, I'm not making any promises, but I'll look into it. :)

EDIT: After some summary research, SWI-Prolog seems ill suited for the end being discussed here, mostly on account of some inconvenient dependencies... :(

+ Creating a Windows console application from SWI-Prolog (http://www.swi-prolog.org/FAQ/WinExe.html):
The command below creates myapp.exe from load.pl and makes the program start at main/0

Code: Select all

 plcon -o myapp.exe -c load.pl --goal=main
To run, myapp.exe requires libpl.dll...
+ Making an executable for XPCE/SWI-Prolog applications in MS-Windows (http://www.swi-prolog.org/FAQ/PceWinExe.html):
The following DLLs seem to be a requirement for GUI apps: libpl.dll, pthreadVC.dll, pl2xpce.dll...

+ For more info, start at http://www.swi-prolog.org/FAQ/MakeExecutable.html

On a related note, I found this intriguing (but hey! I'm out of my depth here):
http://www.oxygenbasic.org/ author wrote:Basic in the QBasic genre, Oxygen can read sufficient C syntax to deal with most C headers directly, eliminating the need to translate them into Basic. [...] The compiler can also generate conventional 32/64 bit executables and dynamic link libraries.

User avatar
tproli
Posts: 1172
Joined: Sat Sep 09, 2006 10:14 am
Location: Hungary
Contact:

Re: yaP - yet another Portablizer

#84 Post by tproli »

I gave Purebasic a try (commercial :() and it's pretty neat.

I was able to move yaP to PB in a few hours and added a new feature too (admin rights check). Of course it was easy because the program logic was not changed since the last BCX rewrite. The final size is 32 KB (uncompressed).

I won't share it until I get my licence... or find another free tool that fits :) (what I doubt)

User avatar
tproli
Posts: 1172
Joined: Sat Sep 09, 2006 10:14 am
Location: Hungary
Contact:

Re: yaP - yet another Portablizer

#85 Post by tproli »

Those who are using "regedit /s" in their batch files to import and merge reg files, try using "reg import" and "reg export" to disable the UAC prompt. I will change it in all the example yaP setups.
(add /y to REG EXPORT to overwrite existing .reg file)

User avatar
Midas
Posts: 6727
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: yaP - yet another Portablizer

#86 Post by Midas »

I did... thanks for the tip. :)

User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

Re: yaP - yet another Portablizer

#87 Post by guinness »

Have you thought about using Powershell?

User avatar
tproli
Posts: 1172
Joined: Sat Sep 09, 2006 10:14 am
Location: Hungary
Contact:

Re: yaP - yet another Portablizer

#88 Post by tproli »

Can it produce small exe sizes?

Currently I'm happy with its current state (PureBasic, not released yet), many bugs were fixed and there are some important new features added (macros, environment variables, java/.net/adminrights check) while filesize is only 40 KB. But I'm not against of rewriting as a free programming language would be better to use.

User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

Re: yaP - yet another Portablizer

#89 Post by guinness »

No, it's like (loosely said) VBScript/Batch scripting.

User avatar
Ascend4nt
Posts: 61
Joined: Fri Nov 19, 2010 10:37 am
Location: NJ, USA
Contact:

Re: yaP - yet another Portablizer

#90 Post by Ascend4nt »

guinness wrote:Have you thought about using Powershell?
I was curious about Powershell myself for all of, hmm, 10 minutes.. hehe. :P

The extraordinary effort it takes just to run a .ps1 file is absurd. You need to change the execution policy (otherwise you get errors like "File C:\scripts\test.ps1 cannot be loaded because the execution of scripts is disabled on this system"). Then you need to either create a shortcut or have a batch file or other executable run the script, because double-clicking it opens up notepad. The path to the powershell script also has to be a full path, otherwise it doesn't recognize the file.

Also, other scripting files like .vbs (VBScript), .js (JScript) and .wsh (Windows Scripting Host) will *possibly* run on Windows, but there's no guarantee. They can be disabled easily, and for security they are in certain environments.

So basically the only 'sure thing' when it comes to Windows are native executables. Even batch file execution can be disabled, though that's pretty unusual in my experience..

tproli, if you're getting up to 40K, Visual C++ Express is calling your name.. :wink:

Post Reply