An HTML index of Gambas Classes

Post Reply
User avatar
Cedron
Posts: 69
Joined: Thursday 21st February 2019 5:02pm
Location: The Mitten State
Contact:

An HTML index of Gambas Classes

Post by Cedron » Friday 17th May 2019 3:44am

GambasClassIndex.htm.zip
(8.52 KiB) Downloaded 12 times
So, sometimes as a relative newbie, I have a tough time remembering which component which class is in. This makes it harder to find in the Wiki.

As part of my FarmDB project, I gathered a lot of the information that is in the Wiki. Well, long story made short, attached you will find a zip file of an html file that is an index of all the class names in Gambas starting with an ordinary letter. The link should take you to the correct page in the wiki.

I hope you all find it useful.

Ced
.... and carry a big stick!

User avatar
Cedron
Posts: 69
Joined: Thursday 21st February 2019 5:02pm
Location: The Mitten State
Contact:

Re: An HTML index of Gambas Classes

Post by Cedron » Friday 17th May 2019 12:31pm

Gambas_13_3_0_AllClassesIndex.htm.zip
(11.29 KiB) Downloaded 10 times
Here is a version with the virtual classes included as well.

Ced
.... and carry a big stick!

stevedee
Posts: 113
Joined: Monday 20th March 2017 6:06pm

Re: An HTML index of Gambas Classes

Post by stevedee » Friday 17th May 2019 4:34pm

Cedron wrote:
Friday 17th May 2019 12:31pm
Here is a version with the virtual classes included as well...
My goodness you must have some patience. Many thanks.

Maybe Charlie could add this to the GambasOne home page?

User avatar
Cedron
Posts: 69
Joined: Thursday 21st February 2019 5:02pm
Location: The Mitten State
Contact:

Re: An HTML index of Gambas Classes

Post by Cedron » Saturday 18th May 2019 12:11pm

ReporterDemo.zip
(385.29 KiB) Downloaded 6 times
Patience? No, it only takes seconds to run.

First fruits of a long process? Yes.

Here is the process information flow diagram (programs in parentheses):

Code: Select all

/usr/share/Gambas3/info/gb.*
  |
  V
(Scanner)
  |
  V
LoadFiles.tsv                                               (Text Editing)
  |                                                               |
  V                                                               V 
(Loader) <-- LoadDB_Vault.SQL      (Text Edit Field Info)   Database Diagram
  |                                         |                     |
  V                                         V                     V
SQLiteDatabase <-- (DB Creator) <-- CreateDB_Vault.SQL <-- (Diagram Parser)
  |
  V
(Reporter) <-- Query_Vault.SQL  <-- (SQLite + Text Editing)
  |         +- Report_Vault.HTM <-- (Text Editing)
  V
HTML Files
Here is the current Database Diagram:

Code: Select all

                   pd_vendors     pd_roots                  wk_class_flags
                           0       1                                    0
                           |       |                                    |
                           M       M                                    |
 pd_tags                  pd_projects                    wk_components  |
  1   1                   1  1 0  1 1                     1         1   |
  |   +-------+           |  | |  | +--------+            |         |   |  +---+
  M           M           M  | |  M          M            M         M   M  M   |
 pd_subtags  pd_project_tags | | pd_files   pd_project_components  wk_classes  |
  1                          | |  1   1 1                           1   1  0   |
  |              +-----------+ |  |   | +-----------+          +----+   |  +---+
  M              M             |  |   M             M          M        | 
 pd_project_subtags    +-------+  |  cs_routines   cs_class_usage       |
                       |          |   1       1                         |
                       |     +----+   |       |                         |
                       M     |        M       |                         |
           cs_shared_libs    |   cs_lines     |      wk_member_types    |
            1       1        |   1  1 1 1     |                  1      |
            |       |        |   |  | | |     |                  |      |     
            |       M        M   |  | | M     M                  M      M
            |      cs_lib_usage  |  | | cs_calls                wk_members
            |                    |  | |                          1
            |                    |  | +-----+           +--------+
            M                    |  |       M           M
           cs_lib_function       |  |      cs_member_usage      wk_keywords 
                   1             |  |                            1
                   |             |  +-------+          +---------+
                   M             M          M          M 
                  cs_function_usage        cs_keyword_usage

It's evolved a bit since the last time I posted it. There are three regions to the database:

wk - Wiki Information

pd - Project Definition

cs - Code Scanner

Currently I have the wk region loaeded, working on the pd, not started on the cs.

When I am done, and the projects/code being scanned are all the projects in the Software Farm, the database will be able to report all sorts of useful information. This class listing is just the first. It is a simple query on the wk_classes and wk_components tables.

Code: Select all


SELECT wk_classes.name          AS ClassName,
       wk_components.name       AS ComponentName,
       wk_classes.inherits_name AS InheritsName

FROM       wk_classes 
INNER JOIN                               wk_components 
ON         wk_classes.wk_components_fk = wk_components.id

ORDER BY   ClassName, ComponentName	 

Then the program simply brute force scans the resulting list for each letter:
'---- Gather the Values
        
        For r = 0 To theClassNames.Max
          If Left(theClassNames[r]) = theLetter Then
             theEntry_Row.Add(r)
          Endif
        Next

        For r = 0 To theClassNames.Max
          If Left(theClassNames[r]) = "." Then
             If Mid(theClassNames[r], 2, 1) = theLetter Then
                theEntry_Row.Add(r)
             Endif
          Endif
        Next

        For r = 0 To theClassNames.Max
          If Left(theClassNames[r]) = "_" Then
             If Mid(theClassNames[r], 2, 1) = theLetter Then
                theEntry_Row.Add(r)
             Endif
          Endif
        Next

'---- Find the One third Mark

        Dim theThird As Integer
        
        theThird = Int((theEntry_Row.Count + 2) / 3)

The broader purpose of this whole exercise is to build a web application and a desktop application which will find code examples from the Software Farm indexed by the components/classes.

Imagine that if you clicked on one of those links, not only would you get a list of members (properties,methods,events) of the class, but also a list of all the Software Farm projects which use that class. Click on a project name and it takes you to a page showing you code excerpts around the class usage.

I have attached the last program in the process for those who are interested in seeing how it works. The included database is just the wk tables to keep it as small as possible.

So, this is really a matter of perserverence over patience. The Vault files are like a Settings file that can be mulitple line with replaceable parameters. The code is a work in progress and I will be formally announcing it soon, but you can see how the first draft works in the attached files. Since they are text files, you can bring them into the IDE and use them as if they are alternative format source files.

Ced

P.S. Cogier, et al, I would be delighted if you downloaded this demo, modified the HTML to fit your site style, and posted a copy.

P.P.S. When you unzip the demo, there is a file called CreateUniqueWiki_Vault.SQL included. You should open up the FarmDB.sqlite database, paste the contents of the SQL file in the query execute panet and run it. This will create a set of new derived tables of unique identifiers for the wk tables.
.... and carry a big stick!

User avatar
cogier
Site Admin
Posts: 266
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: An HTML index of Gambas Classes

Post by cogier » Saturday 18th May 2019 3:10pm

I have added the page to Gambas.one. You can access it from the front page (Gambas Classes) or here https://www.gambas.one/classes/

Image

Can you please advise me how to get the latest copy of the database, better still alter your program to go get it and do the necessary so I can just update the page when a new version of Gambas is out.

Nice work Cedron!

User avatar
Cedron
Posts: 69
Joined: Thursday 21st February 2019 5:02pm
Location: The Mitten State
Contact:

Re: An HTML index of Gambas Classes

Post by Cedron » Saturday 18th May 2019 3:33pm

Thanks Cogier.

I'll be posting all the projects in the system diagram once they are in a presentable state. I'm also thinking of an umbrella project that will do a full refresh with a single button press. Currently the process (Delete the database, create it, load it, and do the report) takes about a minute or so.

I do think that you should dress the page up a bit with your site headers, links and such, so it looks like it belongs. I can modify the report program to match that.

If you want any of the pieces you see ahead of time, send me an email and I will send them to you.

In the meanwhile, if anybody wants to develop a Gambas Application to display the Wiki region of the database and post it here, that would be most welcome.

Ced

P.S. There is a slight error in the database data in that the inherits_id field in the classes table points at the first class that the name matches to, not the class with the same name in the same component. I'll be fixing that shortly, but it has no impact on the report.
.... and carry a big stick!

User avatar
cogier
Site Admin
Posts: 266
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: An HTML index of Gambas Classes

Post by cogier » Saturday 18th May 2019 3:39pm

I'll make some changes as we go along, I have already altered the Report_Vault.HTM file. I would still like to know where you get the database from.

User avatar
Cedron
Posts: 69
Joined: Thursday 21st February 2019 5:02pm
Location: The Mitten State
Contact:

Re: An HTML index of Gambas Classes

Post by Cedron » Saturday 18th May 2019 3:55pm

WikiScanner-0.0.1.tar.gz
(12.01 KiB) Downloaded 5 times
It's down the left column of the information flow diagram:

Code: Select all

/usr/share/Gambas3/info/gb.*
  |
  V
(Scanner)
  |
  V
LoadFiles.tsv
  |
  V
(Loader)
  |
  V
SQLiteDatabase
  |
  V
(Reporter)
  |
  V
HTML Files
I've attached the Scanner program. It's small and simple. I had a great deal of help from Tobi on this one.

Ced
.... and carry a big stick!

User avatar
cogier
Site Admin
Posts: 266
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: An HTML index of Gambas Classes

Post by cogier » Sunday 19th May 2019 4:57pm

Cedron wrote:
Saturday 18th May 2019 3:33pm
In the meanwhile, if anybody wants to develop a Gambas Application to display the Wiki region of the database and post it here, that would be most welcome.
I have used your code Cedron but altered it to suit me (sorry). I like .csv files rather than .tsv. :o

Have a look at the attached program and let me know what you think. I'll put it on the Farm once I have some feed back.

Image
Attachments
Gambas_Classes.7z
(27.62 KiB) Downloaded 7 times

User avatar
Cedron
Posts: 69
Joined: Thursday 21st February 2019 5:02pm
Location: The Mitten State
Contact:

Re: An HTML index of Gambas Classes

Post by Cedron » Sunday 19th May 2019 6:03pm

{Replacement: lower case fix, new vault version]
WikiDemo2.zip
(26.27 KiB) Downloaded 3 times
That's pretty neat. I have no objections to you changing things to suit your tastes.

What I was actually looking for is good template code for typical database usage and you bypassed the database entirely. I'm chuckling.

I will look at your code closer.

In the meanwhile, here is the whole Wiki Scan/Load/Report in one console program.

This one renames the previous version of the database and creates a new one. Ultimately, it will be a refresh process.

To use:

1) Unzip the attached file

2) Open and run the BatchWiki project

The load files will be in the (TsvFiles) directory. (TSV are better suited for this task.)

https://forum.gambas.one/viewtopic.php?f=4&t=673

The Classes list will be in the (HtmlFiles) directory.

The FarmDB,sqlist will hold the Wiki region.

The HTML updates have been applied to the enclosed Report_Vault.HTM file.

Ced
.... and carry a big stick!

Post Reply