|
From: <cre...@us...> - 2007-01-16 19:16:22
|
Revision: 1600
http://svn.sourceforge.net/frontierkernel/?rev=1600&view=rev
Author: creecode
Date: 2007-01-16 11:16:21 -0800 (Tue, 16 Jan 2007)
Log Message:
-----------
support for long odb item names and file paths
formatting tweaks
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/source/cancoon.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/cancoon.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/cancoon.c 2007-01-16 18:41:14 UTC (rev 1599)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/cancoon.c 2007-01-16 19:16:21 UTC (rev 1600)
@@ -505,8 +505,9 @@
create the standard global tables
*/
- register hdlcancoonrecord hc = hcancoon;
- register boolean fl;
+ /* register */ hdlcancoonrecord hc = hcancoon;
+ /* register */ boolean fl;
+
Handle hvariable;
hdlhashtable htable;
@@ -523,6 +524,7 @@
assert (tablevalidate (htable, true));
fl = settablestructureglobals (hvariable, flcreate) || !flcreate;
+
}
fldisablesymbolcallbacks = false;
@@ -570,28 +572,31 @@
} /*clearcancoonglobals*/
-static boolean loadversion2cancoonfile (dbaddress adr, hdlcancoonrecord hcancoon, boolean flhavehost) {
+static boolean loadversion2cancoonfile ( dbaddress adr, hdlcancoonrecord hcancoon, boolean flhavehost ) {
- /*
- 5.0d14 dmb: bumped cancoonversionnumber; hscriptstring is now a text handle,
- not a string handle. (no 255 char limit)
+ //
+ // 2007-01-16 creedon: support for long odb item names and file paths
+ //
+ // 5.0a2 dmb: install the menubar if the database hasn't been upgraded
+ //
+ // 5.0d18 dmb: have to ccwindowsetup _after_ loading system table now
+ //
+ // 5.0d14 dmb: bumped cancoonversionnumber; hscriptstring is now a text
+ // handle, not a string handle. (no 255 char limit)
+ //
+ // 2002-11-11 AR: Added additional asserts to make sure the C compiler
+ // chose the proper byte alignment for the
+ // tycancoonwindowinfo and tyversion2cancoonrecord struct.
+ // If it did not, we would end up corrupting any database
+ // files we saved.
+ //
- 5.0d18 dmb: have to ccwindowsetup _after_ loading system table now
-
- 5.0a2 dmb: install the menubar if the database hasn't been upgraded
-
- 2002-11-11 AR: Added additional asserts to make sure the C compiler chose the
- proper byte alignment for the tycancoonwindowinfo and tyversion2cancoonrecord
- struct. If it did not, we would end up corrupting any database files we saved.
- */
-
+ boolean flguest, frontier4root, frontier5root;
+ hdlmenurecord hmenurecord = nil;
+ hdlstring hstring;
register hdlcancoonrecord hc;
+ short i;
tyversion2cancoonrecord info;
- short i;
- hdlmenurecord hmenurecord = nil;
- hdlstring hstring;
- boolean flguest;
- boolean frontier4root;
assert (sizeof (tycancoonwindowinfo) == 62); /* one padding byte after fontname which is 33 bytes long */
@@ -625,9 +630,8 @@
(**hc).windowinfo [i] = windowinfo;
} /*for*/
- /*cancooninitwindowinfo (hc, ixunused2);*/
-
frontier4root = info.versionnumber < 3;
+ frontier5root = info.versionnumber == 3;
if (frontier4root) {
@@ -640,11 +644,23 @@
dbrefheapstring (info.adrscriptstring, &hstring);
- pullfromhandle ((Handle) hstring, 0, 1, nil); // pluck out the length byte
+ pullfromhandle ((Handle) hstring, 0L, 1L, nil); // pluck out the length byte
+
}
else
dbrefhandle (info.adrscriptstring, (Handle *) &hstring);
+ if ( frontier5root ) {
+
+ bigstring bsprompt;
+
+ shellgetstring ( openolddatabasestring, bsprompt );
+
+ if ( twowaydialog ( bsprompt, BIGSTRING ( "\x06" "Cancel" ), BIGSTRING ( "\x07" "Convert" ) ) )
+ return ( false );
+
+ }
+
(**hc).hscriptstring = (Handle) hstring;
(**hc).flflagdisabled = (info.flags & flflagdisabled_mask) != 0;
@@ -679,9 +695,19 @@
if (frontier4root) {
- if (resourcestable != nil)
- if (menugetmenubar (resourcestable, namemenubar, false, &hmenurecord))
+ if (resourcestable != nil) {
+
+ Handle h;
+
+ if ( ! newtexthandle ( namemenubar, &h ) )
+ return ( false );
+
+ if ( menugetmenubar ( resourcestable, h, false, &hmenurecord ) )
ccinstallmenubar (hc, hmenurecord); /*ignore error*/
+
+ disposehandle ( h );
+
+ } // if
}
if (ccinstalltablestructure (flhavehost))
@@ -693,6 +719,7 @@
(**hc).flguestroot = flguest;
return (true);
+
} /*loadversion2cancoonfile*/
@@ -754,17 +781,20 @@
#endif
boolean ccloadfile (hdlfilenum fnum, short rnum) {
-#pragma unused(rnum)
- /*
- 9/15/92 dmb: removed support for version1 format; it never shipped
-
- 6.1fc2 AR: Don't link cancoondata into (**cancoonwindowinfo).hdata.
- This would crash some installations during the initialization
- of the serial number dialog.
- hdata should be a hdltableformats anyway.
- */
+ #pragma unused(rnum)
+ //
+ // 2007-01-16 creedon: support for long odb item names and file paths
+ //
+ // 6.1fc2 AR: Don't link cancoondata into (**cancoonwindowinfo).hdata.
+ // This would crash some installations during the initialization
+ // of the serial number dialog. hdata should be a
+ // hdltableformats anyway.
+ //
+ // 1992-09-15 dmb: removed support for version1 format; it never shipped
+ //
+
register hdlcancoonrecord hc = nil;
dbaddress adr;
short versionnumber;
@@ -816,8 +846,10 @@
*/
case 2:
+ case 3:
case cancoonversionnumber:
- if (!loadversion2cancoonfile (adr, hc, flhavehost))
+
+ if ( ! loadversion2cancoonfile ( adr, hc, flhavehost ) )
goto error;
if ((**hc).flguestroot)
@@ -855,9 +887,12 @@
boolean ccloadspecialfile (ptrfilespec fspec, OSType filetype) {
-#pragma unused (filetype)
+ #pragma unused (filetype)
+
//
+ // 2007-01-16 creedon: support for long odb item names and file paths
+ //
// 2006-06-23 creedon: replace fsname macro with getfsfile function;
//
// 2.1b3 dmb: only set finder2front to true if the sender of the 'odoc' event was the Finder
@@ -866,8 +901,8 @@
// Frontier.finder2click always set it to true. also, handle updates now.
//
- bigstring bspath;
- bigstring bs;
+ Handle handlePath;
+ bigstring bs, bspath;
ptrbyte pbool;
if (!shellsetsuperglobals ()) {
@@ -879,11 +914,12 @@
shellerrormessage (bs);
return (false);
+
}
}
+
+ if ( ! filespectopath ( fspec, &handlePath ) ) {
- if (!filespectopath (fspec, bspath)) {
-
bigstring bs;
getfsfile ( fspec, bs );
@@ -891,132 +927,142 @@
filenotfounderror ( bs );
return (false);
+
}
+
+ texthandletostring ( handlePath, bspath );
langdeparsestring (bspath, chclosecurlyquote); // add needed escape sequences
if (getsystemtablescript (idfinder2frontscript, bs)) { // frontier.findertofront=^0
#ifdef MACVERSION
+
if ((shellevent.what == kHighLevelEvent) && ((**landgetglobals ()).maceventsender == 'MACS'))
pbool = bstrue;
else
+
#endif
pbool = bsfalse;
parsedialogstring (bs, pbool, nil, nil, nil, bs);
langrunstringnoerror (bs, bs);
+
}
if (!getsystemtablescript (idfinder2clickscript, bs)) // frontier.finder2click ("^0")
return (false);
-
+
parsedialogstring (bs, bspath, nil, nil, nil, bs);
shellpartialeventloop (updateMask); // handle updates first
return (processrunstring (bs));
+
} // ccloadspecialfile
boolean ccsavespecialfile (ptrfilespec fs, hdlfilenum fnum, short rnum, boolean flsaveas, boolean flrunnable) {
-#pragma unused(flsaveas, rnum)
- /*
- 6.17.97 dmb: this is called by opverbs, wpverbs, etc. to save a disk file.
- we leave it to the system.misc.saveWindow script to package the data,
- but we take care of writing it. (our caller did the file creation.)
+ #pragma unused(flsaveas, rnum)
- note: if we decide to make this more open architecture, we could add
- another flat for the config record that would prevent the shell from
- opening the data fork for us. then, we'd need to make this callback
- take the destination filespec as a parameter too, and the saveWindow script
- would take both the window name and the filespec (which would be the same
- for a normal save).
+ //
+ // 2007-01-16 creedon: support for long odb item names and file paths
+ //
+ // 5.0.2b8 dmb: don't unregister the window until we're about to set the
+ // new path
+ // 5.0.2b6 dmb: error checking on openfile
+ //
+ // 1997-06-17 dmb: this is called by opverbs, wpverbs, etc. to save a disk
+ // file. we leave it to the system.misc.saveWindow script
+ // to package the data, but we take care of writing it.
+ // (our caller did the file creation.)
+ //
+ // note: if we decide to make this more open architecture,
+ // we could add another flat for the config record that
+ // would prevent the shell from opening the data fork for
+ // us. then, we'd need to make this callback take the
+ // destination filespec as a parameter too, and the
+ // saveWindow script would take both the window name and
+ // the filespec (which would be the same for a normal
+ // save).
+ //
+ //
- 5.0.2b6 dmb: error checking on openfile
-
- 5.0.2b8 dmb: don't unregister the window until we're about to set the new path
- */
-
- bigstring bs, bspath;
- ptrstring bsrunnable;
- tyvaluerecord val;
- Handle hscript;
+ Handle hPath, hscript;
+ bigstring bs, bsPath;
boolean fl = false;
boolean flopenedfile = false;
hdlexternalvariable hv;
+ ptrstring bsrunnable;
+ tyvaluerecord val;
(*shellglobals.getvariableroutine) ((Handle *) &hv);
-// if (hv != nil)
-// langexternalunregisterwindow (shellwindowinfo);
-
- if (!windowgetpath (shellwindow, bspath))
- shellgetwindowtitle (shellwindowinfo, bspath);
-
- langdeparsestring (bspath, chclosecurlyquote); /*add needed escape sequences*/
+ if ( ! windowgetpath ( shellwindow, &hPath ) )
+ shellgetwindowtitle ( shellwindowinfo, &hPath );
+
+ langDeparseTextHandle ( hPath, chclosecurlyquote ); // add needed escape sequences
- if (!getsystemtablescript (idsavewindowscript, bs)) /*system.misc.saveWindow ("^0","^1")*/
- return (false);
+ if ( ! getsystemtablescript ( idsavewindowscript, bs ) ) // system.misc.saveWindow ("^0","^1")
+ return ( false );
+
+ bsrunnable = ( flrunnable ? bstrue : bsfalse );
- bsrunnable = (flrunnable? bstrue : bsfalse);
-
- parsedialogstring (bs, bspath, bsrunnable, nil, nil, bs);
+ texthandletostring ( hPath, bsPath );
- if (!newtexthandle (bs, &hscript))
- return (false);
+ parsedialogstring ( bs, bsPath, bsrunnable, nil, nil, bs );
- pushprocess (nil);
+ if ( ! newtexthandle ( bs, &hscript ) )
+ return ( false );
+
+ pushprocess ( nil );
- fl = langrun (hscript, &val);
+ fl = langrun ( hscript, &val );
- popprocess ();
+ popprocess ( );
- if (!fl)
- return (false);
+ if ( !fl )
+ return ( false );
+
+ pushhashtable ( roottable ); // need temp stack services
- pushhashtable (roottable); /*need temp stack services*/
+ pushvalueontmpstack ( &val );
- pushvalueontmpstack (&val);
+ if ( coercetostring ( &val ) ) {
- if (coercetostring (&val)) {
+ if ( fnum == 0 ) {
- if (fnum == 0) {
-
- fl = openfile (fs, &fnum, false);
+ fl = openfile ( fs, &fnum, false );
flopenedfile = fl;
+
}
+
+ if ( fl )
+ fl = fileseteof ( fnum, 0 ) && filesetposition ( fnum, 0 ) && filewritehandle ( fnum, val.data.stringvalue );
+
+ if ( flopenedfile )
+ closefile ( fnum );
+ }
- if (fl)
- fl =
- fileseteof (fnum, 0) &&
-
- filesetposition (fnum, 0) &&
-
- filewritehandle (fnum, val.data.stringvalue);
-
- if (flopenedfile)
- closefile (fnum);
- }
+ cleartmpstack ( );
- cleartmpstack ();
+ pophashtable ( );
- pophashtable ();
+ if ( hv != nil )
+ langexternalunregisterwindow ( shellwindowinfo );
+
+ if ( fl )
+ windowsetfspec ( shellwindow, fs );
+
+ if ( hv != nil )
+ langexternalregisterwindow ( hv );
+
+ return ( fl );
- if (hv != nil)
- langexternalunregisterwindow (shellwindowinfo);
-
- if (fl)
- windowsetfspec (shellwindow, fs);
-
- if (hv != nil)
- langexternalregisterwindow (hv);
-
- return (fl);
- } /*ccsavespecialfile*/
+ } // ccsavespecialfile
boolean ccnewrecord (void) {
@@ -1746,58 +1792,77 @@
} /*ccchecktablestructureglobals*/
-static boolean ccsymbolchanged (hdlhashtable htable, const bigstring bsname, hdlhashnode hnode, boolean flvalue) {
+static boolean ccsymbolchanged (hdlhashtable htable, const Handle handleName, hdlhashnode hnode, boolean flvalue) {
+
+ //
+ // used as a callback routine. the value of the indicated variable has
+ // changed. if the cell is being displayed, update the display of it.
+ // this is how the real-time changing of variables is implemented.
+ //
+ // 2007-01-16 creedon: support for long odb item names and file paths
+ //
+ // 2001-11-14 dmb: also call new langexternalsymbolchanged. we should
+ // really create a new callback so we don't have to call
+ // them explicitly here
+ //
+ // 1991-02-28 dmb: also call ccchecktablestructureglobals to make sure our
+ // globals are up to date
+ //
- /*
- used as a callback routine. the value of the indicated variable has changed.
- if the cell is being displayed, update the display of it. this is how the
- real-time changing of variables is implemented.
-
- 2/28/91 dmb: also call ccchecktablestructureglobals to make sure our
- globals are up to date
-
- 11/14/01 dmb: also call new langexternalsymbolchanged. we should really create
- a new callback so we don't have to call them explicitly here
- */
-
if (!ccchecktablestructureglobals (htable))
return (false);
- langipcsymbolchanged (htable, bsname, flvalue);
+ langipcsymbolchanged (htable, handleName, flvalue);
- langexternalsymbolchanged (htable, bsname, hnode, flvalue);
+ langexternalsymbolchanged (htable, handleName, hnode, flvalue);
- return (tablesymbolchanged (htable, bsname, hnode, flvalue));
+ return (tablesymbolchanged (htable, handleName, hnode, flvalue));
+
} /*ccsymbolchanged*/
-static boolean ccsymbolinserted (hdlhashtable htable, const bigstring bsname, hdlhashnode hnode) {
+static boolean ccsymbolinserted (hdlhashtable htable, const Handle handleName, hdlhashnode hnode) {
+
+ //
+ // 2007-01-16 creedon: support for long odb item names and file paths
+ //
if (!ccchecktablestructureglobals (htable))
return (false);
- langipcsymbolinserted (htable, bsname);
+ langipcsymbolinserted (htable, handleName);
- langexternalsymbolinserted (htable, bsname, hnode);
+ langexternalsymbolinserted (htable, handleName, hnode);
- return (tablesymbolinserted (htable, bsname));
- } /*ccsymbolinserted*/
+ return (tablesymbolinserted (htable, handleName));
+
+ } // ccsymbolinserted
-static boolean ccsymboldeleted (hdlhashtable htable, const bigstring bsname) {
+static boolean ccsymboldeleted ( hdlhashtable htable, const Handle handleName ) {
+
+ boolean fl;
- if (!ccchecktablestructureglobals (htable))
- return (false);
+ if ( ! ccchecktablestructureglobals ( htable ) )
+ return ( false );
- langipcsymboldeleted (htable, (ptrstring) bsname);
+ langipcsymboldeleted ( htable, handleName );
- return (tablesymboldeleted (htable, bsname));
- } /*ccsymboldeleted*/
+ fl = tablesymboldeleted ( htable, handleName );
+ return ( fl );
+
+ } // ccsymboldeleted
+
static short cccomparenodes (hdlhashtable htable, hdlhashnode hnode1, hdlhashnode hnode2) {
+
+ //
+ // 2007-01-16 creedon: support for long odb item names and file paths
+ //
return (tablecomparenodes (htable, hnode1, hnode2));
+
} /*cccomparenodes*/
@@ -1831,13 +1896,14 @@
if (hc != cancoonglobals)
setcancoonglobals (hc);
+
+ return (true);
- return (true);
} /*ccrestoreglobals*/
static boolean ccpartialeventloop (short desiredevents) {
-
+
/*
3/23/93 dmb: don't use ccsave/restoreglobals, 'cause we don't want to restore
nil globals (in case we're being called at an odd time, like from an error
@@ -1855,11 +1921,12 @@
setcancoonglobals (hc);
return (fl);
+
} /*ccpartialeventloop*/
boolean ccstart (void) {
-
+
/*
set up callback routines record, and link our data into the shell's
data structure.
@@ -1884,8 +1951,6 @@
shellpushmenuhook (&ccmenuroutine);
return (ccwindowstart ());
+
} /*ccstart*/
-
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|