Announcement

Collapse
No announcement yet.

COM Interface

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • COM Interface

    John,

    Do you have a list of the messages the editor needs to send to the converter? I'm building the event code to handle incoming messages.

    Stan
    Do not go quiet into that good night,
    ... Rage, rage against the dark.

  • #2
    Stan,

    I don't have any official messages as we were only talking about a concept, but I guess we can start to build a list.

    We need:

    Input: A message alerting Tokenizer we are sending one line of VB code.

    Output: A return message from above that the Tokenizer requests additional lines, in case the Tokenizer needs to convert a code block. Maybe call this a repeat code, if set, %TRUE keep sending lines until it is set to %FALSE.

    Output: Status of conversion. Returns either %TRUE (OK), or error/warning/information code. I'm thinking here we could set the message codes INFO = 1 - 200, WARNING = 201 - 400, ERROR = 401 - 600. If %TRUE or INFO then output the converted code to the editor with OBNOXIOUS COMMENT, if WARNING either output code to editor w/OBNOXIOUS COMMENT or issue message box alerting the user, if ERROR then issue error message to user and stop conversion.

    Output: Array or string of the converted code.

    If I know the number of lines the Tokenizer is returning I can always update the editor by the number of elements in the array. If the Tokenizer returns a dynamic string I will need some special format characters in the converted line(s) to parse this into a string array (it is easier to update the editor from an array anyway).

    It would appear there will be more output messages than input messages.

    Do you have any thoughts on the issue?

    Some quick thoughts on the editor.

    BTW, since the editor is a MDI app it sort of precludes the use of DDT. Although it is not impossible to use DDT in a MDI app it is not a straightforward process, especially with dialog box creation, therefore, I have opted to keep the editor a SDK app to preserve the straightforward coding style. Less I have to recode, a lot less. MDI using DDT is something we may want to address in the future, but for version 1 I think SDK is the way to go.

    I have also found optional parameters are handled slightly different under PB 9.0. Under 8.x you could have an optional parameter that is never passed by the calling function/sub and still make reference to it in your procedure. In 9.0 it appears you cannot do this anymore, you have to check if the optional parameter is missing, otherwise you can generate a GPF. I was just about to send you the editor code when I ran into this little problem during my last test, so now I'm reevaluating my use of optional parameters. Will send you what I have when I've gone through my alpha testing. Murphy strikes again.

    I'm also having problems expanding the number of toolbar buttons in SDK. I can create the toolbar with the desired number of additional buttons, but the button images do not show up. I suspect that the color depth of my .BMP toolbar strip is not set correctly, or something of that nature. Will have to do some more digging in the Win32 Programmer's Reference.
    Later...

    JR

    "When governments fear the people there is liberty. When people fear the government there is tyranny." - Thomas Jefferson

    Comment


    • #3
      Originally posted by John R. Heathcote View Post
      Stan,

      I don't have any official messages as we were only talking about a concept, but I guess we can start to build a list.

      We need:

      Input: A message alerting Tokenizer we are sending one line of VB code.

      Output: A return message from above that the Tokenizer requests additional lines, in case the Tokenizer needs to convert a code block. Maybe call this a repeat code, if set, %TRUE keep sending lines until it is set to %FALSE.

      Output: Status of conversion. Returns either %TRUE (OK), or error/warning/information code. I'm thinking here we could set the message codes INFO = 1 - 200, WARNING = 201 - 400, ERROR = 401 - 600. If %TRUE or INFO then output the converted code to the editor with OBNOXIOUS COMMENT, if WARNING either output code to editor w/OBNOXIOUS COMMENT or issue message box alerting the user, if ERROR then issue error message to user and stop conversion.
      Here's a starting list. I bumped your value ranges by 1000 to insure unique number internally. Also, editor-to-converter are 1101 - 1109 and converter-to-editor are 1110-1119.

      Excerpt from vb2pbEquates.inc

      Code:
      'COM Message Equates
      
          'internal TokenizerStatus equates
          %IsPaused               = 560
          %IsReady                = 561
          %IsRunning              = 562
          %IsFinished             = 563
          %IsSearching            = 564
          %IsEditing              = 565
          %IsBrowsing             = 566
          %Saved_WIP              = 580
      
      '   Editor/Converter Messages:
      '       %Info: 1101 - 1200
                  'implied message that ConverterCOM class is ready to be processed
                  %NewCodeLinePosted          = 1101  'editor to converter: ConverterCOM class has been updated with 1 new VB code line
                  %RequestStatus              = 1102  'editor requests status of current process
                                                      'converter reply will be one of the above internal status codes
                  
                  'implied message that ConverterCOM class contains PB code for editor to access
                  %LineConverted              = 1110  'converter to editor: ConverterCOM class has been updated with new PB code line
                  %BlockConverted             = 1111  'converter to editor: EndOfBlock detected, Implies %LineConverted
                  
      '       %Warning: 1201 - 1400
                  %OptionExplicit_NotFound    = 1201  'VB module without OPTION EXPLICIT (obnoxious comment required)
      
      '       %Error: 1401 - 1600
                  %VB_SourceCorrupted         = 1401  'converter cannot read the VB source code
                  %VB_StructureWithoutEND     = 1402  'converter found a FUNCTION, SUB, CLASS, METHOD, PROPERTY, EVENT without END
      
      '       %FatalError: 1601 - 1800
                  %UndefinedFatalError        = 1601  'duh... I think its broke somewhere.
      
      '   *** Numbers used internally = 501-626 as of 8/30/2008 ***
      '   *** Numbers reserverd = 1100 - 1900 for COM messages - see list above for values ***
      '   *** values 601-615 are NOT used by vb2pb v1 - internal PB8 compiler errors) ***
      Output: Array or string of the converted code. ...
      Do you have any thoughts on the issue?
      When I thought this would be an internal process, I set up several arrays to track things. I have two candidates for communication with the editor. One is ParsedTextArray() -- each term in a separate element, would take some extra work to put it back together in human readable form.

      Best choice is probably the Concordance() array. We can add members to this TYPE if the editor needs more information.

      Excerpt from vb2pbTypes.inc
      Code:
      TYPE ConcordanceType                    'use in Concordance() to keep track of which VB line matches which PB line
          vbLineNo AS LONG
          vbCodeString AS STRING * 256
          pbLineNo AS LONG
          pbCodeString AS STRING * 256
      END TYPE
      If we use the Concordance() to pass code back and forth we can do something like this in the editor:

      Code:
      oMessages.Set_VbSource(Concordance(), lArraySize)
      and

      Code:
      oMessages.Get_PbCode(Concordance(), lArraySize)
      This way you have corresponding lines in each element of the array along with indexing line nos. and it wouldn't matter whether the editor passes 1 line or 100 lines.

      Some quick thoughts on the editor.

      BTW, since the editor is a MDI app it sort of precludes the use of DDT. Although it is not impossible to use DDT in a MDI app it is not a straightforward process, especially with dialog box creation, therefore, I have opted to keep the editor a SDK app to preserve the straightforward coding style. Less I have to recode, a lot less. MDI using DDT is something we may want to address in the future, but for version 1 I think SDK is the way to go.
      I don't think it matters DDT or SDK in the vb2pb code so drive on. This wouldn't affect the PB output, which will be compiled in the PB IDE. To the editor it's just text, right? If I'm wrong here, tell me now.

      I have also found optional parameters are handled slightly different under PB 9.0. Under 8.x you could have an optional parameter that is never passed by the calling function/sub and still make reference to it in your procedure. In 9.0 it appears you cannot do this anymore, you have to check if the optional parameter is missing, otherwise you can generate a GPF. I was just about to send you the editor code when I ran into this little problem during my last test, so now I'm reevaluating my use of optional parameters. Will send you what I have when I've gone through my alpha testing. Murphy strikes again.

      I'm also having problems expanding the number of toolbar buttons in SDK. I can create the toolbar with the desired number of additional buttons, but the button images do not show up. I suspect that the color depth of my .BMP toolbar strip is not set correctly, or something of that nature. Will have to do some more digging in the Win32 Programmer's Reference.
      I've used this snippet to handle that. Maybe you will find it useful.

      Code:
      IF ISMISSING(OptParam) THEN
          OptParam = DefaultValue
      END IF
      Sorry, I can't help much with SDK. I'm still learning how to use it. I find myself going back to PBForms constantly to keep my productivity up.

      Stan
      Do not go quiet into that good night,
      ... Rage, rage against the dark.

      Comment


      • #4
        Stan,

        I think you are on the right track.

        Here's a starting list. I bumped your value ranges by 1000 to insure unique number internally. Also, editor-to-converter are 1101 - 1109 and converter-to-editor are 1110-1119.
        Looks good to me.

        Basically, the editor needs the converted text array, the number of lines in the array, which I assume I can get from the UBOUND() function, and the status of the conversion to let the user know if the Tokenizer did its work or not. It sounds like your object equates define a good starting point for this process to work. It is really immaterial what the equate value are as I will test the return status in a SELECT CASE nReturnVal block or equivalent.

        I think it is important at this stage to keep the processing between the editor and Tokenizer as separate as possible. If the Tokenizer needs some information I can test for that in the editor and see to it the editor supplies the required information. Since the editor just handles text the Concordance array would probably be the most likely candidate to handle the text chore.

        The ParsedTextArray() might be useful in the future to enhance the error reporting capabilities of the Tokenizer by outputting the offending VB source code line, then beneath that put a "^" at the offending position within the line where the error occured:

        Code:
          x = something goofy(param1, param2)
              ^
              ***ERROR - INVALID FUNCTION NAME
        I've seen many command based systems use this type of error message reporting to great success.

        This way you have corresponding lines in each element of the array along with indexing line nos. and it wouldn't matter whether the editor passes 1 line or 100 lines.
        This sounds good to me as I think we need to account for the possibility of many Vb lines being condensed into one line of PB code, likewise we need to account for the possibility of one VB line expanding into many PB lines.

        I don't think it matters DDT or SDK in the vb2pb code so drive on. This wouldn't affect the PB output, which will be compiled in the PB IDE. To the editor it's just text, right?
        You're right about that, it doesn't matter. I seem to remember that the group settled on DDT as our programming standard, and here I go breaking the rules (again). I guess MINISTER of OBNOXIA fits doesn't it?

        If I'm wrong here, tell me now.
        You are quite correct.

        I've used this snippet to handle that. Maybe you will find it useful.
        I'm doing this too. But the fact that PB 9.0 handles OPTIONAL paramaters differently has forced me to reevaluate my use of OPTIONALs, which isn't necessarily a bad thing either.

        Sorry, I can't help much with SDK. I'm still learning how to use it.
        Registering as a member of Jose Roca's new web site has helped me considerably. Jose has pointed out some deprecated API calls that should be upgraded, especially dealing with Tool Bars.

        I find myself going back to PBForms constantly to keep my productivity up.
        This is really interesting as I find DDT to be more of a stumbling block to me. I have had far more success writing SDK code than DDT code, despite the fact that DDT appears to be easier to use. This is not a total slam of DDT as I do have some DDT code in the editor and it works, just couldn't get the DDT toolbar stuff to work.
        Later...

        JR

        "When governments fear the people there is liberty. When people fear the government there is tyranny." - Thomas Jefferson

        Comment


        • #5
          Okay, it sounds like we're on the same page. I'll post the COM interface as soon as I've got it debugged and tested so you can implement the client side in the editor.

          Stan
          Do not go quiet into that good night,
          ... Rage, rage against the dark.

          Comment


          • #6
            Originally posted by John R. Heathcote View Post
            ...
            This is really interesting as I find DDT to be more of a stumbling block to me. I have had far more success writing SDK code than DDT code, despite the fact that DDT appears to be easier to use. ...
            In the beginning I gravitated to the quickest/easiest (on the surface, anyway) way to get things done. The main reason I continue to use DDT is the empty structures provided by PBForms. I can concentrate on what I want to do and not on the OS. I've found that PB provides very good native support for dealing with 99.99% of the problems that come up using DDT, and that last 0.01% is usually right here in the forums. Now that I am trying to get up to speed with SDK I'm learning more than I ever really wanted to know about Windows.

            Stan
            Do not go quiet into that good night,
            ... Rage, rage against the dark.

            Comment


            • #7
              Stan,

              Well the good news today is I downloaded one of Jose's Toolbar examples from his web site, created my own ToolBar example and set my own graphic images for the buttons. Since I managed to get this to work I have some more coding updates to do to the editor, but this is important coding that MUST be done. (BTW, if you haven't become a member of Jose's new web site I would strongly recommend you do so. Jose has an incredible amount of PB 9.0 source code ready to go, and with his attention to detail you just know its gonna work).

              It seems that the editor was using a deprecated API function, CreateToolbarEx(), to define and populate the toolbar buttons. It appears this function is difficult to work with (which I can attest to), is finiky about graphic images, and definitely not as flexible, nor forgiving as the code Jose posted. The only problem I had was getting the resource file to compile correctly so I could add ToolTips for the Toolbar buttons, but I think I'm on top of that too, should know more about this tomorrow. I think I should get the framework built for as many of these bells and whistles as I can, will be easier to add to these at a later date. In the mean time I'm leaving myself lots of OBNOXIOUS COMMENTS in the editor source code to remind me to do things.

              I'll post the COM interface as soon as I've got it debugged and tested so you can implement the client side in the editor.
              Sounds good to me. I think the only way we are going to get a handle on this is to put the two pieces together and see what happens, what problems are created, etc. I'm sure there is something we haven't thought of.

              Now that I am trying to get up to speed with SDK I'm learning more than I ever really wanted to know about Windows.
              I sympathize. Quite honestly I would rather compute tangent offests to a clothoid spiral, that only requires analytical geometry, linear algebra, and calculus, while attempting to make ToolBars work requires Windows. The only real positive that I found SDK offers over DDT is its flexibility and immediate control when you want Windows to do something, that is what keeps me going.

              Having said that, the downside of SDK, for me anyway, is the apparent lack of consistency in control implementation, Windows messages sent/received, etc. In fact the only consistent thing about Windows is its inconsistencies. I'm still amazed Windows works as well as it does, or even at all.

              BTW, did you get all of the help files with your PB 9.0 installation? It seems the only help file I received is the one for PB 9.0 itself, the rest appear to be missing. Is this normal?
              Later...

              JR

              "When governments fear the people there is liberty. When people fear the government there is tyranny." - Thomas Jefferson

              Comment


              • #8
                Originally posted by John R. Heathcote View Post
                ...
                (BTW, if you haven't become a member of Jose's new web site I would strongly recommend you do so. Jose has an incredible amount of PB 9.0 source code ready to go, and with his attention to detail you just know its gonna work).
                Is it connected to the old site? I've always found Jose's code quite dependable.

                ...
                It seems that the editor was using a deprecated API function ...
                but I think I'm on top of that too ,,,
                In the mean time I'm leaving myself lots of OBNOXIOUS COMMENTS in the editor source code to remind me to do things.
                My wife reminded me that this is a holiday weekend. I'm glad the editor is working, but don't forget to party just a little bit.

                Sounds good to me. I think the only way we are going to get a handle on this is to put the two pieces together and see what happens, what problems are created, etc. I'm sure there is something we haven't thought of.
                I'm certain of it, but then if we thought of everything we might do better as 900 phone line psychics.

                ...
                BTW, did you get all of the help files with your PB 9.0 installation? It seems the only help file I received is the one for PB 9.0 itself, the rest appear to be missing. Is this normal?
                Only 2 new help files:
                In the BIN folder:
                PBWin = HTML helpfile
                PBrow = HTML help for Object Browser

                I didn't find any other help files in the installation, but since I didn't uninstall PB 8.04, I just sort of set the options in PB 9.0 to look in the PB 8.0 Win32api folder for that help file. According to the history this hasn't been updated since 2005. So far, it's been as much help as it ever was. I still find myself going to MSDN online to find the C/C++ structs when I need that kind of detail.

                Have a great Labor Day weekend (what's left of it). Tomorrow is a family day for us here in Alabama, so I'll post what I've got Tuesday.

                Personal Note: I might be making a business trip to Bolder in October. Are you anywhere close?



                Rod,
                Canadian Labor Day? Or any holiday you can celebrate this weekend?



                Stan
                Do not go quiet into that good night,
                ... Rage, rage against the dark.

                Comment


                • #9
                  Yeah, but up here it's Labour Day. "U" see, we work harder on the spelling.
                  As a holiday treat, Bob Zale gave me a download copy of PB 9, which I got at noon today, so, well, you know how it is.

                  Rod
                  Rod
                  In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.

                  Comment


                  • #10
                    Originally posted by Rodney Hicks View Post
                    Yeah, but up here it's Labour Day. "U" see, we work harder on the spelling.
                    As a holiday treat, Bob Zale gave me a download copy of PB 9, which I got at noon today, so, well, you know how it is.

                    Rod
                    We have Teddy Roosevelt to thank for all those shorter words like Labor, and Harbor, and .... I know there's more, it's just been so long since I took English Lit.

                    Stan
                    Do not go quiet into that good night,
                    ... Rage, rage against the dark.

                    Comment


                    • #11
                      Stan,

                      Is it connected to the old site? I've always found Jose's code quite dependable.
                      It is a rebuild of the old site, more comprehensive. Here's the link:

                      http://www.jose.it-berater.org/smfforum/index.php#19

                      I'm glad the editor is working, but don't forget to party just a little bit.
                      Well, just a little. I find that it is really fun, for me anyway, to sit and watch all my friends get drunk. You can pick up some valuable intel that way.

                      I'm certain of it, but then if we thought of everything we might do better as 900 phone line psychics.
                      Are you the guy that gets up in front of his friends and says, "Here's a little joke for all you psychics in the room", and then promptly sits down?

                      Only 2 new help files:
                      Yeah, I got the same two files. The reason additional help files were not supplied as the old PB 8.x help files wouldn't work with Vista. I did the same thing as you, point to the old PB 8.x help files.

                      Have a great Labor Day weekend (what's left of it). Tomorrow is a family day for us here in Alabama, so I'll post what I've got Tuesday.
                      Thanks. Please have a great and safe, holiday. I'll be playing around with the editor off an on, but I have made it my goal to get you the editor this week, but everything may not work 100%.

                      Personal Note: I might be making a business trip to Bolder in October. Are you anywhere close?
                      I live in Grand Junction which is in the western part of Colorado, approximately 30 miles east of the Utah border. Boulder is about 280 miles from Grand Junction, give or take, depending on the route traveled, about a five hour drive.

                      If you plan to stay in Boulder for a day or two I would recommend you take I-70 west and see Eisenhower tunnel, a construction project I worked on many years ago, and the view ain't bad either. At 11,000 feet in altitude Eisenhower Tunnels, which crosses the Continental Divide, are the worlds highest traffic tunnels. They are almost 2 miles in length. If you do go up there take plenty of water and granola bars with you as folks from low-lying states can get altitude sickness (headaches and nausea) very easily, but it is worth the trip. You will get to see what a real mountain looks like and maybe a bit of snow.
                      Later...

                      JR

                      "When governments fear the people there is liberty. When people fear the government there is tyranny." - Thomas Jefferson

                      Comment


                      • #12
                        The reason additional help files were not supplied as the old PB 8.x help files wouldn't work with Vista. I did the same thing as you, point to the old PB 8.x help files.
                        Not doubting you, for I know Vista had a lot of new hurdles. I bought PBWin 8.03 and I never had any help file troubles, from the computer.(just me getting my head around things).

                        Guys I really like this PB 9. If you don't hear from me you know I've been Over POWERed, BASICly.
                        Rod
                        In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.

                        Comment


                        • #13
                          Originally posted by John R. Heathcote View Post
                          ...
                          It is a rebuild of the old site, more comprehensive. Here's the link:
                          Thanks. I'll update my bookmarks.

                          ...
                          Are you the guy that gets up in front of his friends and says, "Here's a little joke for all you psychics in the room", and then promptly sits down?
                          Well. Let me tell you this about that.


















                          ...
                          Boulder is about 280 miles from Grand Junction, give or take, depending on the route traveled, about a five hour drive....
                          If this deal works out, I'll be there for about 4 weeks. Plenty of time to see the Eisenhower tunnel and few other things

                          ...
                          see what a real mountain looks like and maybe a bit of snow.
                          Good! I haven't seen a real mountain since I got back from Germany too long ago to mention in public.
                          Do not go quiet into that good night,
                          ... Rage, rage against the dark.

                          Comment


                          • #14
                            Originally posted by Rodney Hicks View Post
                            ...
                            Guys I really like this PB 9. If you don't hear from me you know I've been Over POWERed, BASICly.

                            Uh Oh. When I got mine it was 2-3 days before I came up for air.
                            Do not go quiet into that good night,
                            ... Rage, rage against the dark.

                            Comment


                            • #15
                              Rod,

                              Take two new PB 9.0 statements/functions and call me in the morning.

                              Stan,

                              If this deal works out, I'll be there for about 4 weeks. Plenty of time to see the Eisenhower tunnel and few other things
                              Let me know, we will definitely have to look up each other if you have the time.

                              Good! I haven't seen a real mountain since I got back from Germany too long ago to mention in public.
                              I didn't know you were in Germany "too long ago". Usually when people from Alabama or Florida, for example, tell me they are planning a trip to Colorado they always say they want to visit the mountains and see the snow. Normally, these same people have never even seen a mountain, snow, or been above an altitude of 500 feet in their entire lives. When they arrive at an altitude of 11,000 feet they are very surprised at how it affects them physically. The fact that you've been to Germany makes you an "old" hand at visiting the mountains, sorry, couldn't resist.

                              If you are planning your business meeting in October you may get to see some snow, especially in the high country, above 6000 feet.
                              Later...

                              JR

                              "When governments fear the people there is liberty. When people fear the government there is tyranny." - Thomas Jefferson

                              Comment

                              Working...
                              X