home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / OS2XLSP1.ZIP / HUGE.LSP < prev    next >
Text File  |  1988-07-28  |  1KB  |  30 lines

  1. ; huge.lsp
  2. ; allocate huge memory in OS/2
  3. ; for OS2XLISP v. 1.5
  4. ; Andrew Schulman 27-June-1988
  5.  
  6. (define DOSALLOCHUGE (getprocaddr doscalls "DOSALLOCHUGE"))
  7. (define DOSGETHUGESHIFT (getprocaddr doscalls "DOSGETHUGESHIFT"))
  8. (define DOSFREESEG (getprocaddr doscalls "DOSFREESEG"))
  9.  
  10. (define (alloc-huge segs
  11.          &optional (rem 0) (opt 0)              ; optional parameters
  12.          &aux (seg 0) (shift 0) (lst nil))      ; local variables
  13.     (if (not (zerop 
  14.         (call DOSALLOCHUGE (word segs) (word rem) ^seg (word 0) (word opt))))
  15.         nil
  16.         ; else
  17.         (progn
  18.             (call DOSGETHUGESHIFT ^shift)
  19.             (setf shift (shl 1 shift))
  20.             (setf lst (list (new-node seg)))    ; (new-node) needed!!
  21.             (dotimes 
  22.                 (i (if (zerop rem) (1- segs) segs))
  23.                 (nconc lst (list (+ seg (* (1+ i) shift)))))
  24.             lst)))
  25.             
  26. (define (free-huge seg)
  27.     (zerop (call DOSFREESEG (word (if (listp seg) (car seg) seg)))))
  28.  
  29.  
  30.