The SWORD Project  1.9.0.svnversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mkfastmod.cpp File Reference
#include <stdio.h>
#include <rawtext.h>
#include <swmgr.h>
#include <versekey.h>
#include <markupfiltmgr.h>
#include <swbuf.h>
+ Include dependency graph for mkfastmod.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 
void percentUpdate (char percent, void *userData)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 59 of file mkfastmod.cpp.

60 {
61  if (argc != 2) {
62  fprintf(stderr, "usage: %s <modname>\n", argv[0]);
63  exit(-1);
64  }
65 
66  SWModule *target;
67  ListKey listkey;
68  ModMap::iterator it;
69 
70  SWMgr manager;
71  it = manager.Modules.find(argv[1]);
72  if (it == manager.Modules.end()) {
73  fprintf(stderr, "Could not find module [%s]. Available modules:\n", argv[1]);
74  for (it = manager.Modules.begin(); it != manager.Modules.end(); it++) {
75  fprintf(stderr, "[%s]\t - %s\n", (*it).second->getName(), (*it).second->getDescription());
76  }
77  exit(-1);
78  }
79  target = it->second;
80 
81  if (!target->hasSearchFramework()) {
82  fprintf(stderr, "%s: error: %s does not support a search framework.\n", *argv, it->second->getName());
83  exit(-2);
84  }
85 
86  printf("Deleting any existing framework...\n");
87  target->deleteSearchFramework();
88  printf("Building framework, please wait...\n");
89  char lineLen = 70;
90  printf("[0=================================50==============================100]\n ");
91  char error = target->createSearchFramework(&percentUpdate, &lineLen);
92  if (error) {
93  fprintf(stderr, "%s: couldn't create search framework (permissions?)\n", *argv);
94  }
95  printf("\n");
96 }
Definition: swmgr.h:93
virtual bool hasSearchFramework()
Definition: swmodule.cpp:1170
virtual signed char createSearchFramework(void(*percent)(char, void *)=&nullPercent, void *percentUserData=0)
Definition: swmodule.cpp:1193
ModMap Modules
Definition: swmgr.h:322
virtual void deleteSearchFramework()
Definition: swmodule.cpp:1178
void percentUpdate(char percent, void *userData)
Definition: mkfastmod.cpp:43
void percentUpdate ( char  percent,
void *  userData 
)

Definition at line 43 of file mkfastmod.cpp.

43  {
44  static char printed = 0;
45  char maxHashes = *((char *)userData);
46 
47  while ((((float)percent)/100) * maxHashes > printed) {
48  printf("=");
49  printed++;
50  fflush(stdout);
51  }
52 /*
53  std::cout << (int)percent << "% ";
54 */
55  fflush(stdout);
56 }