|
From: <kar...@us...> - 2006-06-02 20:36:22
|
Revision: 1397 Author: karstenw Date: 2006-06-02 13:36:09 -0700 (Fri, 02 Jun 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1397&view=rev Log Message: ----------- copy & paste of sint64 type. saving to odb. Incompatible with non-Int64 version Modified Paths: -------------- Frontier/branches/Int64/Common/headers/lang.h Frontier/branches/Int64/Common/source/langexternal.c Frontier/branches/Int64/Common/source/langhash.c Frontier/branches/Int64/Common/source/langpack.c Frontier/branches/Int64/Common/source/langvalue.c Modified: Frontier/branches/Int64/Common/headers/lang.h =================================================================== --- Frontier/branches/Int64/Common/headers/lang.h 2006-06-02 15:59:34 UTC (rev 1396) +++ Frontier/branches/Int64/Common/headers/lang.h 2006-06-02 20:36:09 UTC (rev 1397) @@ -1078,10 +1078,14 @@ extern boolean coercetolonglong (tyvaluerecord *v); +extern boolean coercetolongdate (tyvaluerecord *v); + extern boolean getlonglongintparam(hdltreenode hfirst, short pnum, tyvaluerecord *v); extern boolean getlonglongintvalue (hdltreenode hfirst, short pnum, tylonglongint *lval); +extern boolean getbinarylonglong (Handle x, tylonglongint *n); + #endif extern boolean setdatevalue (unsigned long, tyvaluerecord *); Modified: Frontier/branches/Int64/Common/source/langexternal.c =================================================================== --- Frontier/branches/Int64/Common/source/langexternal.c 2006-06-02 15:59:34 UTC (rev 1396) +++ Frontier/branches/Int64/Common/source/langexternal.c 2006-06-02 20:36:09 UTC (rev 1397) @@ -2889,7 +2889,8 @@ // kw - 2006-01-30 --- for new int types - these were added at the end // not sure if these need to be externaltypes -#if LONGINT_LONGDATE == 999 // in langexternalgetvaluetype() + // kw - 2006-06-02 --- re-enabled; externaltype is bad for tylonglongint +#if LONGINT_LONGDATE == 1 // in langexternalgetvaluetype() if ( (type < longlongintvaluetype) && (type >= outlinevaluetype)) { Modified: Frontier/branches/Int64/Common/source/langhash.c =================================================================== --- Frontier/branches/Int64/Common/source/langhash.c 2006-06-02 15:59:34 UTC (rev 1396) +++ Frontier/branches/Int64/Common/source/langhash.c 2006-06-02 20:36:09 UTC (rev 1397) @@ -2696,18 +2696,10 @@ // LONGLONGINTCONSTRUCTIONSITE case longlongintvaluetype: case longdatetimevaluetype: { - // break; tylonglongint lln = **val.data.longlongintvalue; // any processor specific handling here??? -# if defined (WIN95VERSION) - -# endif -# if defined (MACVERSION) - -# endif - if (!hashpackdata (&lpi->s2, &lln, sizeof (lln), &rec.data.longvalue)) goto error; @@ -3193,6 +3185,12 @@ case listvaluetype: case recordvaluetype: #endif + +#if LONGINT_LONGDATE == 1 // in hashunpacktable() + // LONGLONGINTCONSTRUCTIONSITE + case longlongintvaluetype: + case longdatetimevaluetype: +#endif case binaryvaluetype: { if (!hashunpackscalar (hstrings, &val, ixstrings)) goto L1; @@ -3200,19 +3198,7 @@ break; } -#if LONGINT_LONGDATE == 1 // in hashumpacktable() - // LONGLONGINTCONSTRUCTIONSITE - case longlongintvaluetype: - case longdatetimevaluetype: - break; -# if defined (WIN95VERSION) -# endif -# if defined (MACVERSION) - -# endif -#endif - #ifdef oplanglists case listvaluetype: case recordvaluetype: Modified: Frontier/branches/Int64/Common/source/langpack.c =================================================================== --- Frontier/branches/Int64/Common/source/langpack.c 2006-06-02 15:59:34 UTC (rev 1396) +++ Frontier/branches/Int64/Common/source/langpack.c 2006-06-02 20:36:09 UTC (rev 1397) @@ -250,19 +250,34 @@ case recordvaluetype: #endif + case binaryvaluetype: + fl = langpackhandle (val.data.binaryvalue, hpackedvalue); + + break; + #if LONGINT_LONGDATE == 1 // in langpackvalue() - // UNTESTED - // LONGLONGINTCONSTRUCTIONSITE + // UNTESTED + // LONGLONGINTCONSTRUCTIONSITE case longlongintvaluetype: - case longdatetimevaluetype: -#endif + case longdatetimevaluetype: { +/* 2006-06-02 - kw --- my intention was to store these as binaries with the proper type + Unfortunately coercetobinary currently calls langpack.... + +*/ +/* + OSType mytype = val.valuetype; - case binaryvaluetype: + coercetobinary(&val); +*/ fl = langpackhandle (val.data.binaryvalue, hpackedvalue); - +/* + setbinaryvalue (val.data.binaryvalue, mytype, &val); +*/ + } break; - - #ifdef oplanglists +#endif + +#ifdef oplanglists case listvaluetype: case recordvaluetype: fl = oppacklist (val.data.listvalue, &hdata); @@ -675,8 +690,35 @@ case listvaluetype: case recordvaluetype: #endif +#if LONGINT_LONGDATE == 1 // in langunpackvalue() + // UNTESTED + // LONGLONGINTCONSTRUCTIONSITE + case longlongintvaluetype: + case longdatetimevaluetype: +#endif + { fl = langunpackhandle (false, &v.data.binaryvalue, h, &ixunpack); - + + // 2006-06-02 - kw --- temporarily switched off; doesn't work + if (false) //(v.valuetype == binaryvaluetype) + { + + OSType t = getbinarytypeid (v.data.binaryvalue); + + switch(t) { + + case 'ldt ': + coercetolongdate(&v); + break; + + case 'comp': + coercetolonglong(&v); + break; + } + } + + + } break; #ifdef oplanglists Modified: Frontier/branches/Int64/Common/source/langvalue.c =================================================================== --- Frontier/branches/Int64/Common/source/langvalue.c 2006-06-02 15:59:34 UTC (rev 1396) +++ Frontier/branches/Int64/Common/source/langvalue.c 2006-06-02 20:36:09 UTC (rev 1397) @@ -1958,7 +1958,38 @@ } /*getbinarynumber*/ +#if LONGINT_LONGDATE == 1 // getbinarylonglong() +boolean getbinarylonglong (Handle x, tylonglongint *n) { + + /* + 2006-06-02 - kw --- modelled after getbinarynumber() + + return a tylonglongint interpretation of the binary handle. + + we're allowed to munge the handle; the caller will be disposing it. + */ + + long ctbytes; + + ctbytes = gethandlesize (x) - sizeof (OSType); + + switch(ctbytes) { + + case 8: + *n = ((*(tylonglongint **) x) [4]); + + break; + + default: + return (false); + } + + return (true); +} /*getbinarylonglong*/ + +#endif + boolean coercetoboolean (tyvaluerecord *v) { /* @@ -2290,6 +2321,9 @@ switch ((*v).valuetype) { + case longlongintvaluetype: + return (true); + case longvaluetype: // kwtodo - 2006-01-30 @@ -2368,14 +2402,12 @@ break; case binaryvaluetype: { - long n; - register Handle h = (*v).data.binaryvalue; + + Handle h = (*v).data.binaryvalue; - if (!getbinarynumber (h, &n)) - return (binarytoscalar (v, longvaluetype)); + if (!getbinarylonglong (h, &x)) + return (false); - x = n; - releaseheaptmp (h); break; @@ -2395,7 +2427,7 @@ } /* coercetolonglong */ -static boolean +boolean coercetolongdate (tyvaluerecord *v) { // kw - 2006-02-12 --- modeled after coercetodate @@ -2464,9 +2496,18 @@ break; } - case binaryvaluetype: - return (binarytoscalar (v, datevaluetype)); + case binaryvaluetype: { + Handle h = (*v).data.binaryvalue; + + if (!getbinarylonglong (h, &x)) + return (false); + + releaseheaptmp (h); + + break; + } + case listvaluetype: case recordvaluetype: return (coercelistvalue (v, datevaluetype)); @@ -3782,7 +3823,28 @@ case filespecvaluetype: case aliasvaluetype: break; - + +#if LONGINT_LONGDATE == 1 // in coercetobinary() + case longlongintvaluetype: + case longdatetimevaluetype: { + Handle x; + + typeid = (*v).valuetype; + + if (!langpackvalue (*v, &x, HNoNode)) + return (false); + + if (!insertinhandle ((*v).data.binaryvalue, 0L, &typeid, sizeof (typeid))) + return (false); + + if (!setheapvalue (x, binaryvaluetype, v)) + return (false); + + + } + break; +#endif + #ifdef oplanglists case listvaluetype: case recordvaluetype: { @@ -6934,7 +6996,7 @@ t1 = (tylonglongint)v1.data.longvalue - (tylonglongint)v2.data.longvalue; if ( (t1 > LONG_MAX ) - || (t1 < LONG_MIN)) + || (t1 < LONG_MIN)) { coercetolonglong(vreturned); @@ -7089,7 +7151,7 @@ t1 = (tylonglongint)v1.data.longvalue * (tylonglongint)v2.data.longvalue; if ( (t1 > LONG_MAX ) - || (t1 < LONG_MIN)) + || (t1 < LONG_MIN)) { coercetolonglong(vreturned); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |