Wiki improvements

Forum for discussion about the documentation project.
Post Reply
coderJeff
Site Admin
Posts: 4313
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: Wiki improvements

Post by coderJeff »

The fb wiki to chm converter doesn't handle unicode; escaping the characters using html is a work around. I'm not sure what the reason for the column tags are, maybe that's an older work around.

%% ... %% code tags should format correctly in wiki and chm. I think this should be used instead of the column tags.

## ... ## monospace tags should also format correctly in wiki and chm.

%%(freebasic) ... %% code tags will format wrong. The syntax highlighter doesn't handle the escaped html.

The online wiki application itself handles unicode with utf-8 encoding and can be stored directly. But the fb wiki to chm converter doesn't know wstring at all, and doesn't try any conversion from utf-8. Any code examples have the filename action are only stored to plain ascii files, so unicode is not handled correctly there either.
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

coderJeff wrote:%% ... %% code tags should format correctly in wiki and chm. I think this should be used instead of the column tags.
But that does not work already in wiki (INSTRREV page for example):
  • %%
    'A Unicode example:
    dim text as wstring*20
    text = "Привет, мир!"
    print instrrev(text,"ет") ' displays 5
    %%

    produces:
    'A Unicode example:
    dim text as wstring*20
    text = "Привет, мир!"
    print instrrev(text,"ет") ' displays 5
    but not:
    'A Unicode example:
    dim text as wstring*20
    text = "Привет, мир!"
    print instrrev(text,"ет") ' displays 5
(## ... ## monospace tags work)
coderJeff
Site Admin
Posts: 4313
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: Wiki improvements

Post by coderJeff »

Oops, I missed a step. %% tags with the html escaping only work for chm.

I think I'd like to get rid of the html escaping and look at improving the fbdoc (wiki-> chm converter). Even though fbdoc doesn't know unicode, the wiki's UTF8 should be preserved through most of the string manipulations. Probably just getting lost (converted) in one step. I will investigate.
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

A next article coming soon (status 'in progress'):
18. How FB supports Sub-Type Polymorphism, demonstrated by Emulation very Close to Real Operating (article of 1 post) Do you have particular requests around this?
Tourist Trap
Posts: 2958
Joined: Jun 02, 2015 16:24

Re: Wiki improvements

Post by Tourist Trap »

fxm wrote:A next article coming soon (status 'in progress'):
18. How FB supports Sub-Type Polymorphism, demonstrated by Emulation very Close to Real Operating (article of 1 post) Do you have particular requests around this?
Will you compare that to a template or an interface, just to know the differences?
Can you also give a word of the size of the udt when it is taken in an inheritance chain (does it keep the private data of the parent and so on)?
Maybe this is off topic. If so I'll ask those questions elsewhere later, otherwise I'm curious of seeing the answer in this context.
Thanks anyway.
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

Tourist Trap wrote:Can you also give a word of the size of the udt when it is taken in an inheritance chain (does it keep the private data of the parent and so on)?
Read carefully the Extends documentation page.
(private non-static data fields of base-types are not excluded for the derived-types size computation)

About interfaces and templates, this goes far beyond what FB currently supports and far exceeds the limits I have set for this type of article to be accessible to all.
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

After the vptr / vtbl (vtable) usage for abstract/virtual procedures, why not another article about the RunTime Type Information (RTTI) provided by the built-in OBJECT:
19. How using RTTI from FB built-in OBJECT to extract Typename and those of all Bases of an instance (article of 1 post)
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: Wiki improvements

Post by paul doe »

fxm wrote:After the vptr / vtbl (vtable) usage for abstract/virtual procedures, why not another article about the RunTime Type Information (RTTI) provided by the built-in OBJECT:
19. How using RTTI from FB built-in OBJECT to extract Typename and those of all Bases of an instance (article of 1 post)
It would be extremely useful. You're doing a pretty good job of documenting more advanced uses of the compiler. Thanks!
coderJeff
Site Admin
Posts: 4313
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: Wiki improvements

Post by coderJeff »

fxm wrote:A next article coming soon (status 'in progress'):
18. How FB supports Sub-Type Polymorphism, demonstrated by Emulation very Close to Real Operating (article of 1 post) Do you have particular requests around this?
To show the emulated implementation, I think a comparison to a simple non-emulated version is needed. For example
B = base type
D = derived type
M = method

Code: Select all

type B extends object
	declare constructor()
	declare virtual destructor()
	declare virtual sub M()
end type 

constructor B(): print "B()", hex(cint(@this)): end constructor
destructor B(): print "~B()", hex(cint(@this)): end destructor
sub B.M(): print "B.M()", hex(cint(@this)): end sub

type D extends B
	declare constructor()
	declare destructor()
	declare sub M() override
end type

constructor D(): print "D()", hex(cint(@this)): end constructor
destructor D(): print "~D()", hex(cint(@this)): end destructor
sub D.M(): print "D.M()", hex(cint(@this)): end sub

sub proc( byref obj as B )
	'' derived-type method called through base
	obj.M()
end sub

scope
	print "---- OK"
	dim x as D = D()
	proc( x )
end scope

scope
	print "---- OK"
	dim x as D ptr = new D()
	proc( *x )
	delete x
end scope

scope
	print "---- OK"
	dim byref x as D = *new D()
	proc( x )
	delete @x
end scope

scope
	print "---- Not OK!, D() is temporary expression"
	dim x as B = D() '' D() is temporary
	proc( x )
end scope

scope
	print "---- OK, but only if destructor B() is virtual"
	dim x as B ptr = new D()
	proc( *x )
	delete x
end scope

scope
	print "---- OK, but only if destructor B() is virtual"
	dim byref x as B = *new D()
	proc( x )
	delete @x 
end scope
I don't know what you have planned to demonstrate through emulation, so maybe method of construction is not relevant.
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

Have you had time to read my article already posted since yesterday?
See: viewtopic.php?f=9&t=27617
coderJeff
Site Admin
Posts: 4313
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: Wiki improvements

Post by coderJeff »

fxm, OK I read your article now. I missed that when I posted here. Very nice. Yes, you have provided what I was hoping to see; introducing the usage before the explanation. Thanks.
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

A next article coming soon (status 'in progress'):
19. How using RTTI from FB built-in OBJECT to extract Typename and those of all Bases of an instance (article of 1 post)

See preamble at: Index page of tutorial / teaching / pedagogical topics (draft articles for documentation)
marcov
Posts: 3454
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: Wiki improvements

Post by marcov »

coderJeff wrote:Oops, I missed a step. %% tags with the html escaping only work for chm.

I think I'd like to get rid of the html escaping and look at improving the fbdoc (wiki-> chm converter). Even though fbdoc doesn't know unicode, the wiki's UTF8 should be preserved through most of the string manipulations. Probably just getting lost (converted) in one step. I will investigate.
CHM contents are html files, string sin CHM internal files are UCS2/UTF16. I happen to be fixing the FPC chm doc tool and compiler this weekend, and it turns out the MS hhc compiler replaces things like ' from HTML topic titles when moving them into indexes, so maybe it does with 4 char escapes too.
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

fxm wrote:A next article coming soon (status 'in progress'):
19. How using RTTI from FB built-in OBJECT to extract Typename and those of all Bases of an instance (article of 1 post)

See preamble at: Index page of tutorial / teaching / pedagogical topics (draft articles for documentation)
The full article is now available at:
viewtopic.php?f=9&t=27622
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

About: Index page of tutorial / teaching / pedagogical topics (draft articles for documentation)

I am still waiting for any article proposed by users:
- either provided already written (perhaps only a final formatting to be done for a better integration with the existing articles),
- or provided in the form of a list of references to posts/topics with enough material to be able, after synthesis, to constitute a complete article in itself.

Do not hesitate to participate and do not compare your ideas with the kind of articles I've already written, because I tend to write articles that some might consider too technical or advanced.
I remind you nevertheless that the content of these articles is also intended to perhaps later feed the official documentation (technical and tutorial).

(thanks to Josep Roca and MrSwiss, each for his previous participation)
Post Reply