HP3000-L Archives

September 1999, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Stan Sieler <[log in to unmask]>
Reply To:
Stan Sieler <[log in to unmask]>
Date:
Thu, 2 Sep 1999 15:58:49 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (100 lines)
Here's the revised, commented source,
and the NMOBJ file is at
http://www.allegro.com/foo.html

Stan.
--------------------------------------------------------------------------------

#pragma intrinsic HPGETPROCPLABEL

#include <stdlib.h>

      /* Never use "int" or "short int" when using intrinsics */
      /* (and not in many other cases either!).               */
      /* Instead, carefully define the exact size you want ...*/
      /* particularly when you are trying to match preexisting*/
      /* sizes (like intrinsic results/parameters).           */

typedef int       int32;
typedef short int int16;
typedef unsigned short int uint16;

extern uint16 subDate ();

/****************************************************************/
uint16 CALENDAR (void)
   {
   struct hpe_status {
      int16 info;
      int16 subsys;
      };

   char
      firstfile   [40],
      procname    [20];

   long int
      pcasesensitive;         /* probably should be char (8-bit) */

   static long int
      procs_loaded = 0L;

   static uint16
      (*pcalendar)() = 0;    /* CALENDAR */

   struct hpe_status
      pstatus;


         /* First time through, load CALENDAR... */

   if (procs_loaded == 0L)
      {
      strcpy ( procname, " CALENDAR \n");
      strcpy ( firstfile, "-XL.PUB.SYS- \0 ");
      pcasesensitive = -1L;

      HPGETPROCPLABEL (
         &procname,
         (void (**) ()) &pcalendar ,
         &pstatus, &firstfile, pcasesensitive);

      procs_loaded = -1L;

      if (pstatus.info < 0)
         {
         printf ("*E* HPGETPROCPLABEL failed while loading \n");
         printf (" Status Codes : %d, \n ", pstatus.info);
         procs_loaded = 0L;

               /* consider *NOT* setting procs_loaded to 0 above */
               /* Instead, try setting to -2.  This will cause   */
               /* the code to do a return of 0 for calls after   */
               /* a failed load attempt.                         */
               /* With current code, if a load fails,            */
               /* subsequent attempts will probably fail *and*   */
               /* will generate the annoying 2-line message      */
               /* every time!                                    */
         };
      };

         /* If CALENDAR loaded, call it ... */

         /* If result from CALENDAR is >= 2000-01-01, effectively  */
         /* sort of .. kind of ... reduce it.   51200 happens      */
         /* to be the CALENDAR equivalent of 2000-00-00.           */
         /* for values in the range 2000-01-01 .. 2027-12-31,      */
         /* the "mod" below will ROUGHLY reduce them to 1900-01-01 */
         /* ..1927-12-31.  Note that most dates in 2000 will *NOT* */
         /* be reduced to the same mm/dd values in 1900 (because   */
         /* 2000 is a leap year and 1900 is not).

   if (procs_loaded == -1L)
      return (((*pcalendar) ()) % 51200);    /* "mod 2000" */

         /* if not loaded, return 0 ... */

   return (0);

   } /* end CALENDAR proc */

ATOM RSS1 RSS2