-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
executable file
·344 lines (343 loc) · 11.2 KB
/
main.cpp
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
#include "resources.h"
int main(int argc, char* argv[]) {
try{
std::ifstream FL;
int sz = 0, sp = 0;
Complementary* th = new Complementary, *thNd = new Complementary;
char inpt01[5], inpt02[1];
sz = 0;
std::string fil, ansr;
bool TF = false, dl = 1, othr = 0, CLI = 0;
//INTAKE:BEGIN
if(argc == 1){
TF = true;
}
else{
for (int i = 1; i < (signed)argc; i++) {
if (!strcmp(argv[i], "-th") || !strcmp(argv[i], "--thneedle")){
th->opChc[0] = 1;
continue;
}
if (!strcmp(argv[i], "-o") || !strcmp(argv[i], "--out-par")){
th->opChc[4] = 1;
continue;
}
if (!strcmp(argv[i], "-lo")||!strcmp(argv[i], "--local-save")){
th->opChc[4] = 1;
th->custom_path = 1;
continue;
}
if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
std::printf("Usage:\nMagnifEye <options> <file>\n\n\n");
std::printf("[-h, --help][-c, --cli][-th, --thneedle][-red, --redcheck][-l, --legend][-w ,--webi][-o ,--out-par ]\n\n\n");
std::printf("options:\n");
std::printf("\tMain functions:\n");
std::printf("\t\t-th, --thneedle\t\t\tDisplay similar words\n");
std::printf("\t\t-c, --cli\t\t\t\tDisplay the CLI(Command Line Interface)\n");
std::printf("\t\t-red, --redcheck\t\t\tDisplay redundancy of phrases used in document\n");
std::printf("\t\t-dc, --doc-com\t\t\t\tDisplay similar phrases and words upon two documents\n");
std::printf("\t\t-w, --webi\t\t\t\tDisplay information on a web interface\n");
std::printf("\tMetric adjustments:\n");
std::printf("\t\t-o, --out-par\t\t\t\tOutput info into parsed version\n");
std::printf("\t\t-raw, --raw-read <T|S>\t\t\tRead from file raw input\n");
std::printf("\t\t\tT (default)\t\t\t\"Thorough\" read of the file to compare words/phrases similar in characters, but display raw\n");
std::printf("\t\t\tS\t\t\t\t\"Skim\" the file to compare words/phrases similar in case and characters\n");
std::printf("\t\t-d, --delimeter <a, b, 123, \\\", \\,>\tBy putting characters as portrayed (yes, even non-readable characters as numbers), you can set a list of 1+ characters as preset delimeters\n");
std::printf("\t\t-rem,--removal <a, b, 123, \\\", \\,>\tBy putting characters as portrayed (yes, even non-readable characters as numbers), you can set a list of 1+ characters to exclude from text\n");
std::printf("\t\t-exc,--exclude \"lorem,ipsum,etc\"\tExclude comma-delimited words put in quotes from analysis\n");
std::printf("\t\t-inc,--include \"lorem,ipsum,etc\"\tInclude comma-delimited words put in quotes from analysis\n");
std::printf("\t\t-mn, --measurement-number <2, 3, 4>\tThis will specify the number of occurrances that an entity will be measured\n");
std::printf("\tSorting:\n");
std::printf("\t\t-r, --reverse\t\t\tspecifies if the output text will be reversed, with lowest to greatest.");
std::printf("\tOther:\n");
std::printf("\t\t-h, --help\t\t\t\tDisplay this screen\n");
std::printf("\t\t-l, --legend\t\t\t\tDisplay legend to display color coding legend for output\n");
std::printf("\t\t-lo, --local-save\t\t\tAutomatically run --out-par option and save it locally\n");
exit(0);
}
if (!strcmp(argv[i], "-c") || !strcmp(argv[i], "--cli")){
TF = true;
continue;
}
if (!strcmp(argv[i], "-red") || !strcmp(argv[i], "--redcheck")){
th->opChc[1] = 1;
continue;
}
if (!strcmp(argv[i], "-l") || !strcmp(argv[i], "--legend")){
std::printf("\n\t\t\tLegend\n\n");
std::printf("\t\e[92mGood\n\n");
std::printf("\tMay need some adjustment, depending on preference\n\n\n");
std::printf("\t\e[93mOkay\n\n");
std::printf("\tNeeds some adjustment because of multiple uses of\n\tsame words\n\n\n");
std::printf("\t\e[31mBad\n\n");
std::printf("\tNeeds adjustment, too many instances of this/these\n\tword(s)\e[0m\n");
continue;
}
if (!strcmp(argv[i], "-dc") || !strcmp(argv[i], "--doc-com")){
th->opChc[2] = 1;
continue;
}
if (!strcmp(argv[i], "-w") || !strcmp(argv[i], "--webi")){
th->opChc[4] = 1;
continue;
}
if (!strcmp(argv[i], "-raw") || !strcmp(argv[i], "--raw-read")){
i++;
switch(argv[i][0]){
case 'T':
case 't':
th->opChc[5] = 1;
break;
case 'S':
case 's':
th->opChc[5] = 1;
th->rawRead = 1;
break;
}
continue;
}
if (!strcmp(argv[i], "-rem") || !strcmp(argv[i], "--removal")){
i++;
th->removalSET(argv[i]);
continue;
}
if (!strcmp(argv[i], "-exc")||!strcmp(argv[i], "--exclude")){
i++;
th->excludeSET(argv[i]);
continue;
}
if (!strcmp(argv[i], "-inc")||!strcmp(argv[i], "--include")){
i++;
th->includeSET(argv[i]);
continue;
}
if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--delimeter")){
i++;
th->delimeterSET(argv[i]);
continue;
}
if (!strcmp(argv[i], "-mn") || !strcmp(argv[i], "--measurement-number")){
i++;
th->metricSET(argv[i]);
continue;
}
if (!strcmp(argv[i], "-r") || !strcmp(argv[i], "--reverse-results")){
th->reverse = 1;
}
}
/*
for (int i = 4; i >= 0; i--)
inpt01[4-i] = argv[argc-1][strlen(argv[argc-1])-i];
inpt01[4] = '\0';
*/
}
//INTAKE:END
if (TF) {
th->clr();
while (true) {
if(dl){
thNd = new Complementary;
dl = 0;
}
thNd->CLI = CLI;
FL.open("downloadTF.txt");
while(getline(FL, ansr)){
if(ansr == "NOT-YET" || ansr == "NO" || ansr == "YES"){
break;
}
}
th->clr();
std::printf(" __ __ ___ ____\n");
std::printf("| \\ / | / __|| __|\n");
std::printf("| ` | _____ ____ ___ _||_ | _| _ ____\n");
std::printf("| |V| || |/ ||V _ |o |_ _| | | \\\\ / /| []|\n");
std::printf("| | | ||[] | || []|| / |||\\ || | |__ \\\\ / / | \\__|\n");
std::printf("|__| |__||___|\\| \\_ ||_| |||_| || |____| \\` / |____/\n");
std::printf(" _| | / /\n");
std::printf(" [__/ / /\n");
std::printf(" /_/\n");
std::printf("\n%s\n", th->ver().c_str());
std::printf("By FlakeyKarma\n\n\n");
std::printf("[0] Regular Output\n");
std::printf("[1] Redundancy Check \e[91m(RedCheck)\e[0m\n");
std::printf("[2] Document Comparison \e[96m(DoCo)\e[0m\n");
std::printf("[3] Web-Based Interface \e[93m(WeBI)\e[0m\n");
std::printf("[F] Enable Output to temp.txt file?");
thNd->TFswitch(thNd->CLI);
std::printf("[O] Other\n");
std::printf("[X] Exit\n");
std::printf("\nMEye> ");
th->libInstl(&ansr);
std::scanf(" %c", inpt01);
inpt01[1] = '\0';
switch (inpt01[0]) {
//Regular output
case '0':
th->clr();
fil = thNd->filIn();
thNd->opChc[0] = 1;
thNd->MagnifEye(fil);
dl = 1;
th->pauz();
inpt01[0] = '\0';
CLI = thNd->CLI;
break;
//RedCheck
case '1':
th->clr();
fil = thNd->filIn();
thNd->opChc[1] = 1;
thNd->MagnifEye(fil);
dl = 1;
th->pauz();
inpt01[0] = '\0';
CLI = thNd->CLI;
break;
//DoCo
case '2':
th->clr();
fil = thNd->filIn();
thNd->opChc[2] = 1;
thNd->MagnifEye(fil);
dl = 1;
th->pauz();
inpt01[0] = '\0';
CLI = thNd->CLI;
break;
//weBI
case '3':
th->clr();
fil = thNd->filIn();
if(thNd->GUD(fil)){
thNd->WeBI();
thNd->MagnifEye(fil);
}
dl = 1;
th->pauz();
inpt01[0] = '\0';
CLI = thNd->CLI;
break;
//(De)Select appending info to temp file
case 'f':
case 'F':
thNd->clr();
inpt01[0] = '\0';
dl = 1;
CLI = !thNd->CLI;
break;
//Other
case 'O':
case 'o':
while(true){
th->clr();
std::printf("\n\n\t\t-<OTHER>-\n\n\n");
std::printf("=============>[0] Legend\n");
std::printf("=============>[1] About\n");
std::printf("=============>[2] Help\n");
std::printf("=============>[3] Check Files\n");
std::printf("=============>[4] Install Libraries :: Current setting=%s\n", ansr.c_str());
std::printf("=============>[x] Exit\n");
std::printf("\n========>MEye> \n");
std::scanf(" %c", inpt02);
inpt01[1] = '\0';
switch(inpt02[0]){
//Legend
case '0':
th->clr();
std::printf("\n\t\t\tLegend\n\n");
std::printf("\t\e[92mGood\n\n");
std::printf("\tMay need some adjustment, depending on preference\n\n\n");
std::printf("\t\e[93mOkay\n\n");
std::printf("\tNeeds some adjustment because of multiple uses of\n\tsame words\n\n\n");
std::printf("\t\e[31mBad\n\n");
std::printf("\tNeeds adjustment, too many instances of this/these\n\tword(s)\e[0m\n");
th->pauz();
inpt02[0] = '\0';
break;
//About
case '1':
th->clr();
std::printf("\n\n\\\\About\n");
std::printf("\n\\\\I started needing to make this program when I found myself trying\
\n finish a ten-page-paper far too late. Albeit, that was a struggle\
\n in of itself, the main problem for me was trying to find out if\
\n I needed to change up the wordage used. Different words used show\
\n the variance in one\'s vocabulary and that's beneficial to prove a\
\n point. Sometimes, you also need a little \"umf\".. ya know?\n\
\n There you go\n\
\n -FlakeyKarma\n\n\n");
th->pauz();
inpt02[0] = '\0';
break;
//Help
case '2':
th->clr();
th->help();
th->pauz();
inpt02[0] = '\0';
CLI = thNd->CLI;
break;
//Check for other files that may be needed for functions
case '3':
th->clr();
th->mkFil();
th->pauz();
inpt02[0] = '\0';
CLI = thNd->CLI;
break;
//What to install
case '4':
th->clr();
th->setDownload();
FL.open("downloadTF.txt");
while(getline(FL, ansr)){
if(ansr == "YES"){
th->Downloadz();
break;
}
}
FL.close();
break;
//Exit
case 'x':
case 'X':
th->clr();
othr = 1;
break;
}
th->pauz();
inpt01[0] = '\0';
if(othr) break;
}
break;
//Exit
case 'x':
case 'X':
th->clr();
std::printf("--=goodbye=--\n");
std::exit(0);
}
inpt01[0] = '\0';
}
}
/*
if (strcmp(inpt01, ".txt") && !TF)
std::exit(0);
*/
std::printf(" \nMagnifEye %s\n", th->ver().c_str());
std::printf("// \\\\\n");
std::printf(" // _ \\\\\n");
std::printf(" /` `\\\n");
std::printf(" <' (O) `>\n");
std::printf(" \\,_,/\n");
std::printf(" \\\\ //\n");
std::printf("\\\\ //\n");
std::printf("\n\n\n\n\nBy FlakeyKarma\n\n\n");
if(argc == 2) th->opChc[0] = 1;
th->MagnifEye(argv[argc-1]);
std::printf("\n\n--=goodbye=--\n\n\n");
return 0;
}catch(int e){
std::printf("\n\n--=goodbye=--\e[0m\n\n\n");
}
}