No BSD License  

Highlights from
htmltool

htmltool

by

 

The HTML Toolbox (HT) stores various crosslink information about Matlab programs using HTML.

[]=maker1(htmldir,currdir,filename,funcall,ref_to,to_ref,U,FL,FP,FS,tt)
function []=maker1(htmldir,currdir,filename,funcall,ref_to,to_ref,U,FL,FP,FS,tt)
% []=maker1(htmldir,currdir,filename,funcall,ref_to,to_ref,[U],[FL],[FP],[FS],[tt])
% This is one of several possible format
% files that be used when generating the crosslinks
% with synopsis.
%
% INPUT PARAMETERS
%
% htmldir        = directory containing the html files
% currdir        = directory containing the m-file
% filename       = name of m-file (without directory) we want to 
%                  describe in a HTML file. Must include the .m extension
% funcall        = string matrix that contains the function call
%                  syntax of the *.m file "filename"
% ref_to         = string matrix of m-file names which the current
%                  m-file points to
% to_ref         = string matrix of m-file names which refers
%                  to the current m-file
% U              = string matrix from the comment read program
%                  com_read.m applied to filename (optional)
%                  contains all the comment lines in the m-file
% FL             = string matrix of files loaded into m-file
% FP             = string matrix of files printed from m-file
% FS             = string matrix of files saved from m-file
% tt             = 'yes' if total cross reference is included in
%                  original m-code, [] if "no".
%
% Copyright (c) 1996 B.K. Alsberg
%


%%%%%%%%%%%%%%%%% Initialization %%%%%%%%%%%%%%%%%%%%%%%%%
fil = deblank(filename);
fil = fil(1:length(fil)-2);
fid = fopen([htmldir,'\',fil,'.htm'],'w');
%fid = fopen([fil,'.htm'],'w');

CC = zeros(11,3); % this is the matrix of colors for each
% call to fntwrt in maker1.m. CC(1,:) is call no.1 and so forth
% insert the proper color code here.

% Checking the drive (C:,D:,E: etc):
dummy = pwd;
driver = dummy(1:2);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%% Writing a header %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 HEAD_mak(fid,[],'Cross-linked m-file',3,0);
 fntwrt(fid,filename,'CENTER',2,1,CC(1,:));
 fntwrt(fid,'Located in:','CENTER',1,1,CC(1,:));
 fntwrt(fid,currdir,'CENTER',1,1,CC(2,:));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

fprintf(fid,'%s \n','<P><HR WIDTH="100%"></P>');

%%%%%%%%%%% Writing out the function call %%%%%%%%%%%%%%%%
if length(funcall) >=1,
 fntwrt(fid,'Function synopsis','LEFT',2,1,CC(3,:));
 %fprintf(fid,'%s \n','<P><HR WIDTH="100%"></P>');
 fntwrt(fid,funcall,'LEFT',1,0,CC(4,:));
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

fprintf(fid,'%s \n','<P><HR WIDTH="100%"></P>');

%%%% Here we write out all the n first comment lines %%%%%
%%%% in the program                                  %%%%%
if length(U) >=1,
 fntwrt(fid,'Function comments','LEFT',2,1,CC(5,:));
 TEXT_wrt(fid,U);
 fprintf(fid,'%s \n','<P><HR WIDTH="100%"></P>');
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if length(ref_to) >=1,  
 fntwrt(fid,['m-files called by ',filename],'LEFT',1,1,CC(6,:))
 %fprintf(fid,'%s \n','<P><HR WIDTH="100%"></P>');
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 %%%%% Making a list of pointers to files current %%%%%%%%
 %     file calls THE REF_TO MATRIX  %%%%
 [n1,m1]=size(ref_to);
 LST_mak(fid,0,0);
 for i =1:n1
  r1 = deblank(ref_to(i,:));
  r2 = deblank(ref_to(i,:));
  % Must add .htm instead of .m since we are
  % referring to another 
  ref1 = [r1(1:length(r1)-2),'.htm'];
  ref2 = r2(1:length(r2)-2);
  REF_mak(fid,ref2,ref1,1)
 end;
 LST_mak(fid,1,0);
 fprintf(fid,'%s \n','<P><HR WIDTH="100%"></P>');
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if length(to_ref) >=1,
 fntwrt(fid,['m-files that call ',filename],'LEFT',1,1,CC(7,:))
 %%%%% Making a list of pointers to files that calls current
 %     file        THE TO_REF MATRIX                  %%%%
 [n2,m2]=size(to_ref);
 LST_mak(fid,0,0);
 for i =1:n2
  r1 = deblank(to_ref(i,:));
  r2 = deblank(to_ref(i,:));
  % Must add .htm instead of .m since we are
  % referring to another HTML file 
  ref1 = [r1(1:length(r1)-2),'.htm'];
  ref2 = r2(1:length(r2)-2);
  REF_mak(fid,ref2,ref1,1)
 end;
 LST_mak(fid,1,0);
 fprintf(fid,'%s \n','<P><HR WIDTH="100%"></P>');
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%% Writing out references to LOADED files      %%%%%%%%
if length(FL) >=1,
 fntwrt(fid,['Files that are LOADED into ',filename],'LEFT',1,1,CC(8,:))
 [n,m]=size(FL);
 LST_mak(fid,0,0);
 for i =1:n
   inpput_file_names =[FL(i,:) blanks(1)];
   tmp = deblank(inpput_file_names);
   tmp = strrep(tmp,driver,''); %supposed to remove the driver
   aa = findstr(tmp,'.');
   if length(aa) <1,
    tmp = [tmp,'.mat'];
   end;
   if tmp(1) == '\'
    tmp2 = ['file:///',driver(1),'|' tmp];
   else
    tmp2 = ['file:///',driver(1),'|' '/' tmp];
   end;
   tmp2 = strrep(tmp2,'\','/');
   REF_mak(fid,tmp,tmp2,1);
 end;
 LST_mak(fid,1,0);
 fprintf(fid,'%s \n','<P><HR WIDTH="100%"></P>');
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%% Writing out references to PRINTED files     %%%%%%%%
if length(FP) >=1,
 fntwrt(fid,['Files that are PRINTED from ',filename],'LEFT',1,1,CC(9,:))
 [n,m]=size(FP);
 LST_mak(fid,0,0);
 for i =1:n
   printed_file_names = [FP(i,:) blanks(1)];
   tmp = deblank(printed_file_names);
   tmp = strrep(tmp,driver,''); %supposed to remove the driver
   aa = findstr(tmp,'.');
   if length(aa) <1,
    tmp = [tmp,'.mat'];
   end;
   if tmp(1) == '\'
    tmp2 = ['file:///',driver(1),'|' tmp];
   else
    tmp2 = ['file:///',driver(1),'|' '/' tmp];
   end;
   tmp2 = strrep(tmp2,'\','/');
   REF_mak(fid,tmp,tmp2,1);
 end;
 LST_mak(fid,1,0);
 fprintf(fid,'%s \n','<P><HR WIDTH="100%"></P>');
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%% Writing out references to SAVED files       %%%%%%%%
if length(FS) >=1,
 fntwrt(fid,['Files that are SAVED from ',filename],'LEFT',1,1,CC(10,:))
 [n,m]=size(FS);
 LST_mak(fid,0,0);
 for i =1:n
   saved_file_names = [currdir '/' FS(i,:) blanks(1)];
   tmp = deblank(saved_file_names);
   tmp = strrep(tmp,driver,''); %supposed to remove the driver
   aa = findstr(tmp,'.');
   if length(aa) <1,
    tmp = [tmp,'.mat'];
   end;
   if tmp(1) == '\'
    tmp2 = ['file:///',driver(1),'|' tmp];
   else
    tmp2 = ['file:///',driver(1),'|' '/' tmp];
   end;
   tmp2 = strrep(tmp2,'\','/');
   REF_mak(fid,tmp,tmp2,1);
 end;
 LST_mak(fid,1,0);
 fprintf(fid,'%s \n','<P><HR WIDTH="100%"></P>');
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if length(tt) >=1,
 fntwrt(fid,['All the cross references in the source m-code of ',filename],'LEFT',1,1,CC(11,:))
 totxref(fid,currdir,[],filename,ref_to,'.htm');
 fprintf(fid,'%s \n','<P><HR WIDTH="100%"></P>');
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%% Here we initialize the parameters to the signature file by %%%%%
%% reading from the initialization file htini.dat             %%%%%
[Name,email,par]=iniread1; 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

sig_wrt1(fid,Name,par,email);


fclose(fid)


Contact us