Skip to content

Instantly share code, notes, and snippets.

@Backup-eric645
Created March 11, 2020 01:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Backup-eric645/a3565c9e351330947d4959f7a34c786f to your computer and use it in GitHub Desktop.
Save Backup-eric645/a3565c9e351330947d4959f7a34c786f to your computer and use it in GitHub Desktop.
Source Code Annotation source code
#pragma once
#define _HAS_CXX17_ true
#define _SCA_annotes(n,pp1,pp2 )
#define _SCA_annotes(n,pp1,pp2,pp3)
#define xname "SCASYS"
#define _ScaSrc_(name ) _SCA_annotes(xname, #name, "SCA" )
#define _ScaSrc_(name, base) _SCA_annotes(xname, #name, #base, "SCA")
#define I _ScaSrc_(I )
#define I_OPT _ScaSrc_(I_OPT, I )
#define IO _ScaSrc_(IO, I O )
#define IO_OPT _ScaSrc_(IO_OPT, IO )
#define O _ScaSrc_(O )
#define O_OPT _ScaSrc_(O_OPT, O )
#define O_PTR _ScaSrc_(O_PTR, O )
#define O_PTR_OPT _ScaSrc_(O_PTR_OPT, O_PTR)
#define O_REF _ScaSrc_(O_REF, O_PTR)
#define O_REF_OPT _ScaSrc_(O_REF_OPT, O_REF)
#define O_RET _ScaSrc_(O_RET )
#ifdef SCA_NOCPPHELPERS
#undef SCA_NOCPPHELPERS
#else
#include <Windows.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <io.h>
using namespace std;
#define standard std::
#define DECLH(name, cont) struct _rgp__##name##__ {##cont##}; typedef struct _rgp__##name##__ *name
DECLH(C_AMBIGIOUS_OBJECT);
#define constant const
#define variable(type) type
#define ASSEMBLY_CODE __asm
#define DECLARATION_MOD __declspec
#define u(t) unsigned t
#define STD_CALL __stdcall
#define CDECL __cdecl
#define CLR_CALL __clrcall
#define FAST_CALL __fastcall
#define THIS_CALL __thiscall
#define VEC_CALL __vectorcall
#define WRITE_FILE _Writettf_
#define READ_FILE _Readtff_
#define FILE_EXISTS _Fileexists_
C_AMBIGIOUS_OBJECT _Writettf_(I string file, I string content)
{
variable(ofstream) s;
s.open(file);
s << content;
s.close();
return (C_AMBIGIOUS_OBJECT)new _rgp__C_AMBIGIOUS_OBJECT__();
}
bool _Readtff_(I string file, O string content)
{
if (!FILE_EXISTS(file))
{
return false;
}
variable(ifstream) s;
s.open(file);
s >> content;
s.close();
return true;
}
bool _Fileexists_(I string file)
{
return _access_s(file.c_str(), 0) == 0;
}
[NO-PARSE]
UINT16 DECLARATION_MOD(naked) STD_CALL _PLATF()
{
ASSEMBLY_CODE
{
MOV AX, CS
RET
}
}
#define x86 (_PLATF() == 35)[/NO-PARSE]
#define x64 (_PLATF() == 51)[/NO-PARSE]
#endif
#define SCA_VER "1.0.0a1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment