* Don't forget to decrease in_putstr before returning... */
| 1794 | * Don't forget to decrease in_putstr before returning... |
| 1795 | */ |
| 1796 | void |
| 1797 | mac_putstr(winid win, int attr, const char *str) |
| 1798 | { |
| 1799 | long len, slen; |
| 1800 | NhWindow *aWin = &theWindows[win]; |
| 1801 | static char in_putstr = 0; |
| 1802 | short newWidth, maxWidth; |
| 1803 | Rect r; |
| 1804 | char *src, *sline, *dst, ch; |
| 1805 | |
| 1806 | if (win < 0 || win >= NUM_MACWINDOWS || !aWin->its_window) { |
| 1807 | error("putstr: Invalid win %d (Max %d).", win, NUM_MACWINDOWS, attr); |
| 1808 | return; |
| 1809 | } |
| 1810 | |
| 1811 | if (aWin->its_window == _mt_window) { |
| 1812 | tty_putstr(win, attr, str); |
| 1813 | return; |
| 1814 | } |
| 1815 | |
| 1816 | if (in_putstr > 3) |
| 1817 | return; |
| 1818 | |
| 1819 | in_putstr++; |
| 1820 | slen = strlen(str); |
| 1821 | |
| 1822 | SetPortWindowPort(aWin->its_window); |
| 1823 | GetWindowBounds(aWin->its_window, kWindowContentRgn, &r); |
| 1824 | OffsetRect(&r, -r.left, -r.top); |
| 1825 | if (win == WIN_MESSAGE) { |
| 1826 | r.right -= SBARWIDTH; |
| 1827 | r.bottom -= SBARHEIGHT; |
| 1828 | if (flags.page_wait |
| 1829 | && aWin->last_more_lin |
| 1830 | <= aWin->y_size - (r.bottom - r.top) / aWin->row_height) { |
| 1831 | aWin->last_more_lin = aWin->y_size; |
| 1832 | mac_display_nhwindow(win, TRUE); |
| 1833 | } |
| 1834 | } |
| 1835 | |
| 1836 | /* |
| 1837 | * A "default" text window - uses TETextBox |
| 1838 | * We just add the text, without attributes for now |
| 1839 | */ |
| 1840 | len = GetHandleSize(aWin->windowText); |
| 1841 | while (aWin->windowTextLen + slen + 1 > len) { |
| 1842 | len = (len > 2048) ? (len + 2048) : (len * 2); |
| 1843 | SetHandleSize(aWin->windowText, len); |
| 1844 | if (MemError()) { |
| 1845 | error("putstr: SetHandleSize"); |
| 1846 | aWin->windowTextLen = 0L; |
| 1847 | aWin->save_lin = 0; |
| 1848 | aWin->y_curs = 0; |
| 1849 | aWin->y_size = 0; |
| 1850 | } |
| 1851 | } |
| 1852 | |
| 1853 | len = aWin->windowTextLen; |
nothing calls this directly
no test coverage detected