Menu

[73c16a]: / CPP Converter / main.cpp  Maximize  Restore  History

Download this file

51 lines (45 with data), 1.9 kB

 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
#include <windows.h>// Used for DLL exportation
#include <iostream>// Used for input/output and strings
#include <cstdio>// Usd for file io
#include "../Classes.h"// Defines all of the classes used
#include <windows.h>
#define DLL_EXPORT __declspec(dllexport)// The functions we want to export
using namespace std;
string InputFile = "";// The file we are reading from
char TempChar = ' ';
FILE* Output;// The output file
#include "Errors.h"
#include "Input.h"
extern "C" {// Keep the function names the same
void DLL_EXPORT Plugin(string Text) {// The main compile function
cout << sizeof(CONSOLE_SCREEN_BUFFER_INFO) << endl;
InputFile = Text;
if(Text == "")
throw Compile_Error("You nust input a file to compile","NULL",ERROR_FILEIN,0);
if((Input = fopen(InputFile.c_str(),"r")) == NULL)
throw Compile_Error((string("Could not open \"")+InputFile+"\"").c_str(),"NULL",ERROR_FILEIN,0);
string::size_type pos = InputFile.find_last_of( "." );
if((Output = fopen((InputFile.substr(0, pos)+".cpp").c_str(),"w")) == NULL)
throw Compile_Error((string("Could not open \"")+(InputFile.substr(0, pos)+".asm")+"\"").c_str(),"NULL",ERROR_FILEOUT,0);
GetChar();
SkipWhite();
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
// attach to process
// return FALSE to fail DLL load
break;
case DLL_PROCESS_DETACH:
// detach from process
break;
case DLL_THREAD_ATTACH:
// attach to thread
break;
case DLL_THREAD_DETACH:
// detach from thread
break;
}
return true; // succesful
}
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.