Loading ...
Sorry, an error occurred while loading the content.

It's beautiful... except for the part where it doesn't work

Expand Messages
  • BC Holmes
    Sigh. I feel like I m in the home stretch. I ve got the majority of my code ported, and it runs in stand-alone mode. I ve got an interface to my code that
    Message 1 of 7 , Apr 4, 2012
    • 0 Attachment
      Sigh.

      I feel like I'm in the home stretch. I've got the majority of my code
      ported, and it runs in stand-alone mode. I've got an interface to my
      code that works with the XP API and with a simple file interface. I've
      got all my code loaded up into Visual Studio, and all the compile
      problems have been figured out.

      But the code doesn't work when I invoke it from CC3. Specifically, I
      get the hourglass and my CC3 process starts consuming a lot of memory.
      Never a good sign with a Windows/C++ program.

      I'm sure there's some dumb little thing that's a problem for me. But
      what techniques do people use to debug XPs running in CC3? Is there any
      kind of existing logging API? Or sumpthing like that?

      BCing you
      --
      B.C. Holmes \u2625 http://www.bcholmes.org/
      "All my life I've wanted to be somebody; I guess I should've been
      more specific." -- Lily Tomlin
    • L. Lee Saunders
      Peter will probably answer with some great way (He is just Soooooo much more experienced at XP development than I am) but here is what I do, I call out to a
      Message 2 of 7 , Apr 4, 2012
      • 0 Attachment
        Peter will probably answer with some great way (He is just Soooooo much more experienced at XP development than I am) but here is what I do, I call out to a console window.  Here is my blog post where I describe how it works:
         
        http://cc3-developer.blogspot.com/2010/11/quick-development-tip.html

        L. Lee Saunders
         
        "It was only a partial solution, of course, as solutions usually are, and addressed only one specific problem, as solutions usually do. But, as was often also true, it opened the door—if only a crack—for the multitude of solutions to follow." 
        1632 - Eric Flint
         
        my blog: http://oldschooldotnet.blogspot.com
        Taking Dot Net "Old School" - Playing with old ideas/concepts using the newest tools!
         
         


         

        To: cc2-dev-l@yahoogroups.com
        From: yahoo@...
        Date: Wed, 4 Apr 2012 21:36:06 -0400
        Subject: [cc2-dev-l] It's beautiful... except for the part where it doesn't work

         

        Sigh.

        I feel like I'm in the home stretch. I've got the majority of my code
        ported, and it runs in stand-alone mode. I've got an interface to my
        code that works with the XP API and with a simple file interface. I've
        got all my code loaded up into Visual Studio, and all the compile
        problems have been figured out.

        But the code doesn't work when I invoke it from CC3. Specifically, I
        get the hourglass and my CC3 process starts consuming a lot of memory.
        Never a good sign with a Windows/C++ program.

        I'm sure there's some dumb little thing that's a problem for me. But
        what techniques do people use to debug XPs running in CC3? Is there any
        kind of existing logging API? Or sumpthing like that?

        BCing you
        --
        B.C. Holmes \u2625 http://www.bcholmes.org/
        "All my life I've wanted to be somebody; I guess I should've been
        more specific." -- Lily Tomlin

      • Peter Olsson
        Are you able to use the built in debugger in Visual Studio? 1. Set the output to the CC3-folder. 2. Press F9 on the line you want to break 3. Press
        Message 3 of 7 , Apr 5, 2012
        • 0 Attachment

          Are you able to use the built in debugger in Visual Studio?

           

          1.     Set the output to the CC3-folder.

          2.     Press F9 on the line you want to break

          3.     Press F5 to run in the debugger and select FCW32.exe as your target.

           

          Peter

           

           

          From: cc2-dev-l@yahoogroups.com [mailto:cc2-dev-l@yahoogroups.com] On Behalf Of BC Holmes
          Sent: Thursday, April 05, 2012 3:36 AM
          To: cc2-dev-l@yahoogroups.com
          Subject: [cc2-dev-l] It's beautiful... except for the part where it doesn't work

           

           


          Sigh.

          I feel like I'm in the home stretch. I've got the majority of my code
          ported, and it runs in stand-alone mode. I've got an interface to my
          code that works with the XP API and with a simple file interface. I've
          got all my code loaded up into Visual Studio, and all the compile
          problems have been figured out.

          But the code doesn't work when I invoke it from CC3. Specifically, I
          get the hourglass and my CC3 process starts consuming a lot of memory.
          Never a good sign with a Windows/C++ program.

          I'm sure there's some dumb little thing that's a problem for me. But
          what techniques do people use to debug XPs running in CC3? Is there any
          kind of existing logging API? Or sumpthing like that?

          BCing you
          --
          B.C. Holmes \u2625 http://www.bcholmes.org/
          "All my life I've wanted to be somebody; I guess I should've been
          more specific." -- Lily Tomlin

        • bcholmes2001
          ... Oh, hey, I am now! I ve never used the VS Debugger quite like this before -- debugging a DLL being called from a program. Interesting. Mostly I ve used
          Message 4 of 7 , Apr 5, 2012
          • 0 Attachment
            --- In cc2-dev-l@yahoogroups.com, Peter Olsson <peter@...> wrote:
            >
            > Are you able to use the built in debugger in Visual Studio?


            Oh, hey, I am now! I've never used the VS Debugger quite like this before -- debugging a DLL being called from a program. Interesting. Mostly I've used it in C# .Net app development. I've also figured out how to spit stuff out to the debug console. (Windows has never been my strong suit, so there's a bit of a learning curve).

            It looks like this is my problem, at the moment: I don't understand enough about the DLScan. I based my code on the sample that you sent me, but I think I've made bad assumptions about how to invoke the DLScan.

            In my code, the boiler-plate XP stuff ultimately invokes this method, here:

            int SaveSVG(char *FileName)
            {
            Fcw fcw("", FileName);
            HDR* hdr = GetHeaderAdr();
            fcw.addInfoBlock(hdr);
            DLScan(NULL, SaveSVGScan, DLS_Std, (void *)&fcw, 0);

            fcw.toSvg();
            return true;
            }

            I instantiate a copy of my converter engine (the Fcw object), and I want to feed all the entities into it, so that it can build up a set of objects representing the different shapes.

            What I *thought* this would do is invoke the SaveSVGScan function on each of the top-level entities. Then, in my SaveSVGScan function, I have this:

            static DWORD XPCALL SaveSVGScan(hDLIST hDList, pENTREC pEntRec,
            void *node_handle, PARM parm2)
            {
            Fcw* fcw = (Fcw*) node_handle;
            fcw->addEntity(pEntRec);

            switch(pEntRec->CStuff.EType)
            {
            case ET_MPOLY2:
            case ET_SYMDEF:
            case ET_SYMREF:
            case ET_PART:
            case ET_SHEET:
            {
            fcw->startSubList();

            hDLIST hSubList = DLGetSubList(pEntRec);
            DLScan(hSubList, SaveSVGScan, DLS_Std, node_handle, 0);

            fcw->endSubList();

            break;
            }
            default:
            ;

            }
            return 0;
            }

            If I comment out the logic relating to sublists, here, this mostly works, but I end up missing a lot of entities. What I wanted was believe that this would invoke the same SaveSVGScan function on each item in the sublist (and that the sublist would contain all of the immediate children of each entity).

            What I see, in practice, is that it appears that I keep visiting the same entities again and again (judging by the fact that I keep finding the same Tags). Now, my understanding of the entities is definitely influenced by the structure of the .fcw file format. The structure, there, is straight-forwardly hierarchical. Any particular entity (of specific types) may have a sublist of entities. Walking through the file is like depth-first tree crawl.

            Am I wrong to think I can accomplish a similar type of tree crawl in the XP?

            BCing you
          • BC Holmes
            ... I gotta confess that I m feeling pretty defeated at this point. I tried a variety of different options on my DLScan call tonight, but I still have
            Message 5 of 7 , Apr 13, 2012
            • 0 Attachment
              On 12-04-05 6:46 PM, bcholmes2001 wrote:
              >
              > What I see, in practice, is that it appears that I keep visiting the
              > same entities again and again (judging by the fact that I keep
              > finding the same Tags). Now, my understanding of the entities is
              > definitely influenced by the structure of the .fcw file format. The
              > structure, there, is straight-forwardly hierarchical. Any particular
              > entity (of specific types) may have a sublist of entities. Walking
              > through the file is like depth-first tree crawl.


              I gotta confess that I'm feeling pretty defeated at this point. I tried
              a variety of different options on my DLScan call tonight, but I still
              have problems with the sublists. I can't figure out why my sublists
              seem to keep giving me the same elements over and over again.

              BCing you
              --
              B.C. Holmes \u2625 http://www.bcholmes.org/
              "All my life I've wanted to be somebody; I guess I should've been
              more specific." -- Lily Tomlin
            • Peter Olsson
              Do you mind sharing your Visual Studio project? I doesn t have to be the full project as long as it shows the bug. I will rn it through the debugger. Peter
              Message 6 of 7 , Apr 13, 2012
              • 0 Attachment
                Do you mind sharing your Visual Studio project?
                I doesn't have to be the full project as long as it shows the bug. 
                I will rn it through the debugger. 

                Peter

                Skickat från min iPad

                14 apr 2012 kl. 04:29 skrev BC Holmes <yahoo@...>:

                 

                On 12-04-05 6:46 PM, bcholmes2001 wrote:
                >
                > What I see, in practice, is that it appears that I keep visiting the
                > same entities again and again (judging by the fact that I keep
                > finding the same Tags). Now, my understanding of the entities is
                > definitely influenced by the structure of the .fcw file format. The
                > structure, there, is straight-forwardly hierarchical. Any particular
                > entity (of specific types) may have a sublist of entities. Walking
                > through the file is like depth-first tree crawl.

                I gotta confess that I'm feeling pretty defeated at this point. I tried
                a variety of different options on my DLScan call tonight, but I still
                have problems with the sublists. I can't figure out why my sublists
                seem to keep giving me the same elements over and over again.

                BCing you
                --
                B.C. Holmes \u2625 http://www.bcholmes.org/
                "All my life I've wanted to be somebody; I guess I should've been
                more specific." -- Lily Tomlin

              • bcholmes2001
                ... I don t mind that at all, and I was completely willing to take you up on your offer. But I woke up this morning with a bit of an a-ha moment about what
                Message 7 of 7 , Apr 14, 2012
                • 0 Attachment
                  --- In cc2-dev-l@yahoogroups.com, Peter Olsson <peter@...> wrote:
                  >
                  > Do you mind sharing your Visual Studio project?
                  > I doesn't have to be the full project as long as it shows the bug.
                  > I will rn it through the debugger.


                  I don't mind that at all, and I was completely willing to take you up on your offer. But I woke up this morning with a bit of an a-ha moment about what the problem might be. All I needed was a null check like so:


                  hDLIST hSubList = DLGetSubList(pEntRec);
                  if (hSubList != NULL) {
                  DLScan(hSubList, SaveSVGScan, DLS_UNLK | DLS_NOWDC, node_handle, 0);
                  }

                  And -- ta-da! -- that takes care of my problem. If the handle is null, then the subsequent DLScan tries to go through everything all over again: exactly my symptom.

                  I haven't fully tracked down why some fields were giving me a null sublist. If I had to guess, I'd suspect that SYMREFs, which appear as group items in the file format, might not behave like a group item in the XP API.

                  But thank you again for the offer of help.

                  BCing you
                Your message has been successfully submitted and would be delivered to recipients shortly.