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

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

Expand Messages
  • bcholmes2001
    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
    • Show all 7 messages in this topic