× 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.



I noticed the source invocation offset behaves differently between
_MATINVAT2 and matinvat().  With _MATINVAT2, the source invocation offset
value '0' denotes the invocation executing _MATINVAT2, value -1 denotes its
caller, value -2 denotes its caller's caller, etc.  For example the
following gets the program pointer of the caller, so the source invocation
offset is -1.

#include <mimchobs.h>
#include <string.h>
void test(void)
{ _INV_Template_T  I;
  _Select_Templatge_T  S;
  char  *P;
  memset(&I, 0 ,sizeof(I));
  memset(&S, 0 ,sizeof(S));
  I.Inv_Offset = -1;  /*caller*/
  S.Numb_Attrs = 1;
  S.Entry[0].Attr_ID = _MATV_PGM_PTR;
  S.Entry[0].Rcvr_Len = sizeof(P);
  _MATINVAT2((_SPCPTR) &P, &I, &S);
  return; }

But with matinvat(), the source invocation offset value -1 denotes the
invocation executing matinvat(), value -2 denotes its caller, value -3
denotes its caller's caller, etc.  So to acheive the same result above with
matinvat(), I have to decrement the offset from -1 to -2!  Is this working
as designed, or an off by one bug?

#include <mimchobs.h>
#include <string.h>
void test(void)
{ _INV_Template_T  I;
  char  *P;
  memset(&I, 0, sizeof(I));
  I.Inv_Offset = -2;   /*caller*/
  matinvat((_SPCPTR) &P, &I, _MATV_PGM_TR, sizeof(P));
  return; }



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.