Edinburgh Speech Tools  2.1-release
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
doc/estexec.md
1 Executable Programs {#estexec}
2 ===================
3 
4 ## Manuals
5 
6 See @subpage estmanuals for more information
7 
8 # Building your own executable programs {#estexecbuilding}
9 
10 A simple mechanism is provided for doing all the configuration needed
11 to build a executable program which uses the speech tools library.
12 
13 First, make a directory which will hold your program. To make a program called "do_stuff", type
14 
15  est_program do_stuff
16 
17 if you haven't got the EST bin directory in your path you will have
18 to add the path explicitly, e.g.
19 
20  speech_tools/bin/est_program do_stuff
21 
22 
23 This will create a Makefile and a .cc file called
24 *do_stuff_main.cc*, which will look something like
25  this:
26 
27 ~~~~~~~~~~~~~~~{.cc}
28 #include "EST.h"
29 #include "EST_types.h"
30 #include "EST_error.h"
31 
32 int main(int argc, char *argv[])
33 {
34  EST_StrList files; // the list of input files will go here
35  EST_Option cmd_line; // the parsed list of command line arguments
36  // will go here.
37 
38  // This bit parses the command line args and puts them into
39  // files and cmd_line
40  parse_command_line
41  (argc, argv,
42  EST_String("[OPTIONS] [files...]\n")+
43  "Summary; DO SOMETHING\n"+
44  "-o [ofile] Ouptut file\n",
45  files, cmd_line);
46 
47  EST_String out_file; // the name of the output file
48 
49  // If a output file has been specified using -o, put it in out_file
50  if (cmd_line.present("-o"))
51  out_file = cmd_line.val("-o");
52  else
53  EST_error("No output file specified");
54 
55  // declare EST_StrList iterator
56  EST_StrList::Entries fs;
57 
58  // iterate through files and do something.
59  for(fs.begin(files); fs; ++fs)
60  {
61  EST_String file = *fs;
62 
63  // Process file
64  }
65 
66  return 0;
67 }
68 ~~~~~~~~~~~~~~~
69 
70 You can now add any C++ code to this, and compile by typing *make*.
71 
72 If you want to create a second program in the same directory, type the
73 same again:
74 
75  speech_tools/bin/est_program do_more_stuff
76 
77 This time, *do_more_stuff_main.cc* will be created and the
78 appropriate build commands added to the extisting Makefile. If you
79 wish to add an extra .cc file to particular program, simply edit the
80 Makefile and add it on the line:
81 
82  do_stuff_CXXSRC= do_stuff.cc extra.cc
83 
84 
85