|
|
1.1 ! root 1: .ds ZZ DEVELOPMENT PACKAGE ! 2: .TH PEEL 3R "630 MTG" ! 3: .XE "peel()" ! 4: .SH NAME ! 5: peel \- make process local and create new process ! 6: .SH SYNOPSIS ! 7: .B #include <dmd.h> ! 8: .sp ! 9: .B Proc \(**peel (dstrect, flag) ! 10: .br ! 11: .B Rectangle dstrect; ! 12: .br ! 13: .B int flag; ! 14: .SH DESCRIPTION ! 15: .PP ! 16: The \fIpeel\fP function is an uncommon feature that allows a process ! 17: to be made local and reshaped (or moved). The \f2peel\f1 ! 18: function then creates a new ! 19: process that uses the previous process's window and host connection. ! 20: The rectangle \fIdstrect\fP defines the new window (display) to be used by ! 21: the peeled local process. The ! 22: remaining window is associated with a new process that takes on the ! 23: status of the connection of the previous process. ! 24: .PP ! 25: If argument \f2flag\f1 is zero, the terminal's default process ! 26: is started in the old window. ! 27: If argument \f2flag\f1 has a non-zero value, the process that is ! 28: used to replace the peeled process is another invocation of ! 29: the same process. ! 30: The process must be cached to do this. ! 31: .PP ! 32: The peeled process will have its \fIP->state\fP variable updated. ! 33: If the \fIdstrect\fP rectangle is the same size ! 34: as the original window, both the MOVED and RESHAPED bits ! 35: will be set; otherwise, just the RESHAPED bit is set. If the MOVED bit ! 36: is set, the new window will have the contents of the old window ! 37: copied into it. ! 38: Otherwise, it is the responsibility of the peeled process to draw the new window's ! 39: contents. ! 40: The old window is always cleared. ! 41: .PP ! 42: The function will return -1 if it failed due to a lack of memory. ! 43: It will return 0 if it failed because dstrect is smaller than 32x32. ! 44: Otherwise, it will return a pointer to the newly created process ! 45: running in the old window. ! 46: .SH EXAMPLE ! 47: .PP ! 48: The following example shows how a process can peel itself and ! 49: leave behind the default terminal process. ! 50: The rectangle \fIdstrect\fP is specified through the mouse interface ! 51: that allows the user to position or sweep out a rectangle using a ! 52: default size as specified by the rectangle of the window or a new size ! 53: using the mouse and button 2. ! 54: .PP ! 55: .RS 3 ! 56: .nf ! 57: .ft CM ! 58: #include <dmd.h> ! 59: Proc *peel(); ! 60: Rectangle newrect(); ! 61: ! 62: int ! 63: peelme() ! 64: { ! 65: Proc *p; ! 66: ! 67: p = peel(newrect(2, display.rect), 0); ! 68: if(p == (Proc *)-1) ! 69: msgbox("no memory", (char *)0); ! 70: else if(p == (Proc *)0) ! 71: msgbox("swept window too small", (char *)0); ! 72: return((long)p > 0); ! 73: } ! 74: \fR ! 75: .fi ! 76: .RE ! 77: \s+1 ! 78: .SH SEE ALSO ! 79: cache(3L), local(3R), state(3R).
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.