Main Page ? Class Hierarchy ? Compound List ? File List ? Compound Members ? File Members ?

Script Class Reference

#include

Collaboration diagram for Script:

Collaboration graph
[legend]
List of all members.

Public Types

typedef cmt_vector< Script >? ScriptVector

Public Methods

? Script ()
? ~Script ()
int? print (PrintMode mode, const Use *use)

Static Public Methods

void? action (const CmtSystem::cmt_string_vector &words, ScriptType type, Use *use)
Script *? find (const cmt_string &name, Use *use)
Script *? add (const cmt_string &name, ScriptType type, Use *use)
void? all_print_clean (PrintMode mode)
void? all_print (PrintMode mode)
void? clear_all ()

Public Attributes

cmt_string? name
ScriptType? type

Member Typedef Documentation

typedef cmt_vector
?

Definition at line 16 of file cmt_script.h.


Constructor & Destructor Documentation

Script::Script (? ? )?
?

Definition at line 186 of file cmt_script.cxx.

00187 {
00188 }

Script::~Script (? ? )?
?

Definition at line 191 of file cmt_script.cxx.

00192 {
00193 }

Member Function Documentation

void Script::action (? const CmtSystem::cmt_string_vector &? ? words,
ScriptType? ? type,
Use *? ? use
)? [static]
?

Definition at line 22 of file cmt_script.cxx.

References add(), Use::current(), name, ScriptType, and type.

Referenced by KwdSetupScript::action(), and KwdCleanupScript::action().

00025 {
00026   cmt_string name;
00027   Script* script;
00028 
00029   if (use == 0) use = &(Use::current());
00030 
00031   name = words[1];
00032   if (name == "") return;
00033 
00034   script = add (name, type, use);
00035 }

Script * Script::add (? const cmt_string &? ? name,
ScriptType? ? type,
Use *? ? use
)? [static]
?

Definition at line 62 of file cmt_script.cxx.

References cmt_vector< Script >::add(), Use::current(), cmt_string::erase(), find(), cmt_string::find(), name, cmt_string::npos, Use::scripts, ScriptType, and type.

Referenced by action().

00063 {
00064   cmt_string short_name = name;
00065 
00066   if (use == 0) use = &(Use::current());
00067 
00068   int pos;
00069 
00070   pos = short_name.find (".csh");
00071   if (pos != cmt_string::npos)
00072     {
00073       short_name.erase (pos);
00074     }
00075 
00076   pos = short_name.find (".sh");
00077   if (pos != cmt_string::npos)
00078     {
00079       short_name.erase (pos);
00080     }
00081 
00082   {
00083     Script* script;
00084 
00085     if (short_name == "") return (0);
00086     script = find (short_name, use);
00087     if (script != 0)
00088       {
00089         script->type = type;
00090         return (script);
00091       }
00092   }
00093 
00094   Script& script = use->scripts.add ();
00095 
00096   script.name = short_name;
00097   script.type = type;
00098 
00099   return (&script);
00100 }

void Script::all_print (? PrintMode? ? mode )? [static]
?

Definition at line 134 of file cmt_script.cxx.

References Use::current(), Use::get_ordered_uses(), Use::get_package(), Package::is_cmt(), print(), PrintMode, Use::scripts, SetupScript, cmt_vector< Script >::size(), cmt_vector< Use * >::size(), and type.

00135 {
00136   int number;
00137   int script_number;
00138   Use::UsePtrVector& uses = Use::get_ordered_uses ();
00139 
00140   if (uses.size () > 0)
00141     {
00142       for (number = 0; number < uses.size (); number++)
00143         {
00144           const Use* use = uses[number];
00145 
00146           Package* p = use->get_package ();
00147           if (p->is_cmt ()) continue;
00148 
00149           for (script_number = 0;
00150                script_number < use->scripts.size ();
00151                script_number++)
00152             {
00153               Script& script = use->scripts[script_number];
00154 
00155               if (script.type == SetupScript)
00156                 {
00157                   if (script.print (mode, use)) cout << "; ";
00158                 }
00159             }
00160         }
00161     }
00162 
00163   {
00164     const Use& use = Use::current ();
00165 
00166     for (script_number = 0;
00167          script_number < use.scripts.size ();
00168          script_number++)
00169       {
00170         Script& script = use.scripts[script_number];
00171 
00172         if (script.type == SetupScript)
00173           {
00174             if (script.print (mode, &use)) cout << "; ";
00175           }
00176       }
00177   }
00178 }

void Script::all_print_clean (? PrintMode? ? mode )? [static]
?

Definition at line 103 of file cmt_script.cxx.

References CleanupScript, Use::get_ordered_uses(), Use::get_package(), Package::is_cmt(), print(), PrintMode, Use::scripts, cmt_vector< Script >::size(), cmt_vector< Use * >::size(), and type.

Referenced by Cmt::print_clean().

00104 {
00105   int number;
00106   int script_number;
00107   Use::UsePtrVector& uses = Use::get_ordered_uses ();
00108 
00109   if (uses.size () > 0)
00110     {
00111       for (number = 0; number < uses.size (); number++)
00112         {
00113           const Use* use = uses[number];
00114 
00115           Package* p = use->get_package ();
00116           if (p->is_cmt ()) continue;
00117 
00118           for (script_number = 0;
00119                script_number < use->scripts.size ();
00120                script_number++)
00121             {
00122               Script& script = use->scripts[script_number];
00123 
00124               if (script.type == CleanupScript)
00125                 {
00126                   if (script.print (mode, use)) cout << "; ";
00127                 }
00128             }
00129         }
00130     }
00131 }

void Script::clear_all (? ? )? [static]
?

Definition at line 181 of file cmt_script.cxx.

Referenced by Cmt::clear().

00182 {
00183 }

Script * Script::find (? const cmt_string &? ? name,
Use *? ? use
)? [static]
?

Definition at line 38 of file cmt_script.cxx.

References Use::current(), name, Use::scripts, and cmt_vector< Script >::size().

Referenced by add().

00039 {
00040   int script_index;
00041 
00042   if (use == 0) use = &(Use::current());
00043 
00044   if (use->scripts.size () == 0) return (0);
00045 
00046   for (script_index = 0;
00047        script_index < use->scripts.size ();
00048        script_index++)
00049     {
00050       Script& script = use->scripts[script_index];
00051 
00052       if (script.name == name)
00053         {
00054           return (&script);
00055         }
00056     }
00057 
00058   return (0);
00059 }

int Script::print (? PrintMode? ? mode,
const Use *? ? use
)?
?

Definition at line 196 of file cmt_script.cxx.

References cmt_style, Csh, cmt_string::find(), name, cmt_string::npos, Use::prefix, PrintMode, Sh, SLASH, and Use::style.

Referenced by all_print(), and all_print_clean().

00197 {
00198   int result = 1;
00199   cmt_string suffix;
00200 
00201   if (name == "") return (0);
00202 
00203   switch (mode)
00204     {
00205       case Csh :
00206         suffix = ".csh";
00207         cout << "source ";
00208         break;
00209       case Sh :
00210         suffix = ".sh";
00211         cout << ". ";
00212         break;
00213     }
00214 
00215   if (name.find (SLASH) == cmt_string::npos)
00216     {
00217       cout << "${" << use->prefix << "ROOT}/";
00218       if (use->style == cmt_style) cout << "cmt/";
00219       else cout << "mgr/";
00220     }
00221 
00222   cout << name << suffix;
00223 
00224   return (result);
00225 }

Member Data Documentation

cmt_string Script::name
?

Definition at line 32 of file cmt_script.h.

Referenced by action(), add(), find(), and print().

ScriptType Script::type
?

Definition at line 33 of file cmt_script.h.

Referenced by action(), add(), all_print(), and all_print_clean().


The documentation for this class was generated from the following files:
Generated on Wed Dec 1 15:25:32 2004 for CMT by 1.2.18