× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



maybe ... you could set up the teraspace management process as a separate
data queue driven server job.  In addition to the partial solution provided
by Simon, add a C module to convert between 8 byte and 16 byte pointers, and
have the 16 byte pointers stored in the main RPG IV server process in a
based data structure.  The magic cookie would be the offset to the 16 byte
pointer in the RPG IV data structure, and could be returned to the calling
process, again via dtaq.  If the idea is good, you could call the server
process a Bakery.  Otherwise, call it half baked.  -Dave K.

----- Original Message -----
From: "Walden H. Leverich" <WaldenL@TechSoftInc.com>
To: <midrange-l@midrange.com>
Sent: Thursday, December 20, 2001 11:27 AM
Subject: RE: Teraspace memory allocation


> Simon,
>
> Thanks, the VALUE option helped a lot. I can allocate and deallocate
> teraspace, cool. However, the other reason I wanted teraspace (besides >
> 16Meg) was the statement that teraspace pointers don't need to be
quad-word
> aligned and aren't tagged. I hoped I could pass them around to non-ILE
> programs as 8-byte character arrays. I know I can't do the following with
> space pointers but I was hoping for success with teraspace pointers since
> they aren't tagged and aren't quad-word aligned.
>
> Pnew              B                   export
> Dnew              pi            16
>
> DMsgP             s               *
> D@Msg             s               *
> DMsg              s             16    based(@Msg)
>
>  *Allocate 20Meg from teraspace
> C                   eval      msgp=tsmalloc(20000000)
>  *Set @Msg to the address of the pointer returned from teraspace
> c                   eval      @msg = %addr(msgp)
>  *Return the 16-byte character value of the pointer into teraspace
> c                   return    msg
> c
>
> P                 E
>
>
> PDestroy          B                   export
> DDestroy          pi            10i 0
> D e                             16
>
> dMsgP             s               *
> d@MsgP            s               *
> dMsg              s             16    based(@MsgP)
> drc               s             10i 0
>
>  *Get the address of the pointer
> c                   eval      @msgP = %addr(msgp)
>  *Load the pointer with the character data passed in -- this was returned
> from the New() function
> c                   eval      msg = e
>
>  *Free the space
> c                   callp     tsfree(msgp)
> C                   return    0
> P                 E
>
>
>
> -Walden
>
> ------------
> Walden H Leverich III
> President
> Tech Software
> (516)627-3800 x11
> WaldenL@TechSoftInc.com
> http://www.TechSoftInc.com
>
>
>
> -----Original Message-----
> From: Simon Coulter [mailto:shc@flybynight.com.au]
> Sent: Thursday, December 20, 2001 03:22
> To: midrange-l@midrange.com
> Subject: Re: Teraspace memory allocation
>
>
>
> Hello Walden,
>
> You wrote:
> >Where did you find out about the TERASPACE__ define?
>
> Nowhere.  That's just my version of the __TERASPACE__ define used in the C
> include for stdlib since RPG IV doesn't allow names beginning with
> underscores.  Its only effect is to change the EXTPROC associated with the
> various storage allocation functions.
>
> >Also, what's in your STDLIB include?
>
> An RPG IV version of all the stuff that is in the C stdlib . . .  but
that's
> not really what you were asking is it?  Here is an excerpt from my STDLIB
> that contains the definitions you need.
>
> *========================================================================*
>       * Allocate and initialise storage for an array
> *
>       *                void    *calloc   ( size_t, size_t );
> *
>
> *========================================================================*
>              D calloc          PR                  LIKE(pointer_t)
>  @A1A  /if defined(TERASPACE__)
>  @A1A D                                     EXTPROC('_C_TS_calloc')
>  @A1A  /else
>       D                                     EXTPROC('calloc')
>  @A1A  /endif
>        *
>        * Required parameter group:
>        *                             Number of elements to allocate
>       D   nbrElem                           LIKE(size_t) VALUE
>        *                             Size of each element
>       D   size                              LIKE(size_t) VALUE
>
>
> *========================================================================*
>        * Release allocated storage
> *
>        *                void     free     ( void * );
> *
>
> *========================================================================*
>       D free            PR
>  @A1A  /if defined(TERASPACE__)
>  @A1A D                                     EXTPROC('_C_TS_free')
>  @A1A  /else
>       D                                     EXTPROC('free')
>  @A1A  /endif
>        *
>        * Required parameter group:
>        *                             Address of storage to release
>       D   stgPtr                            LIKE(pointer_t) VALUE
>
>
> *========================================================================*
>        * Allocate and initialise storage block
> *
>        *                void    *malloc   ( size_t );
> *
>
> *========================================================================*
>       D malloc          PR                  LIKE(pointer_t)
>  @A1A  /if defined(TERASPACE__)
>  @A1A D                                     EXTPROC('_C_TS_malloc')
>  @A1A  /else
>       D                                     EXTPROC('malloc')
>  @A1A  /endif
>        *
>        * Required parameter group:
>        *                             Size of storage to allocate
>       D   size                              LIKE(size_t) VALUE
>
>
> *========================================================================*
>        * Change allocated storage block size
> *
>        *                void    *realloc  ( void *, size_t );
> *
>
> *========================================================================*
>       D realloc         PR                  LIKE(pointer_t)
>  @A1A  /if defined(TERASPACE__)
>  @A1A D                                     EXTPROC('_C_TS_realloc')
>  @A1A  /else
>       D                                     EXTPROC('realloc')
>  @A1A  /endif
>        *
>        * Required parameter group:
>        *                             Address of storage to reallocate
>       D   stgPtr                            LIKE(pointer_t) VALUE
>        *                             Size of storage to allocate
>       D   size                              LIKE(size_t) VALUE
>
> You'll also need the following from STDDEF
>
> D size_t          S                   LIKE(uint_t)
>
> and the following from my C_RPG_TYPE include
>
> @A1A D char_t          S              3I 0
>      D short_t         S              5I 0
>      D int_t           S             10I 0
>      D long_t          S                   LIKE(int_t)
> @A1A D longLong_t      S             20I 0
> @A1A D uchar_t         S              3U 0
>      D ushort_t        S              5U 0
>      D uint_t          S             10U 0
>      D ulong_t         S                   LIKE(uint_t)
> @A1A D ulongLong_t     S             20U 0
>      D float_t         S              4F
>      D double_t        S              8F
>      D longDouble_t    S                   LIKE(double_t)
>      D pointer_t       S               *
>      D funcPtr_t       S               *   PROCPTR
>
> Regards,
> Simon Coulter.
>
> --------------------------------------------------------------------
>    FlyByNight Software         AS/400 Technical Specialists
>    http://www.flybynight.com.au/
>
>    Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
>    Fax:   +61 3 9419 0175   mailto: shc@flybynight.com.au   \ /
>                                                              X
>                  ASCII Ribbon campaign against HTML E-Mail  / \
> --------------------------------------------------------------------
>
> _______________________________________________
> This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
> To post a message email: MIDRANGE-L@midrange.com To subscribe,
unsubscribe,
> or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
> or email: MIDRANGE-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/midrange-l.
> _______________________________________________
> This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
> To post a message email: MIDRANGE-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
> or email: MIDRANGE-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/midrange-l.
>



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.