Wiki improvements

Forum for discussion about the documentation project.
Post Reply
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

fxm wrote: Jun 24, 2022 9:26 Bug report filled in:
#963 Depending on backend, 'SGN' returns different types

The chosen solving is to update the documentation description according to the current behavior of SGN:
  • KeyPgSgn → fxm [SGN return type depends on passed argument and backend]
SARG
Posts: 1755
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Wiki improvements

Post by SARG »

I tried to change the returned type by sgn in gas32 to long to be homogeneous but too complicated for a very small benefit.
Now sgn in gas64 uses direct asm code instead a function call, except for floats, and returning an integer is more efficient.
So updating the documentation is the 'best' solution.

Reminder : Chm file up to date (if I don't forget to check...) https://users.freebasic-portal.de/sarg/fbdoc.chm
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

SARG wrote: Aug 10, 2022 10:02 So updating the documentation is the 'best' solution.
That was also Jeff's opinion after looking at the code.

SARG wrote: Aug 10, 2022 10:02 Reminder : Chm file up to date (if I don't forget to check...) https://users.freebasic-portal.de/sarg/fbdoc.chm
Thanks.
SARG
Posts: 1755
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Wiki improvements

Post by SARG »

@fxm
When helping demosthenesk to use Newt library (a C library) I struggled to find the valid alias for a function.
The example of declare for a sub without any parameter is to simple.
I suggest to add something like that :

Code: Select all

declare function myfunction alias "MyFunctioninLib" (as long , as long,  as zstring ptr) as integer
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

What documentation page are you talking about ?
SARG
Posts: 1755
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Wiki improvements

Post by SARG »

https://www.freebasic.net/wiki/KeyPgAlias
There is only :

Code: Select all

Declare Sub ClearVideoScreen Alias "xClearScreen" ()
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

OK for adding that.

(note: the most complete syntax for declaring a Sub or Function is on the Sub or Function page)
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

Done:
- KeyPgAlias → fxm [added example]
SARG
Posts: 1755
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Wiki improvements

Post by SARG »

Thanks.
fxm wrote: Oct 02, 2022 8:51 (note: the most complete syntax for declaring a Sub or Function is on the Sub or Function page)
I agree but there is no example of alias in the sub/function page.

As usually new chm file available here : https://users.freebasic-portal.de/sarg/fbdoc.chm
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: Wiki improvements

Post by VANYA »

By the way, I wanted to ask: why did ALIAS apply to TYPE?
How to use it? :

Code: Select all

type A alias "AA"
	i as Long
end type

dim q as A
dim q1 as AA ' error
so why do you need alias in Type?
Last edited by VANYA on Oct 02, 2022 14:41, edited 1 time in total.
SARG
Posts: 1755
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Wiki improvements

Post by SARG »

Look at the page type alias in thé manuel.
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: Wiki improvements

Post by VANYA »

Slightly corrected the example (I forgot the quotes)
Look at the page type alias in thé manuel.
I didn't find anything there. There is no usage example, at least this one:

type A alias "aliasname"
SARG
Posts: 1755
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Wiki improvements

Post by SARG »

Sorry I did a confusion.

Extracted from manual, page Alias (Modifier) :
Alias modifies the data type name mangling (decoration) of a public symbol
Alias "modifier", when specified following a data type, gives an alternate meaning to the data type, which may be needed for linking with languages other than FreeBASIC.
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: Wiki improvements

Post by VANYA »

SARG!

I don't understand at all! Can you show with an example? I'm not asking for another programming language, just show up for FB.

For example, there are 2 modules (1.bas , 2 bas):

1.bas

Code: Select all

type A alias "AA"
	i as Long
end type
2.bas

Code: Select all

type a as AA

? A.i
Even that doesn't work, how do you want it to work with other programming languages?
SARG
Posts: 1755
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Wiki improvements

Post by SARG »

what I understand, it's only if you compile a module for a future use with C++ not for a use in FB code.

"Public symbol names are mangled (decorated) to encode information about the data type that is used for the symbol. When linking with the c language, the special meaning of the alias modifier is meaningless, since the extra information is not encoded in to the public name. When linking with the c++ language, typically more information is encoded in to the public symbol, and the alias modifier may be required. The public name is written to the compiled object file, and used by the linker to match symbol names from one object module to another."

Equivalent to declare sub nameinfb alias "NameinCpp" ()
In the fb code you use nameinfb and the linker use NameinCpp
Post Reply