|
From: <cre...@us...> - 2007-02-27 20:29:43
|
Revision: 1636
http://svn.sourceforge.net/frontierkernel/?rev=1636&view=rev
Author: creecode
Date: 2007-02-27 12:29:44 -0800 (Tue, 27 Feb 2007)
Log Message:
-----------
support for long odb item names and file paths
formatting tweaks
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/headers/process.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/scripts.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/shell.h
Frontier/branches/Frontier_Long_File_Paths/Common/resources/Mac/SHELL.R
Frontier/branches/Frontier_Long_File_Paths/Common/source/opverbs.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/opxml.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/osacomponent.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/osawindows.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/pictverbs.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/process.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/scripts.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellfile.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellmenu.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellsysverbs.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellverbs.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellwindow.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellwindowmenu.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellwindowverbs.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/process.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/process.h 2007-02-27 08:00:29 UTC (rev 1635)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/process.h 2007-02-27 20:29:44 UTC (rev 1636)
@@ -41,7 +41,7 @@
#endif
-typedef struct tythreadglobals **hdlprocessthread; // it's a hdlthreadglobals really; we're avoiding dependencies
+typedef struct tythreadglobals **hdlprocessthread; // it's a hdlthreadglobals really; we're avoiding dependencies
typedef struct typrocessrecord {
@@ -96,6 +96,7 @@
bigstring bsname; // 5.0a22 dmb: why not maintain the name from the start?
long processrefcon; /*for client use only*/
+
} typrocessrecord, *ptrprocessrecord, **hdlprocessrecord;
@@ -206,7 +207,7 @@
extern short processthreadcount (void);
-extern boolean initprocessthread (bigstring);
+extern boolean initprocessthread ( Handle );
extern void exitprocessthread (void);
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/scripts.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/scripts.h 2007-02-27 08:00:29 UTC (rev 1635)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/scripts.h 2007-02-27 20:29:44 UTC (rev 1636)
@@ -65,7 +65,7 @@
extern boolean scriptkilled (void);
-extern boolean scriptpushsourcecode (hdlhashtable, hdlhashnode, bigstring);
+extern boolean scriptpushsourcecode ( hdlhashtable, hdlhashnode, const Handle );
extern boolean scriptpopsourcecode (void);
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/shell.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/shell.h 2007-02-27 08:00:29 UTC (rev 1635)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/shell.h 2007-02-27 20:29:44 UTC (rev 1636)
@@ -253,7 +253,7 @@
Handle hundostack, hredostack; /*handles are untyped here so avoid shellundo.h*/
- hdlstring hwindowtitle; /*so we don't have to ask the window for it*/
+ Handle hwindowtitle; /*so we don't have to ask the window for it*/
long ctpushes;
@@ -280,6 +280,7 @@
boolean flbeingclosed: 1; /*if true, we're inside of shellclosexxx right now*/
boolean fldisposewhenpopped: 1; //if true, dispose was called while we were pushed
+
} tywindowinfo, *ptrwindowinfo, **hdlwindowinfo;
@@ -776,7 +777,7 @@
extern boolean windowgetfspec ( WindowPtr, ptrfilespec );
-extern boolean windowgetpath (WindowPtr, bigstring);
+extern boolean windowgetpath ( WindowPtr, Handle * );
extern void windowsetvnum (WindowPtr, short);
@@ -796,9 +797,9 @@
extern boolean shellbringtofront (hdlwindowinfo);
-extern boolean shellsetwindowtitle (hdlwindowinfo, bigstring);
+extern boolean shellsetwindowtitle ( hdlwindowinfo, const Handle );
-extern void shellgetwindowtitle (hdlwindowinfo, bigstring);
+extern void shellgetwindowtitle ( hdlwindowinfo, Handle * );
extern boolean getfrontwindowinfo (hdlwindowinfo *);
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/resources/Mac/SHELL.R
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/resources/Mac/SHELL.R 2007-02-27 08:00:29 UTC (rev 1635)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/resources/Mac/SHELL.R 2007-02-27 20:29:44 UTC (rev 1636)
@@ -871,19 +871,23 @@
}
};
-resource 'STR#' (132, "Font Names", purgeable) {
- { /* array StringArray: 4 elements */
- /* [1] */
- "Palatino",
- /* [2] */
- "Geneva",
- /* [3] */
- "Helvetica",
- /* [4] */
- "Chicago"
- }
-};
+resource 'STR#' ( 132, "Font Names", purgeable ) {
+ { // array StringArray: 5 elements
+
+ "Palatino", // 1
+
+ "Geneva", // 2
+
+ "Helvetica", // 3
+
+ "Chicago", // 4
+
+ "Lucida Grande" // 5
+
+ }
+ };
+
resource 'STR#' (133, "QuickScript") {
{ /* array StringArray: 2 elements */
/* [1] */
@@ -3348,8 +3352,8 @@
}
};
+
/* kw - 2006-02-05 --- personalisation dialog - was in root resourcefork */
-/* kw - 2006-02-05 --- personalisation dialog - was in root resourcefork */
#if 0
@@ -3775,8 +3779,8 @@
"scroll bar"
};
-/* kw - 2006-02-05 --- missing; taken from old root */
-resource 'CNTL' (25000) {
+
+resource 'CNTL' (25000) { // kw - 2006-02-05 --- missing; taken from old root
{64, 9, 89, 169},
0,
visible,
@@ -3787,6 +3791,7 @@
"Hot List:"
};
+
resource 'cnfg' (128, "menu bar") {
nohorizscroll,
vertscroll,
@@ -3922,40 +3927,63 @@
{100, 100, 270, 540}
};
-resource 'cnfg' (132, "table") {
+resource 'cnfg' ( 132, "table" ) {
+
nohorizscroll,
+
vertscroll,
+
windowfloats,
+
messagearea,
+
dontinsetcontentrect,
+
nonewonlaunch,
+
dontopenresfile,
+
normalwindow,
+
isgrowable,
+
createonnew,
+
nowindoidscrollbars,
+
notstoredindatabase,
+
handlesownsave,
+
eraseonresize,
+
consumefrontclicks,
+
colorwindow,
+
onethird,
- #ifdef version42orgreater
- 'LAND',
- 'FTtb',
- #else
- 'BigD',
- 'TABL',
- #endif
+
+ 'LAND',
+
+ 'FTtb',
+
129,
- {0, 0, 100, 260},
- 4,
+
+ { 0, 0, 100, 260 },
+
+ 5,
+
size12,
+
plain,
+
0,
- {100, 100, 250, 500}
-};
+
+ { 100, 100, 250, 500 }
+
+ };
+
resource 'cnfg' (134, "wpengine") {
horizscroll,
vertscroll,
@@ -4690,4 +4718,3 @@
"Frontier\xAA\n\nHigh performance Web content management, object database, system-level and Internet scripting environment, including source code editing and debugging"
};
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/opverbs.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/opverbs.c 2007-02-27 08:00:29 UTC (rev 1635)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/opverbs.c 2007-02-27 20:29:44 UTC (rev 1636)
@@ -377,6 +377,7 @@
opdisposeoutline ((hdloutlinerecord) (**hv).variabledata, fldisk);
return (true);
+
} /*opdisposevariable*/
@@ -387,6 +388,7 @@
opverbdisposecode ((hdloutlinevariable) hv); /*must check for code even if outline isn't in memory*/
return (langexternaldisposevariable (hv, fldisk, &opdisposevariable));
+
} /*opverbdispose*/
@@ -456,10 +458,12 @@
shellinvalbuttons ();
shellpopglobals ();
+
}
}
return (true);
+
} /*opverblinkcode*/
@@ -1839,21 +1843,25 @@
static boolean opcompileverb (hdltreenode hparam1, tyvaluerecord *v) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ Handle handleName;
+ boolean fl;
+ hdlhashnode hnode;
hdlhashtable htable;
- bigstring bsname;
- hdlhashnode hnode;
hdltreenode hcode;
- boolean fl;
flnextparamislast = true;
- if (!getvarparam (hparam1, 1, &htable, bsname))
+ if (!getvarparam (hparam1, 1, &htable, &handleName))
return (false);
pushhashtable (htable);
- fl = hashlookupnode (bsname, &hnode);
+ fl = hashlookupnode (handleName, &hnode);
pophashtable ();
@@ -1869,35 +1877,45 @@
}
return (setbooleanvalue (fl, v));
+
} /*opcompileverb*/
static boolean opuncompileverb (hdltreenode hparam1, tyvaluerecord *v) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ Handle handleName;
+ hdlhashnode hnode;
hdlhashtable htable;
- bigstring bsname;
+ hdltreenode hcode;
tyvaluerecord val;
- hdltreenode hcode;
- hdlhashnode hnode;
flnextparamislast = true;
- if (!getvarvalue (hparam1, 1, &htable, bsname, &val, &hnode))
+ if (!getvarvalue (hparam1, 1, &htable, &handleName, &val, &hnode))
return (false);
if (!langexternalvaltocode (val, &hcode)) { /*easy way to check for a script*/
-
+
errornum = namenotscripterror;
+ // disposehandle ( handleName );
+
return (false);
+
}
-
+
pushhashtable (htable);
- hashlookupnode (bsname, &hnode);
+ hashlookupnode (handleName, &hnode);
pophashtable ();
+ // disposehandle ( handleName );
+
if (opcodeisrunning (hnode)) /*can't uncompile running code; return false to caller*/
return (true);
@@ -1907,6 +1925,7 @@
opverbdisposecode ((hdloutlinevariable) val.data.externalvalue);
return (setbooleanvalue (true, v));
+
} /*opuncompileverb*/
@@ -1977,35 +1996,39 @@
static boolean opgetcodeverb (hdltreenode hparam1, boolean flosacode, tyvaluerecord *v) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 2.1b15 dmb: fixed memory leak; osagetcode does _not_ consume htext
+ //
- /*
- 2.1b15 dmb: fixed memory leak; osagetcode does _not_ consume htext
- */
+ register hdltreenode hp1 = hparam1;
- register hdltreenode hp1 = hparam1;
+ Handle handleName;
+ boolean fl;
+ hdlhashnode hnode;
+ hdlhashtable htable;
short pnum;
- hdlhashtable htable;
- bigstring bsname;
- tyvaluerecord val;
- hdlhashnode hnode;
- tyvaluerecord vcode;
- boolean fl;
+ tyvaluerecord val, vcode;
initvalue (&vcode, codevaluetype);
if (flosacode) {
+
+ #ifdef flcomponent
- #ifdef flcomponent
+ Handle htext;
+ boolean flexecuteonly;
hdloutlinevariable hv;
- Handle htext;
long signature;
- boolean flexecuteonly;
if (!havecomponentmanager ()) {
langerror (nocomponentmanagererror);
return (false);
+
}
if (!getscriptparam (hp1, 1, &hv))
@@ -2025,69 +2048,96 @@
return (false);
pnum = 3;
+
#else
+
langerror (nocomponentmanagererror);
return (false);
+
#endif
+
}
else {
-
- if (!getvarvalue (hp1, 1, &htable, bsname, &val, &hnode))
+
+ if (!getvarvalue (hp1, 1, &htable, &handleName, &val, &hnode))
return (false);
-
+
if (!langexternalvaltocode (val, &vcode.data.codevalue)) {
errornum = namenotscripterror;
+ // disposehandle ( handleName );
+
return (false);
+
}
+
+ if (vcode.data.codevalue == nil) {
- if (vcode.data.codevalue == nil) {
-
pushhashtable (htable);
- fl = hashlookupnode (bsname, &hnode);
+ fl = hashlookupnode (handleName, &hnode);
pophashtable ();
- if (!langcompilescript (hnode, &vcode.data.codevalue))
+ if (!langcompilescript (hnode, &vcode.data.codevalue)) {
+
+ // disposehandle ( handleName );
+
return (false);
+
+ }
}
+
+ // disposehandle ( handleName );
if (!copyvaluerecord (vcode, &vcode))
return (false);
+
+ pnum = 2;
- pnum = 2;
}
-
+
flnextparamislast = true;
- if (!getvarparam (hp1, pnum, &htable, bsname))
+ if (!getvarparam (hp1, pnum, &htable, &handleName))
return (false);
+
+ if (!hashtableassign (htable, handleName, vcode)) {
- if (!hashtableassign (htable, bsname, vcode))
+ // disposehandle ( handleName );
+
return (false);
+
+ }
+
+ // disposehandle ( handleName );
exemptfromtmpstack (&vcode);
return (setbooleanvalue (true, v));
+
} /*opgetcodeverb*/
static boolean opgetsourceverb (hdltreenode hparam1, boolean flosacode, tyvaluerecord *v) {
-#pragma unused(flosacode)
+ #pragma unused(flosacode)
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
register hdltreenode hp1 = hparam1;
+
+ Handle handleName;
+ OSType signature;
hdlhashtable htable;
- bigstring bsname;
- tyvaluerecord vcode;
- tyvaluerecord vsource;
- tyvaluerecord vscript;
hdlheadrecord hsummit;
hdloutlinerecord houtline;
register hdloutlinerecord ho;
- OSType signature;
+ tyvaluerecord vcode, vscript, vsource;
initvalue (&vcode, binaryvaluetype);
@@ -2096,16 +2146,19 @@
flnextparamislast = true;
- if (!getvarparam (hp1, 2, &htable, bsname))
+ if (!getvarparam (hp1, 2, &htable, &handleName))
return (false);
#ifdef flcomponent
+
if (!osagetsource (&vcode, &signature, &vsource))
return (false);
#else
+
langerror (nocomponentmanagererror);
return (false);
+
#endif
if (!langexternalnewvalue (idscriptprocessor, nil, &vscript))
@@ -2128,17 +2181,17 @@
//oppopoutline ();
- if (!hashtableassign (htable, bsname, vscript))
+ if (!hashtableassign (htable, handleName, vscript))
goto error;
return (setbooleanvalue (true, v));
- error: {
+ error:
disposevaluerecord (vscript, true);
return (false);
- }
+
} /*opgetsourceverb*/
@@ -2161,70 +2214,90 @@
static boolean convertprofiletoticksvisit (hdlhashnode hnode, ptrvoid refcon) {
-#pragma unused (refcon)
+ #pragma unused (refcon)
+
tyvaluerecord * val = &(**hnode).val;
(*val).data.longvalue = ( ( (*val).data.longvalue * 3 ) / 50 );
return (true);
-}
+
+ }
+
static boolean opstopprofileverb (hdltreenode hp1, tyvaluerecord *v) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 2005-01-14 SMD: results are stored in milliseconds, but the return
+ // values have been in ticks for a long time. So, added an
+ // optional param, flUseMilliseconds. Default is false. If
+ // true, we convert the milliseconds to ticks.
+ //
+ // 5.0.2b15 dmb: turn off profiling. If the user passes an address (not
+ // nil), we assign the profiledata table and remove it from
+ // the process.
+ //
- /*
- 5.0.2b15 dmb: turn off profiling. If the user passes an address (not nil),
- we assign the profiledata table and remove it from the process.
-
- 2005-01-14 SMD: results are stored in milliseconds, but the return values
- have been in ticks for a long time. So, added an optional param,
- flUseMilliseconds. Default is false. If true, we convert the milliseconds
- to ticks.
- */
-
+ Handle h = NULL;
+ boolean fl = false;
+ hdlhashtable ht;
hdlprocessrecord hp = currentprocess;
- hdlhashtable ht;
- bigstring bs;
+ short ctconsumed = 1, ctpositional = 1;
tyvaluerecord val;
- short ctconsumed = 1;
- short ctpositional = 1;
tyvaluerecord vflusemilliseconds; /* for optional flUseMilliseconds param */
- if (!getvarparam (hp1, 1, &ht, bs))
+ if (!getvarparam (hp1, 1, &ht, &h))
return (false);
-
+
setbooleanvalue (false, &vflusemilliseconds);
flnextparamislast = true;
if (!getoptionalparamvalue (hp1, &ctconsumed, &ctpositional, BIGSTRING ("\x11" "flUseMilliseconds"), &vflusemilliseconds))
- return (false);
+ goto exit;
+
+ if (!processstopprofiling ()) {
- if (!processstopprofiling ())
- return (setbooleanvalue (false, v));
+ fl = setbooleanvalue (false, v);
+
+ goto exit;
+
+ }
- if (!isemptystring (bs)) { // move our table to caller's address
+ if ( h != NULL ) { // move our table to caller's address
if ((**hp).hprofiledata == nil)
+
setnilvalue (&val);
- else
- {
+
+ else {
+
if (! vflusemilliseconds.data.flvalue) /* convert values to ticks */
- {
+
if (!hashtablevisit ((hdlhashtable) (**(**hp).hprofiledata).variabledata, &convertprofiletoticksvisit, (ptrvoid) nil))
- return (false);
+ goto exit;
+
+ setexternalvalue ((Handle) (**hp).hprofiledata, &val);
+
}
- setexternalvalue ((Handle) (**hp).hprofiledata, &val);
+ hashtableassign (ht, h, val);
+
+ (**hp).hprofiledata = nil;
+
}
- hashtableassign (ht, bs, val);
+ fl = setbooleanvalue (true, v);
+
+ exit:
+ disposehandle ( h );
- (**hp).hprofiledata = nil;
- }
-
- return (setbooleanvalue (true, v));
-} /*opstopprofileverb*/
+ return ( fl );
+
+ } /*opstopprofileverb*/
static boolean opverbrejectmenubar (bigstring bserror) {
@@ -2873,7 +2946,7 @@
} /*opgetheadnumberverb*/
-extern boolean langsettarget (hdlhashtable htable, bigstring bsname, tyvaluerecord *prevtarget);
+extern boolean langsettarget ( hdlhashtable, const Handle, tyvaluerecord * );
extern boolean langcleartarget (tyvaluerecord *prevtarget);
@@ -2917,44 +2990,46 @@
static boolean opvisitallverb (hdltreenode hparam1, tyvaluerecord *v, bigstring bserror) {
-#pragma unused (bserror)
- /*
- 7.0b17 PBS: visit every headline, running the specified callback script.
- */
+ #pragma unused (bserror)
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b17 PBS: visit every headline, running the specified callback script.
+ //
+
+ Handle handleName = NULL, handleNameOldTarget = NULL;
bigstring bsscriptname;
+ boolean fl = false, flhadtarget = false;
+ hdlhashnode hnode;
+ hdlhashtable htable, htableoldtarget;
+ hdlheadrecord horigcursor;
hdloutlinerecord ho;
- hdlhashtable htable, htableoldtarget;
- bigstring bsname, bsnameoldtarget;
tyvaluerecord val, prevtarget;
- hdlhashnode hnode;
- hdlheadrecord horigcursor;
- boolean fl = false;
- boolean flhadtarget = false;
/*Get outline parameter.*/
if (!getoutlinevalue (hparam1, 1, &ho))
goto exit1;
-
+
/*Set the target to the outline.*/
- if (!getvarvalue (hparam1, 1, &htable, bsname, &val, &hnode))
+ if (!getvarvalue (hparam1, 1, &htable, &handleName, &val, &hnode))
goto exit1;
-
- if (!langsettarget (htable, bsname, &prevtarget))
+
+ if (!langsettarget (htable, handleName, &prevtarget))
goto exit1;
-
- if (getaddressvalue (prevtarget, &htableoldtarget, bsnameoldtarget)) /*get info about previous target*/
+
+ if (getaddressvalue (prevtarget, &htableoldtarget, &handleNameOldTarget)) /*get info about previous target*/
flhadtarget = true;
-
+
if (htableoldtarget == nil)
flhadtarget = false;
-
+
/*Open window as hidden.*/
- if (!langzoomvalwindow (htable, bsname, val, false))
+ if (!langzoomvalwindow (htable, &handleName, val, false))
goto exit2;
/*Get script parameter.*/
@@ -2963,18 +3038,13 @@
if (!getstringvalue (hparam1, 2, bsscriptname))
goto exit2;
-
-// if (!getvarvalue (hparam1, 2, &htable, bsname, &val, &hnode))
-// goto exit2;
-
+
oppushoutline (ho);
horigcursor = (**ho).hbarcursor; /*get cursor*/
opvisiteverything (&opvisitallvisit, bsscriptname); /*call the visit routine*/
-// opvisiteverything (&opvisitallvisit, val); /*call the visit routine*/
-
(**ho).hbarcursor = horigcursor; /*restore cursor*/
oppopoutline ();
@@ -2983,18 +3053,25 @@
exit2:
- /*Restore the previous target.*/
-
- if (flhadtarget)
- langsettarget (htableoldtarget, bsnameoldtarget, &prevtarget);
- else
- langcleartarget (nil);
-
+ /*Restore the previous target.*/
+
+ if (flhadtarget)
+ langsettarget (htableoldtarget, handleNameOldTarget, &prevtarget);
+ else
+ langcleartarget (nil);
+
exit1:
- setbooleanvalue (fl, v);
-
- return (fl);
+ setbooleanvalue (fl, v);
+
+ if ( handleName != NULL )
+ disposehandle ( handleName );
+
+ if ( handleNameOldTarget != NULL )
+ disposehandle ( handleNameOldTarget );
+
+ return (fl);
+
} /*opvisitallverb*/
@@ -3080,12 +3157,16 @@
static boolean getoptionaltablereference (hdltreenode hp1, short pnum, hdlhashtable *ht) {
- /*
- 7.1b45 dmb: new function to get an optional table reference that may be nil
- */
-
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.1b45 dmb: new function to get an optional table reference that may be nil
+ //
+
tyvaluerecord v;
xmladdress adr;
+ Handle h;
+ boolean fl;
if (!getparamvalue (hp1, pnum, &v))
return (false);
@@ -3095,36 +3176,43 @@
*ht = nil;
return (true);
+
}
- if (!getvarparam (hp1, pnum, &adr.ht, adr.bs))
+ if (!getvarparam (hp1, pnum, &adr.ht, &h))
return (false);
-
- return (langassignnewtablevalue (adr.ht, adr.bs, ht));
+
+ texthandletostring ( h, adr.bs );
+
+ fl = langassignnewtablevalue (adr.ht, h, ht);
+
+ disposehandle ( h );
+
+ return ( fl );
+
} /*getoptionaltablereference*/
static boolean opxmltooutlineverb (hdltreenode hparam1, tyvaluerecord *v) {
- /*
- 7.0b21 PBS -- convert an XML outlineDocument to an outline.
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.1b43 dmb: added optional cloudSpec parameter. table can be null.
+ //
+ // 7.0b21 PBS: convert an XML outlineDocument to an outline.
+ //
+ // Two parameters: xml text and the address of an outline.
+ //
+ // opxmltooutline is in opxml.c.
+ //
- Two parameters: xml text and the address of an outline.
-
- opxmltooutline is in opxml.c.
-
- 7.1b43 dmb: added optional cloudSpec parameter. table can be null.
- */
-
+ Handle handleName = NULL, htext;
+ boolean fl = false, flnewoutline;
+ hdlhashnode hnode;
+ hdlhashtable hcloud = nil, htable;
hdloutlinerecord ho;
- hdlhashtable htable;
- bigstring bsname;
tyvaluerecord val;
- hdlhashnode hnode;
- boolean fl = false;
- Handle htext;
- boolean flnewoutline;
- hdlhashtable hcloud = nil;
if (!getreadonlytextvalue (hparam1, 1, &htext))
goto exit;
@@ -3132,7 +3220,7 @@
if (!getoutlinevalue (hparam1, 2, &ho))
goto exit;
- if (!getvarvalue (hparam1, 2, &htable, bsname, &val, &hnode))
+ if (!getvarvalue (hparam1, 2, &htable, &handleName, &val, &hnode))
goto exit;
if (!getbooleanvalue (hparam1, 3, &flnewoutline))
@@ -3148,50 +3236,52 @@
oppushoutline (ho);
- fl = opxmltooutline (htext, ho, flnewoutline, htable, bsname, val, hcloud);
+ fl = opxmltooutline ( htext, ho, flnewoutline, htable, &handleName, val, hcloud );
oppopoutline ();
-
+
exit:
- setbooleanvalue (fl, v);
-
- return (fl);
+ if ( handleName != NULL )
+ disposehandle ( handleName );
+
+ setbooleanvalue (fl, v);
+
+ return (fl);
+
} /*opxmltooutlineverb*/
static boolean opoutlinetoxmlverb (hdltreenode hparam1, tyvaluerecord *v) {
-
- /*
- 7.0b21 PBS: convert an outline to outlineDocument XML.
- 7.1b43 dmb; handle optional cloud parameter. also, fixed handle disposal
- in error condition
- */
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.1b43 dmb; handle optional cloud parameter. also, fixed handle
+ // disposal in error condition
+ //
+ // 7.0b21 PBS: convert an outline to outlineDocument XML.
+ //
+ Handle handleName, hemail = nil, hname = nil, htext = nil;
boolean fl = false;
- Handle htext = nil;
- Handle hname = nil;
- Handle hemail = nil;
- hdloutlinerecord ho;
- hdlhashtable ht;
+ hdlhashnode hnode;
+ hdlhashtable hcloud = nil, ht;
+ hdloutlinerecord ho ;
tyvaluerecord val;
- hdlhashnode hnode;
- bigstring bsname;
- hdlhashtable hcloud = nil;
-
+
if (!getoutlinevalue (hparam1, 1, &ho)) /*Get the outline pointed to in first parameter*/
goto exit;
-
- if (!getvarvalue (hparam1, 1, &ht, bsname, &val, &hnode)) /*We'll be opening the window.*/
+
+ if (!getvarvalue (hparam1, 1, &ht, &handleName, &val, &hnode)) /*We'll be opening the window.*/
goto exit;
-
+
if (!getexempttextvalue (hparam1, 2, &hname)) /*ownerName*/
goto exit;
-
+
if (!getexempttextvalue (hparam1, 3, &hemail)) /*ownerEmail*/
goto exit;
-
+
if (langgetparamcount (hparam1) > 3) {
flnextparamislast = true;
@@ -3199,19 +3289,22 @@
if (!getoptionaltablevalue (hparam1, 4, &hcloud))
return (false);
}
-
- if (!opoutlinetoxml (ho, hname, hemail, &htext, ht, bsname, val, hcloud)) /*Convert from outline to XML text*/
+
+ if (!opoutlinetoxml (ho, hname, hemail, &htext, ht, &handleName, val, hcloud)) /*Convert from outline to XML text*/
goto exit;
fl = setheapvalue (htext, stringvaluetype, v); /*htext is returned XML text*/
exit:
- disposehandle (hname);
-
- disposehandle (hemail);
-
- return (fl);
+ disposehandle ( handleName );
+
+ disposehandle (hname);
+
+ disposehandle (hemail);
+
+ return (fl);
+
} /*opoutlinetoxmlverb*/
@@ -4109,74 +4202,77 @@
case getallfunc: { /*7.0b16 PBS: op.attributes.getAll*/
+ Handle handleVariableName;
hdlhashtable ht;
- bigstring bsvarname;
tyvaluerecord val;
flnextparamislast = true;
- if (!getvarparam (hparam1, 1, &ht, bsvarname))
+ if (!getvarparam (hparam1, 1, &ht, &handleVariableName))
break;
- if (!opattributesgetpackedtablevalue (hbarcursor, &val)) {
-
+ if (!opattributesgetpackedtablevalue (hbarcursor, &val))
break;
- }
- if (!langsetsymboltableval (ht, bsvarname, val)) {
+ if (!langsetsymboltableval (ht, handleVariableName, val)) {
disposevaluerecord (val, false);
break;
+
}
fl = true;
break;
+
}
-
+
case getonefunc: { /*7.0b16 PBS: op.attributes.getOne*/
- bigstring bsattname, bsvarname;
+ Handle handleAttributeName, handleVariableName;
+ hdlhashtable ht;
tyvaluerecord val;
- hdlhashtable ht;
fl = true;
- if (!getstringvalue (hparam1, 1, bsattname))
+ if ( ! getreadonlytextvalue ( hparam1, 1, &handleAttributeName ) )
break;
-
+
flnextparamislast = true;
- if (!getvarparam (hparam1, 2, &ht, bsvarname))
- break;
+ if (!getvarparam (hparam1, 2, &ht, &handleVariableName))
+ goto exitgetonefunc;
+
+ (*v).data.flvalue = opattributesgetoneattribute (hbarcursor, handleAttributeName, &val);
- (*v).data.flvalue = opattributesgetoneattribute (hbarcursor, bsattname, &val);
+ if ((*v).data.flvalue) {
- if ((*v).data.flvalue) {
+ if (!langsetsymboltableval (ht, handleVariableName, val)) {
- if (!langsetsymboltableval (ht, bsvarname, val)) {
-
disposevaluerecord (val, false);
-
- break;
+
+ goto exitgetonefunc;
+
} /*if*/
+
} /*if*/
-
- break;
+
+ exitgetonefunc:
+
+ disposehandle ( handleVariableName );
+
+ break;
+
}
-
- case makeemptyfunc: { /*7.0b16 PBS: op.attributes.makeEmpty*/
-
+ case makeemptyfunc: /*7.0b16 PBS: op.attributes.makeEmpty*/
+
break;
- }
- case setonefunc: { /*7.0b16 PBS: op.attributes.setOne*/
+ case setonefunc: /*7.0b16 PBS: op.attributes.setOne*/
-
break;
- }
} /*switch*/
@@ -4190,16 +4286,18 @@
error:
- if (errornum != 0) /*get error string*/
- getstringlist (operrorlist, errornum, bserror);
-
- return (false);
+ if (errornum != 0) /*get error string*/
+ getstringlist (operrorlist, errornum, bserror);
+
+ return (false);
+
} /*opfunctionvalue*/
static boolean opinitverbs (void) {
return (loadfunctionprocessor (idopverbs, &opfunctionvalue));
+
} /*opinitverbs*/
@@ -4212,6 +4310,7 @@
#ifdef WIN95VERSION
opupdatenow ();
#endif
+
} /*opverbresize*/
@@ -4249,12 +4348,14 @@
}
return (true);
+
} /*opverbclose*/
boolean opverbfind (hdlexternalvariable hvariable, boolean *flzoom) {
-#pragma unused(flzoom)
+ #pragma unused(flzoom)
+
register hdloutlinevariable hv = (hdloutlinevariable) hvariable;
register hdloutlinerecord ho;
register boolean fl;
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/opxml.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/opxml.c 2007-02-27 08:00:29 UTC (rev 1635)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/opxml.c 2007-02-27 20:29:44 UTC (rev 1636)
@@ -115,19 +115,19 @@
-/*Prototypes*/
+// prototypes
static boolean opxmltooutlinevisit (hdlhashtable ht, short ixlevel, bigstring bsname, boolean flfirstline);
static boolean opxmlgetheadlinetextfromatts (hdlhashtable ht, Handle htext);
-static boolean opxmlsetwindowatts (hdlhashtable ht, hdloutlinerecord ho, hdlhashtable hto, bigstring bso, tyvaluerecord vo);
+static boolean opxmlsetwindowatts (hdlhashtable, hdloutlinerecord, hdlhashtable, Handle *, tyvaluerecord );
static boolean opxmlsetwindowpositionandsize (hdlhashtable ht, hdlwindowinfo hinfo);
-static boolean opxmlfindtableitem (hdlhashtable ht, bigstring bsname, hdlhashtable *htfound);
+static boolean opxmlfindtableitem ( hdlhashtable, const Handle, hdlhashtable * );
-static boolean opxmlgetonelongvalue (hdlhashtable ht, bigstring bsname, long *v);
+static boolean opxmlgetonelongvalue ( hdlhashtable, const Handle, long * );
//static boolean opxmlpushxmlheader (Handle htext, short indentlevel);
@@ -143,7 +143,7 @@
static boolean opxmlbuildbody (hdloutlinerecord ho, Handle htext, short indentlevel);
-static boolean opxmlensureopenwindow (hdloutlinerecord ho, hdlhashtable hto, bigstring bso, tyvaluerecord vo, hdlwindowinfo *hinfo, boolean *flwasopen);
+static boolean opxmlensureopenwindow ( hdloutlinerecord, hdlhashtable, Handle *, tyvaluerecord, hdlwindowinfo *, boolean * );
static boolean opxmlpushindents (Handle htext, short indentlevel);
@@ -155,31 +155,32 @@
static boolean opxmlgetcloudatts (hdlhashtable hhead, hdlhashtable hcloudspec);
-static boolean opxmlpushoneattribute (Handle htext, bigstring bsname, Handle hvalue);
+static boolean opxmlpushoneattribute ( Handle htext, const Handle, Handle hvalue );
-static boolean opxmlgetattribute (hdlhashtable ht, bigstring bsname, tyvaluetype type, tyvaluerecord *val);
+static boolean opxmlgetattribute ( hdlhashtable, const Handle, tyvaluetype, tyvaluerecord * );
-/*Functions*/
+// functions
boolean opoutlinetoxml (hdloutlinerecord ho, Handle hname, Handle hemail, Handle *htext,
- hdlhashtable hto, bigstring bso, tyvaluerecord vo, hdlhashtable hcloud) {
-
- /*
- 7.0b21 PBS: convert an outline to XML text.
-
- 7.1b42 dmb: added hcloud parameter
+ hdlhashtable hto, Handle *handleO, tyvaluerecord vo, hdlhashtable hcloud) {
- Note: it might be wise to use handlestreams at some point. Since I don't know how they work yet,
- I'm sticking with the tried-and-true.
+ //
+ // Note: it might be wise to use handlestreams at some point. Since I don't
+ // know how they work yet, I'm sticking with the tried-and-true.
+ //
+ // Caller is responsible for disposing htext.
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.1b42 dmb: added hcloud parameter
+ //
+ // 7.0b21 PBS: convert an outline to XML text.
+ //
- Caller is responsible for disposing htext.
- */
-
+ boolean fl = false, flwindowwasopen = false;
+ hdlwindowinfo hinfo;
short indentlevel = 0;
- hdlwindowinfo hinfo;
- boolean flwindowwasopen = false;
- boolean fl = false;
if (!newemptyhandle (htext))
goto exit;
@@ -192,7 +193,7 @@
indentlevel++;
- if (!opxmlensureopenwindow (ho, hto, bso, vo, &hinfo, &flwindowwasopen)) /*Make sure op window is open.*/
+ if (!opxmlensureopenwindow (ho, hto, handleO, vo, &hinfo, &flwindowwasopen)) /*Make sure op window is open.*/
goto exit;
if (!opxmlbuildhead (*htext, ho, hname, hemail, indentlevel, hinfo, hcloud)) /*Build <head> section.*/
@@ -211,34 +212,33 @@
exit:
- return (fl);
+ return (fl);
+
} /*opoutlinetoxml*/
boolean opxmltooutline (Handle htext, hdloutlinerecord ho, boolean flnewoutline,
- hdlhashtable hto, bigstring bso, tyvaluerecord vo, hdlhashtable hcloud) {
-
- /*
- 7.0b21 PBS -- convert XML text to an outline.
+ hdlhashtable hto, Handle *handleO, tyvaluerecord vo, hdlhashtable hcloud) {
-
-
- 7.0b33 PBS: changes to conform to changing spec. Both <head> and <body> are required. <head> may be empty.
-
- 7.1b42 dmb: added hcloud parameter
-
- <body> must contain one or more <outline> elements.
- */
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.1b42 dmb: added hcloud parameter
+ //
+ // <body> must contain one or more <outline> elements.
+ //
+ // 7.0b33 PBS: changes to conform to changing spec. Both <head> and <body>
+ // are required. <head> may be empty.
+ //
+ // 7.0b21 PBS: convert XML text to an outline.
+ Handle h;
+ bigstring bsvers;
+ boolean fl = false, flcanhavecloud = true, flheadfound = false, florigdisplayenabled = true;
+ hdlhashnode hn;
hdlhashtable ht, htfirst, htopmldocument, htbody, hthead;
- hdlhashnode hn;
+ tyvaluerecord v, vvers;
xmladdress xstruct;
- boolean flheadfound = false;
- boolean fl = false;
- boolean florigdisplayenabled = true;
- boolean flcanhavecloud = true;
- tyvaluerecord v, vvers;
- bigstring bsvers;
/*New local table*/
@@ -261,21 +261,36 @@
/*Get <opml> item*/
- if (!opxmlfindtableitem (htfirst, STR_opmldocument, &htopmldocument)) { /*Find <opml> item*/
+ if ( ! newtexthandle ( STR_opmldocument, &h ) )
+ goto exit2;
- if (!opxmlfindtableitem (htfirst, STR_outlinedocument, &htopmldocument)) { /*<outlineDocument> grandfathered in*/
+ if (!opxmlfindtableitem (htfirst, h, &htopmldocument)) { /*Find <opml> item*/
+
+ disposehandle ( h );
+
+ if ( ! newtexthandle ( STR_outlinedocument, &h ) )
+ goto exit2;
+ if (!opxmlfindtableitem (htfirst, h, &htopmldocument)) { /*<outlineDocument> grandfathered in*/
+
langerrormessage (STR_errornotopml);
goto exit2;
+
} /*if*/
-
+
} /*if*/
+
+ // Get the version number and test for 1.1
- // Get the version number and test for 1.1
- if (!opxmlgetattribute (htopmldocument, STR_version, stringvaluetype, &vvers))
+ disposehandle ( h );
+
+ if ( ! newtexthandle ( STR_version, &h ) )
goto exit2;
-
+
+ if (!opxmlgetattribute (htopmldocument, h, stringvaluetype, &vvers))
+ goto exit2;
+
pullstringvalue (&vvers, bsvers);
dateversionlessthan (bsvers, BIGSTRING ("\x03" "1.1"), &v);
@@ -284,13 +299,19 @@
/*Get <body> item and convert it to an outline.*/
- if (!opxmlfindtableitem (htopmldocument, STR_body, &htbody)) { /*<body> is not optional*/
+ disposehandle ( h );
+
+ if ( ! newtexthandle ( STR_body, &h ) )
+ goto exit2;
+
+ if (!opxmlfindtableitem (htopmldocument, h, &htbody)) { /*<body> is not optional*/
langerrormessage (STR_errornobody);
goto exit2;
+
} /*if*/
-
+
oppushoutline (ho);
if (!flnewoutline) { /*7.1b12 PBS: Inhibit display*/
@@ -298,18 +319,19 @@
florigdisplayenabled = (**ho).flinhibitdisplay;
(**ho).flinhibitdisplay = true;
+
}
-
+
if (!opxmltooutlinevisit (htbody, 0, STR_body, true)) { /*Convert XML to outline -- recursive routine*/
-
+
langerrormessage (STR_errornooutlines);
-
+
oppopoutline ();
-
+
goto exit2;
-
+
} /*if*/
-
+
if (!flnewoutline) { /*7.1b12 PBS: Restore display setting; update window*/
hdlwindowinfo hinfo;
@@ -319,10 +341,11 @@
if (shellfinddatawindow ((Handle) ho, &hinfo)) { /*get window info*/
shellupdatenow ((**hinfo).macwindow);
+
} /*if*/
+
} /*if*/
-
-
+
oppopoutline ();
/*Get <head> item and set the window attributes if this is a new outline.*/
@@ -335,13 +358,19 @@
if (flnewoutline && flheadfound) {
- if (opxmlfindtableitem (htopmldocument, STR_head, &hthead)) {
+ disposehandle ( h );
+
+ if ( ! newtexthandle ( STR_head, &h ) )
+ goto exit2;
+ if (opxmlfindtableitem (htopmldocument, h, &hthead)) {
+
oppushoutline (ho);
- opxmlsetwindowatts (hthead, ho, hto, bso, vo); /*set window attributes*/
+ opxmlsetwindowatts (hthead, ho, hto, handleO, vo); /*set window attributes*/
oppopoutline ();
+
}
} /*if*/
@@ -355,6 +384,7 @@
langerrormessage (STR_errornohead);
goto exit2;
+
} /*if*/
if (hcloud != nil && flcanhavecloud) { /*7.1b43 dmb: load the cloud elements into the table*/
@@ -367,11 +397,14 @@
exit2:
- disposehashtable (ht, false);
-
+ disposehandle ( h );
+
+ disposehashtable (ht, false);
+
exit1:
- return (fl);
+ return (fl);
+
} /*opxmltooutline*/
@@ -561,72 +594,103 @@
} /*teststringvalue*/
-static boolean opxmlpushcloudattribute (Handle htag, hdlhashtable hcloud, bigstring bsatt, bigstring legalvalues) {
+static boolean opxmlpushcloudattribute (Handle htag, hdlhashtable hcloud, const Handle handleAttribute, bigstring legalvalues) {
- /*
- 7.1b43 dmb: push the named attribute into the cloud tag, getting the value from the hcloud table
- if legalvalues is not nil, it's a |-delimited list of legal string values for this attribute
- */
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.1b43 dmb: push the named attribute into the cloud tag, getting the
+ // value from the hcloud table if legalvalues is not nil, it's
+ // a |-delimited list of legal string values for this attribute
+ //
tyvaluerecord v;
hdlhashnode hn;
- if (!hashtablelookup (hcloud, bsatt, &v, &hn) ||
- !copyvaluerecord (v, &v) ||
- !coercetostring (&v) ||
- !teststringvalue (&v, legalvalues)) {
+ if ( ! hashtablelookup ( hcloud, handleAttribute, &v, &hn ) ||
+ ! copyvaluerecord ( v, &v ) || ! coercetostring ( &v ) ||
+ ! teststringvalue ( &v, legalvalues ) ) {
- langparamerror (cloudspecerror, bsatt);
+ langparamerror ( cloudspecerror, handleAttribute );
return (false);
+
}
-
- if (!opxmlpushoneattribute (htag, bsatt, v.data.stringvalue)) //Add att to returned text.
+
+ if (!opxmlpushoneattribute (htag, handleAttribute, v.data.stringvalue)) //Add att to returned text.
return (false);
disposevaluerecord (v, false);
return (true);
+
} /*opxmlpushcloudattribute*/
static boolean opxmlpushcloudtag (hdlhashtable hcloud, short indentlevel, Handle htext) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.1b43 dmb: push a cloud tag with attributes coming from hcloud table
+ // values
+ //
- /*
- 7.1b43 dmb: push a cloud tag with attributes coming from hcloud table values
- */
-
- Handle hcloudtag;
+ Handle h, hcloudtag;
boolean fl = false;
if (!newtexthandle (STR_opencloud, &hcloudtag))
return (false);
+
+ if ( ! newtexthandle ( STR_domain, &h ) )
+ return ( false );
+
+ if (!opxmlpushcloudattribute (hcloudtag, hcloud, h, nil))
+ goto exit;
+
+ disposehandle ( h );
- if (!opxmlpushcloudattribute (hcloudtag, hcloud, STR_domain, nil))
+ if ( ! newtexthandle ( STR_port, &h ) )
+ return ( false );
+
+ if (!opxmlpushcloudattribute (hcloudtag, hcloud, h, nil))
goto exit;
-
- if (!opxmlpushcloudattribute (hcloudtag, hcloud, STR_port, nil))
+
+ disposehandle ( h );
+
+ if ( ! newtexthandle ( STR_path, &h ) )
+ return ( false );
+
+ if (!opxmlpushcloudattribute (hcloudtag, hcloud, h, nil))
goto exit;
-
- if (!opxmlpushcloudattribute (hcloudtag, hcloud, STR_path, nil))
+
+ disposehandle ( h );
+
+ if ( ! newtexthandle ( STR_regProcedure, &h ) )
+ return ( false );
+
+ if (!opxmlpushcloudattribute (hcloudtag, hcloud, h, nil))
goto exit;
-
- if (!opxmlpushcloudattribute (hcloudtag, hcloud, STR_regProcedure, nil))
+
+ disposehandle ( h );
+
+ if ( ! newtexthandle ( STR_protocol, &h ) )
+ return ( false );
+
+ if (!opxmlpushcloudattribute (hcloudtag, hcloud, h, STR_legalprotocols))
goto exit;
-
- if (!opxmlpushcloudattribute (hcloudtag, hcloud, STR_protocol, STR_legalprotocols))
- goto exit;
-
+
if (!pushtexthandle (BIGSTRING ("\x02" "/>"), hcloudtag))
goto exit;
-
+
fl = opxmlpushhandleline (htext, hcloudtag, indentlevel);
exit:
-
- disposehandle (hcloudtag);
-
- return (fl);
+
+ disposehandle (hcloudtag);
+
+ return (fl);
+
} /*opxmlpushcloudtag*/
@@ -698,12 +762,14 @@
} /*opxmlpushclosingoutlinetags*/
-static boolean opxmlpushoneattribute (Handle htext, bigstring bsname, Handle hvalue) {
+static boolean opxmlpushoneattribute (Handle htext, const Handle handleName, Handle hvalue) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: Push one attribute onto the returned text.
+ //
- /*
- 7.0b21 PBS: Push one attribute onto the returned text.
- */
-
Handle h;
boolean fl = false;
@@ -719,7 +785,7 @@
if (!pushtexthandle (STR_space, htext)) /*add a space character*/
goto exit;
- if (!pushtexthandle (bsname, htext)) /*add the attribute name*/
+ if (!pushhandle (handleName, htext)) /*add the attribute name*/
goto exit;
if (!pushtexthandle (STR_equalsquotes, htext)) /*add ="*/
@@ -739,37 +805,52 @@
static boolean opxmlpushattributes (hdlheadrecord hnode, Handle htext, short indentlevel) {
-#pragma unused(indentlevel)
- /*
- 7.0b21 PBS: push the attributes onto the current <outline> item.
- */
+ #pragma unused(indentlevel)
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: push the attributes onto the current <outline> item.
+ //
+
+ Handle h = NULL, htrue;
+ boolean fl = false, flhasatts = false;
+ hdlhashnode hn = nil, hn2 = nil;
+ hdlhashtable ht;
tyvaluerecord v;
- hdlhashtable ht;
- hdlhashnode hn = nil, hn2 = nil;
- boolean fl = false;
- boolean flhasatts = false;
- Handle htrue;
/*Possibly set isComment and isBreakpoint.*/
if (!newemptyhandle (&htrue))
return (false);
-
+
if (!pushtexthandle (STR_booleantrue, htrue))
goto exit;
+
+ if ((**hnode).flcomment) {
- if ((**hnode).flcomment)
-
- if (!opxmlpushoneattribute (htext, STR_iscomment, htrue)) /*isComment="true"*/
+ if ( ! newtexthandle ( STR_iscomment, &h ) )
goto exit;
+
+ if (!opxmlpushoneattribute (htext, h, htrue)) /*isComment="true"*/
+ goto exit;
+
+ disposehandle ( h );
+
+ h = NULL;
+
+ }
+
+ if ((**hnode).flbreakpoint) {
- if ((**hnode).flbreakpoint)
-
- if (!opxmlpushoneattribute (htext, STR_isbreakpoint, htrue)) /*isBreakpoint="true"*/
+ if ( ! newtexthandle ( STR_isbreakpoint, &h ) )
goto exit;
-
+
+ if (!opxmlpushoneattribute (htext, h, htrue)) /*isBreakpoint="true"*/
+ goto exit;
+ }
+
/*Get other attributes from the refcon -- the packed table.*/
disablelangerror ();
@@ -783,36 +864,48 @@
fl = true;
goto exit; /*no atts -- not an error*/
+
} /*if*/
-
+
if (!tablevaltotable (v, &ht, hn))
goto exit; /*Error.*/
-
+
/*Loop through the table*/
for (hn2 = (**ht).hfirstsort; hn2 != nil; hn2 = (**hn2).sortedlink) {
+
+ Handle handleName;
- bigstring bsname;
-
if (coercevalue (&((**hn2).val), stringvaluetype)) { /*Does the coercion to string succeed?*/
- gethashkey (hn2, bsname); /*Get att name*/
+ gethashkey ( hn2, &handleName ); // get att name
- if (!opxmlpushoneattribute (htext, bsname, (**hn2).val.data.stringvalue)) /*Add att to returned text.*/
- goto exit;
+ if (!opxmlpushoneattribute (htext, handleName, (**hn2).val.data.stringvalue)) { /*Add att to returned text.*/
+
+ disposehandle ( handleName );
+
+ goto exit;
+
+ }
+
+ disposehandle ( handleName );
+
} /*if*/
+
} /*for*/
fl = true; /*success*/
exit:
- disposehandle (htrue);
-
- if (flhasatts)
- disposevaluerecord (v, false);
-
- return (fl);
+ disposehandle ( h );
+ disposehandle ( htrue );
+
+ if (flhasatts)
+ disposevaluerecord (v, false);
+
+ return (fl);
+
} /*opxmlpushattributes*/
@@ -878,22 +971,23 @@
return (true);
nomad = nextnomad;
+
} /*while*/
} /*opxmlvisitnondynamicnodes*/
static boolean opxmlbodyvisit (hdlheadrecord hnode, ptrvoid htext) {
-
+
/*
7.0b21 PBS: process one headline, add it to the returned text.
Look ahead to the next flatdown headline, and add a /> if no subs.
If next headline is at a higher level, close off <outline> elements,
as many as needed.
-
+
7.0b30 PBS: handle a dynamic node -- it has subs, but pretend it doesn't,
-
+
since the children should not be saved.
*/
@@ -906,25 +1000,25 @@
if (!copyhandle ((**hnode).headstring, &h))
return (false);
-
+
indentlevel = (**hnode).headlevel + 2;
if (!opxmlpushoutlinetext (h, htext, indentlevel))
goto exit;
-
+
if (!opxmlpushattributes (hnode, htext, indentlevel))
goto exit;
-
+
hflatdown = opbumpflatdown (hnode, false);
nextlevel = (**hflatdown).headlevel + 2;
if (nextlevel == indentlevel)
fl = true;
-
+
if (nextlevel > indentlevel)
flsubs = true;
-
+
if ((**hnode).fldynamic) /*7.0b30: dynamic nodes may have subs, but we ignore them.*/
flsubs = false;
@@ -936,19 +1030,21 @@
goto exit;
fl = true;
+
} /*if*/
-
+
if (nextlevel < indentlevel) /*Need to close off outline items?*/
fl = opxmlpushclosingoutlinetags (htext, indentlevel, nextlevel); /*Add as many </outline> tags as needed.*/
if (hnode == hflatdown) /*At the end of the outline?*/
fl = opxmlpushclosingoutlinetags (htext, indentlevel, 2); /*Add as many </outline> tags as needed.*/
-exit:
+ exit:
- disposehandle (h);
-
- return (fl);
+ disposehandle (h);
+
+ return (fl);
+
} /*opxmlbodyvisit*/
@@ -991,45 +1087,50 @@
} /*opxmlbuildbody*/
-static boolean opxmlensureopenwindow (hdloutlinerecord ho, hdlhashtable hto, bigstring bso, tyvaluerecord vo, hdlwindowinfo *hinfo, boolean *flwasopen) {
+static boolean opxmlensureopenwindow (hdloutlinerecord ho, hdlhashtable hto, Handle *handleO, tyvaluerecord vo, hdlwindowinfo *hinfo, boolean *flwasopen) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: make sure the window is open. *hinfo gets the window info.
+ //
- /*
- 7.0b21 PBS: make sure the window is open. *hinfo gets the window info.
- */
-
*flwasopen = true;
if (!shellfinddatawindow ((Handle) ho, hinfo)) { /*try to find window -- it might be open*/
*flwasopen = false;
- if (!langzoomvalwindow (hto, bso, vo, false)) /*open window*/
+ if (!langzoomvalwindow (hto, handleO, vo, false)) /*open window*/
return (false);
+
} /*if*/
if (!shellfinddatawindow ((Handle) ho, hinfo)) /*get window info*/
return (false);
return (true);
+
} /*opxmlensureopenwindow*/
static boolean opxmlbuildhead (Handle htext, hdloutlinerecord ho, Handle hname, Handle hemail, short indentlevel, hdlwindowinfo hinfo, hdlhashtable hcloud) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: build the <head> section of the document.
+ //
+ // First get info about the window -- title, rect, etc. -- then
+ // push the tagged values on the returned text.
+ //
- /*
- 7.0b21 PBS: build the <head> section of the document.
-
- First get info about the window -- title, rect, etc. -- then push the tagged values on the returned text.
- */
-
- long scrollstate;
- Handle hexpansionstate;
+ Handle hexpansionstate, hTitle;
Rect r;
boolean fl = false;
+ long scrollstate;
+ tyvaluerecord vtimecreated, vtimemodified;
unsigned long timecreated, timemodified;
- tyvaluerecord vtimecreated, vtimemodified;
- bigstring bstitle;
- Handle htitle;
/*Get window info.*/
@@ -1042,8 +1143,11 @@
if (!shellgetglobalwindowrect (hinfo, &r)) /*window rect*/
goto exit;
- shellgetwindowtitle (hinfo, bstitle); /*window title -- no return value*/
+ if ( ! newemptyhandle ( &hTitle ) )
+ goto exit3;
+ shellgetwindowtitle ( hinfo, &hTitle ); // window title -- no return value
+
timecreated = (**ho).timecreated; /*time created*/
timemodified = (**ho).timelastsave; /*time last saved*/
@@ -1061,17 +1165,11 @@
indentlevel++;
- if (!newemptyhandle (&htitle))
+ if (!opxmlpushonetag (STR_title, hTitle, indentlevel, htext)) /*<title>*/
goto exit3;
- if (!pushtexthandle (bstitle, htitle))
- goto exit3;
+ disposehandle ( hTitle );
- if (!opxmlpushonetag (STR_title, htitle, indentlevel, htext)) /*<title>*/
- goto exit3;
-
- disposehandle (htitle);
-
if (!opxmlpushonetag (STR_datecreated, vtimecreated.data.stringvalue, indentlevel, htext)) /*<dateCreated>*/
goto exit3;
@@ -1113,20 +1211,18 @@
/*Clean up*/
-exit3:
+ exit3:
+ disposevaluerecord (vtimemodified, false);
+
+ exit2:
+ disposevaluerecord (vtimecreated, false);
+
+ exit:
+ disposehandle (hexpansionstate);
- disposevaluerecord (vtimemodified, false);
+ return (fl);
-exit2:
-
- disposevaluerecord (vtimecreated, false);
-
-exit:
-
- disposehandle (hexpansionstate);
-
- return (fl);
- } /*opxmlbuildhead*/
+ } // opxmlbuildhead
static boolean opxmlencodetext (Handle htext) {
@@ -1243,65 +1339,88 @@
} /*opxmlpushhandleline*/
-static boolean opxmlfindtableitem (hdlhashtable ht, bigstring bsname, hdlhashtable *htfound) {
+static boolean opxmlfindtableitem (hdlhashtable ht, const Handle handleName, hdlhashtable *htfound) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: find one table item in a table, such as an
+ // <outlineDocument>, <head>, or <body> item.
+ //
- /*
- 7.0b21 PBS: find one table item in a table, such as an <outlineDocument>,
- <head>, or <body> item.
- */
-
hdlhashnode hn;
for (hn = (**ht).hfirstsort; hn != nil; hn = (**hn).sortedlink) { /*loop through the table*/
- if (isxmlmatch (hn, bsname)) { /*is this the name we're looking for?*/
+ if (isxmlmatch (hn, handleName)) { /*is this the name we're looking for?*/
if (gethashnodetable (hn, htfound)) { /*Try to get the table*/
return (true); /*Found, it's a table, return true.*/
+
} /*if*/
+
} /*if*/
+
} /*for*/
return (false);
+
} /*opxmlfindtableitem*/
static boolean opxmlheadexists (hdlhashtable ht) {
- /*
- 7.0b33 PBS: return true if there's a required <head> section of the document.
- */
-
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b33 PBS: return true if there's a required <head> section of the
+ // document.
+ //
+
+ Handle h;
+ boolean fl = false;
hdlhashnode hn;
+
+ if ( newtexthandle ( STR_head, &h ) )
+ return ( false );
+
+ for (hn = (**ht).hfirstsort; hn != nil; hn = (**hn).sortedlink) // loop through the table
+
+ if ( isxmlmatch ( hn, h ) ) { // is this the name we're looking for?
+
+ fl = true;
+
+ goto exit; // found; return true
+
+ }
+
+ exit:
+ disposehandle ( h );
+
+ return ( fl );
+
+ } /*opxmlheadexists*/
- for (hn = (**ht).hfirstsort; hn != nil; hn = (**hn).sortedlink) { /*loop through the table*/
- if (isxmlmatch (hn, STR_head)) /*is this the name we're looking for?*/
- return (true); /*Found; return true.*/
- } /*for*/
+static boolean opxmlgetonevalue (hdlhashtable ht, const Handle handleName, Handle htext) {
- return (false);
- } /*opxmlheadexists*/
-
-
-static boolean opxmlgetonevalue (hdlhashtable ht, bigstring bsname, Handle htext) {
+ // Everything is text at this level -- if you're not expecting text, don't
+ // use this routine. Other wrapper routines convert from text to numbers or
+ // lists or whatever.
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: get the value of one item from a table.
+ //
- /*
- 7.0b21 PBS: get the value of one item from a table.
-
- Everything is text at this level -- if you're not expecting text,
- don't use this routine. Other wrapper routines convert from text
- to numbers or lists or whatever.
- */
-
tyvaluerecord val;
hdlhashnode hn;
boolean fl = false;
for (hn = (**ht).hfirstsort; hn != nil; hn = (**hn).sortedlink) {
- if (isxmlmatch (hn, bsname)) {
+ if (isxmlmatch (hn, handleName)) {
val = (**hn).val;
@@ -1310,29 +1429,36 @@
if (copyhandlecontents (val.data.stringvalue, htext)) {
fl = true;
+
} /*if*/
+
} /*if*/
break; /*Break once the item has been found, whether or not htext contains the data sought.*/
+
} /*if*/
+
} /*for*/
return (fl);
+
} /*opxmlgetonevalue*/
-static boolean opxmlgetonelongvalue (hdlhashtable ht, bigstring bsname, long *v) {
+static boolean opxmlgetonelongvalue (hdlhashtable ht, const Handle handleName, long *v) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: get one long value. See comments in opxmlgetoneshortvalue.
+ //
- /*
- 7.0b21 PBS: get one long value. See comments in opxmlgetoneshortvalue.
- */
-
Handle h;
bigstring bs;
newemptyhandle (&h);
- if (!opxmlgetonevalue (ht, bsname, h)) /*Get value in Handle h*/
+ if (!opxmlgetonevalue (ht, handleName, h)) /*Get value in Handle h*/
return (false);
texthandletostring (h, bs); /*Convert to bigstring -- it's going to be a number, so a bigstring's size limit is okay*/
@@ -1340,26 +1466,30 @@
disposehandle (h);
return (stringtonumber (bs, v)); /*Convert bigstring to a long*/
+
} /*opxmlgetonelongvalue*/
-static boolean opxmlgetoneshortvalue (hdlhashtable ht, bigstring bsname, short *v) {
+static boolean opxmlgetoneshortvalue (hdlhashtable ht, const Handle handleName, short *v) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: get one number value.
+ //
+ // This function goes from handle to bigstring to short. Why?
+ // Because I wanted just one routine that gets the value --
+ // that's opxmlgetonevalue. All other routines use that routine
+ // to get a value, then do coercions. Is that a performance
+ // problem? I seriously doubt it, but testing will tell.
+ //
- /*
- 7.0b21 PBS: get one number value.
-
- This function goes from handle to bigstring to short. Why? Because I wanted just one
- routine that gets the value -- that's opxmlgetonevalue. All other routines use
- that routine to get a value, then do coercions. Is that a performance problem? I seriously
- doubt it, but testing will tell.
- */
-
Handle h;
bigstring bs;
newemptyhandle (&h);
- if (!opxmlgetonevalue (ht, bsname, h)) /*Get value in Handle h*/
+ if (!opxmlgetonevalue (ht, handleName, h)) /*Get value in Handle h*/
return (false);
texthandletostring (h, bs); /*Convert to bigstring -- it's going to be a number, so a bigstring's size limit is okay*/
@@ -1367,87 +1497,146 @@
disposehandle (h);
return (stringtoshort (bs, v)); /*Convert bigstring to a short*/
+
} /*opxmlgetoneshortvalue*/
static boolean opxmlsetwindowpositionandsize (hdlhashtable ht, hdlwindowinfo hinfo) {
+
+ //
+ // Get windowtop, windowleft, windowbottom, and windowright from the
+ // <head> section of the XML.
+ //
+ // Even though the return value is ignored by opxmlsetwindowatts, this
+ // script still returns a boolean just in case at some point later someone
+ // does care about success or failure.
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: set the window's position and size.
+ //
- /*
- 7.0b21 PBS: set the window's position and size.
-
- Get windowtop, windowleft, windowbottom, and windowright from the <head>
- section of the XML.
-
- Even though the return value is ignored by opxmlsetwindowatts, this script still returns
- a boolean just in case at some point later someone does care about success or failure.
- */
-
+ Handle h;
short windowtop, windowleft, windowbottom, windowright;
/*Set window position*/
-
- if (!opxmlgetoneshortvalue (ht, STR_windowtop, &windowtop))
- return (false);
-
- if (!opxmlgetoneshortvalue (ht, STR_windowleft, &windowleft))
- return (false);
+ if ( ! newtexthandle ( STR_windowtop, &h ) )
+ return ( false );
+
+ if (!opxmlgetoneshortvalue (ht, h, &windowtop))
+ goto exit;
+
+ disposehandle ( h );
+
+ if ( ! newtexthandle ( STR_windowleft, &h ) )
+ return ( false );
+
+ if (!opxmlgetoneshortvalue (ht, h, &windowleft))
+ goto exit;
+
// if (!shellmovewindow (hinfo, windowleft, windowtop)) /*Set window position*/
// return (false); /*shellmovewindow always returns true at this writing, but that could change*/
if (!shellmovewindowhidden (hinfo, windowleft, windowtop)) /*Set window position*/
return (false); /*shellmovewindow always returns true at this writing, but that could change*/
-
+
/*Set the window size*/
-
- if (!opxmlgetoneshortvalue (ht, STR_windowright, &windowright))
- return (false);
- if (!opxmlgetoneshortvalue (ht, STR_windowbottom, &windowbottom))
- return (false);
+ disposehandle ( h );
+ if ( ! newtexthandle ( STR_windowright, &h ) )
+ return ( false );
+
+ if (!opxmlgetoneshortvalue (ht, h, &windowright))
+ goto exit;
+
+ disposehandle ( h );
+
+ if ( ! newtexthandle ( STR_windowbottom, &h ) )
+ return ( false );
+
+ if (!opxmlgetoneshortvalue (ht, h, &windowbottom))
+ goto exit;
+
+ disposehandle ( h );
+
if (!shellsizewindowhidden (hinfo, windowright - windowleft, windowbottom - windowtop)) /*Set window size*/
return (false); /*shellsizewindow returns false if the window isn't growable*/
-
+
return (true);
+
+ exit:
+
+ disposehandle ( h );
+
+ return ( false );
+
} /*opxmlsetwindowpositionandsize*/
static boolean opxmlsetwindowtitle (hdlhashtable ht, hdlwindowinfo hinfo) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: set the window title.
+ //
- /*
- 7.0b21 PBS: set the window title.
- */
+ Handle h, htext;
+ boolean fl;
- Handle htext;
- bigstring bstitle;
-
if (!newemptyhandle (&htext))
return (false);
+
+ if ( ! newtexthandle ( STR_title, &h ) )
+ return ( false );
+
+ if (!opxmlgetonevalue (ht, h, htext)) { /*Get the <title> value*/
- if (!opxmlgetonevalue (ht, STR_title, htext)) /*Get the <title> value*/
+ disposehandle ( h );
+
return (false);
+
+ }
+
+ disposehandle ( h );
- texthandletostring (htext, bstitle); /*Convert to bigstring -- window titles are bigstrings*/
+ fl = shellsetwindowtitle ( hinfo, htext ); // Set the window title
- return (shellsetwindowtitle (hinfo, bstitle)); /*Set the window title*/
+ return ( fl );
+
+ disposehandle ( htext );
+
} /*opxmlsetwindowtitle*/
static boolean opxmlsetwindowexpansionstate (hdlhashtable ht, hdlwindowinfo hinfo) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: set the expansion state for a window.
+ //
- /*
- 7.0b21 PBS: set the expansion state for a window.
- */
-
- Handle htext;
+ Handle h, htext;
+ boolean fl = false;
tyvaluerecord val, v;
- boolean fl = false;
if (!newemptyhandle (&htext))
return (false);
+
+ if ( ! newtexthandle ( STR_expansionstate, &h ) ) {
- if (!opxmlgetonevalue (ht, STR_expansionstate, htext))
+ disposehandle ( h );
+
+ return ( false );
+
+ }
+
+ disposehandle ( h );
+
+ if (!opxmlgetonevalue (ht, h, htext))
goto exit1;
/*Surround text with { and }, so it can be coerced to a list.*/
@@ -1486,36 +1675,47 @@
htext = nil;
-exit1:
+ exit1:
- if (htext != nil)
- disposehandle (htext);
-
- return (fl);
+ if (htext != nil)
+ disposehandle (htext);
+
+ return (fl);
+
} /*opxmlsetwindowexpansionstate*/
static boolean opxmlsetwindowverticalscrollstate (hdlhashtable ht, hdlwindowinfo hinfo) {
-
- /*
- 7.0b21 PBS: set vertical scroll state for the outline window.
- 7.0b22 PBS: fix display glitch by updating the outline window.
-
-
-
- 7.0b23 PBS: display glitch fix part two -- set hline1 to hbarcursor, not ...
[truncated message content] |