GDSX Manual

Service Routines
Extended General Device Support (GDSX) Manual134303
8-32
GETEXTPOOL
Examples
1. This example allocates 20 words in the extended buffer pool and deallocates the
space when it is no longer needed with PUTEXTPOOL:
INT .EXT buf; !Pointer for extended buffer pool.
INT size := 20; !Length in words of extended pool
!area to acquire.
INT(32) holdaddr; !Hold extended buffer address (optional)
.
@buf := GETEXTPOOL (10, size);
holdaddr := @buf;
.
CALL PUTEXTPOOL (10, @buf);
or
CALL PUTEXTPOOL (10, holdaddr);
2. This example allocates 100 words in the shared extended pool and deallocates the
space when it is no longer needed with PUTEXTPOOL:
> PARAM TASKPOOLSIZE 2000 !comment 2000 words
> PARAM POOLSIZE 200 !comment 200 words
> RUN GDSC /NAME $GDSX, NOWAIT/
BLOCK USER^PRIVATE;
INT .EXT GLOBAL^SHARED^PTR := 0D;
INT .EXT TASK^SHARED^PTR;
.
END BLOCK;
PROC USER^START;
INT WDS;
! Pointer initialized @ first call to USER^START
IF @GLOBAL^SHARED^PTR = 0D THEN
BEGIN
WDS := 100;
@GLOBAL^SHARED^PTR := GETEXTPOOL(1, WDS);
GLOBAL^SHARED^PTR ':=' "+ Let all tasks see this !+";
END;
.
END; ! of USER^START;
PROC DEVICE^HANDLER(.......);
INT .EXT WORK^PTR;
INT WDS, N;
.
.
@WORK^PTR := @GLOBAL^SHARED^PTR;
IF WORK^PTR = "+" THEN !All user tasks can see
!this data
BEGIN
WORK^PTR ':=' " "; !Spaces on first time thru
!Allocate a second buffer of 100 words.
@TASK^SHARED^PTR := GETEXTPOOL(1, 100);
TASK^SHARED^PTR ':=' "5";
.