Changeset 81 in Sophya
- Timestamp:
- Feb 24, 1998, 7:07:46 PM (28 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/piapplgen.h
r78 r81 33 33 virtual int PrefYSize() = 0; 34 34 35 virtual void RedirectSdtOut(PIConsole* cons) = 0; 35 virtual void RedirectOutStream(PIConsole* cons, unsigned char va= PIVA_Def) = 0; 36 virtual void RedirectErrStream(PIConsole* cons, unsigned char va= PIVA_Ital) = 0; 36 37 37 38 protected: -
trunk/SophyaPI/PI/piapplx.cc
r78 r81 159 159 160 160 /* Call-Back - Fonction privee de ce fichier */ 161 static void redirectstdout_callback(XtPointer, int *, XtInputId*); 162 163 static PIConsole* curconstdout = NULL; 164 165 static void redirectstdout_callback(XtPointer /*cld*/, int * fd, XtInputId* /*iid*/) 161 static void redirectstream_callback(XtPointer, int *, XtInputId*); 162 163 static PIConsole* consstream[2] = {NULL, NULL}; 164 static unsigned char streamva[2] = { PIVA_Def, PIVA_Ital}; 165 static int streamno[2] = {0,1}; 166 167 static void redirectstream_callback(XtPointer cld, int * fd, XtInputId* /*iid*/) 166 168 { 167 169 char buff[128]; 168 170 int nr; 171 172 int idx = *((int*)cld); 173 if (idx != 1) idx = 0; 169 174 while ( (nr=read(*fd, buff, 127)) > 0 ) { 170 buff[nr] = '\0'; curconstdout->AddStr(buff, PIVA_Def, false); 171 } 172 173 curconstdout->Refresh(); 174 } 175 176 177 /* --Methode-- */ 178 void PIApplicationX::RedirectSdtOut(PIConsole* cons) 175 buff[nr] = '\0'; consstream[idx]->AddStr(buff, streamva[idx], false); 176 } 177 consstream[idx]->Refresh(); 178 } 179 180 /* --Methode-- */ 181 void PIApplicationX::RedirectOutStream(PIConsole* cons, unsigned char va) 179 182 { 180 183 if (!cons) return; 181 if (curconstdout) { curconstdout = cons; return; } 182 curconstdout = cons; 184 185 if (consstream[0]) { consstream[0] = cons; streamva[0] = va; return; } 186 consstream[0] = cons; streamva[0] = va; 183 187 184 188 int p[2]; … … 190 194 fcntl(p[0], F_SETFL, O_NONBLOCK); 191 195 192 XtAddInput(p[0], (XtPointer) XtInputReadMask, redirectstdout_callback, NULL); 193 } 196 XtAddInput(p[0], (XtPointer) XtInputReadMask, redirectstream_callback, (XtPointer) streamno); 197 } 198 199 /* --Methode-- */ 200 void PIApplicationX::RedirectErrStream(PIConsole* cons, unsigned char va) 201 { 202 if (!cons) return; 203 204 if (consstream[1]) { consstream[1] = cons; streamva[1] = va; return; } 205 consstream[1] = cons; streamva[1] = va; 206 207 int p[2]; 208 pipe(p); 209 // Redirection de stderr : 210 close(2); 211 dup(p[1]); 212 close(p[1]); 213 fcntl(p[0], F_SETFL, O_NONBLOCK); 214 215 XtAddInput(p[0], (XtPointer) XtInputReadMask, redirectstream_callback, (XtPointer) (streamno+1)); 216 } 217 -
trunk/SophyaPI/PI/piapplx.h
r78 r81 21 21 virtual int PrefXSize(); 22 22 virtual int PrefYSize(); 23 virtual void RedirectSdtOut(PIConsole* cons); 23 24 virtual void RedirectOutStream(PIConsole* cons, unsigned char va= PIVA_Def); 25 virtual void RedirectErrStream(PIConsole* cons, unsigned char va= PIVA_Ital); 24 26 25 27 PIContainer* MBCont() { return intcont; } -
trunk/SophyaPI/PI/picons.cc
r80 r81 700 700 for(j=0; j<j1; j++) { 701 701 mText[mLPo[mNL-1]+j] = mPrompt[j]; 702 mAtt[mLPo[mNL-1]+j] = PIVA_ Ital;702 mAtt[mLPo[mNL-1]+j] = PIVA_Def; 703 703 // strg[j] = mPrompt[j]; debug 704 704 } … … 784 784 // printf("**DBG** Save: C= %d %d L = %d %d \n", mCPbeginC, mCPendC, mCPbeginL, mCPendL); 785 785 786 if (!ClaimSelection()) {787 mCPbeginC = mCPendC = -1;788 mCPbeginL = mCPendL = -1;789 return;790 }791 792 786 793 787 // On transforme la position sur la fenetre en position en caracteres ds les buffers … … 808 802 809 803 if ( (nc > 0) && (nl > 0) ) { 804 if (!ClaimSelection()) { 805 mCPbeginC = mCPendC = -1; 806 mCPbeginL = mCPendL = -1; 807 if (l2 > -1) DisplayLines(mWGrC, l1, l2); 808 return; 809 } 810 810 l = (mCPendC-mCPbeginC+1) * (mCPendL-mCPbeginL); 811 811 if (l < 0) l = 0;
Note:
See TracChangeset
for help on using the changeset viewer.