info_dke_yp

PURPOSE ^

SYNOPSIS ^

function [] = info_dke_yp(mode,a,display_mode,color_mode)

DESCRIPTION ^

    Customized message display (may be colorized, with cprintf.m)

    Input:

        - mode: type of message [1,1]
          (0): message
          (1): --------------------------- Essai de texte ---------------------------
          (2): -------> message
          (3): message...
               -----------------
          (4):  - message
          (5): -----------------
               message
               -----------------
          (6): WARNING: message
          (7): ERROR: message
        - a: the text (string) [1,m]
        - display_mode: yes -> 1, no -> 0 [1,1]
         (default: 0)
       - color_mode: 'Black','Cyan','Magenta','Blue','Green','Red','Yellow','White' (string) [1,m]
         (default: 'Black' if empty)

    Output: none

   Warning: none

 By Yves Peysson (CEA/DSM/IRFM, yves.peysson@cea.fr) and Joan Decker (CEA/DSM/IRFM, joan.decker@cea.fr)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [] = info_dke_yp(mode,a,display_mode,color_mode)
0002 %
0003 %    Customized message display (may be colorized, with cprintf.m)
0004 %
0005 %    Input:
0006 %
0007 %        - mode: type of message [1,1]
0008 %          (0): message
0009 %          (1): --------------------------- Essai de texte ---------------------------
0010 %          (2): -------> message
0011 %          (3): message...
0012 %               -----------------
0013 %          (4):  - message
0014 %          (5): -----------------
0015 %               message
0016 %               -----------------
0017 %          (6): WARNING: message
0018 %          (7): ERROR: message
0019 %        - a: the text (string) [1,m]
0020 %        - display_mode: yes -> 1, no -> 0 [1,1]
0021 %         (default: 0)
0022 %       - color_mode: 'Black','Cyan','Magenta','Blue','Green','Red','Yellow','White' (string) [1,m]
0023 %         (default: 'Black' if empty)
0024 %
0025 %    Output: none
0026 %
0027 %   Warning: none
0028 %
0029 % By Yves Peysson (CEA/DSM/IRFM, yves.peysson@cea.fr) and Joan Decker (CEA/DSM/IRFM, joan.decker@cea.fr)
0030 %
0031 if nargin < 2,
0032     info_dke_yp(2,'Wrong number of input arguments for info_dke_yp');
0033     return
0034 end
0035 if nargin < 3,
0036     display_mode = 1;
0037     color_mode = '';
0038 end
0039 if nargin < 4,
0040     color_mode = '';
0041     if isempty(display_mode),display_mode = 1;end
0042 end
0043 %
0044 [lukeversion,matver] = LUKEversion_jd;
0045 if str2num(matver) < 713,color_mode = '';end
0046 %
0047 if mode == 0,
0048     if isempty(color_mode)
0049         disp(a);
0050     else
0051         try
0052             cprintf(color_mode,[a,'\n']);
0053         catch
0054             disp(a);
0055         end
0056     end 
0057 elseif mode == 1,
0058     a1 = [];
0059     sa = size(a);
0060     nmax = 68; 
0061     n0 = nmax-sa(2);
0062     n1 = fix(n0/2);
0063     n2 = n0-n1;
0064     for i = 1:n1,a1 = [a1,'-'];end
0065     if n2==n1,
0066          a2 = a1;
0067     else
0068          a2 = [a1,'-'];
0069     end
0070     %
0071     if isempty(color_mode)
0072         disp([a1,' ',a,' ',a2]);
0073     else
0074         try
0075             cprintf(color_mode,[a1,' ',a,' ',a2,'\n']);
0076         catch
0077             disp([a1,' ',a,' ',a2]);
0078         end
0079     end
0080 elseif mode == 2,
0081     if isempty(color_mode)
0082         disp(['-------> ',a]);
0083     else
0084         try
0085             cprintf(color_mode,['-------> ',a,'\n']);
0086         catch
0087             disp(['-------> ',a]);
0088         end
0089     end
0090 elseif mode == 3,
0091     ttt = [];
0092     sa = size(a);
0093     if isempty(color_mode)
0094         disp([a,'...']);
0095     else
0096         try
0097             cprintf(color_mode,[a,'...','\n']);
0098         catch
0099             disp([a,'...']);
0100         end
0101     end
0102     for i = 1:sa(2)+10,
0103         ttt= [ttt,'-'];
0104     end
0105     %
0106     disp(ttt);
0107 elseif mode == 4,
0108     ttt = [];
0109     sa = size(a);
0110     if isempty(color_mode)
0111         disp([' - ',a]);
0112     else
0113         try
0114             cprintf(color_mode,[' - ',a,'\n']);
0115          catch
0116              disp([' - ',a]);
0117          end
0118     end
0119     if isempty(color_mode)
0120         disp(ttt);
0121     else
0122         try
0123             cprintf(color_mode,[ttt,'\n']);
0124         catch
0125             disp(ttt);
0126         end
0127     end
0128 elseif mode == 5,
0129     ttt = [];
0130     sa = size(a);
0131     for i = 1:sa(2)+10,
0132         ttt= [ttt,'-'];
0133     end
0134     %
0135     disp(ttt);
0136     %
0137     if isempty(color_mode)
0138         disp(a);
0139     else
0140         try
0141             cprintf(color_mode,[a,'\n']);
0142         catch
0143             disp(a);
0144         end
0145     end
0146     %
0147     disp(ttt);
0148 elseif mode == 6,
0149     if isempty(color_mode)
0150         disp(['WARNING: ',a]);
0151     else
0152         try
0153             cprintf(color_mode,['WARNING: ',a,'\n']);
0154         catch
0155             disp(['WARNING: ',a]);
0156         end
0157     end
0158 elseif mode == 7,
0159     if isempty(color_mode)
0160         disp(['ERROR: ',a]);
0161     else
0162         cprintf(color_mode,['ERROR: ',a,'\n']);
0163     end
0164 end

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.