home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!cis.ohio-state.edu!news.cis.ohio-state.edu!hughson
- From: hughson@news.cis.ohio-state.edu (J.R. Hughson)
- Subject: XCMD Debug?
- Message-ID: <9208310226.AA06198@lilac.cis.ohio-state.edu>
- Sender: hughson@cis.ohio-state.edu (Jerry R Hughson)
- Organization: The Ohio State University Department of Computer and Information Science
- Date: Mon, 31 Aug 1992 02:26:44 GMT
- Lines: 68
-
-
- Hello all,
- I really hate to do this, but can anyone see where this code
- writes over low mem? The thing crashes, but only after it has executed
- and returned with proper results. I wouldn't do this, but I need this
- XCMD to work soon.
-
- The purpose of the code is to make a popup menu on the fly
- and display it. It should return an int to say which line was chosen.
- I tried to follow IM by the letter. Comments have been removed for clarity :)
-
- thanks in advance.
- J.R.
- hughson@cis.ohio-state.edu
- p.s. either email or news is fine for a reply. I will post a summary of email.
-
- //code starts here....
-
- #include <menus.h>
- #include <HyperXCmd.h>
-
- main(XCmdPtr pp)
- {
- MenuHandle mymenu;
- int myresult,current;
- Point topleft;
- Str255 temp;
-
- if (StillDown())
- {
- if ((mymenu = NewMenu(46,"\p"))== 0l)
- {
- pp->result = -1;
- return;
- }
- HLock(pp->params[2]);
- ZeroToPas(pp,*(pp->params[2]),temp);
- HUnlock(pp->params[2]);
-
- topleft.v = StrToNum(pp,temp);
-
- HLock(pp->params[3]);
- ZeroToPas(pp,*(pp->params[3]),temp);
- HUnlock(pp->params[3]);
-
- topleft.h = StrToNum(pp,temp);
-
- HLock(pp->params[1]);
- ZeroToPas(pp,*(pp->params[1]),temp);
- HUnlock(pp->params[1]);
-
- current = StrToNum(pp,temp);
-
- HLock(pp->params[0]);
- ZeroToPas(pp,*(pp->params[0]),temp);
- HUnlock(pp->params[0]);
-
- LocalToGlobal(&topleft);
- InsertMenu(mymenu, -1);
- AppendMenu(mymenu, temp );
- myresult = PopUpMenuSelect(mymenu, topleft.v, topleft.h, current);
- DeleteMenu(46);
- DisposeMenu(mymenu);
- pp->result = myresult;
- }
- else
- pp->result = 0;
- }
-