[comp.sys.amiga.tech] Lattice 5.10 #pragma limit

andrew@cuenews.UUCP (Andrew Folkins) (10/23/90)

According to the docs (Preface pg. xv), the limit on parameters to a
#pragma call has been raised to 14, "allowing ALL Amiga library functions
to be called with parameters in registers."  Except that when I used
the #pragma for NewModifyProp(), lc2 gurus (tb reports foo.0000000b).
Take out the pragma, and it compiles fine.  Has anyone else run into this?

============================== cut here ====================================
/*
 * compile with: lc test.c
 */

#include <exec/types.h>
#include <intuition/intuition.h>
#include <proto/intuition.h>

struct ExtPropInfo {
   struct PropInfo pi;
   UWORD Overlap,        /* Amount of overlap between successive views */
         TotalLines,
         VisibleLines,
         TopLine;
};

void SetPropPosition(window, gadget, topline, refresh)
struct Window *window;
struct Gadget *gadget;
UWORD topline;
short refresh;
{
   UWORD hidden;
   struct ExtPropInfo *epi;

   epi = (struct ExtPropInfo *)gadget->SpecialInfo;

   /* Don't have to update imagery */
   if (epi->TopLine == topline && !refresh)
      return;

   epi->TopLine = topline;

   /* Find the number of hidden lines */
   hidden = max(epi->TotalLines - epi->VisibleLines, 0);

   /* If we can't fill the last display, reduce TopLine */
   if (epi->TopLine > hidden)
      epi->TopLine = hidden;

   if (hidden > 0)
      epi->pi.VertBody = (UWORD)((ULONG)(epi->VisibleLines - epi->Overlap) * MAXBODY
                                      / (epi->TotalLines - epi->Overlap));
   else
      epi->pi.VertBody = MAXBODY;

   if (hidden > 0)
      epi->pi.VertPot = (UWORD)(((ULONG)epi->TopLine * MAXPOT) / hidden);
   else
      epi->pi.VertPot = 0;

   if (window)
      NewModifyProp(gadget, window, NULL, epi->pi.Flags,
                    0, epi->pi.VertPot, 0, epi->pi.VertBody, 1);
}

============================== and here ====================================

--
  Andrew Folkins  ...!alberta!edm!cuenews!andrew   Edmonton, Alberta, Canada
                                  ^A1000^
  Newsfeed for the Amiga SIG of the Commodore Users of Edmonton (AmiCUE)

walker@unx.sas.com (Doug Walker) (11/07/90)

In article <1364.AA1364@cuenews> andrew@cuenews.UUCP (Andrew Folkins) writes:
>According to the docs (Preface pg. xv), the limit on parameters to a
>#pragma call has been raised to 14, "allowing ALL Amiga library functions
>to be called with parameters in registers."  Except that when I used
>the #pragma for NewModifyProp(), lc2 gurus (tb reports foo.0000000b).
>Take out the pragma, and it compiles fine.  Has anyone else run into this?
>
>      NewModifyProp(gadget, window, NULL, epi->pi.Flags,
>                    0, epi->pi.VertPot, 0, epi->pi.VertBody, 1);

This is a bug in the 5.10 version of the compiler.  The compiler will crash
if fed an ODD CONSTANT to a #pragma routine taking more than 8 parameters.

You can get around it by changing the code to 

>      { int tmpint = 1;
>      NewModifyProp(gadget, window, NULL, epi->pi.Flags,
>                    0, epi->pi.VertPot, 0, epi->pi.VertBody, tmpint);
>      }

We apologize for the bug and will fix it in the next maintenance release.

(Please feel free to call SAS/C tech support at (919)677-8009 to report this
 kind of problem - that's what they are there for. )

 
  *****
=*|_o_o|\\=====Doug Walker, Software Distiller====== BBS: (919)460-7430 =
 *|. o.| ||                                          1200/2400/9600 Dual
  | o  |//     For all you do, this bug's for you!
  ====== 
usenet: ...mcnc!rti!sas!walker   plink: dwalker  bix: djwalker