tablenewvalue.c

Go to the documentation of this file.
00001 
00002 /*  $Id: tablenewvalue.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 <standard.h>
00029 #include "memory.h"
00030 #include "lang.h"
00031 #include "shell.rsrc.h"
00032 #include "shellundo.h"
00033 #include "tableinternal.h"
00034 #include "tablestructure.h"
00035 
00036 
00037 
00038 boolean tablemakenewvalue (void) {
00039     
00040     /*
00041     create a new, empty value below the current cell.
00042     
00043     to get the node to be inserted below the current position, we use
00044     tableoverridesort to patch the comparenodes langglobals callback and 
00045     look for the next node in the table
00046     */
00047     
00048     register hdlhashtable ht;
00049     bigstring bsname;
00050     tyvaluerecord val;
00051     short newrow;
00052     hdlhashnode hnode, hnext;
00053     register boolean fl;
00054     
00055     pushundoaction (undotypingstring);
00056     
00057     if (tableempty ())
00058         newrow = 0;
00059     else
00060         newrow = (**tableformatsdata).rowcursor + 1;
00061     
00062     ht = tablegetlinkedhashtable ();
00063     
00064     pushhashtable (ht);
00065     
00066     hashgetnthnode (ht, newrow, &hnext); /*ignore result -- will be nil if rowcursor is last*/
00067     
00068     tableoverridesort (hnext);
00069     
00070     setemptystring (bsname);
00071     
00072     clearbytes (&val, longsizeof (val));
00073     
00074     fl = hashinsert (bsname, val);
00075     
00076     assert (tablevalidate (ht, true));
00077     
00078     tablerestoresort ();
00079     
00080     // (**ht).flneedsort = true;
00081     
00082     pophashtable ();
00083     
00084     if (!fl)
00085         return (false);
00086     
00087     if (hashgetnthnode (ht, newrow, &hnode))
00088         pushundostep ((undocallback) tableredoclear, (Handle) hnode);
00089     
00090     if (!tableeditentercell (newrow, namecolumn)) {
00091         
00092         undolastaction (false);
00093         
00094         return (false);
00095         }
00096     
00097     return (true);
00098     } /*tablemakenewvalue*/
00099 
00100 
00101 

Generated on Wed May 31 18:20:02 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6