Date: Fri, 12 Oct 2001 10:57:00 -0700
From: Neil Rhodes <neil@pobox.com>
To: ardiri@ardiri.com
Subject: Changes to pilRc

Aaron,

Here are changes to 2.8p7 for the codewarrior plugin (which now supports
command-line options!)

main.c
In the usage function, change to call the existing Error function:
was:
 Usage(void) {
 printf
    ("..."
     ...
   "...");
  exit(1);
change to:
Usage(void)
{
    Error
    ("..."
     ...
   "...");
}

Fix an incorrect cast (needs to be unsigned char *)

diff -c -r1.2 makeKbd.c
*** makeKbd.c   2001/10/08 23:03:18     1.2
--- makeKbd.c   2001/10/08 23:09:34
***************
*** 707,713 ****
    CbEmitStruct(pkeyboardLayout + 3, szRCKEYBOARDLAYOUT, NULL, fTrue);   /*
pPunc2KeyboardLayout */
    CbEmitStruct(pkeyboardLayout + 4, szRCKEYBOARDLAYOUT, NULL, fTrue);   /*
pAccentKeyboardLayout */
    // Emit the alpha keycaps
!   pRunning = (char *)(pkeyboardLayout + 5);
    keyboardKeyEmit((KeyboardKeyType *) pRunning, numAlphaKeys, fTrue);   /*
pAlphaKeys */
    pRunning += sizeof(KeyboardKeyType) * numAlphaKeys;
    // Emit the number keycaps
--- 707,713 ----
    CbEmitStruct(pkeyboardLayout + 3, szRCKEYBOARDLAYOUT, NULL, fTrue);   /*
pPunc2KeyboardLayout */
    CbEmitStruct(pkeyboardLayout + 4, szRCKEYBOARDLAYOUT, NULL, fTrue);   /*
pAccentKeyboardLayout */
    // Emit the alpha keycaps
!   pRunning = (unsigned char *)(pkeyboardLayout + 5);
    keyboardKeyEmit((KeyboardKeyType *) pRunning, numAlphaKeys, fTrue);   /*
pAlphaKeys */
    pRunning += sizeof(KeyboardKeyType) * numAlphaKeys;
    // Emit the number keycaps

Add strdup declaration to pilrc.h (it's used in both pilrc.c and main.c):

#ifndef strdup
char *strdup(const char *s);
#endif


Remove strdup declaration from pilrc.c, deleting:
#ifndef strdup
char *strdup(const char *s);
#endif


Fix bug with default buttons (defaults should start at 0, and not at 1):
In pilrc.c, change:
  if (at.numButtons > 0 && at.defaultButton > at.numButtons)
    ErrorLine("Invalid default button number");

  if ((!at.defaultButton) && (at.numButtons == 1))
    at.defaultButton = 1;
to:
  if (at.numButtons > 0 && at.defaultButton >= at.numButtons)
    ErrorLine("Invalid default button number");

In InitRcpfile, remove #ifdef (it doesn't hurt to always initialize these
variables), and don't initialize as many (because we may be setting them in
the command-line);
change from:
InitRcpfile(RCPFILE * prcpfile,
            int fontType)
{
  PlexInit(&prcpfile->plfrm, sizeof(FRM), 10, 10);
  InitFontMem(fontType);

#ifdef CW_PLUGIN
  // NCR: 15-feb-00 : in codewarrior plugin, globals need to be
reinitialized

  iidMenuMac = 0;
  iidAlertMac = 0;
  iidStringMac = 0;
  iidStringTableMac = 0;
  iidAISMac = 0;
  idAutoMac = idAutoInit;
  psymFirst = 0;
  vfAllowEditIDs = 1;
  szLanguage = "ENGLISH";                        // so we have some default
#endif
}
to:
InitRcpfile(RCPFILE * prcpfile,
            int fontType)
{
  PlexInit(&prcpfile->plfrm, sizeof(FRM), 10, 10);
  InitFontMem(fontType);

  iidMenuMac = 0;
  iidAlertMac = 0;
  iidStringMac = 0;
  iidStringTableMac = 0;
  iidAISMac = 0;
  idAutoMac = idAutoInit;
}

Thanks,

Neil

--
Neil Rhodes
Calliope Enterprises, Inc.
1328 Clock Avenue
Redlands, CA  92374
(909) 793-5995     neil@pobox.com      fax: (909) 793-2545

