Updating Older Applications
This section describes the tools that are available for updating applications from older versions to the current release of Creo TOOLKIT.
Overview
Creo TOOLKIT users are responsible for updating their applications from older versions to use the new Creo TOOLKIT functions. When you update the applications, use the functions that have been updated in the current release.
PTC provides tools that facilitate updating of your Creo TOOLKIT applications from older versions. However, in certain scenarios, the tools may not give expected results.
Tools Available for Updating Applications
PTC provides the mark_deprecated.pl tool to update your applications from older versions to the current release. This perl script is located at <creo_loadpoint>\<version>\Common Files\protoolkit\scripts. The script parses directories and looks for files with extensions such as, .c, .cxx, and .cpp, which are the default extensions included in the script.
The script searches for deprecated symbols, such as, functions, structures, enumerated data types and so on, in these files. When it finds such symbols, the script inserts comments with recommendations of possible replacements. By default, the script uses the mapping table protkmap.txt provided at <creo_loadpoint>\<version>\Common Files\protoolkit\scripts.
The mapping table is based on DEPRECATED and SUCCESSORS tags specified in the Creo TOOLKIT header files. Some deprecated functions may not have direct replacement functions. In such cases, the script adds the comment AS APPROPRIATE.
The script options are listed when you run mark_deprecated.pl with no arguments, or with options h, -? or help.
Note
The options may vary in future releases.
When you run the script, it saves a copy of the original files. However, PTC recommends that you back up all the files, before running the script.
The script generates two types of output. The outputs depend on the -m option.
For example, consider a file with the name model.c. It contains the following code:
void findMdlParam(ProMdl mdl) {
  ProMdlnameShortdata *modelList = NULL;
/* should we call ProMdlInit here?? */
  error = ProMdlDependenciesList (mdl, &modelList, &noOFModels);
  error = ProMdlCopy (mdl); // what to do? 
/*who knows? That's a question btkString errorStr = "\"ProMdlCopy (mdl)\" - error"; PrintModelDependencies(modelList); /* * This is long multiline comment, where some Pro/TK * calls like ProCollectionAlloc or ProCollectioninstrAlloc * can be found. */ return; }
If you specify the -m option, the original file is retained, and the output file with the name <filename>_markup.c is created. The comments recommending new symbols are inserted on separate lines in the output file. For the file model.c, the following output is generated in the file model_markup.c:
void findMdlParam(ProMdl mdl) {
  ProMdlnameShortdata *modelList = NULL;
/* should we call ProMdlInit here?? */
/* Deprecated_API_Used: Replace ProMdlInit with ProMdlnameInit */
  error = ProMdlDependenciesList (mdl, &modelList, &noOfModels);
/* Deprecated_API_Used: Replace ProMdlDependenciesList 
with ProMdlDependenciesMdlnameList */ error = ProMdlCopy (mdl); // what to do? /*who knows? That's a question /* Deprecated_API_Used: Replace ProMdlCopy with ProMdlnameCopy */ btkString errorStr = "\"ProMdlCopy (mdl)\" - error"; PrintModelDependencies(modelList); /* * This is long multiline comment, where I can also note some Pro/TK * calls like ProCollectionAlloc or ProCollectioninstrAlloc ** Deprecated_API_Used: Replace ProCollectionAlloc with
ProCrvcollectionAlloc, ProSrfcollectionAlloc ** ** Deprecated_API_Used: Replace ProCollectioninstrAlloc with AS APPROPRIATE ** * can be found. */ return; }
If you do not specify the -m option, a copy of the original file is saved as <filename>.c.orig. The comments with recommendations are inserted in the original file. For example, the original file is saved as model.c.orig. The following output is generated in the file model.c:
void findMdlParam(ProMdl mdl) {
 ProMdlnameShortdata *modelList = NULL;
/* should we call ** PROTK_DEPRECATED ProMdlInit -> 
ProMdlnameInit ** ProMdlInit here?? */
 error = /* PROTK_DEPRECATED ProMdlDependenciesList -> 
ProMdlDependenciesMdlnameList */ 
ProMdlDependenciesList (mdl, &modelList, &noOfModels);
 error = /* PROTK_DEPRECATED ProMdlCopy -> 
ProMdlnameCopy */ ProMdlCopy (mdl); // what to do? /*who knows? That's a question btkString errorStr = "\"ProMdlCopy (mdl)\" - error"; PrintModelDependencies(modelList); /* * This is long multiline comment, where some Pro/TK * calls like ** PROTK_DEPRECATED ProCollectionAlloc -> ProCrvcollectionAlloc, ProSrfcollectionAlloc ** ProCollectionAlloc or ** PROTK_DEPRECATED-> AS APPROPRIATE ** ProCollectioninstrAlloc * can be found. */ return; }