Back to index

texmacs  1.0.7.15
struct2bullet.m
Go to the documentation of this file.
00001 ## Released under the GNU General Public License, see www.gnu.org
00002 ## Copyright (C) 2002 by the Free Software Foundation
00003 ## Written by Michael Graffam mikegraffam@yahoo.com
00004 ##
00005 ## Convert an Octave structure to a Scheme bulleted list
00006 ## Created: Sept 2002
00007 
00008 function tmp=struct2bullet(n,c)
00009 
00010        global TMCOLORS;
00011        global TMCOLIDX;
00012 
00013        # Constrain c to 1:TMCOLIDX, and insure it is defined
00014        if ((nargin<2) || (c>TMCOLIDX))
00015               c=1;
00016        endif
00017 
00018        color=deblank(TMCOLORS(c,:)); ## Pick a color, any color
00019 
00020        ## Use arrows first then we itemize with bullets
00021        if (c==1)
00022               tmp="(itemize-arrow (document ";
00023        else
00024               tmp="(itemize (document ";
00025        endif
00026 
00027        
00028        for [val, key] = n
00029               switch (typeinfo(val))
00030                      case ("struct")
00031                             ## Itemize the new struct, and switch the key color
00032                             tmp1=["(concat (item) (with \"color\" \"", color, "\" \"", key, " = \") ", struct2bullet(val,c+1),")"];
00033                      otherwise
00034                             tmp1=["(concat (item) (with \"color\" \"", color, "\" \"", key, " = \") ", obj2scm(val,c),")"];
00035               endswitch
00036               tmp=[tmp,tmp1];
00037        endfor
00038        tmp=[tmp,"))"];
00039 endfunction