Back to index

texmacs  1.0.7.15
struct2tree.m
Go to the documentation of this file.
00001 function tmp=struct2tree(n,name)
00002 
00003        if ((nargin<2))
00004               name='(with "mode" "math" (big "triangleup"))';
00005        end
00006 
00007        tmp=['(tree (with "color" "', 'black', '" ',name,') '];
00008        FIELDS=fieldnames(n);
00009        for i=1:length(FIELDS)
00010               key=char(FIELDS(i));
00011               val=getfield(n,key);
00012               switch (typeinfo(val))
00013                      case ('struct')
00014                             tmp1=struct2tree(val,key);
00015                      otherwise
00016                             tmp1=['(switch (document (with "color" "', 'black','" "',key,'")) (tuple (tmarker) (with "color" "', 'blue', '" ' ,obj2scm(val),'))) '];
00017               end
00018               tmp=[tmp,tmp1];
00019        end
00020        tmp=[tmp,')'];