mirror of
https://github.com/UzixLS/KernelEx.git
synced 2025-07-19 07:21:20 +03:00
import KernelEx-4.5-Beta1
This commit is contained in:
0
util/dumpconf.c
Normal file → Executable file
0
util/dumpconf.c
Normal file → Executable file
0
util/dumpimte.c
Normal file → Executable file
0
util/dumpimte.c
Normal file → Executable file
0
util/dumpsett.c
Normal file → Executable file
0
util/dumpsett.c
Normal file → Executable file
0
util/funique.cpp
Normal file → Executable file
0
util/funique.cpp
Normal file → Executable file
0
util/load.c
Normal file → Executable file
0
util/load.c
Normal file → Executable file
0
util/patterns.txt
Normal file → Executable file
0
util/patterns.txt
Normal file → Executable file
74
util/prep/prep.cpp
Normal file → Executable file
74
util/prep/prep.cpp
Normal file → Executable file
@ -31,6 +31,7 @@
|
||||
#include <exception>
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <sys/stat.h>
|
||||
using namespace std;
|
||||
#include "prep.h"
|
||||
|
||||
@ -463,41 +464,52 @@ void dump_all()
|
||||
write_ordinal_exports(cout);
|
||||
}
|
||||
|
||||
void replace_if_changed(const string& out, const string& in)
|
||||
void replace(const string& out, const string& in)
|
||||
{
|
||||
fstream f;
|
||||
stringstream buf;
|
||||
string in1;
|
||||
string in2;
|
||||
ifstream fin;
|
||||
ofstream fout;
|
||||
|
||||
f.open(out.c_str(), fstream::in);
|
||||
if (!f)
|
||||
fin.open(in.c_str(), ios::in);
|
||||
if (!fin)
|
||||
throw Exception("Failed to open file");
|
||||
buf << f.rdbuf();
|
||||
in1 = buf.str();
|
||||
f.close();
|
||||
|
||||
f.open(in.c_str(), fstream::in);
|
||||
if (!f)
|
||||
fout.open(out.c_str(), ios::out | ios::trunc);
|
||||
if (!fout)
|
||||
throw Exception("Failed to open file");
|
||||
buf.clear();
|
||||
buf.str("");
|
||||
buf << f.rdbuf();
|
||||
in2 = buf.str();
|
||||
f.close();
|
||||
fout << fin.rdbuf();
|
||||
|
||||
if (in1.compare(in2))
|
||||
{
|
||||
f.open(out.c_str(), ios::out | ios::trunc);
|
||||
if (!f)
|
||||
throw Exception("Failed to open file");
|
||||
f << in2;
|
||||
f.close();
|
||||
}
|
||||
fout.close();
|
||||
fin.close();
|
||||
|
||||
remove(in.c_str());
|
||||
}
|
||||
|
||||
bool is_uptodate_dir(const string& path)
|
||||
{
|
||||
string file;
|
||||
FileFinder ff;
|
||||
struct _stat st;
|
||||
time_t mintime;
|
||||
|
||||
ff.search_for(path + "_*_apilist.c");
|
||||
file = ff.get_next_file();
|
||||
if (file.empty())
|
||||
throw Exception("Couldn't find output def file");
|
||||
|
||||
_stat((path + file).c_str(), &st);
|
||||
mintime = st.st_mtime;
|
||||
|
||||
ff.search_for(path + "*.c");
|
||||
while (!(file = ff.get_next_file()).empty())
|
||||
{
|
||||
_stat((path + file).c_str(), &st);
|
||||
if (st.st_mtime > mintime)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void work()
|
||||
{
|
||||
ifstream dirlist("dirlist");
|
||||
@ -527,6 +539,11 @@ void work()
|
||||
path += '\\';
|
||||
|
||||
cout << "Processing directory: '" << path << '\'' << endl;
|
||||
if (is_uptodate_dir(path))
|
||||
{
|
||||
cout << "Directory is up to date" << endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
ff.search_for(path + "*.c");
|
||||
|
||||
@ -535,9 +552,6 @@ void work()
|
||||
{
|
||||
FileDeclParser* parser;
|
||||
|
||||
//if (file.find("_apilist.") != string::npos)
|
||||
// continue;
|
||||
|
||||
file = path + file;
|
||||
|
||||
cout << "Parsing file: '" << file << '\'' << endl;
|
||||
@ -612,7 +626,7 @@ void work()
|
||||
}
|
||||
|
||||
out_file.close();
|
||||
replace_if_changed(file, file + ".tmp");
|
||||
replace(file, file + ".tmp");
|
||||
|
||||
//write output decls
|
||||
ff.search_for(path + "_*_apilist.h");
|
||||
@ -665,7 +679,7 @@ void work()
|
||||
}
|
||||
|
||||
out_file.close();
|
||||
replace_if_changed(file, file + ".tmp");
|
||||
replace(file, file + ".tmp");
|
||||
}
|
||||
|
||||
}
|
||||
|
24
util/prep/prep.dsp
Normal file → Executable file
24
util/prep/prep.dsp
Normal file → Executable file
@ -52,18 +52,6 @@ LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /OPT:NOWIN98
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
# Begin Custom Build
|
||||
OutDir=.\Release
|
||||
WkspDir=.
|
||||
TargetName=prep
|
||||
InputPath=.\Release\prep.exe
|
||||
SOURCE="$(InputPath)"
|
||||
|
||||
"nope" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(OutDir)\$(TargetName) "$(WkspDir)\apilibs\kexbases"
|
||||
$(OutDir)\$(TargetName) "$(WkspDir)\apilibs\kexbasen"
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "prep - Win32 Debug"
|
||||
|
||||
@ -89,18 +77,6 @@ LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /OPT:NOWIN98
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
# Begin Custom Build
|
||||
OutDir=.\Debug
|
||||
WkspDir=.
|
||||
TargetName=prep
|
||||
InputPath=.\Debug\prep.exe
|
||||
SOURCE="$(InputPath)"
|
||||
|
||||
"nope" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(OutDir)\$(TargetName) "$(WkspDir)\apilibs\kexbases"
|
||||
$(OutDir)\$(TargetName) "$(WkspDir)\apilibs\kexbasen"
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
0
util/prep/prep.h
Normal file → Executable file
0
util/prep/prep.h
Normal file → Executable file
0
util/prep/test/_te_apilist.c
Normal file → Executable file
0
util/prep/test/_te_apilist.c
Normal file → Executable file
0
util/prep/test/dirlist
Normal file → Executable file
0
util/prep/test/dirlist
Normal file → Executable file
0
util/prep/test/junk.c
Normal file → Executable file
0
util/prep/test/junk.c
Normal file → Executable file
0
util/prep/test/test.c
Normal file → Executable file
0
util/prep/test/test.c
Normal file → Executable file
Reference in New Issue
Block a user