| 55 | } |
| 56 | |
| 57 | Boolean itworked(short errcode) |
| 58 | /* Return TRUE if it worked, do an error message and return false if it didn't. Error |
| 59 | strings for native C errors are in STR#1999, Mac errs in STR 2000-errcode, e.g |
| 60 | 2108 for not enough memory */ |
| 61 | |
| 62 | { |
| 63 | if (errcode != 0) { |
| 64 | short itemHit; |
| 65 | Str255 errdesc; |
| 66 | StringHandle strh; |
| 67 | |
| 68 | errdesc[0] = '\0'; |
| 69 | if (errcode > 0) GetIndString(errdesc,stdIOErrID,errcode); /* STDIO file rres, etc */ |
| 70 | else { |
| 71 | strh = GetString(2000-errcode); |
| 72 | if (strh != (StringHandle) nil) { |
| 73 | memcpy(errdesc,*strh,256); |
| 74 | ReleaseResource((Handle)strh); |
| 75 | } |
| 76 | } |
| 77 | if (errdesc[0] == '\0') { /* No description found, just give the number */ |
| 78 | sprintf((char *)&errdesc[1],"a %d error occurred",errcode); |
| 79 | errdesc[0] = strlen((char*)&errdesc[1]); |
| 80 | } |
| 81 | SetCursor(&qd.arrow); |
| 82 | ParamText(errdesc,(StringPtr)"",gActivities[gTopactivity],(StringPtr)""); |
| 83 | itemHit = Alert(errAlertID, (ModalFilterUPP)nil); |
| 84 | } |
| 85 | return(errcode==0); |
| 86 | } |
| 87 | |
| 88 | void mustwork(short errcode) |
| 89 | /* For cases where we can't recover from the error by any means */ |