Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Creating thinBasic keywords lists

  1. #1
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    54
    Posts
    8,636
    Blog Entries
    2
    Rep Power
    10

    Creating thinBasic keywords lists

    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?


    [code=thinbasic] '---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!"

    [/code]
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  2. #2
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    64
    Posts
    3,869
    Rep Power
    401

    Re: Creating thinBasic keywords lists

    Another Gem of a script, thanks!!
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  3. #3
    Member marcuslee's Avatar
    Join Date
    Sep 2008
    Location
    Kansas, USA
    Age
    39
    Posts
    222
    Blog Entries
    2
    Rep Power
    35

    Re: Creating thinBasic keywords lists

    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

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    54
    Posts
    8,636
    Blog Entries
    2
    Rep Power
    10

    Re: Creating thinBasic keywords lists

    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

    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  5. #5
    Member marcuslee's Avatar
    Join Date
    Sep 2008
    Location
    Kansas, USA
    Age
    39
    Posts
    222
    Blog Entries
    2
    Rep Power
    35

    Re: Creating thinBasic keywords lists

    Quote Originally Posted by Eros Olmi
    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:

    [code=thinbasic]
    IF aKeys(Count) <> "REM" THEN
    sOut = sOut & aMod(Count) & "-" & aKeys(Count) & $CRLF
    END IF
    [/code]

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

    Mark ???

  6. #6
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    54
    Posts
    8,636
    Blog Entries
    2
    Rep Power
    10

    Re: Creating thinBasic keywords lists

    Quote Originally Posted by marcuslee
    ... and since everything isn't in the helpfile ...
    Please list the missing items in help forum 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
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  7. #7
    Member
    Join Date
    Nov 2012
    Location
    Missouri, USA
    Posts
    113
    Rep Power
    26
    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
    Last edited by Billbo; 27-11-2012 at 23:19.

  8. #8
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,083
    Blog Entries
    5
    Rep Power
    725
    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
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  9. #9
    Member
    Join Date
    Nov 2012
    Location
    Missouri, USA
    Posts
    113
    Rep Power
    26
    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
    Last edited by Billbo; 28-11-2012 at 18:11.

  10. #10
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,083
    Blog Entries
    5
    Rep Power
    725
    Hi Bilbo,

    the ASTAR module can be found here, 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 Journals.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Page 1 of 2 12 LastLast

Similar Threads

  1. Creating .exe from thinbasic scripts
    By Macros The Black in forum thinBundle
    Replies: 1
    Last Post: 02-06-2009, 09:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •