P1(PUBLIC pascal trap, void, LDispose, ListHandle, list) /* IMIV-271 */ { if (list) { LISTDECL(); LISTBEGIN(list); LISTCALL(lCloseMsg, FALSE, (Rect *)0, * (Cell *) &HxX(list, clikLoc), 0, 0, list); LISTEND(list); DisposHandle((Handle) HxP(list, cells)); if (HxP(list, hScroll)) DisposeControl(HxP(list, hScroll)); if (HxP(list, vScroll)) DisposeControl(HxP(list, vScroll)); } #if defined (LIST_DEBUG) delete_list (list); #endif }
//============================================================================ void NetTransUpdate () { LISTDECL(NetTrans, m_link) completed; LISTDECL(NetTrans, m_link) parentCompleted; s_critsect.Enter(); NetTrans * next, * trans = s_transactions.Head(); for (; trans; trans = next) { next = s_transactions.Next(trans); bool done = false; while (!done) { switch (trans->m_state) { case kTransStateComplete: if (trans->m_hasSubTrans) parentCompleted.Link(trans); else completed.Link(trans); done = true; break; case kTransStateWaitServerConnect: if (!trans->CanStart()) { done = true; break; } if (trans->m_protocol && 0 == (trans->m_connId = ConnGetId(trans->m_protocol))) { done = true; break; } // This is the default "next state", trans->Send() can override this trans->m_state = kTransStateWaitServerResponse; // Set timeout time before calling Send(), allowing Send() to change it if it wants to. trans->m_timeoutAtMs = TimeGetMs() + s_timeoutMs; if (!trans->Send()) { // Revert back to current state so that we'll attempt to send again trans->m_state = kTransStateWaitServerConnect; done = true; break; } break; case kTransStateWaitServerResponse: // Check for timeout if ((int)(TimeGetMs() - trans->m_timeoutAtMs) > 0) { // Check to see if the transaction wants to "abort" the timeout if (trans->TimedOut()) CancelTrans_CS(trans, kNetErrTimeout); else trans->m_timeoutAtMs = TimeGetMs() + s_timeoutMs; // Reset the timeout counter } done = true; break; DEFAULT_FATAL(trans->m_state); } } } s_critsect.Leave(); // Post completed transactions while (NetTrans * trans = completed.Head()) { completed.Unlink(trans); trans->Post(); trans->UnRef("Lifetime"); } // Post completed parent transactions while (NetTrans * trans = parentCompleted.Head()) { parentCompleted.Unlink(trans); trans->Post(); trans->UnRef("Lifetime"); } }
P9(PUBLIC pascal trap, ListHandle, LNew, Rect *, rview, /* IMIV-270 */ Rect *, bounds, Point, csize, INTEGER, proc, WindowPtr, wind, BOOLEAN, draw, BOOLEAN, grow, BOOLEAN, scrollh, BOOLEAN, scrollv) { ListHandle retval; ListPtr lp; INTEGER noffs, min, max; INTEGER *ip; Rect r; int i; DataHandle tempdatah; Handle temph; LISTDECL(); noffs = (CW(bounds->right) - CW(bounds->left)) * (CW(bounds->bottom) - CW(bounds->top)) +1; retval = (ListHandle) NewHandle(sizeof(ListRec) - sizeof(HxX(retval, cellArray)) + (noffs+1) * sizeof(INTEGER)); if (!retval) /*-->*/ return 0; /* couldn't allocate memory */ temph = RM(GetResource(TICK("LDEF"), proc)); if (!(HxX(retval, listDefProc) = temph)) { DisposHandle((Handle) retval); /*-->*/ return 0; /* spooey list definition proc */ } TRAPBEGIN(); tempdatah = RM((DataHandle) NewHandle(0)); HxX(retval, cells) = tempdatah; HLock((Handle) retval); lp = STARH(retval); lp->dataBounds = *bounds; lp->rView = *rview; lp->port = RM(wind); lp->indent.h = 0; lp->indent.v = 0; lp->selFlags = 0; #if defined (STEF_lActivefix) lp->lActive = TRUE; #else lp->lActive = FrontWindow() == wind; #endif lp->lReserved = 0; lp->clikTime = 0; lp->clikLoc.h = CWC(-32768); lp->clikLoc.v = CWC(-32768); lp->mouseLoc.h = -1; lp->mouseLoc.v = -1; lp->lClikLoop = 0; lp->lastClick.h = -1; lp->lastClick.v = -1; lp->refCon = 0; lp->userHandle = (Handle) 0; lp->maxIndex = -1; /* What is this anyway? */ ip = (INTEGER *) lp->cellArray; for (i = 0; i <= noffs; i++) *ip++ = 0; lp->visible.top = bounds->top; lp->visible.left = bounds->left; lp->vScroll = 0; lp->hScroll = 0; C_LCellSize(csize, retval); /* sets cellSize and visible */ lp->listFlags = draw ? DODRAW : 0; if (scrollv) { r = lp->rView; r.top = CW(CW(r.top) - 1); r.left = r.right; r.right = CW(CW(r.right) + (16)); r.bottom = CW(CW(r.bottom) + 1); ROMlib_vminmax(&min, &max, lp); lp->vScroll = RM(NewControl((WindowPtr) wind, &r, (StringPtr) "", draw && lp->lActive, min, min, max, scrollBarProc, (LONGINT) 0)); STARH(MR(lp->vScroll))->contrlRfCon = RM((LONGINT) (long) retval); lp->listFlags |= lDoVAutoscroll; } if (scrollh) { r = lp->rView; r.left = CW(CW(r.left) - 1); r.top = r.bottom; r.bottom = CW(CW(r.bottom) + (16)); r.right = CW(CW(r.right) + 1); ROMlib_hminmax(&min, &max, lp); lp->hScroll = RM(NewControl((WindowPtr) wind, &r, (StringPtr) "", draw && lp->lActive, min, min, max, scrollBarProc, (LONGINT) 0)); STARH(MR(lp->hScroll))->contrlRfCon = RM((LONGINT) (long) retval); lp->listFlags |= lDoHAutoscroll; } HUnlock((Handle) retval); LISTBEGIN(retval); LISTCALL(lInitMsg, FALSE, (Rect *)0, * (Cell *)&lp->clikLoc, 0, 0, retval); LISTEND(retval); TRAPEND(); #if defined (LIST_DEBUG) add_list (retval); #endif return retval; }