FreeBasic IDE-poseidonFB(Update 2024.03.03)

User projects written in or related to FreeBASIC.
Post Reply
kcvinu
Posts: 232
Joined: Oct 07, 2015 16:44
Location: Keralam, India

Re: FreeBasic IDE-poseidonFB(Update 2018.02.23)

Post by kcvinu »

Oh, i see. Thank you sancho3. I thought it is a data type like in c++.
Kuan Hsu
Posts: 586
Joined: Sep 16, 2007 15:12
Location: Taiwan

Re: FreeBasic IDE-poseidonFB(Update 2018.02.23)

Post by Kuan Hsu »

kcvinu wrote:Oh, i see. Thank you sancho3. I thought it is a data type like in c++.
As I said before, we can self-define words by setting "Keywords", no matter about they are freeBASIC keywords or not......^^
kcvinu
Posts: 232
Joined: Oct 07, 2015 16:44
Location: Keralam, India

Re: FreeBasic IDE-poseidonFB(Update 2018.02.23)

Post by kcvinu »

Thanks @Kuan Hsu. By the way, please dont take this wrong because, i have a few requests.
1. Automatic end keyword feature has a bug. For example when we hit enter key upon a line which contains a starting keyword like "namespace", "type", poseidon will automatically put an appropriate end key word right under the line and place an empty line in the middle of that tow lines and place the cursor there. Its ok. But if we place the cursor upon the top line and hit enter key once again, the poseidon will automatically put an end keyword for "namespace", "type" again. So i think a little bit of work need to fix this.
2. For beauty purpose, i need to create a manifest file in my gui projects. ( I think you are aware of this manifest file stuff) Could you please make an option to create a manifest file in the exe file's same name ?. I mean when someone wants to create a gui project in Poseidon, when they hit "Compile and Run" first time, poseidon should check if there is file named :exe_name.exe.manifest". If there is not a file in that name, then copy the manifest file from a pre-defined path and rename it.
Kuan Hsu
Posts: 586
Joined: Sep 16, 2007 15:12
Location: Taiwan

Re: FreeBasic IDE-poseidonFB(Update 2018.02.23)

Post by Kuan Hsu »

kcvinu wrote:Thanks @Kuan Hsu. By the way, please dont take this wrong because, i have a few requests.
1. Automatic end keyword feature has a bug. For example when we hit enter key upon a line which contains a starting keyword like "namespace", "type", poseidon will automatically put an appropriate end key word right under the line and place an empty line in the middle of that tow lines and place the cursor there. Its ok. But if we place the cursor upon the top line and hit enter key once again, the poseidon will automatically put an end keyword for "namespace", "type" again. So i think a little bit of work need to fix this.
2. For beauty purpose, i need to create a manifest file in my gui projects. ( I think you are aware of this manifest file stuff) Could you please make an option to create a manifest file in the exe file's same name ?. I mean when someone wants to create a gui project in Poseidon, when they hit "Compile and Run" first time, poseidon should check if there is file named :exe_name.exe.manifest". If there is not a file in that name, then copy the manifest file from a pre-defined path and rename it.
(1) Please check rev.369/370~~
(2) I think I will not make default in poseidonFB, but we can write a little custom tool and run it.
I create a makeManifest.exe and set it to a custom tool:( I know the manifest work in Windows, just a example )
Image
Click "Options" -> "Tools" -> "makeManifest"
or
Ctrl + Shift +F1~F9
to create *.exe.manifest

makeManifest.bas:

Code: Select all

dim as string inFileName, outFileName

if( __fb_argc__ >= 2 ) then
	
	inFileName = command(1)
	dim as integer length = len( inFileName )
	
	if( right( inFileName, 1 ) <> "/" ) then
		if( right( lcase(inFileName), 4 ) = ".bas" ) then
			inFileName = left( inFileName, length - 4 )
			outFileName = inFileName + ".exe.manifest"
		else
			outFileName = inFileName + ".exe.manifest"
		end if
	else
		length -= 1
		inFileName = left( inFileName, length )
		
		dim as integer _pos = InStrRev( inFileName, "/" )
		if( _pos > 0 ) then
			dim as string fn = right( inFileName, length - _pos )
			outFileName = inFileName + "/" + fn + ".exe.manifest"
		end if
		
	end if

	dim as string txt
	
	txt	 = !"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
	txt	+= !"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">\n"
	txt	+= !"<assemblyIdentity\n"
	txt	+= !"	version=\"1.0.0.0\"\n"
	txt	+= !"	processorArchitecture=\"X86\"\n"
	txt	+= !"	name=\"CompanyName.ProductName.YourApplication\"\n"
	txt	+= !"	type=\"win32\"\n"
	txt	+= !"/>\n"
	txt	+= !"<description>Your application description here.</description>\n"
	txt	+= !"<dependency>\n"
	txt	+= !"	<dependentAssembly>\n"
	txt	+= !"		<assemblyIdentity\n"
	txt	+= !"			type=\"win32\"\n"
	txt	+= !"			name=\"Microsoft.Windows.Common-Controls\"\n"
	txt	+= !"			version=\"6.0.0.0\"\n"
	txt	+= !"			processorArchitecture=\"X86\"\n"
	txt	+= !"			publicKeyToken=\"6595b64144ccf1df\"\n"
	txt	+= !"			language=\"*\"\n"
	txt	+= !"		/>\n"
	txt	+= !"	</dependentAssembly>\n"
	txt	+= !"</dependency>\n"
	txt	+= !"</assembly>\n"
	
	open outFileName for output encoding "utf8" as #1
	
	if put( #1, 1, txt ) <> 0 then
		print "Error! File Write Error!"
	else
		print "Create " + outFileName + " ......OK"
	end if		

	close	
	
else
	print "Warning! No Enough Args!"
end if

sleep
end
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: FreeBasic IDE-poseidonFB(Update 2018.02.27)

Post by deltarho[1859] »

For what it is worth I think it better to create a bespoke reource file.

This is what I am using for my latest project.
RSA-ECDSA.rc

Code: Select all

#define IDR_VERSION 1
 
100 icon padlock.ico
101 bitmap DRmed.bmp
102 icon FB_Icon.ico
 
IDR_VERSION VERSIONINFO
FILEVERSION 1,0,0,0000
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
BEGIN
  BLOCK "StringFileInfo"
  BEGIN
    BLOCK "080904E4"
    BEGIN
      VALUE "FileDescription", "RSA and ECDSA\0"
      VALUE "ProductName", "RSA-ECDSA\0"
      VALUE "LegalCopyright", " \251 2018 David Roberts\0"
    END
  END
  BLOCK "VarFileInfo"
  BEGIN
    VALUE "Translation", 0x0809, 0x04E4
  END
END
 
1 24 "Theme.xml"
If we have no images to import or don't want a specific property sheet then the rc file may be reduced to simply ' 1 24 "Theme.xml" '.

The additional compiler option swiches are '-gen gcc -Wc -O3 RSA-ECDSA.rc'; that is additional to '-s gui' or '-s console', for example.

This is my Theme.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
 
    <assemblyIdentity
        version="1.0.0.1"
        processorArchitecture="*"
        name="MyAppName.exe"
        type="win32"
    />
    <description>Optional MyDescription for MyAppName.exe</description>
 
    <asmv3:application>
        <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
        <dpiAware>true</dpiAware>
        </asmv3:windowsSettings>
    </asmv3:application>
 
    <!-- Compatibility section for Program Compatibility Assistant (PCA) -->
    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
        <application>
            <!-- Windows Vista -->
            <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
            <!-- Windows 7 -->
            <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
            <!-- Windows 8 -->
            <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
            <!-- Windows 8.1 -->
            <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
            <!-- Windows 10 -->
            <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
        </application>
    </compatibility>
 
    <!-- Trustinfo section for User Account Control (UAC) -->
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
        <security>
            <requestedPrivileges>
                <!-- level   = "asInvoker"            -->
                <!-- level   = "highestAvailable"     -->
                <!-- level   = "requireAdministrator" -->
                <requestedExecutionLevel
                    level    = "asInvoker"
                    uiAccess = "false"
                />
            </requestedPrivileges>
        </security>
    </trustInfo>
 
    <!-- Dependency section -->
    <dependency>
        <dependentAssembly>
            <assemblyIdentity
                type="win32"
                name="Microsoft.Windows.Common-Controls"
                version="6.0.0.0"
                processorArchitecture="*"
                publicKeyToken="6595b64144ccf1df"
                language="*"
            />
        </dependentAssembly>
    </dependency>
 
</assembly>
kcvinu
Posts: 232
Joined: Oct 07, 2015 16:44
Location: Keralam, India

Re: FreeBasic IDE-poseidonFB(Update 2018.02.27)

Post by kcvinu »

@ Kuan Hsu
Thanks for the custom tools. Thats great. Will check it and inform you.

@ deltarho[1859]
I have read somewhere that we can include these manifest data inside our exe file with the help of a rc file. But i dont know how to do that. Thanks for the info.
So what i understand from your post is ;
Step 1 - Cretae a rc file named filename.rc in the same folder of our exe file and write like this " 1 24 "Theme.xml"
Step 2 - Put the theme.xml file in the same folder.

Step 3 - Change compiler option to " -s gui -gen gcc -Wc -O3 filename.rc"
Please correct me if i am wrong.
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: FreeBasic IDE-poseidonFB(Update 2018.02.27)

Post by deltarho[1859] »

@kcvinu

Exactly. It is the easiest way to theme a gui.

Of course, Step 3 could simply be '-s gui filename.rc' or '-s console filename.rc'.
kcvinu
Posts: 232
Joined: Oct 07, 2015 16:44
Location: Keralam, India

Re: FreeBasic IDE-poseidonFB(Update 2018.02.27)

Post by kcvinu »

@ deltarho[1859]
Thank you.
Kuan Hsu
Posts: 586
Joined: Sep 16, 2007 15:12
Location: Taiwan

Re: FreeBasic IDE-poseidonFB(Update 2018.02.27)

Post by Kuan Hsu »

kcvinu wrote:@ deltarho[1859]
Thank you.
Another Step 3 - In "Project Panel", right click "Others", add filename.rc then build the project.....
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: FreeBasic IDE-poseidonFB(Update 2018.02.27)

Post by Dinosaur »

Hi All

I seem to be always doing the Project thing wrong.

I create the project, add the files, fill in the properties etc, etc.

Then OK I goto "Build Project" or "Rebuild Project" and get hundreds of errors.

Goto "Build File" whilst focus on "Main basic File" and all is good.
Main Basic file has:
#include once "Project.bi"
which has
#include once "libusb-1.0.bi"
#include once "fbthread.bi"
#include once "Types.bi"
#include once "declares.bi"
#include once "AIO-usb.bas"

in it.

So, what is the point of a "Project" and how do I build it so it behaves ?

Regards
Kuan Hsu
Posts: 586
Joined: Sep 16, 2007 15:12
Location: Taiwan

Re: FreeBasic IDE-poseidonFB(Update 2018.02.27)

Post by Kuan Hsu »

Dinosaur wrote:Goto "Build File" whilst focus on "Main basic File" and all is good.
"Build File" and Main basic File? Do you mean "Main File" in "Project Properties..." ?
I think the issue is about entry point and compiler....

freeBASIC is a interest language, but sometime it confuse me, like below:
Image
I want the result is:
a.bas
b.bas
Sleeping......in b.bas
Sleeping......in a.bas

But the output is like the image, I need compile only a.bas to get what I wnat......

So in my freeBASIC projects, the *.bi is just include files, every #include are #include "*.bi" not #include "*.bas"......
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: FreeBasic IDE-poseidonFB(Update 2018.02.27)

Post by Dinosaur »

Hi All

Ever since QBasic I did as follows:
Main.bas with the first line = #Include Project.bi

In that Project.bi:
#Include Types.bi
#Include Declares.bi
etc
etc
#Include Module01.bas
#Include Module02.bas
etc
etc
In the Editor (same with Geany) I make sure that Main.bas is in focus in the editing window, or in the Project Window,
Press Compile Button and no errors. So it compiles Main.bas and honours the Project.bi file by reading it
and including the files nominated.

Using "Build Project" or "ReBuild Project" throws hundreds of declare errors as if it simply is NOT reading the Project.bi file.
So how do the others make a "Project" work in this Editor ?

Regards
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: FreeBasic IDE-poseidonFB(Update 2018.02.27)

Post by caseih »

Kuan Hsu, your question is best left in the the other thread, viewtopic.php?t=26466. This really isn't a PoseidonFB-related issue.

But the short answer is, main-level code in non-main .bas files is for initialization of the code in that code unit, and not intended to be part of your overall main program. There's no guarantee of the order in which the linker will place everything together, and thus no guarantee of the order in which this module-level initialization code will execute. It's really unusual to put main-level code in more than one .bas file and expect it all to be combined into one coherent program. Why do you want to do such a thing? Variables defined in one .bas file are not by default visible in another .bas file either unless you use the extern keyword to bring them in.

Select one .bas file as your main module as Dinosaur suggests, and limit your other .bas files to functions and subs (unless you need to do initialization of module global variables).
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: FreeBasic IDE-poseidonFB(Update 2018.02.27)

Post by caseih »

Dinosaur wrote:Using "Build Project" or "ReBuild Project" throws hundreds of declare errors as if it simply is NOT reading the Project.bi file.
So how do the others make a "Project" work in this Editor ?
Wait, so you have a project with several files including Module01.bas, module02.bas, and you also are using project.bi to include everything into one file? No wonder you're seeing errors. PoseidenFB is compiling each .bas file separately, yet you have a project.bi file that's including all the .bas files, leading to all sorts of duplicate symbols and errors. Am I right? You're basically fighting the build system. Eliminate your project.bi file entirely, and let the IDE compile and link your individual modules and you should have no problems.

Never include .bas files. With a proper build system there's just no reason to ever do this. Only include .bi files. In fact with an IDE you really can't include .bas files without leading to errors as you've found.

A project should consist of a main .bas file, and all your module .bas files. Each module .bas file should have a corresponding .bi file that defines all the types and external interfaces for that file (functions, subs, classes, etc), and is itself included by the module .bas file. Your main .bas should include all the necessary .bi files from your modules to make appropriate function calls and instantiate classes (this may not mean all the .bi files... some might just be for other module .bas files).
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: FreeBasic IDE-poseidonFB(Update 2018.02.27)

Post by Dinosaur »

Hi All

Caseih you have misunderstood my process.

I am having problems utilising the "Project" concept in Poseidon.

As I just noted in the Beginners thread, the preferred method is entirely up to your preference.
Here an example of one project, where the Main.bas file has one #Include Project.bi .

Code: Select all

#Include once "allegro.bi"
#Include once "cgui.bi"
#include once "file.bi"
#Include once "types.bi"
#Include once "IA3125.bi"
#Include once "declares.bi"
#Include once "presets.bi"
#Include Once "Win01.bas"
#Include Once "Win02.bas"
#Include Once "WinHelp.bas"
#Include Once "RunMod00.bas"
#Include Once "RunMod01.bas"
#Include Once "IA3125.bas"
Compile that one Main.bas file with the compile button in the editor and the integrity of the code is intact with no duplicates or errors.
Post Reply