PDA

View Full Version : Creating thinBasic keywords lists



ErosOlmi
18-03-2007, 10:55
This script can be useful in case you want create or edit thinBasic scripts with other editors but keep syntax highlight possibility.
Usually every editor featuring syntax highligh has some kind of files where to store keywords or other specific language features.

Just modify this script to follow your editor syntax highlight file rules and you go. Every time we update thinBasic with new keywords or equates this script will output all the new features. Which other scripting or compiled language gives you this option?



'---Load all modules in order to get all keywords
#INCLUDE "%APP_INCLUDEPATH%\thinbasic_GL.inc"
#INCLUDE "%APP_INCLUDEPATH%\thinbasic_GLU.inc"
#include "%APP_INCLUDEPATH%\ODBC352.INC"

uses "BIFF"
uses "CGI"
uses "Console"
uses "Crypto"
uses "File"
uses "DT"
uses "FTP"
uses "INet"
uses "INI"
uses "LL"
uses "MATH"
uses "OS"
uses "PC"
uses "RAS"
uses "Registry"
uses "SAPI"
uses "SMTP"
uses "TcpUdp"
uses "XML"
uses "ZLib"
uses "UI"
uses "TBGL"
uses "COM"
uses "tokenizer"
uses "stat"
uses "TBASS"
uses "Eval"
USES "TBDI"


DIM sKeys AS STRING
DIM aKeys() AS STRING
DIM nKeys AS LONG
DIM Count AS LONG
DIM sOut AS STRING

'---Get a string with equates separated by $TAB
sKeys = APP_ListEquates

'---Parse string into an array
PARSE sKeys, aKeys, $TAB

'---Creates output buffer with equates
nKeys = UBOUND(aKeys(1))
FOR Count = 1 TO nKeys
sOut = sOut & aKeys(Count) & $CRLF
NEXT


'---Get a string with keywords separated by $TAB
sKeys = APP_ListKeywords & $tab & APP_ListFunctions

'---Parse string into an array
PARSE sKeys, aKeys, $TAB

'---Creates output buffer with keywords and functions
nKeys = UBOUND(aKeys(1))
FOR Count = 1 TO nKeys
if aKeys(Count) = "" then iterate for
IF aKeys(Count) <> "REM" THEN
sOut = sOut & aKeys(Count) & $CRLF
END IF
NEXT

'---Save buffer into .txt file
File_Save(app_sourcepath & "thinBasic_KeyWords.txt", sOut)
MSGBOX 0, app_sourcepath & "thinBasic_KeyWords.txt file created!"

kryton9
18-03-2007, 23:01
Another Gem of a script, thanks!!

marcuslee
04-09-2008, 00:00
I'm sorry for replying to a topic this old, but since there are only 2 threads in this sub-forum, I don't feel so bad. Why waste a new thread since my question has to do with what this thread is about?

Eros, your script is great. It isn't something you find in other languages that I know of, so good job. Is there a way to modify it or do something similiar so that you get only the keywords for one particular module?

If not, is there a place that I can see all the keywords in a particular module? The help file usuallly does the trick, but not all the keywords are listed for ODBC, for example. Or, at least that is how I understand it.

Mark

ErosOlmi
04-09-2008, 00:33
Mark,

unfortunately there is no way at the moment to get the list of keywords present just in one module. You will always get the list if thinBasic Core Engine plus the keywords of the modules used by the script. So, thinBasic core engine keywords will be always present.

Regarding specific request of keywords of ODBC, ODBC is not a module (so there are no keywords) but a source code include file of a dll that wraps operating system ODBC library. You can get all the function used in that source code looking at \thinBasic\Inc\ODBC352.INC
In that file, every function is listed and commented. The big job has been done by Josť Roca and can be found at: http://www.jose.it-berater.org/ (look ODBC reference guide).

Ciao
Eros

marcuslee
07-09-2008, 06:11
unfortunately there is no way at the moment to get the list of keywords present just in one module. You will always get the list if thinBasic Core Engine plus the keywords of the modules used by the script. So, thinBasic core engine keywords will be always present.


Okay, that makes sense. It would be helpful to know what module a keyword goes to, and since everything isn't in the helpfile, it would be even more helpful. Is there a way to show what module a keyword goes with?

Here's a crude example of what I am talking about:



IF aKeys(Count) <> "REM" THEN
sOut = sOut & aMod(Count) & "-" & aKeys(Count) & $CRLF
END IF


Of course, aMod would show what module the keyword, equate, or function came from.

Mark ???

ErosOlmi
07-09-2008, 10:06
... and since everything isn't in the helpfile ...


Please list the missing items in help forum (http://community.thinbasic.com/index.php?board=13.0) and we will try our best to fill it (if possible).
It is hard to bealive but we spent more time in thinBasic help fine than in thinBasic development. This because, even if thinBasic is free, we want create a professional help usually not seen in free software.
Writing help files is an hard work but we are committed to have this work done as better as we can.

Do you ("you" here is used in general form) have some piece of help you would like to write? Just let us know and we will be very happy to have it done by you.

Ciao
Eros

Billbo
27-11-2012, 23:16
Eros,

I loaded and ran this script in the 1.9.1.0 Beta. I got
a list of 9,052 keywords. Now this scrip is old, so I
added to the list of uses the ones from 1.9.1.0 that
were not there.

When I ran it, it when into a debug mode. So, I started
again and added one at a time, ran and saved each
time until another 'debug.' The one that was causing
the debug was 'Trace' (thinBasic_Trace.dll from the
Lib directory). Anyway, with all but that one, I got
a total of 9,633 keywords.

These are mighty large numbers for keywors. Are they
anywhere near correct???

Ciao,
Bill

Petr Schreiber
28-11-2012, 09:45
Hi,

the script to update keywords is now present in ThinBASIC installation at:
\thinBasic\thinAir\Syntax\thinBasic\thinBasic.CreateSyntaxIni.tBasic

The number is correct I think - just the TBGL module has 432 keywords.


Petr

Billbo
28-11-2012, 18:07
Petr,

Thanks for the direction.

I ran it and here is what I found:

6,476 keywords

There are two(2) reasons for the
almost 3,000 difference in the
number I posted above.

1. The #INCLUDEs were " ' " out.
2. Did not have uses "ADO"

I removed the " ' " from the #INCLUDEs and
ran it; 11,629 keywords.

I notice that there was a uses "ASTAR"
in the list. I could not find this anywhere
in the thinBasic directory. I changed it
to ADO and ran it again; 11,669 keywords.

Again, that's a hell-of-a-lot of keywords.

Well, when I get some other tasks
completed, I am going to explore
thinBasic a lot more.

BTW, if you wonder why I use short lines,
it is because I believe it makes my posts or
replies easier to read. But, I suppose if everyone
did it it would make long pages and instead
of one page for a topic, there might be
2 or 3. It started when I first started using
email and it has just carried over.

Bill

Petr Schreiber
28-11-2012, 18:53
Hi Bilbo,

the ASTAR module can be found here (http://www.thinbasic.com/community/showthread.php?8403-Maze-Solver-A-Star-Path-Finding), it is user module.
ThinBASIC can be extended via user modules based on SDK, which is present in:
\ThinBasic\SDK\

Basically - any language capable of producing DLL can be used for creation of ThinBASIC modules.
The difference between classic DLL and module DLL is this:

using thinBASIC SDK, you can predefine keywords (okay, DLLs can do this too), equates (now this is new), even user defined types(and this is also special) in modules
you don't need to declare functions anywhere, thinBASIC is able to detect it from module DLLs automagically
there is work in progress work on user defined classes in module DLLs, which will add another layer of flexibility


Regarding writing in short lines - it is very common in screenplay documents, as you say, it improves readability.
That is the reason why many magazines organize the text to columns as well, even ThinBASIC Journal (http://www.thinbasic.com/community/showthread.php?9450-ThinBasic-Journal-Issue-2)s.


Petr

Billbo
28-11-2012, 20:00
Hey Petr,

I sure appreciate the reply. I download ASTAR.
I will add it to my thinBasic. I'll never know
when I might run across a script that needs it,
or need it myself. Plus, I'll have a look at the
SDK.

I sure like the journals. To bad there's only
two(2) of them. I was checking on that recently.
Your reply to the topic was, I believe, that you
just provide the information on the forum now.
But, isn't it nice to a lot of information in one
handy file, with graphics and all?

Again, I appreciate your help. And like the
Terminator said, "I'll be back!"

Bill

Petr Schreiber
29-11-2012, 09:57
The ASTAR pathfinding is now integrated in TBAI module, so this is something to consider for use as well.

Regarding Journals - they transformed into online articles (http://www.thinbasic.com/community/content.php). This approach collects all the articles on one place (like magazine does) with the advantage of users being able to comment. Another advantage is that the articles can be continuously updated.


Petr

Billbo
29-11-2012, 16:44
Petr,

Thank you. I'll check out the articles, also
the TBAI.

Bill

HelloCode
29-12-2012, 03:45
The ASTAR pathfinding is now integrated in TBAI module, so this is something to consider for use as well.

Regarding Journals - they transformed into online articles (http://www.thinbasic.com/community/content.php). This approach collects all the articles on one place (like magazine does) with the advantage of users being able to comment. Another advantage is that the articles can be continuously updated.


Petr


You are my idol. You are superman. You can solve almost all the problems.