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

# SequenceRunner Class Reference

This very simplified sequence interpreter is meant for internal use only, for driving demo or test scenarios. More...

Inheritance diagram for SequenceRunner

[legend]
Collaboration diagram for SequenceRunner:

[legend]
List of all members.

## Public Methods
| SequenceRunner ()
void | begin ()
void | filter (const cmt_string& line)
void | end ()
## Private Attributes
bool | started
bool | running
cmt_string | style
cmt_string | vdir
cmt_string | package
cmt_string | filename
cmt_string | buffer
cmt_string | pwd

## Detailed Description

This very simplified sequence interpreter is meant for internal use only, for driving demo or test scenarios.

This is run as follows:

> cd ../demo > cmt run_sequence xxx.cmt

where xxx.cmt is a text file containing descriptions of sequence steps:

sequence_step : package-creation | file-description | package-access | cmt-action | comment

package-creation : "%package" <package-name> requirements-file

This creates a package from the current location, at version v1 structuration style is considered. Requirements file follows the statement.

requirements-file : file-contents

file-description : "%file" <file-path> file-contents

Create a files relatively to the last created package.

package-access : "%cdpackage" <package-name>

Move to the cmt directory of the specified package

cmt-action : "%cmt"

Perform the specified cmt action.

file-contents : line ...

comment : %%% ...

Definition at line 2709 of file cmt_parser.cxx.

## Constructor & Destructor Documentation

SequenceRunner::SequenceRunner ( | )`[inline]`

| Definition at line 2713 of file cmt_parser.cxx.
    02714   {
    02715   }

## Member Function Documentation

void SequenceRunner::begin ( | )`[inline, virtual]`

| Reimplemented from Awk. Definition at line 2717 of file cmt_parser.cxx.
    02718   {
    02719     started = false;
    02720     running = false;
    02721     if (style == CmtSystem::getenv ("CMTSTRUCTURINGSTYLE"))
    02722       {
    02723         vdir = CmtSystem::file_separator ();
    02724         vdir += "v1";
    02725       }
    02726     else
    02727       {
    02728         vdir = "";
    02729       }
    02730     package = "";
    02731     filename = "";
    02732     buffer = "";
    02733     pwd = "";
    02734   }

void SequenceRunner::end ( | )`[inline, virtual]`

| Reimplemented from Awk. Definition at line 2844 of file cmt_parser.cxx.
    02845   {
    02846     if (running)
    02847       {
    02848         if (buffer != "")
    02849           {
    02850             buffer.write (filename);
    02851             //cout << "%%Writing file " << filename << endl;
    02852             //cout << buffer << endl;
    02853             buffer = "";
    02854           }
    02855         running = false;
    02856       }
    02857   }

void SequenceRunner::filter ( | const cmt_string & line )`[inline, virtual]`

| Reimplemented from Awk. Definition at line 2736 of file cmt_parser.cxx.
    02737   {
    02738     //cout << "line=[" << line << "]" << endl;
    02739
    02740     CmtSystem::cmt_string_vector words;
    02741
    02742     CmtSystem::split (line, " \t", words);
    02743
    02744     cmt_string verb;
    02745
    02746     if (words.size () > 0) verb = words[0];
    02747
    02748     if (verb.substr (0, 2) == "%%")
    02749       {
    02750         if (verb.substr (0, 3) == "%%%") return;
    02751
    02752         if (running)
    02753           {
    02754             buffer.write (filename);
    02755             //cout << "%%Writing file " << filename << endl;
    02756             //cout << buffer << endl;
    02757             buffer = "";
    02758
    02759             running = false;
    02760           }
    02761       }
    02762
    02763     if (verb == "%%package")
    02764       {
    02765         package = words[1];
    02766
    02767         cmt_string command = "cmt create ";
    02768         command += package;
    02769         command += " v1";
    02770
    02771         CmtSystem::execute (command);
    02772         //cout << "%% creating package " << package << " with command [" << command << "]" << endl;
    02773
    02774         filename = package;
    02775         filename += vdir;
    02776         filename += CmtSystem::file_separator ();
    02777         filename += "cmt";
    02778         filename += CmtSystem::file_separator ();
    02779         filename += "requirements";
    02780
    02781         started = true;
    02782       }
    02783     else if (verb == "%%file")
    02784       {
    02785         cmt_string file = words[1];
    02786
    02787         cmt_string d = package;
    02788         d += vdir;
    02789         d += CmtSystem::file_separator ();
    02790         d += file;
    02791         CmtSystem::dirname (d, d);
    02792
    02793         CmtSystem::mkdir (d);
    02794         //cout << "%% creating directory " << d << endl;
    02795
    02796         buffer = "";
    02797
    02798         filename = package;
    02799         filename += vdir;
    02800         filename += CmtSystem::file_separator ();
    02801         filename += file;
    02802         started = true;
    02803       }
    02804     else if (verb == "%%cdpackage")
    02805       {
    02806         package = words[1];
    02807
    02808         pwd = package;
    02809         pwd += vdir;
    02810         pwd += CmtSystem::file_separator ();
    02811         pwd += "cmt";
    02812       }
    02813     else if (verb == "%%cmt")
    02814       {
    02815         cmt_string command;
    02816
    02817         if (pwd != "")
    02818           {
    02819             command = "cd ";
    02820             command += pwd;
    02821             command += " ";
    02822             command += CmtSystem::command_separator ();
    02823             command += " ";
    02824           }
    02825
    02826         command += line;
    02827         command.replace ("%%", "");
    02828
    02829         CmtSystem::execute (command);
    02830       }
    02831     else
    02832       {
    02833         buffer += line;
    02834         buffer += "\n";
    02835       }
    02836
    02837     if (started)
    02838       {
    02839         started = false;
    02840         running = true;
    02841       }
    02842   }

## Member Data Documentation

cmt_string SequenceRunner::buffer`[private]`

| Definition at line 2866 of file cmt_parser.cxx.

cmt_string SequenceRunner::filename`[private]`

| Definition at line 2865 of file cmt_parser.cxx.

cmt_string SequenceRunner::package`[private]`

| Definition at line 2864 of file cmt_parser.cxx.

cmt_string SequenceRunner::pwd`[private]`

| Definition at line 2867 of file cmt_parser.cxx.

bool SequenceRunner::running`[private]`

| Definition at line 2861 of file cmt_parser.cxx.

bool SequenceRunner::started`[private]`

| Definition at line 2860 of file cmt_parser.cxx.

cmt_string SequenceRunner::style`[private]`

| Definition at line 2862 of file cmt_parser.cxx.

cmt_string SequenceRunner::vdir`[private]`

| Definition at line 2863 of file cmt_parser.cxx.

The documentation for this class was generated from the following file:

- cmt_parser.cxx