home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 612a.lha / PowerVisor_v1.13 / PowerVisor_v1.13.lzh / Source / GetLogWin.c < prev    next >
C/C++ Source or Header  |  1992-02-05  |  1KB  |  49 lines

  1. /* Routine to copy the contents of the memory given on the commandline
  2.     to the active logical window
  3.  
  4. Compile with (SAS/C) :
  5.     lc -v -cmsw -O GetLogWin
  6.     blink GetLogWin.o to GetLogWin lib pv:pvdevelop/lib/PVCallStub.lib
  7. */
  8.  
  9.  
  10.  
  11. #include <exec/types.h>
  12. #include "pv:PVDevelop/include/PV/screenbase.h"
  13. #include "pv:PVDevelop/include/PV/pvcallroutines.h"
  14. #include <pragmas/exec.h>
  15. #include <pragmas/keymap.h>
  16. #include <string.h>
  17.  
  18. APTR PVCallTable;
  19.  
  20. int __saveds __asm GetLogWin (register __a0 char *cmdline, register __a2 APTR table[])
  21. {
  22.     struct ScreenBase *ScreenBase;
  23.     struct LogicalWindow *ActiveLogWin;
  24.     PVBLOCK block;
  25.     WORD CCols,CLines,Cols,Lines,i,j;
  26.     APTR *buf;
  27.  
  28.     PVCallTable = table;
  29.  
  30.     ScreenBase = PVCGetScreenBase ();
  31.  
  32.     ActiveLogWin = ScreenBase->TheGlobal->ActiveLogWin;
  33.     block = (PVBLOCK)PVCEvaluate (cmdline);
  34.  
  35.     CLines = *(UWORD *)block;
  36.     Lines = ActiveLogWin->NrLinesInBuf;
  37.     CCols = *(((UWORD *)block)+1);
  38.     Cols = ActiveLogWin->NrColsInLine;
  39.     buf = (APTR *)(ActiveLogWin->Buffer);
  40.  
  41.     Cols++; CCols++;    /* Attribute */
  42.  
  43.     for (i=0 ; i<Lines && i<CLines ; i++)
  44.         if (buf[i])
  45.             for (j=0 ; j<Cols && j<CCols ; j++)
  46.                 ((UBYTE *)buf[i])[j] = *(((UBYTE *)block)+4+i*CCols+j);
  47.     PVCRefreshLogWin (ActiveLogWin);
  48. }
  49.