代码拉取完成,页面将自动刷新
// CSmalltalk.h
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <setjmp.h>
#include <assert.h>
#define True 1
#define False 0
#define C57P_MCRO (True)
#define TRYP_MCRO (True)
#if C57P_MCRO // CSmalltalk-parse Macro
# define regsgH(mt) \
( \
signal(SIGABRT,mt), \
signal(SIGFPE,mt), \
signal(SIGILL,mt), \
signal(SIGINT,mt), \
signal(SIGSEGV,mt), \
signal(SIGTERM,mt), \
True \
)
# define nil (NULL)
# ifdef NDEBUG
# define C57LOG(...) return 0
# else
# define C57LOG(...) fprintf(stdout,__VA_ARGS__)
# endif
#endif
#if TRYP_MCRO // Try-pack Macro
# define TRINT(EXP) jmp_buf EXP; typedef enum
# define TRY(EXP,JBRN) int JBRN=setjmp(EXP);if(!JBRN)
# define CATCH(JBRN,VAL) else if(JBRN==VAL)
# define THROW(EXP,VAL) (longjmp(EXP,VAL))
# define FINALLY() if(True)
#endif
#undef True
#undef False
#define FPARAM(argc,argv,env) signed argc,const char* argv[], const char* env[]
#define THBLOCK(...) if(True)
#define PARAM 0 +
#define C57Pair(type1,type2) \
struct { \
type1 first; \
type2 second; \
}
#if !defined(__cplusplus)
typedef enum {False, True} Bool; // Bool Type
#else
# define Bool bool
# define False false
# define True true
#endif
TRINT(C57Exp) {
NORMAL, PROGRAM_ABORT,
UNKNOWN, ENOUGH_MEM
} EXCEPT_VAL;
#define $ model->_private
#define pc(n) struct {n;}
#define detect ((short)-1)
typedef char* string;
typedef struct {
char* rcode;
short limit;
string*sybl;
Bool next;
struct {
short* bracks;
int btop;
char* executes;
int etop;
} _private;
} CSmalltalk;
typedef struct {
string path;
short mlt;
string rdata;
string symbol;
} C57Object;
Bool split(CSmalltalk*);
Bool parse(CSmalltalk*);
Bool flint(void);
Bool NeutralInt(CSmalltalk*);
string malloc_string(const string);
C57Object objPool[128];
short i,j,k,h,w,s,cnt0,cnt1,temp,ptop=0,lmt,ftop,t, alp;
char*substr(char*str,short beg,short end) {
char*sub=(char*)malloc((end-beg+1)*sizeof(char));
for(short i = 0; i<(end-beg+1); i++) {
sub[i]=str[i+beg];
}
if(sub[strlen(sub)-1]>=32&&sub[strlen(sub)-1]<=126);
else sub[strlen(sub)-1]=0;
return sub;
}
string remove_bracks(const string str) {
string sret=(string)malloc(sizeof(char)*strlen(str));
strcpy(sret, str);
while(sret[0]=='('||sret[0]==32||sret[0]=='.'||sret[0]==';') sret++;
// while(sret[strlen(sret)-1]==')'||sret[strlen(sret)-1]==32) sret[strlen(sret)-1]=0;
return sret;
}
string remove_bracks2(const string str) {
string sret=(string)malloc(sizeof(char)*strlen(str));
strcpy(sret, str);
// while(sret[0]=='(') sret++;
while(sret[strlen(sret)-1]==')'||sret[strlen(sret)-1]==32||sret[strlen(sret)-1]=='.'||sret[strlen(sret)-1]==';') sret[strlen(sret)-1]=0;
return sret;
}
Bool split(CSmalltalk* model) {
if(model->limit==detect) model->limit=strlen(model->rcode);
Bool instr=False;
CSmalltalk phrase={.limit=detect};
for(h=0, s=0; s<(model->limit); s++) {
if(model->rcode[s]=='\''&&model->rcode[s-1]!='\\') instr^=1;
if(!instr&&(model->rcode[s]=='.'||model->rcode[s]==','))
phrase.rcode=substr(model->rcode,h,s), h=s+1, parse(&phrase);
}
return True;
}
Bool parse(CSmalltalk* model) {
if(model->limit==detect) model->limit=strlen(model->rcode);
Bool instr=False;
$.bracks=(short*)malloc(model->limit*sizeof(short));
$.btop=0;
for(i=0; i<(model->limit); i++) {
if(model->rcode[i]=='\''&&model->rcode[i-1]!='\\') instr^=1;
if(model->rcode[i]=='('&&!instr)
$.bracks[$.btop++]= +i;
if(model->rcode[i]==')'&&!instr)
$.bracks[$.btop++]= -i;
}
$.executes=(char*)malloc(256*sizeof(char));
for(j=$.btop-1,cnt0=0, alp='A'; j>=0; j--) {
if($.bracks[j]<0) {
cnt1=0;
for(i=j; i>=0; i--) {
if($.bracks[i]>=0) cnt1++;
if(cnt1==cnt0+1) {
// $.executes[$.etop]
char* temp=remove_bracks2(remove_bracks(substr(model->rcode,$.bracks[i],-$.bracks[j])));
if(strcmp($.executes, temp)) {
$.executes=temp;
if($.executes[strlen($.executes)-1]==')') j++;
printf("\033[32m'%s'\033[0m execute.\n\n",($.executes));
// for(k=$.bracks[i]; k<=-$.bracks[j]; k++) model->rcode[k]=alp;
alp++;
}
// break;
}
}
cnt0++;
}
}
return True;
}
Bool flint(void) {
ptop=0;
return True;
}
Bool NeutralInt(CSmalltalk* model) { // Still writing...
_using: model=model;
// goto _using;
return True;
}
string malloc_string(const string str) {
string sret=(string)malloc(sizeof(char)*strlen(str));
strcpy(sret,str);
return sret;
}
#undef $
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。