minneed.c

Go to the documentation of this file.
00001 
00002 /*  $Id: minneed.c 355 2005-01-11 22:48:55Z andreradke $    */
00003 
00004 /******************************************************************************
00005 
00006     UserLand Frontier(tm) -- High performance Web content management,
00007     object database, system-level and Internet scripting environment,
00008     including source code editing and debugging.
00009 
00010     Copyright (C) 1992-2004 UserLand Software, Inc.
00011 
00012     This program is free software; you can redistribute it and/or modify
00013     it under the terms of the GNU General Public License as published by
00014     the Free Software Foundation; either version 2 of the License, or
00015     (at your option) any later version.
00016 
00017     This program is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020     GNU General Public License for more details.
00021 
00022     You should have received a copy of the GNU General Public License
00023     along with this program; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 
00026 ******************************************************************************/
00027 
00028 #include "frontier.h"
00029 #include "standard.h"
00030 
00031 #include "memory.h"
00032 #include "quickdraw.h"
00033 #include "strings.h"
00034 #include "ops.h"
00035 #include "resources.h"
00036 #include "shell.rsrc.h"
00037 #include "langinternal.h"
00038 
00039 
00040 #if 0 // (odbengine==1)
00041 static byte bshexprefix [] = "0x";
00042 
00043 
00044 #define ctparseparams 4
00045 byte zerostring [] = "\0"; /*use this to conserve constant space*/
00046 
00047 void uppertext (ptrbyte ptext, long ctchars) {
00048     
00049     register long n = ctchars;
00050     register ptrbyte p = ptext;
00051     register byte ch;
00052     
00053     while (--n >= 0) {
00054         
00055         ch = *p;
00056         
00057         if ((ch >= 'a') && (ch <= 'z'))
00058             *p -= 32;
00059         
00060         p++;
00061         } /*while*/
00062     } /*uppertext*/
00063 
00064 
00065 void lowertext (ptrbyte ptext, long ctchars) {
00066     
00067     register long n = ctchars;
00068     register ptrbyte p = ptext;
00069     register byte ch;
00070     
00071     while (--n >= 0) {
00072         
00073         ch = *p;
00074         
00075         if ((ch >= 'A') && (ch <= 'Z'))
00076             *p += 32;
00077         
00078         p++;
00079         } /*while*/
00080     } /*lowertext*/
00081 
00082 
00083 void allupper (bigstring bs) {
00084     
00085     uppertext (bs + 1, *bs);
00086     } /*allupper*/
00087 
00088 
00089 void alllower (bigstring bs) {
00090     
00091     lowertext (bs + 1, *bs);
00092     } /*alllower*/
00093     
00094 
00095 
00096 void copystring (bigstring bssource, bigstring bsdest) {
00097 
00098     /*
00099     create a copy of bssource in bsdest.  copy the length byte and
00100     all the characters in the source string.
00101 
00102     assume the strings are pascal strings, with the length byte in
00103     the first character of the string.
00104     */
00105 
00106     register short i, len;
00107     
00108     if (bssource == nil) { /*special case, handled at lowest level*/
00109         
00110         setemptystring (bsdest);
00111         
00112         return;
00113         }
00114     
00115     len = (short) stringlength(bssource);
00116     CopyMemory (bsdest, bssource, len+1);
00117 //  for (i = 0; i <= len; i++) 
00118 //      bsdest [i] = bssource [i];
00119     } /*copystring*/
00120 
00121 void bytestohexstring (ptrvoid pdata, long ctbytes, bigstring bshex) {
00122     
00123     register byte *p = pdata;
00124     register byte x;
00125     register short ct = ctbytes;
00126     byte bsbyte [3];
00127     static byte hex [16] = "0123456789ABCDEF";
00128     
00129     setemptystring (bshex);
00130     
00131     setstringlength (bsbyte, 2);
00132     
00133     ct = min (ctbytes, lenbigstring / 2 - 2); /*leave room for hex prefix*/
00134     
00135     while (--ct >= 0) {
00136         
00137         x = *p++;
00138         
00139         bsbyte [1] = hex [(x >> 4) & 0x000F];
00140         
00141         bsbyte [2] = hex [x & 0x000F];
00142         
00143         pushstring (bsbyte, bshex);
00144         }
00145     
00146     insertstring (bshexprefix, bshex);
00147     } /*bytestohexstring*/
00148 
00149 #endif
00150 
00151 #define dberrorlist 256
00152 
00153 static byte * dberrorstrings [] = {
00154         /* [1] */
00155         STR_File_was_created_by_an_incompatible_version_of_this_program,
00156         /* [2] */
00157         STR_Internal_error_attempted_to_read_a_free_block
00158     };
00159 
00160 
00161 static byte * langmiscstrings [] = {
00162         /* [1] */
00163         STR_unknown,
00164         /* [2] */
00165         STR_error
00166     };
00167 
00168 
00169 static byte * stacknames [] = {
00170         /* [1] */
00171         STR_hash_table
00172     };
00173 
00174 
00175 static byte * langerrorstrings [] = {
00176         /* [1] */
00177         STR_Cant_delete_XXX_because_it_hasnt_been_defined,
00178         /* [2] */
00179         STR_Stack_overflow_XXX_stack,
00180         /* [3] */
00181         STR_The_name_XXX_hasnt_been_defined,
00182         /* [4] */
00183         STR_Address_value_doesnt_refer_to_a_valid_table
00184     };
00185 
00186 
00187 #if 0 // (odbengine==1)
00188 
00189 boolean equalstrings (bigstring bs1, bigstring bs2) {
00190 
00191     /*
00192     return true if the two strings (pascal type, with length-byte) are
00193     equal.  return false otherwise.
00194     */
00195 
00196     register ptrbyte p1 = bs1, p2 = bs2;
00197     register short ct = *p1 + 1;
00198     
00199     if (*p1 != *p2) /*different lengths*/
00200         return (false);
00201     
00202     while (ct--) 
00203         
00204         if (*p1++ != *p2++)
00205         
00206             return (false);
00207         
00208     return (true); /*loop terminated*/
00209     } /*equalstrings*/
00210 
00211 short comparestrings (bigstring bs1, bigstring bs2) {
00212 
00213     /*
00214     3.0.2b1 dmb: use std c lib as much as possible
00215     */
00216     
00217     register short len1 = stringlength (bs1);
00218     register short len2 = stringlength (bs2);
00219     register short n;
00220     
00221     n = memcmp ((char *) bs1 + 1, (char *) bs2 + 1, min (len1, len2));
00222     
00223     if (n == 0)
00224         n = sgn (len1 - len2);
00225     
00226     return (n);
00227     } /*comparestrings*/
00228 
00229 
00230 boolean stringlessthan (register bigstring bs1, register bigstring bs2) {
00231     
00232     return (comparestrings (bs1, bs2) < 0);
00233     } /*stringlessthan*/
00234 
00235     
00236 boolean pushstring (bigstring bssource, bigstring bsdest) {
00237 
00238     /*
00239     insert the source string at the end of the destination string.
00240     
00241     assume the strings are pascal strings, with the length byte in
00242     the first character of the string.
00243     
00244     return false if the resulting string would be too long.
00245     */
00246     
00247     register short lensource = stringlength (bssource);
00248     register short lendest = stringlength (bsdest);
00249     register byte *psource, *pdest;
00250     
00251     if ((lensource + lendest) > lenbigstring) /*resulting string would be too long*/
00252         return (false);
00253         
00254     CopyMemory (bsdest + lendest, bssource, lensource+1);
00255     
00256 //  psource = bssource + 1;
00257     
00258     setstringlength(bsdest,  lendest + lensource);
00259     
00260 //  while (lensource--) *pdest++ = *psource++;
00261     
00262     return (true);
00263     } /*pushstring*/
00264 
00265 
00266 boolean deletestring (bigstring bs, short ixdelete, short ctdelete) {
00267     
00268     /*
00269     delete ct chars in the indicated string, starting with the character
00270     at offset ix.
00271     */
00272     
00273     register short ix = ixdelete;
00274     register short ct = ctdelete;
00275     register short len = stringlength (bs);
00276     register long ctmove;
00277     register ptrbyte pfrom, pto;        
00278     
00279     if ((ix > len) || (ix < 0))
00280         return (false);
00281         
00282     if (ct <= 0)
00283         return (ct == 0);
00284         
00285     ctmove = len - ix - ct + 1;
00286      
00287     if (ctmove > 0) {
00288         
00289         pfrom = bs + ix + ct;
00290         
00291         pto = bs + ix;
00292         
00293         moveleft (pfrom, pto, ctmove);
00294         }
00295     
00296     setstringlength (bs, len - ct);
00297     
00298     return (true);
00299     } /*deletestring*/
00300 
00301 
00302 boolean deletefirstchar (bigstring bs) {    
00303     
00304     return (deletestring (bs, 1, 1));
00305     } /*deletefirstchar*/
00306     
00307     
00308 short popleadingchars (bigstring bs, byte ch) {
00309     
00310     /*
00311     2.1b1 dmb: return the number of characters popped
00312     */
00313     
00314     register short len = stringlength (bs);
00315     register short i;
00316     
00317     for (i = 1; i <= len; i++) {
00318         
00319         if (bs [i] != ch) {
00320             
00321             deletestring (bs, 1, --i);
00322             
00323             return (i);
00324             }
00325         } /*for*/
00326         
00327     setemptystring (bs);
00328     
00329     return (len);
00330     } /*popleadingchars*/
00331 
00332 
00333 boolean pushchar (byte ch, bigstring bs) {
00334     
00335     /*
00336     insert the character at the end of a pascal string.
00337     */
00338     
00339     register short len;
00340     
00341     len = stringlength(bs); 
00342     
00343     if (len >= lenbigstring)
00344         return (false);
00345     
00346     setstringcharacter(bs, len, ch);
00347     
00348     setstringlength(bs, len+1);
00349     
00350     return (true);
00351     } /*pushchar*/
00352     
00353     
00354 boolean pushspace (bigstring bs) {
00355 
00356     /*
00357     an oft-repeated function, add a space at the end of bs.
00358     */
00359     
00360     return (pushchar (chspace, bs));
00361     } /*pushspace*/
00362     
00363     
00364 boolean pushlong (long num, bigstring bsdest) {
00365 
00366     bigstring bsint;
00367     
00368     numbertostring (num, bsint);
00369     
00370     return (pushstring (bsint, bsdest));
00371     } /*pushlong*/
00372     
00373 
00374 boolean pushint (short num, bigstring bsdest) {
00375     
00376     return (pushlong ((long) num, bsdest));
00377     } /*pushint*/
00378 
00379 boolean insertstring (bigstring bssource, bigstring bsdest) {
00380     
00381     /*
00382     insert the source string at the beginning of the destination string.
00383     
00384     return false if the resulting string would be longer than 255 chars.
00385     */
00386     
00387     register short len1 = stringlength (bssource), len2 = stringlength (bsdest);
00388     bigstring bs;
00389     
00390     if ((len1 + len2) > lenbigstring) /*resulting string would be too long*/
00391         return (false);
00392         
00393     copystring (bssource, bs);
00394     
00395     pushstring (bsdest, bs);
00396     
00397     copystring (bs, bsdest);
00398     
00399     return (true);
00400     } /*insertstring*/
00401 
00402 
00403 boolean insertchar (byte ch, bigstring bsdest) {
00404     
00405     register byte *pdest = bsdest;
00406     register short len = stringlength (pdest);
00407     
00408     if (len == lenbigstring)
00409         return (false);
00410     
00411     moveright (pdest + 1, pdest + 2, len);
00412     
00413     setstringlength (pdest, len + 1);
00414     
00415     pdest [1] = ch;
00416     
00417     return (true);
00418     } /*insertchar*/
00419 
00420 
00421 void midstring (bigstring bssource, short ix, short len, bigstring bsdest) {
00422     
00423     /*
00424     2.1b2 dmb: to make calling easier, protect again negative lengths
00425     */
00426     
00427     if (len <= 0)
00428         setemptystring (bsdest);
00429     
00430     else {
00431         
00432         setstringlength (bsdest, len);
00433         
00434         moveleft (&bssource [ix], &bsdest [0], (long) len);
00435         }
00436     } /*midstring*/
00437 
00438 
00439 boolean scanstring (byte ch, bigstring bs, short *ix) {
00440     
00441     /*
00442     return in ix the index in the string of the first occurence of chscan.
00443     
00444     return false if it wasn't found, true otherwise.
00445     
00446     dmb 10/26/90: p is now initialized correctly to bs + i, not bs + 1
00447     */
00448     
00449     register short i;
00450     register ptrbyte p;
00451     register byte c = ch;
00452     register short len = stringlength (bs);
00453     
00454     for (i = *ix, p = bs + i; i < len; i++) 
00455         
00456         if (*p++ == c) {
00457             
00458             *ix = i;
00459             
00460             return (true);
00461             }
00462             
00463     return (false);
00464     } /*scanstring*/
00465 
00466 
00467 boolean stringfindchar (byte ch, bigstring bs) {
00468     
00469     /*
00470     simpler entrypoint for scanstring when caller just wants 
00471     to know if ch appears anywhere in bs
00472     */
00473     
00474     short ix = 1;
00475     
00476     return (scanstring (ch, bs, &ix));
00477     } /*stringfindchar*/
00478 
00479 
00480 boolean stringreplaceall (char ch1, char ch2, bigstring bs) {
00481     
00482     /*
00483     replace all instances of ch1 in bs with ch2
00484     */
00485     
00486     short ix = 1;
00487     
00488     while (scanstring (ch1, bs, &ix))
00489         bs [ix] = ch2;
00490     
00491     return (true);
00492     } /*stringreplaceall*/
00493 
00494 
00495 boolean textlastword (ptrbyte ptext, long lentext, byte chdelim, bigstring bsdest) {
00496     
00497     /*
00498     copy the last word from bs, and put it into bsdest.
00499     
00500     search backwards from the end of the source string until you find
00501     chdelim.
00502     */
00503     
00504     register long len = lentext;
00505     register long i;
00506     register byte ch = chdelim;
00507     
00508     for (i = len; i > 0; i--) {
00509         
00510         if (ptext [i - 1] == ch)
00511             break;
00512         } /*for*/
00513     
00514     texttostring (ptext + i, len - i, bsdest);
00515     
00516     return (true);
00517     } /*textlastword*/
00518 
00519 
00520 boolean textfirstword (ptrbyte ptext, long lentext, byte chdelim, bigstring bsdest) {
00521     
00522     /*
00523     copy the first word from bs, and put it into bsdest.
00524     
00525     search forwards from the beginning of the source string until you 
00526     find chdelim.
00527     */
00528     
00529     register long len = lentext;
00530     register long i;
00531     register byte ch = chdelim;
00532     
00533     for (i = 0; i < len; i++) {
00534         
00535         if (ptext [i] == ch)
00536             break;
00537         } /*for*/
00538     
00539     texttostring (ptext, i, bsdest);
00540     
00541     return (true);
00542     } /*textfirstword*/
00543 
00544 
00545 boolean textnthword (ptrbyte ptext, long lentext, long wordnum, byte chdelim, boolean flstrict, long *ixword, long *lenword) {
00546     
00547     /*
00548     6/10/91 dmb: a single word preceeded or followed by chdelim should be 
00549     counted as just one word
00550     
00551     8/7/92 dmb: added flstrict parameter. when set, every delimiter starts a new word, 
00552     even consecutive characters, possibly yielding empty words
00553     */
00554     
00555     register long len = lentext;
00556     register long ix;
00557     register long ixlastword;
00558     register long ctwords = 1;
00559     register byte ch = chdelim;
00560     boolean fllastwasdelim = true;
00561     
00562     ix = 0;
00563     
00564     ixlastword = 0;
00565     
00566     while (true) { /*scan string*/
00567         
00568         if (ix >= len) /*reached end of string*/
00569             break;
00570         
00571         if (ptext [ix] == ch) { /*at a delimiter*/
00572             
00573             if (ix == len - 1) /*trailing delimiter, don't bump word count*/
00574                 break;
00575             
00576             if (flstrict || !fllastwasdelim) {
00577                 
00578                 if (ctwords >= wordnum) /*we've found the end of the right word*/
00579                     break;
00580                 
00581                 ctwords++;
00582                 }
00583             
00584             ixlastword = ix + 1; /*next word starts after the delimiter*/
00585             
00586             fllastwasdelim = true;
00587             }
00588         else
00589             fllastwasdelim = false;
00590         
00591         ix++; /*advance to next character*/
00592         } /*while*/
00593     
00594     /*
00595     texttostring (ptext + ixlastword, ix - ixlastword, bsword);
00596     
00597     if (isemptystring (bsword) && !flstrict)
00598         return (false);
00599     */
00600     
00601     *ixword = ixlastword;
00602     
00603     *lenword = ix - ixlastword;
00604     
00605     if ((*lenword == 0) && !flstrict)
00606         return (false);
00607     
00608     return (ctwords == wordnum);
00609     } /*textnthword*/
00610 
00611 
00612 long textcountwords (ptrbyte ptext, long lentext, byte chdelim, boolean flstrict) {
00613     
00614     /*
00615     8/7/92 dmb: added flstrict parameter
00616     */
00617     
00618     register long wordnum = 1;
00619 //  bigstring bsword;
00620     long ixword;
00621     long lenword;
00622     
00623     while (true) {
00624         
00625         if (!textnthword (ptext, lentext, wordnum, chdelim, flstrict, &ixword, &lenword))
00626             return (wordnum - 1);
00627         
00628         wordnum++;
00629         } /*while*/
00630     } /*textcountwords*/
00631 
00632 
00633 boolean lastword (bigstring bssource, byte chdelim, bigstring bsdest) {
00634     
00635     return (textlastword (bssource + 1, stringlength (bssource), chdelim, bsdest));
00636     } /*lastword*/
00637     
00638 
00639 void poplastword (bigstring bs, byte chdelim) {
00640     
00641     bigstring bsword;
00642     
00643     if (lastword (bs, chdelim, bsword)) 
00644     
00645         setstringlength (bs, stringlength (bs) - stringlength (bsword));
00646     } /*poplastword*/
00647 
00648 
00649 boolean firstword (bigstring bssource, byte chdelim, bigstring bsdest) {
00650     
00651     return (textfirstword (bssource + 1, stringlength (bssource), chdelim, bsdest));
00652     } /*firstword*/
00653 
00654 
00655 boolean nthword (bigstring bs, short wordnum, byte chdelim, bigstring bsword) {
00656     
00657     long ixword;
00658     long lenword;
00659     
00660     if (!textnthword (bs + 1, stringlength (bs), wordnum, chdelim, false, &ixword, &lenword))
00661         return (false);
00662     
00663     texttostring (bs + 1 + ixword, lenword, bsword);
00664     
00665     return (true);
00666     } /*nthword*/
00667 
00668 
00669 short countwords (bigstring bs, byte chdelim) {
00670     
00671     return (textcountwords (bs + 1, stringlength (bs), chdelim, false));
00672     } /*countwords*/
00673 
00674 
00675 void commentdelete (byte chdelim, bigstring bs) {
00676     
00677     /*
00678     scan the string from left to right.  if we find a comment delimiting
00679     character, delete all the characters to the right, including the
00680     delimiter and return.
00681     
00682     10/30/91 dmb: ignore comment characters that are embedded in quoted strings
00683     
00684     5/4/93 dmb: handle single-quoted strings too
00685     
00686     3.0.2b1 dmb: handle escape sequences. note that we don't have to deal with 
00687     the 0x## form because ## can never be quote characters, and thus can't 
00688     confuse our string parsing
00689     */
00690     
00691     register byte chcomment = chdelim;
00692     register short i, ct;
00693     register byte ch;
00694     boolean flinstring = false;
00695     boolean flinescapesequence = false;
00696     byte chendstring;
00697     
00698     ct = stringlength (bs);
00699     
00700     for (i = 1; i <= ct; i++) {
00701         
00702         ch = bs [i];
00703         
00704         if (flinstring) {
00705             
00706             if (flinescapesequence)
00707                 flinescapesequence = false; /*it's been consumed*/
00708             
00709             else {
00710                 
00711                 if (ch == (byte) '\\')
00712                     flinescapesequence = true;
00713                 else
00714                     flinstring = ch != chendstring;
00715                 }
00716             }
00717         
00718         else if (ch == (byte) '"') {
00719             
00720             flinstring = true;
00721             
00722             chendstring = '"';
00723             }
00724         
00725         else if (ch == (byte) '') {
00726             
00727             flinstring = true;
00728             
00729             chendstring = '';
00730             }
00731         
00732         else if (ch == (byte) '\'') {
00733             
00734             flinstring = true;
00735             
00736             chendstring = '\'';
00737             }
00738         
00739         else if (ch == chcomment) {
00740             
00741             setstringlength (bs, i - 1);
00742             
00743             return;
00744             }
00745         }
00746     } /*commentdelete*/
00747 
00748 
00749 boolean whitespacechar (byte ch) {
00750     
00751     return ((ch == ' ') || (ch == '\t') || (ch == '\n') || (ch == '\r'));
00752     } /*whitespacechar*/
00753     
00754     
00755 boolean poptrailingwhitespace (bigstring bs) {
00756     
00757     /*
00758     return true if there were trailing "whitespace" characters to be popped.
00759     */
00760     
00761     register short i, ct;
00762     
00763     ct = stringlength (bs);
00764     
00765     for (i = ct; i > 0; i--)
00766     
00767         if (!whitespacechar (bs [i])) { /*found a non-blank character*/
00768             
00769             setstringlength (bs, i);
00770             
00771             return (i < ct);
00772             }
00773     
00774     setemptystring (bs);
00775     
00776     return (true); /*string is all blank*/
00777     } /*poptrailingwhitespace*/
00778     
00779     
00780 boolean firstsentence (bigstring bs) { 
00781     
00782     /*
00783     pops all characters after the first period followed by a space.
00784     
00785     return true if any chars were popped.
00786     */
00787     
00788     register short i;
00789     register short len = stringlength (bs);
00790     
00791     for (i = 1; i <= len; i++) {
00792         
00793         if (bs [i] == '.') {
00794             
00795             if (i == len) /*no next character, no chars to pop*/
00796                 return (false);
00797                 
00798             if (whitespacechar (bs [i+1])) { /*truncate length and return*/
00799                 
00800                 setstringlength (bs, i);
00801                 
00802                 return (true);
00803                 }
00804             }
00805         } /*for*/
00806         
00807     return (false); /*no chars popped*/
00808     } /*firstsentence*/
00809 
00810 
00811     
00812 boolean capitalizefirstchar (bigstring bs) {
00813     
00814     register char ch;
00815     
00816     if (stringlength (bs) == 0)
00817         return (true);
00818         
00819     ch = bs [1];
00820     
00821     if ((ch < 'a') || (ch > 'z'))
00822         return (false);
00823         
00824     bs [1] = ch - 32;
00825     
00826     return (true);
00827     } /*capitalizefirstchar*/
00828     
00829     
00830 boolean isallnumeric (bigstring bs) {
00831     
00832     /*
00833     11/6/92 dmb: allow first character to be a sign instead of a digit
00834     */
00835     
00836     register short ct = stringlength (bs);
00837     register ptrbyte p = &bs [1];
00838     register byte ch;
00839     
00840     while (--ct >= 0) {
00841         
00842         ch = *p++;
00843         
00844         if (!isnumeric (ch)) {
00845             
00846             if (ct == stringlength (bs) - 1) { /*checking first character*/
00847                 
00848                 if ((ch == '-') || (ch == '+')) /*sign character -- it's cool*/
00849                     continue;
00850                 }
00851             
00852             return (false);
00853             }
00854         } /*while*/
00855         
00856     return (true); /*composed entirely of numeric chars*/
00857     } /*isallnumeric*/
00858 
00859 void filledstring (byte ch, short ct, bigstring bs) {
00860     
00861     if (ct < 0)
00862         ct = 0;
00863         
00864     setstringlength(bs, ct);
00865     
00866     fillchar (bs, (long) ct, ch);
00867     } /*filledstring*/
00868     
00869 void copyheapstring (hdlstring hsource, bigstring bsdest) {
00870     
00871     /*
00872     a safe way of copying a string out of the heap into a stack-allocated or
00873     global string.
00874     */
00875     
00876     register hdlstring h = hsource;
00877     
00878     if (h == nil) { /*nil handles are empty strings*/
00879         
00880         setemptystring (bsdest);
00881         
00882         return;
00883         }
00884     
00885     HLock ((Handle) h);
00886     
00887     copystring (*h, bsdest);
00888     
00889     HUnlock ((Handle) h);
00890     } /*copyheapstring*/
00891     
00892 void convertpstring (bigstring bs) {
00893     
00894     /*
00895     convert a pascal string to a c string.
00896     */
00897     
00898     register short len;
00899     
00900     len = (short) bs [0];
00901     
00902     moveleft (&bs [1], &bs [0], (long) len);
00903     
00904     bs [len] = 0; /*dmb 8/1/90:  shouldn't add 1 to len here*/
00905     } /*convertpstring*/
00906     
00907     
00908 void convertcstring (bigstring bs) {
00909     
00910     /*
00911     convert a c string to a pascal string.
00912     */
00913     
00914     register ptrbyte p;
00915     register short len = 0;
00916     
00917     p = &bs [0]; /*point at the first byte in c string*/
00918     
00919     while (*p++) len++;
00920     
00921     moveright (&bs [0], &bs [1], (long) len);
00922     
00923     bs [0] = (byte) len;
00924     } /*convertcstring*/
00925 #endif
00926 
00927 #if 0 // (odbengine==1)
00928 
00929 #ifdef fldebug
00930     
00931     void shellinternalerrormessage (bigstring bs) {
00932         
00933         DebugStr (bs);
00934         } /*shellinternalerrormessage*/
00935 
00936 #else
00937     
00938     void shellinternalerrormessage (short n) {
00939         } /*shellinternalerrormessage*/
00940 
00941 #endif
00942 #endif
00943 
00944 #if 0 // (odbengine==1)
00945 
00946 void ostypetostring (OSType type, bigstring bs) {
00947     
00948     setstringlength (bs, sizeof (OSType));
00949     
00950     moveleft (&type, &bs [1], longsizeof (OSType));
00951     } /*ostypetostring*/
00952     
00953     
00954 void parsedialogstring (bigstring bssource, bigstring bs0, bigstring bs1, bigstring bs2, bigstring bs3, bigstring bsresult)
00955     {
00956     }
00957     
00958 #endif
00959 
00960 #if 0 // (odbengine==1)
00961 void memoryerror ()
00962     {
00963     }
00964 #endif
00965 
00966 #ifdef WIN95VERSION
00967 void recttowinrect (Rect * rIn, RECT * rOut) {
00968     rOut->left = rIn->left;
00969     rOut->top = rIn->top;
00970     rOut->right = rIn->right;
00971     rOut->bottom = rIn->bottom;
00972     }
00973 
00974 void winrecttorect (RECT * rIn, Rect * rOut) {
00975     rOut->left = (short)rIn->left;
00976     rOut->top = (short)rIn->top;
00977     rOut->right = (short)rIn->right;
00978     rOut->bottom = (short)rIn->bottom;
00979     }
00980 #endif
00981 
00982 #ifdef PASCALSTRINGVERSION
00983 #ifdef WIN95VERSION
00984 char * pwstringbaseaddress(char * bs) {
00985     bs[bs[0]+1]=0;
00986     return (bs+1);
00987     }
00988 
00989 void pwsetstringlength(char * bs, short len) {
00990     bs[0]=(char)len;
00991 //  bs[len+1] = 0;
00992     }
00993 #endif
00994 #endif
00995 
00996 
00997 

Generated on Wed May 31 18:19:55 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6