#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "cmt_parser.h"
#include "cmt_version.h"
#include "cmt_database.h"
#include "cmt_include.h"
#include "cmt_script.h"
#include "cmt_generator.h"
#include "cmt_system.h"
#include "cmt.h"
#include "cmt_error.h"
#include "cmt_cvs.h"
#include "cmt_lock.h"
#include "cmt_triggers.h"
#include "cmt_model.h"
#include "cmt_awk.h"
#include "cmt_syntax.h"
#include "cmt_install_area.h"
#include "cmt_cmtpath_pattern.h"
#include "cmt_sequence.h"
#include "cmt_map.h"
#include "cmt_project.h"
#include "cmt_log.h"
#include "cmt_commands.h"
Include dependency graph for cmt_parser.cxx:
Go to the source code of this file.
Classes | |
class | AwkActor |
class | ClientCollector |
This PathScanner actor collects all packages clients of the specified one It is used by the cmt show clients operation. More... | |
class | CmtMountFilterParser |
class | PackageSelector |
This PathScanner actor accumulates all found packages into a cmt_string_vector It is used by the broadcast operation. More... | |
class | PackageViewer |
This PathScanner actor simply displays the package name/version/path It is used by the cmt show packages operation. More... | |
class | StandardMacroBuilder |
This completely local class holds primitive actions for building standard macros. More... | |
Functions | |
bool | get_strategy (const cmt_string &name, Use &use=Use::current()) |
void | dos_script_prefix (FILE *f, const cmt_string &cmt_root, const cmt_string &package, const cmt_string &version, const cmt_string &path, const cmt_string &action, const cmt_string &option="") |
cmt_string | get_best_form (const CmtSystem::cmt_string_vector &pwd, const cmt_string &path) |
Variables | |
CmtContext | Me |
|
Definition at line 3956 of file cmt_parser.cxx. References CmtSystem::absolute_path(), cmt_string::c_str(), Cmt::get_current_style(), no_version_style, and cmt_string::substr(). Referenced by Cmt::install_cleanup_scripts(), Cmt::install_setup_scripts(), Cmt::install_test_cleanup_scripts(), and Cmt::install_test_setup_scripts().
03963 { 03964 cmt_string no_device = path; 03965 03966 if (CmtSystem::absolute_path (path)) 03967 { 03968 if (path[1] == ':') 03969 { 03970 no_device = path.substr (2); 03971 } 03972 } 03973 03974 if (package == "cmt_standalone") 03975 { 03976 no_device = ""; 03977 } 03978 else 03979 { 03980 no_device = "..\\..\\.."; 03981 if (Cmt::get_current_style () == no_version_style) 03982 { 03983 no_device = "..\\.."; 03984 } 03985 } 03986 03987 03988 fprintf (f, "@echo off\n"); 03989 fprintf (f, "if NOT DEFINED CMTROOT set CMTROOT=%s& set PATH=%%CMTROOT%%\\%%CMTBIN%%;%%PATH%%& set CMTBIN=VisualC& if not defined CMTCONFIG set CMTCONFIG=%%CMTBIN%%\n", cmt_root.c_str ()); 03990 fprintf (f, "\n"); 03991 fprintf (f, "set cmttempfile=\"%%TEMP%%\\tmpsetup.bat\"\n"); 03992 fprintf (f, "%%CMTROOT%%\\%%CMTBIN%%\\cmt.exe %s -bat " 03993 " -pack=%s -version=%s -path=%%~d0%%~p0%s " 03994 " %s " 03995 "%%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9 >%%cmttempfile%%\n", 03996 action.c_str (), 03997 package.c_str (), 03998 version.c_str (), 03999 no_device.c_str (), 04000 option.c_str ()); 04001 fprintf (f, "if exist %%cmttempfile%% call %%cmttempfile%%\n"); 04002 fprintf (f, "if exist %%cmttempfile%% del %%cmttempfile%%\n"); 04003 fprintf (f, "set cmttempfile=\n"); 04004 } |
|
Definition at line 6067 of file cmt_parser.cxx. References cmt_vector< T >::clear(), CmtSystem::cmt_string_vector, CmtSystem::file_separator(), cmt_string::size(), cmt_vector< T >::size(), and CmtSystem::split().
06069 { 06070 static cmt_string fs = CmtSystem::file_separator (); 06071 cmt_string result; 06072 06073 /* 06074 //if (CmtSystem::getenv ("CMTTESTPREFIX") != "") 06075 { 06076 */ 06077 06078 // 06079 // If there is a common prefix between 06080 // use->real_path and pwd 06081 // we have 06082 // use->real_path = /<prefix>/aaa 06083 // pwd = /<prefix>/bbb 06084 // 06085 // Then use->real_path may be expressed as: 06086 // ../..../../aaa 06087 // where ../..../../ moves up to /<prefix> 06088 // 06089 // Then we try to find the shortest between 06090 // 06091 // /<prefix> and ../..../.. 06092 // 06093 cmt_string a = path; 06094 06095 CmtSystem::cmt_string_vector va; 06096 06097 va.clear (); 06098 06099 CmtSystem::split (a, fs, va); 06100 06101 int m = va.size (); 06102 if (pwd.size () < m) m = pwd.size (); 06103 06104 int i; 06105 06106 //cout << "Package " << use->get_package_name () << endl; 06107 06108 for (i = 0; i < m; i++) 06109 { 06110 const cmt_string& fa = va[i]; 06111 const cmt_string& fb = pwd[i]; 06112 06113 //cout << " fa=" << fa << " fb=" << fb << endl; 06114 06115 if (fa != fb) break; 06116 } 06117 06118 cmt_string ups = ""; 06119 06120 if (i > 0) 06121 { 06122 // We have the prefix. 06123 // if we count what remains from pwd, then 06124 // we have the number of ../ required to 06125 // move to /<prefix> 06126 int j; 06127 06128 for (j = i; j < pwd.size (); j++) 06129 { 06130 if (j > i) ups += fs; 06131 ups += ".."; 06132 } 06133 06134 for (j = i; j < va.size (); j++) 06135 { 06136 ups += fs; 06137 ups += va[j]; 06138 } 06139 } 06140 06141 // 06142 // Here ups contains the ../..../../aaa form 06143 // for the use->real_path or is empty when there 06144 // were no common prefix. 06145 // 06146 06147 //if (ups != "") 06148 if ((ups != "") && 06149 (ups.size () < path.size ())) 06150 { 06151 result = ups; 06152 } 06153 else 06154 { 06155 result = path; 06156 } 06157 06158 return (result); 06159 } |
|
Definition at line 155 of file cmt_parser.cxx. References Project::find_by_cmtpath(), StrategyMgr::get_default_strategy(), and Project::get_strategy(). Referenced by Cmt::do_build_library_links(), Cmt::do_remove_library_links(), Cmt::do_setup(), Cmt::do_show_strategies(), StandardMacroBuilder::fill_for_install_area(), Cmt::install_setup_scripts(), Cmt::install_test_setup_scripts(), Cmt::need_prototypes(), and Cmt::print_context().
00156 { 00157 static cmt_string cmtpath; 00158 static cmt_string offset; 00159 00160 use.get_cmtpath_and_offset (cmtpath, offset); 00161 00162 Project* p = Project::find_by_cmtpath (cmtpath); 00163 00164 bool strategy; 00165 00166 if (p == 0) strategy = StrategyMgr::get_default_strategy (name); 00167 else strategy = p->get_strategy (name); 00168 00169 return (strategy); 00170 } |
|