Results 1 to 2 of 2

Thread: Questions about SDK-functions (Syntax, Parameters etc.)

  1. #1
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,527
    Rep Power
    170

    Questions about SDK-functions (Syntax, Parameters etc.)

    my question of today is about thinBasic_GetKeywordSpeficic

    All i know is
    '----------------------------------------------------------------------------
      'thinBasic_GetKeywordSpeficic
      '----------------------------------------------------------------------------
      ' Instruct parser to get next token, test if it a keyword and if yes,
      ' check if it is one of the possible keywords passed. If not, a RT-Error
      ' will be generated
      '----------------------------------------------------------------------------
    DECLARE FUNCTION  thinBasic_GetKeywordSpeficic                  _
                              LIB "thinCore.DLL"                      _
                              ALIAS "thinBasic_GetKeywordSpeficic"    _
                              (                                       _
                                          BYVAL HideError   AS LONG , _
                                          BYVAL AutoPutBack AS LONG , _
                                          BYVAL lKey1   AS LONG     , _
                                 OPTIONAL BYVAL lKey2   AS LONG     , _
                                          BYVAL lKey3   AS LONG     , _
                                          BYVAL lKey4   AS LONG     , _
                                          BYVAL lKey5   AS LONG     , _
                                          BYVAL lKey6   AS LONG     , _
                                          BYVAL lKey7   AS LONG     , _
                                          BYVAL lKey8   AS LONG     , _
                                          BYVAL lKey9   AS LONG     , _
                                          BYVAL lKey10  AS LONG     , _
                                          BYVAL lKey11  AS LONG     , _
                                          BYVAL lKey12  AS LONG     , _
                                          BYVAL lKey13  AS LONG     , _
                                          BYVAL lKey14  AS LONG     , _
                                          BYVAL lKey15  AS LONG     , _
                                          BYVAL lKey16  AS LONG     , _
                                          BYVAL lKey17  AS LONG     , _
                                          BYVAL lKey18  AS LONG     , _
                                          BYVAL lKey19  AS LONG     , _
                                          ByVal lKey20  As Long     , _
                                          ByVal lKey21  As Long     , _
                                          ByVal lKey22  As Long     , _
                                          ByVal lKey23  As Long     , _
                                          ByVal lKey24  As Long     , _
                                          ByVal lKey25  As Long       _
                              ) As Long
    
    i guess i have to store up to 25 different keywords to lKey1 to lKey25 ?
    What is the rule? why "As Long? Will it return the number 1 to 25 telling me the keyword? isn't it possible without to create an Error?
    Last edited by ReneMiner; 22-01-2021 at 20:31.
    I think there are missing some Forum-sections as beta-testing and support

  2. #2
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,527
    Rep Power
    170

    add SDK-Function: thinBasic_ValidateNewName()

    rIs there no other way than to create a list of thinBasic-keywords and scan it for existance of a string-expression to make sure a name for a new variable or a new udt is not used yet?
    i mean its quite a big list and thinCore probably has built-in some function already to check if a string matches any keyword or other, name or identifier. especially if my module will have to check multiple times for user-defined names if anything matches to keywords user dimensioned names as class-names, udt-names, variable-names, controls-names.

    A new function App_ListNames could be developed for runtime-usage from within a thinbasic script. But as already mentioned, from a module i will have to perform these tests multiple times. if other developers modules have to validate names too and all would keep theie lists of Keywords, Functions, user-defined names etc. to maintain in memory then available memory will shrink fast towards zero.

    Since multiple modules might be in use it makes no sense to maintain such lists because we don't know if nor how many additional names were added by other developers. Means to let thinbasic collect all data about keywords etc. again and compare if the name by the user suggested is still available - or not.

    Also the question if a user desired string-expression matches the naming-conventions of thinBasic has to be asked over and over again by all modules that will add udts, variables, equates, controls and even functions. i think thincore is the first who knows if anything with a new name was added or if a previously collected list of variables, udts etc.is still valid

    I would suggest to develop 2 functions for the sdk,
    ### 1###
    the first function to test if a name can be used for a certain purpose and follows the rules like start with a letter or be prefixed with $ or % for equates and consist of word chars only and functions or variables for numerals must not end with $

    (Extended rules including enforcement of naming rules are thinkeable as a preparsing directive to reduce errors caused by typos or confusion, i.e. not on purpose exchanged names. Ass a class variable has to be prefixed with c or cls , use underscore or have suffix "_class" could be made an optional ruleset as
    #Default Name {(Prefix|Suffix) Len(1|3|full) } [,Using Underscore]
    
    )

    ### 2 ###
    the second function would allow to check if the string containig the desired new name is available or in use by something else already.

    can it be that those 2 functions become a "sdk-module" to be used by any module or are already functions present for this purpose?
    I think there are missing some Forum-sections as beta-testing and support

Similar Threads

  1. Replies: 0
    Last Post: 15-11-2015, 09:54
  2. three questions
    By christianssen in forum thinBasic General
    Replies: 6
    Last Post: 10-03-2010, 11:12
  3. A few more questions..
    By oldpapa49 in forum thinBasic General
    Replies: 12
    Last Post: 21-03-2009, 21:45
  4. DT questions
    By Dave in forum DT (Date module)
    Replies: 9
    Last Post: 16-04-2008, 09:48

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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