function lib_TimeMeas_genSfH()
%
%% Generates Sfunction wrapper and tlc file from information in the header file. 
% NOTE: This file needs a licensed script file see include statement in this script
% Please contact hartmut.schorrig@vishia.de to get more information.
% The generated wrapper and tlc should be stored additionally, so you can% compile 
% mex files nevertheless with unchanged S-function wrapper (unchanged interface of the Sfunction)
%
rootPath = evalin('base', 'rootPath');
display(rootPath);
clc
clear mex
currdir_ = pwd;
cd(rootPath);
disp('Generate S-Fuctions for lib_TimeMeas ...');
system('java.exe -cp ../../zbnfjax/zbnf.jar org.vishia.jztxtcmd.JZtxtcmd lib_Sfn/+mkSfn/lib_TimeMeas_genSfH.m');
genSfn.lib_TimeMeas_mex();    %just generated script.
%genSfn.lib_TimeMeas_mexdbg();    %just generated script.
disp('successfull')
disp('successfull');
system('time /T');
cd(currdir_);
end
%{
==JZtxtcmd==
currdir = <:><&scriptdir>/../..<.>;                        ##the scriptdir is the simulink root dir.
include ../../../SmlkSfunc_jzTc/simulinkSfuncBusGen.jzTc;  ##out of the box, see below

##Important note: To complile the Sfunctions newly you need three things outside of this simulink box.
##They should be placed in file system parallel to this this current dir 'smlk/SMLK_PRJ/Simulink'.
##1. The JZtxtcmd script engine. It is contained in 'Java/vishiajar/zbnf.jar'.
##   It is only used in the Java invocation as class path.
##2. Sources of Library C-functions. 
##3. The scripts to generate S-Funtion wrapper. This script is included above with relative path.
##   This scripts are not open source. you can get it with a low fee (one week coaching) from vishia.org.


Subtextvar mexAddCmd = <:>
system('copy "lib_Sfn\+mkSfn\emC_rtwmakecfg.m$" "<&dirMexWin>\rtwmakecfg.m"');
<.>;



Fileset srcHeader =  ##from this header Sfunctions are generated.
( emc:Base/time_emC.h  
);


Fileset includepath = 
( .
, emC/.. 
, emC/genRefl
, emC/incApplSpecific/stdef_SmlkSfuncExcH
, emC/incComplSpecific/cc_SmlkSfunc_64bit
, emC
);

## All sources for compilation to the named header file, except the generated Sfunc-wrapper.
Fileset srcTlc_time_emC = 
( emc/Base/time_emC.c
);
## All sources for compilation to the named header file, except the generated Sfunc-wrapper.
Fileset src_time_emC = 
( &srcTlc_time_emC
, emc/sourceApplSpecific/applConv/ApplThrowOnFatalError_emC.c
, emc/sourceApplSpecific/applConv/Exception_emC.c
, emc/sourceApplSpecific/applConv/ExceptionPrintStacktrace_emC.c
, emc/sourceApplSpecific/applConv/ExcThCxtStacksize.c
, emc/sourceApplSpecific/SimpleNumCNoExc/ThreadContextSingle_emC.c
, emc/sourceApplSpecific/applConv/ThreadContextUserBuffer_emC.c
, emC/Base/MemC_emC.c
, emC/Base/Memfree_ThreadAndBlockHeap.c
, emC/Base/Object_emC.c
, emC/Base/CheckStack_emC.c
, emC/Base/DefPortTypes_emC.c
//, emC/Base/time_emC.c
, emC/Base/Reflection_emC.c
, emC/Base/ReflectionBaseTypes_emC.c
, emC/Base/StringBase_emC.c
, emC/Base/Handle_ptr64_emC.c
, emC/Base/Handle_ptr64_TimeMeas_emC.c
, emc/Base/os_common.c
, emc/sourceSpecials/osal_Windows/os_sharedmem.c
, emc/sourceSpecials/osal_Windows/os_file.c
, emc/sourceSpecials/osal_Windows/os_mem.c
, emc/sourceSpecials/osal_Windows/os_time.c
);

##Docu: if this Subtextvar is found, the memory for the Object Function Blocks is gotten in the function InitializeConditions.
##If the genAllocmem is not existing or null, The Sfunctions will get a second output for a bus which presents the internal data.
##Because the code generation provides a memory space with pointer, that is used.
##Note that some special condition 'don't reuse' etc. should be set for code generation optimizations.
##
Subtextvar genAllocmem(String dst, String nameStruct, Num ident) =
<:>(<&nameStruct>*) malloc(sizeof(<&nameStruct>))  /*JZtc: user-specific ExampleObjO*/ <.>;

main() { ##main routine for the JZtxtcmd:

  zmake "lib_Sfn:lib_TimeMeas" := simulinkSfuncBusGen(&srcHeader, coptions="-TP -EHa" 
    , dirRefl = null ##Reflections are part of the emC sources.
    ##, fileBus = ":+genBus/lib_TimeMeas_genBus.m"
    , dirMexDbg = "../mexDbg", dirMex = ":mex"
    , dirMexcc=":+genSfn", dirSfunc = ":+genSfn/Ctrl", dirTlc = ":+genSfn/Ctrl"
    ##, html=":test.html"  ##only for internally data view
    );

}

==endJZcmd==
%}
