Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 35

Thread: O2 - some basic questions

  1. #21
    I think Petr is the only one using thinBasic Oxygen, in a live application so far.

  2. #22
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Hehe, I am afraid I am not very bright and it gets worse with every year . The Oxy <-> ThinBASIC interface is just simple to use, the most seamless embedding I have seen so far.

    Oxygen is needed for ThinBASIC programmer whenever you need codepointer to function (mostly for callbacks), this is why I think it is not just something for my entertainment, but useful general purpose helper.
    I am also happy Charles listened to my crazy ideas regarding OOP, I consider his final implementation the most easy one to use along with C#, but without need for those nasty semicolons.

    In my opinion, even more people would use Oxygen (standalone or embedded) if it had a bit more structured help file and most importantly, more easy to read error messages. Which is ton of work of course.


    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

  3. #23
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    I do publish knowledge I consider interesting via articles and samples. I take your saying that I "leave thinBasic users in the dust" as opinion, but I hope most of ThinBASIC users would not agree - I support TBGL, my primary creation, daily for 8 years in row. When user comes with general question on other sides of ThinBASIC, if I have time and know the answer, I always reply.

    I can't offer this to Oxygen, because I have not enough time & most importantly knowledge for it. There are other interests that keep me busy, and I think author should be responsible person #1 for documenting and supporting their work.
    That is why I am not asking anybody else to do support for TBGL for me. When Rene, Kent, Mike(s) or others do that voluntarily, I really appreciate it and it makes me really happy. But life is short and asking others for their time is always a thing to think about twice.


    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

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

    Arrow

    I think I'm not leaving anyone in the dust and publish all my stuff here in plain thinBasic so everyone can look inside and check out what it does. And I do have to check tB-help over and over again- even if I used a method a hundred times already - I'll check help once more for parameters order, special behaviour etc.
    The problem in using O2 is to me, that I don't have any asm- nor c-background and I only have a list of keywords in alphabetical order and no idea about what the keyword does - no idea what the "opposite method" is and I struggle already with some very basic functions as Peek & Poke - maybe there are ASM-methods but I don't know their names either...

    It's like having a starship with built-in bistromathic drive parking in front of the house - ready for take off into another galaxy but the only clue I have how to operate it, is some advertising brochure in magrathean language. And John is the one who says: "Of course it can fly! Just place yourself in the pilots seat, push the ignition button and go!" - but after I've found the button to ignite I feel really stupid because I don't know how to control that thing...

    But I did not give up yet: I got the function to calculate multidimensional indexes in one-dimensional array finally together in O2-basic. But I would like it faster and replace Len with something like StrPtrLen - but I don't know how to get these 4 bytes in front of that StrPtr-position - in tB I'd just Peek them...

    Uses "console", "oxygen"
     
    Long pGetIndex
    Long pFinish
    
    ' this function calculates the one-dimensional array-index of any 
    ' "multidimensional" stored element 
    
    ' pass one string containing the elements position within multidimensional
    ' storage, for example myStorage(1,1,1) setup string like MKDWD$(1,1,1)
    ' second string has to contain the dimensions Ubounds, 
    
    ' retrieve Index in one-dimensional array or 0 if invalid parameters
    
    ' to keep the function small there's a minimum of 2 dimensions
    ' and a minimum-Ubound of 2 elements per dimension
      
    O2_Basic RawText
       
      Function GetIndex( bString Element, bString Bounds) As DWord, link #pGetIndex
            
        If Len(Element) <> Len(Bounds) 
    ' both strings have to match in length
          Return 0
        Else
    ' both strings have to have at least 2 dimensions
          If Len(Element) < 8 Then Return 0
      '   If Len(Bounds)  < 8 Then Return 0 - not necessary if both match in size...
        EndIf
         
        DWord i, position, numElements
        DWord numDims = Len(Element)/SizeOf(DWord)
         
        DWord vElement At StrPtr(Element) 
        DWord vBounds  At StrPtr(Bounds)
         
        For i = 1 To numDims
    ' element must not be out of bounds
          If vElement[i] < 1 Or vElement[i] > vBounds[i] Then Return 0
    ' a dimension needs at least 2 elements
          If vBounds[i]  < 2 Then Return 0
        Next
         
        numElements = vBounds[1]
        For i = 2 To numDims
          numElements = numElements * vBounds[i]
        Next
      
        For i = 1 To numDims - 1
          numElements = numElements/vBounds[i]
          position = position + (vElement[i]-1) * numElements
        Next
      
      Function = position + vElement[numDims]
      
       
      End Function
      '-------------------------
      Sub Finish() link #pFinish
        terminate
      End Sub       
      
    End RawText
     
    If O2_Error <> "" Then
      PrintL "Can not run - Error within o2-script:" + $CRLF
      PrintL O2_Error 
      WaitKey
      Stop
    Else
      ' can run
      O2_Exec
    End If   
    '---------------------------------------------------------------
    ' TB_section      
    Declare Function GetIndex( ByVal String, ByVal String) As DWord At pGetIndex
    Declare Sub Finish() At pFinish 
    ' test:   
    PrintL "search Element 2,3 in bounds of 2,3"
    PrintL Str$( GetIndex MKDWD$(2,3), MKDWD$(2,3) )
    PrintL
    
    PrintL "search Element 3,4,5 in bounds of 4,5,6"
    PrintL Str$( GetIndex MKDWD$(3,4,5), MKDWD$(4,5,6) ) 
    PrintL
    
    PrintL "search Element 2,3,4,5 in bounds of 4,6,8,10"
    PrintL Str$( GetIndex MKDWD$(2,3,4,5), MKDWD$(4,6,8,10) )
    
    PrintL "search Element 1,1,1,1,1,1 in bounds of 2,4,6,8,10,12"
    PrintL Str$( GetIndex MKDWD$(1,1,1,1,1,1), MKDWD$(2,4,6,8,10,12) )
     
    WaitKey
    Finish()
    
    Limits:
    minimum 2 dimensions with at least 2 elements per dimension
    maximum &H3FFFFFFE dimensions since there don't fit no more parameters into these strings
    maximum &HFFFFFFFF elements altogether in all dimensions

    more information
    Last edited by ReneMiner; 08-08-2013 at 13:22.
    I think there are missing some Forum-sections as beta-testing and support

  5. #25
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,527
    Rep Power
    170
    That's your guess. But how could I get anything together then?
    It's just like having to browse 50 examples of unknown code to find a certain keyword or method of unknown name and structure not even knowing if any of these examples uses the desired method nor the ability to recognize it then because I don't know what it would look like.
    Last edited by ReneMiner; 08-08-2013 at 10:28.
    I think there are missing some Forum-sections as beta-testing and support

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

    Arrow

    A good documentation is the alpha and omega to get good results out of a language. Users have the information about the famous abilities all bundled to some convincing package that leaves almost no open questions and encourage them to try out their ideas since it supports these ideas with some informational background.
    I like the style of tB-documentation that not just lists those keywords in a tree sorted by purpose/subject area, but also describes their usage and covers for each keyword needed basic informations as

    Description
    Syntax
    Returns
    Parameters
    Remarks
    Restrictions
    See also
    Examples

    It might be using up some time to write such documentation - but it's the key to success for a language: Add up all the time the author of the documentation needs: maybe hundreds of hours. Now add up the time all other users need to search for information - it's the time they need longer to get any projects done - so I think a good documentation with as much information as possible together at one place pays back because users are faster in developing their stuff - more stuff in less time and also faster learning users! - which will eventually lead the language to spread much faster and gain intelligence through more brains thinking of ways how to initiate it.
    Last edited by ReneMiner; 08-08-2013 at 11:14.
    I think there are missing some Forum-sections as beta-testing and support

  7. #27
    Rene
    I really can't understand what is not clear to you about Oxygen Basic .
    I think that you complicate things without reason.
    And any example in oxygen package is very clean and simple to understand.

  8. #28
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,527
    Rep Power
    170
    Quote Originally Posted by John Spikowski View Post
    In most cases all I need is an example that is in the ballpark of what I'm trying to do and I can figure out the rest...
    problem is mostly to find the correct example that runs first. And the search for that fitting example always needs some time and includes reading through a dozen inappropriates and stumbling across unknown expressions and there's no help available that explains those - so have to find out by try'n error or search another example - good documentation is unpayable and pays off maugre
    Last edited by ReneMiner; 08-08-2013 at 20:49.
    I think there are missing some Forum-sections as beta-testing and support

  9. #29
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,527
    Rep Power
    170
    too cumbersome. I don't like spending all my time on searching and browsing examples to get information together. As long as I don't find out how to poke some value to an absolute address and how to read it out again I feel unable to create something of use in O2.

    I don't know why- maybe it has been overseen or nobody knows the answer - the problem is this:
    bString test = "teststring"
    ' i think the length of test is stored at StrPtr(test)-4
    ' but if i do this:
    Dword myLen at StrPtr(test)-4 
    ' myLen holds 0 instead of 10!
    
    so it's either a bug - or not as easy as this - or some exception?

    And: does O2 have something like heap-memory in tB?
    Last edited by ReneMiner; 09-08-2013 at 08:19.
    I think there are missing some Forum-sections as beta-testing and support

  10. #30
    Hi ReneMiner

    At expressions need to be enclosed by brackets, if they are not simple variables. I hope to make the compiler a bit smarter in this area.

    Also better to use sys integers unless you intend to do 32 bit unsigned arithmetic with dwords.

    bString test = "teststring"

    print len(test) '10
    sys myLen at (StrPtr(test)-4) 'put brackets around the 'at' expression
    print mylen 'answer 10
    Last edited by Charles Pegge; 09-08-2013 at 20:19.

Page 3 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. Replies: 0
    Last Post: 14-07-2013, 17:27
  2. Questions About Focus
    By gungadout in forum thinBasic General
    Replies: 2
    Last Post: 12-11-2010, 03:44
  3. three questions
    By christianssen in forum thinBasic General
    Replies: 6
    Last Post: 10-03-2010, 11:12
  4. A few more questions..
    By oldpapa49 in forum thinBasic General
    Replies: 12
    Last Post: 21-03-2009, 21:45
  5. 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
  •