utilities/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 54 of file mkfastmod.cpp.

00055 {
00056     if (argc != 2) {
00057         fprintf(stderr, "usage: %s <modname>\n", argv[0]);
00058         exit(-1);
00059     }
00060 
00061     SWModule *target;
00062     ListKey listkey;
00063     ModMap::iterator it;
00064 
00065     SWMgr manager;
00066     it = manager.Modules.find(argv[1]);
00067     if (it == manager.Modules.end()) {
00068         fprintf(stderr, "Could not find module [%s].  Available modules:\n", argv[1]);
00069         for (it = manager.Modules.begin(); it != manager.Modules.end(); it++) {
00070             fprintf(stderr, "[%s]\t - %s\n", (*it).second->getName(), (*it).second->getDescription());
00071         }
00072         exit(-1);
00073     }
00074     target = it->second;
00075 
00076     if (!target->hasSearchFramework()) {
00077         fprintf(stderr, "%s: error: %s does not support a search framework.\n", *argv, it->second->getName());
00078         exit(-2);
00079     }
00080 
00081     printf("Deleting any existing framework...\n");
00082     target->deleteSearchFramework();
00083     printf("Building framework, please wait...\n");
00084     char lineLen = 70;
00085     printf("[0=================================50==============================100]\n ");
00086     char error = target->createSearchFramework(&percentUpdate, &lineLen);
00087     if (error) {
00088         fprintf(stderr, "%s: couldn't create search framework (permissions?)\n", *argv);
00089     }
00090     printf("\n");
00091 }

void percentUpdate ( char  percent,
void *  userData 
)

Definition at line 38 of file mkfastmod.cpp.

00038                                                  {
00039     static char printed = 0;
00040     char maxHashes = *((char *)userData);
00041     
00042     while ((((float)percent)/100) * maxHashes > printed) {
00043         printf("=");
00044         printed++;
00045         fflush(stdout);
00046     }
00047 /*
00048     std::cout << (int)percent << "% ";
00049 */
00050     fflush(stdout);
00051 }


Generated on 18 Mar 2013 for The SWORD Project by  doxygen 1.6.1