* display messages using Notification Manager or an alert. * no run-length checking is done. the messages are created to fit * in the allocated space (nmBufSize and aboutBufSize). */
| 484 | * in the allocated space (nmBufSize and aboutBufSize). |
| 485 | */ |
| 486 | static void |
| 487 | note(short errorSignal, short alertID, unsigned char *msg) |
| 488 | { |
| 489 | if (!errorSignal) { |
| 490 | Size grow; |
| 491 | |
| 492 | if (MaxMem(&grow) < pBytes->memAbort) |
| 493 | noteErrorMessage(msg, "\pOut of Memory"); |
| 494 | } |
| 495 | |
| 496 | if (errorSignal || !in.Front) { |
| 497 | notifPtr pNMR; |
| 498 | short i = nmt.nmBuf[0] + 1; /* insertion point */ |
| 499 | |
| 500 | if (errorSignal) /* use notification template */ |
| 501 | { |
| 502 | pNMR = &nmt; |
| 503 | |
| 504 | /* we're going to abort so add in this prefix */ |
| 505 | BlockMove("Abort: ", &nmt.nmBuf[i], 7); |
| 506 | i += 7; |
| 507 | nmt.nmBuf[0] += 7; |
| 508 | } else /* allocate a notification record */ |
| 509 | { |
| 510 | if (!(pNMR = (notifPtr) NewPtr(sizeof(notifRec)))) |
| 511 | noteErrorMessage(msg, "\pNil New Pointer"); |
| 512 | |
| 513 | /* initialize it */ |
| 514 | *pNMR = nmt; |
| 515 | pNMR->nmr.nmStr = (StringPtr) & (pNMR->nmBuf); |
| 516 | |
| 517 | /* update the notification queue */ |
| 518 | if (!pNMQ) |
| 519 | pNMQ = pNMR; |
| 520 | else { |
| 521 | notifPtr pNMX; |
| 522 | |
| 523 | /* find the end of the queue */ |
| 524 | for (pNMX = pNMQ; pNMX->nmNext; pNMX = pNMX->nmNext) |
| 525 | ; |
| 526 | |
| 527 | pNMX->nmNext = pNMR; |
| 528 | } |
| 529 | } |
| 530 | |
| 531 | /* concatenate the message */ |
| 532 | BlockMove(&msg[1], &((pNMR->nmBuf)[i]), msg[0]); |
| 533 | (pNMR->nmBuf)[0] += msg[0]; |
| 534 | |
| 535 | in.Notify++; /* increase note pending level */ |
| 536 | |
| 537 | NMInstall((NMRec *) pNMR); |
| 538 | |
| 539 | if (errorSignal) |
| 540 | cooldown(); |
| 541 | |
| 542 | return; |
| 543 | } |
no test coverage detected