www.gusucode.com > private工具箱matlab源码程序 > private/code_sfun_customcode_cov_header_file.m

    function code_sfun_customcode_cov_header_file(fileNameInfo)
% CODE_SFUN_CUSTOMCODE_COV_HEADER_FILE(FILENAMEINFO)

%   Copyright 2015 The MathWorks, Inc.

   global gMachineInfo

   fileName = fullfile(fileNameInfo.targetDirName, fileNameInfo.customCodeCovHeaderFile);
   sf_echo_generating('Coder', fileName);
   machine = gMachineInfo.machineId;

   file = fopen(fileName,'Wt');
   if file<3
       construct_coder_error([],sprintf('Failed to create file: %s.',fileName),1);
       return
   end

fprintf(file,'%s\n',get_boiler_plate_comment('machine', machine));

fprintf(file,'#ifndef __%s_customcode_cov_h__\n',gMachineInfo.machineName);
fprintf(file,'#define __%s_customcode_cov_h__\n',gMachineInfo.machineName);
fprintf(file,'\n');
    if ~isempty(gMachineInfo.ctxInfo.sfcnTgtCustomCodeInfo.instrumenter)
       % Emit the instrumentation globals and helpers
fprintf(file,'    %s\n',gMachineInfo.ctxInfo.sfcnTgtCustomCodeInfo.instrumenter.getChartIncludesStr());
fprintf(file,'    %s\n',gMachineInfo.ctxInfo.sfcnTgtCustomCodeInfo.instrumenter.getChartExternalDeclStr());
fprintf(file,'    %s\n',gMachineInfo.ctxInfo.sfcnTgtCustomCodeInfo.instrumenter.getChartHelperDefineStr());
    else
       % code_machine_registry_file.ccdr includes this file even if
       % no file has been instrumented then need to generate some stubs
fprintf(file,'    #define SLCOV_ENTER_METHOD(S, isStart)\n');
fprintf(file,'    #define SLCOV_EXIT_METHOD(S, isTerm)\n');
    end
fprintf(file,'#endif\n');
fprintf(file,'\n');

   fclose(file);
   try_indenting_file(fileName);