Computer Laboratory

read.cpp File Reference

Detailed Description

Tool for reading TESLA manifests.

Definition in file read.cpp.

#include "Manifest.h"
#include "tesla.pb.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Pass.h"
+ Include dependency graph for read.cpp:

Go to the source code of this file.

Enumerations

enum  Command { ListAutomata }
 

Functions

cl::opt< string > ManifestName (cl::desc("[manifest file]"), cl::Positional, cl::Optional)
 
cl::opt< CommandUserCommand (cl::desc("Command to execute"), cl::Required, cl::values("list-automata", int(ListAutomata),"Print short string representation of all automata",(reinterpret_cast< void * >(0))))
 
cl::opt< Automaton::TypeDeterminism (cl::desc("automata determinism:"), cl::values("u", int(Automaton::Unlinked),"unlinked NFA","l", int(Automaton::Linked),"linked NFA","d", int(Automaton::Deterministic),"DFA",(reinterpret_cast< void * >(0))), cl::init(Automaton::Unlinked))
 
int main (int argc, char *argv[])
 

Enumeration Type Documentation

enum Command
Enumerator
ListAutomata 

Definition at line 51 of file read.cpp.

51  {
53 };

Function Documentation

cl::opt<Automaton::Type> Determinism ( cl::  desc"automata determinism:",
cl::  values"u", int(Automaton::Unlinked),"unlinked NFA","l", int(Automaton::Linked),"linked NFA","d", int(Automaton::Deterministic),"DFA",(reinterpret_cast< void * >(0)),
cl::  initAutomaton::Unlinked 
)
int main ( int  argc,
char *  argv[] 
)

Definition at line 71 of file read.cpp.

References tesla::Manifest::AllAutomata(), Determinism(), tesla::Manifest::FindAutomaton(), ListAutomata, tesla::ManifestName(), tesla::Automaton::String(), and UserCommand().

71  {
72  cl::ParseCommandLineOptions(argc, argv);
73 
74  auto& out = llvm::outs();
75  auto& err = llvm::errs();
76 
77  OwningPtr<Manifest> Manifest(
78  ManifestName.empty()
79  ? Manifest::load(llvm::errs(), Determinism)
80  : Manifest::load(llvm::errs(), Determinism, ManifestName));
81 
82  if (!Manifest) {
83  err << "Unable to read manifest '" << ManifestName << "'\n";
84  return false;
85  }
86 
87  switch (UserCommand) {
88  case ListAutomata:
89  for (auto i : Manifest->AllAutomata()) {
90  auto ID = i.first;
91 
92  auto *A = Manifest->FindAutomaton(ID);
93  out << A->String() << "\n\n";
94  }
95  break;
96  }
97 
98  google::protobuf::ShutdownProtobufLibrary();
99  return 0;
100 }

+ Here is the call graph for this function:

cl::opt<string> ManifestName ( cl::  desc"[manifest file]",
cl::Positional  ,
cl::Optional   
)
cl::opt<Command> UserCommand ( cl::  desc"Command to execute",
cl::Required  ,
cl::  values"list-automata", int(ListAutomata),"Print short string representation of all automata",(reinterpret_cast< void * >(0)) 
)

Referenced by main().

+ Here is the caller graph for this function: