home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mac / programm / 14766 < prev    next >
Encoding:
Text File  |  1992-08-30  |  2.0 KB  |  79 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!cis.ohio-state.edu!news.cis.ohio-state.edu!hughson
  3. From: hughson@news.cis.ohio-state.edu (J.R. Hughson)
  4. Subject: XCMD Debug?
  5. Message-ID: <9208310226.AA06198@lilac.cis.ohio-state.edu>
  6. Sender: hughson@cis.ohio-state.edu (Jerry R Hughson)
  7. Organization: The Ohio State University Department of Computer and Information Science
  8. Date: Mon, 31 Aug 1992 02:26:44 GMT
  9. Lines: 68
  10.  
  11.  
  12. Hello all,
  13.     I really hate to do this, but can anyone see where this code
  14. writes over low mem?  The thing crashes, but only after it has executed
  15. and returned with proper results.  I wouldn't do this, but I need this
  16. XCMD to work soon.  
  17.  
  18.     The purpose of the code is to make a popup menu on the fly
  19. and display it.  It should return an int to say which line was chosen.
  20. I tried to follow IM by the letter. Comments have been removed for clarity :)
  21.  
  22. thanks in advance.
  23. J.R.
  24. hughson@cis.ohio-state.edu
  25. p.s. either email or news is fine for a reply.  I will post a summary of email.
  26.  
  27. //code starts here....
  28.  
  29. #include <menus.h>
  30. #include <HyperXCmd.h>
  31.  
  32. main(XCmdPtr pp)
  33.   {
  34.   MenuHandle mymenu;
  35.   int myresult,current;
  36.   Point topleft;
  37.   Str255 temp;    
  38.   
  39.   if (StillDown())
  40.       {
  41.       if ((mymenu = NewMenu(46,"\p"))== 0l)
  42.           {
  43.           pp->result = -1;
  44.           return;
  45.           }
  46.       HLock(pp->params[2]);
  47.       ZeroToPas(pp,*(pp->params[2]),temp); 
  48.       HUnlock(pp->params[2]);
  49.       
  50.       topleft.v = StrToNum(pp,temp);
  51.   
  52.       HLock(pp->params[3]);
  53.       ZeroToPas(pp,*(pp->params[3]),temp); 
  54.       HUnlock(pp->params[3]);
  55.       
  56.       topleft.h = StrToNum(pp,temp);
  57.   
  58.       HLock(pp->params[1]);
  59.       ZeroToPas(pp,*(pp->params[1]),temp); 
  60.       HUnlock(pp->params[1]);
  61.   
  62.       current = StrToNum(pp,temp);
  63.  
  64.       HLock(pp->params[0]);
  65.       ZeroToPas(pp,*(pp->params[0]),temp); 
  66.       HUnlock(pp->params[0]);
  67.  
  68.       LocalToGlobal(&topleft);
  69.       InsertMenu(mymenu, -1);
  70.       AppendMenu(mymenu, temp ); 
  71.       myresult = PopUpMenuSelect(mymenu, topleft.v, topleft.h, current);
  72.       DeleteMenu(46);        
  73.       DisposeMenu(mymenu);
  74.       pp->result = myresult;
  75.       }
  76.   else
  77.       pp->result = 0;
  78.   }
  79.