mirror of
https://github.com/Jaxan/hybrid-ads.git
synced 2025-06-06 08:27:45 +02:00
Windows hotpatch
This commit is contained in:
parent
aa718f17d3
commit
687784bcf9
4 changed files with 101 additions and 0 deletions
20
README.md
20
README.md
|
@ -60,6 +60,26 @@ I hope most of the code is portable c++11. But I may have used some c++14
|
||||||
features. (If this is a problem for you, please let me know.)
|
features. (If this is a problem for you, please let me know.)
|
||||||
|
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
|
||||||
|
David Huistra tried to build the tool on Windows using MinGW. That did not
|
||||||
|
work. (Dynamic linker errors, probably because I am using c++11.) But it does
|
||||||
|
work with Visual Studio 2015. For this, you can instruct `cmake` to generate
|
||||||
|
a solution file:
|
||||||
|
|
||||||
|
```
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake -G "Visual Studio 14" -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
|
||||||
|
```
|
||||||
|
|
||||||
|
See [here](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html)
|
||||||
|
for other versions of Visual Studio (not tested). After `cmake` you can open
|
||||||
|
the solution file and build the project. NOTE: The `Debug` build does not work
|
||||||
|
properly (I will have to look into this), so I recommend building the
|
||||||
|
`RelWithDebInfo` configuration.
|
||||||
|
|
||||||
|
|
||||||
## Java
|
## Java
|
||||||
|
|
||||||
For now the java code, which acts as a bridge between LearnLib and this c++
|
For now the java code, which acts as a bridge between LearnLib and this c++
|
||||||
|
|
74
lib/windows_getopt.h
Normal file
74
lib/windows_getopt.h
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int opterr = 1, /* if error message should be printed */
|
||||||
|
optind = 1, /* index into parent argv vector */
|
||||||
|
optopt, /* character checked for validity */
|
||||||
|
optreset; /* reset getopt */
|
||||||
|
char *optarg; /* argument associated with option */
|
||||||
|
|
||||||
|
#define BADCH (int)'?'
|
||||||
|
#define BADARG (int)':'
|
||||||
|
#define EMSG ""
|
||||||
|
|
||||||
|
/*
|
||||||
|
* getopt --
|
||||||
|
* Parse argc/argv argument vector.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
getopt(int nargc, char * const nargv[], const char *ostr)
|
||||||
|
{
|
||||||
|
static char *place = EMSG; /* option letter processing */
|
||||||
|
const char *oli; /* option letter list index */
|
||||||
|
|
||||||
|
if (optreset || !*place) { /* update scanning pointer */
|
||||||
|
optreset = 0;
|
||||||
|
if (optind >= nargc || *(place = nargv[optind]) != '-') {
|
||||||
|
place = EMSG;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
if (place[1] && *++place == '-') { /* found "--" */
|
||||||
|
++optind;
|
||||||
|
place = EMSG;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
} /* option letter okay? */
|
||||||
|
if ((optopt = (int)*place++) == (int)':' ||
|
||||||
|
!(oli = strchr(ostr, optopt))) {
|
||||||
|
/*
|
||||||
|
* if the user didn't specify '-' as an option,
|
||||||
|
* assume it means -1.
|
||||||
|
*/
|
||||||
|
if (optopt == (int)'-')
|
||||||
|
return (-1);
|
||||||
|
if (!*place)
|
||||||
|
++optind;
|
||||||
|
if (opterr && *ostr != ':')
|
||||||
|
(void)printf("illegal option -- %c\n", optopt);
|
||||||
|
return (BADCH);
|
||||||
|
}
|
||||||
|
if (*++oli != ':') { /* don't need argument */
|
||||||
|
optarg = NULL;
|
||||||
|
if (!*place)
|
||||||
|
++optind;
|
||||||
|
}
|
||||||
|
else { /* need an argument */
|
||||||
|
if (*place) /* no white space */
|
||||||
|
optarg = place;
|
||||||
|
else if (nargc <= ++optind) { /* no arg */
|
||||||
|
place = EMSG;
|
||||||
|
if (*ostr == ':')
|
||||||
|
return (BADARG);
|
||||||
|
if (opterr)
|
||||||
|
(void)printf("option requires an argument -- %c\n", optopt);
|
||||||
|
return (BADCH);
|
||||||
|
}
|
||||||
|
else /* white space */
|
||||||
|
optarg = nargv[optind];
|
||||||
|
place = EMSG;
|
||||||
|
++optind;
|
||||||
|
}
|
||||||
|
return (optopt); /* dump back option letter */
|
||||||
|
}
|
|
@ -24,7 +24,13 @@
|
||||||
* I've installed this software several times, and it was never
|
* I've installed this software several times, and it was never
|
||||||
* easy because of its dependencies.
|
* easy because of its dependencies.
|
||||||
*/
|
*/
|
||||||
|
#ifdef _WIN32
|
||||||
|
extern "C" {
|
||||||
|
#include <windows_getopt.h>
|
||||||
|
}
|
||||||
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <numeric>
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
Loading…
Add table
Reference in a new issue