File: ldtest.cpp

package info (click to toggle)
sword 1.8.1%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 13,976 kB
  • sloc: cpp: 45,938; sh: 11,833; ansic: 7,976; objc: 1,801; java: 1,724; makefile: 1,300; cs: 1,007; perl: 784; xml: 736; pascal: 681; tcl: 350; python: 79
file content (32 lines) | stat: -rw-r--r-- 667 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <swmodule.h>
#include <swmgr.h>
#include <iostream>
#include <stdio.h>

using namespace sword;
using namespace std;

int main(int argc, char **argv) {

	if (argc < 2) {
		fprintf(stderr, "usage: %s <lexdict_name>\n", *argv);
		exit(-1);
	}

	SWMgr library;
	SWModule *module = library.getModule(argv[1]);
	if (!module) {
		cerr << "\nCouldn't find module: " << argv[1] << "\n" << endl;
		exit(-2);
	}
	int i = 0;
	for ((*module) = TOP; !module->popError(); module->increment()) {
		cout << module->getKeyText() << ": " << module->stripText() << "\n";
		if (++i > 10) {
			cout << "ERROR: more than 10 iterations. stopping.\n";
			break;
		}

	}
	return 0;
}