Christer Lofving wrote:  (privately, but the mail server rejects any attempt
to reply to him directly)

> static int calcAscension(int y, int m, int d)
> {
> int temp;
> int nmonth;
> int nday;
> DateType theDate;
> DatePtr  dp;
>
> temp = y-1904;
> dp = &theDate;
> dp->year = temp;
> dp->month = m;
> dp->day = d;
> DateAdjust(dp, 4);
> nday = dp->day;
> nmonth = dp->month;
> return temp;
> }
>
> There is still only nonsense in the variables...

I'm not sure I understand why you are copying the results of the DateAdjust
to local variables that aren't used, but I'm guessing that you are trying to
step through the code with Poser to see what's happening.  If you are using
CodeWarrior, the variables will likely appear to be messed up as you step
through the code due to some "optimizations" the compiler uses.  Sometimes,
the only way to see what is going on during debugging is to add some "print"
statements, like the following:

static int calcAscension(int y, int m, int d, CharPtr result /* added */)
{
    int temp;
    int nmonth;
    int nday;
    DateType theDate;
    DatePtr  dp;
    Char tstr[100];        // added

    StrPrintF(result, "INPUT:(y:%i, m:%i, d:%i) ", y, m, d);    // added
    temp = y-1904;
    dp = &theDate;
    dp->year = temp;
    dp->month = m;
    dp->day = d;
    StrPrintF(tstr, "DP BEFORE:(y:%i, m:%i, d:%i) ", dp->year, dp->month,
dp->day);    // added
    StrCat(result, tstr);        // added
    DateAdjust(dp, 4);
    StrPrintF(tstr, "DP AFTER:(y:%i, m:%i, d:%i) ", dp->year, dp->month,
dp->day);    // added
    StrCat(result, tstr);        // added
    nday = dp->day;
    nmonth = dp->month;
    return temp;
}

This worked as expected on my computer:  Pentium PC, CW 6, Poser 2.1d29



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to