Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
DEntis-T committed Aug 3, 2024
1 parent 06e659e commit 5b741de
Show file tree
Hide file tree
Showing 7 changed files with 193 additions and 8 deletions.
Binary file modified scriptfiles/index.ps
Binary file not shown.
6 changes: 6 additions & 0 deletions src/core/index.inc
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@ stock dpp_formatarg(argument[]) // creds DEntisT
if(argument[i] == '}') end = i;
}

if((start != -1 && end == -1) || (start == -1 && end != -1))
{
dpp_fatalerror(7);
return 1;
}

strmid(symbolname, argument, start+1, end);
strmid(replacementname, argument, start, end+1);

Expand Down
7 changes: 7 additions & 0 deletions src/core/sys_utils.inc
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,12 @@ stock dpp_fatalerror(errorid, const fmat[] = "")
dpp_info("Process has been terminated to prevent further complication.");
return 1;
}
if(errorid == 7)
{
dpp_fatalerror__("Format system failed.");
dpp_terminated = 1;
dpp_info("Process has been terminated to prevent further complication.");
return 1;
}
return 0;
}
64 changes: 61 additions & 3 deletions src/modules/header.inc
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,63 @@ stock dpp_deletefunc(const name[])
return 1;
}

stock dpp_inheritfunc(funcname[],fromfunc[],private=0)
{
dpp_argclasscheck(fromfunc);
dpp_symbolcheck__(funcname);
if(dpp_currentobject != DPP_INVALID_OBJECT_ID)
{
new newvalue[dpp_argcharsize];
format(newvalue,sizeof(newvalue),"DPPOf@%s_%s",dpp_objectname[dpp_currentobject],funcname);
strmid(funcname, newvalue, 0, dpp_argcharsize,dpp_argcharsize);
}
new _fromfunc__ = -1;
for(new i; i < dpp_maxfuncs; i++)
{
if(!strcmp(dpp_funcname[i], fromfunc))
{
if(dpp_validfunc[i] == 1 && dpp_hookform[i] == 0)
{
if(dpp_virtualfunc[i] == 1)
{
_fromfunc__ = i;
}
}
}
}
if(_fromfunc__ == -1)
{
return 1;
}

for(new i; i < dpp_maxfuncs; i++)
{
if(dpp_validfunc[i] == 0)
{
dpp_validfunc[i] = 1;
//dpp_structtype[i] = dpp_structtype__;
//dpp_methodform[i] = method;

dpp_returntype[i] = dpp_returntype[_fromfunc__];

dpp_privatefunc[i] = private;


for(new argid; argid < dpp_maxformargs; argid++)
{
strmid(dpp_args[i][argid][dpp_argname],dpp_args[_fromfunc__][argid][dpp_argname],0,100,100);
}

strmid(dpp_funcname[i], funcname, 0, 64);

strmid(dpp_funccodeblock[i], dpp_funccodeblock[_fromfunc__], 0,dpp_buffersize,dpp_buffersize);

return 1;
}
}
return 1;
}

stock dpp_createfunc(funcname[], const args[], autoform = 0, hookform = 0, method = 0, ret = dpp_rtn_type_void)
{
if(hookform == 1)
Expand All @@ -411,7 +468,7 @@ stock dpp_createfunc(funcname[], const args[], autoform = 0, hookform = 0, metho
strmid(funcname, newvalue, 0, dpp_argcharsize,dpp_argcharsize);
}
dpp_symbolcheck__(funcname);
new dpp_formcount;
//new dpp_formcount;
for(new i; i < dpp_maxfuncs; i++)
{
if(dpp_validfunc[i] == 0)
Expand All @@ -433,8 +490,9 @@ stock dpp_createfunc(funcname[], const args[], autoform = 0, hookform = 0, metho
dpp_returntype[i] = ret;

dpp_privatefunc[i] = dpp_setprivate__;
dpp_virtualfunc[i] = dpp_setvirtual__;

for(new y; y < dpp_maxfuncs; y++)
/*for(new y; y < dpp_maxfuncs; y++)
{
if(!strcmp(dpp_funcname[y], funcname))
{
Expand All @@ -448,7 +506,7 @@ stock dpp_createfunc(funcname[], const args[], autoform = 0, hookform = 0, metho
if(dpp_formcount > 1)
{
dpp_warning("There are multiple forms with name \"%s\" created.",funcname);
}
}*/

new formargs[dpp_maxformargs][100];
dpp_parseline(args,formargs,',');
Expand Down
120 changes: 116 additions & 4 deletions src/modules/interpreter.inc
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ stock dpp_process(line[])
return 1;
}

if((!strcmp(funcdeclgroup2[1], "public")) || (!strcmp(funcdeclgroup2[1], "private")))
if((!strcmp(funcdeclgroup2[1], "public")) || (!strcmp(funcdeclgroup2[1], "private")) || (!strcmp(funcdeclgroup2[1], "virtual")))
{
if(dpp_processfunc != DPP_INVALID_FORM_ID)
{
Expand All @@ -850,10 +850,15 @@ stock dpp_process(line[])
}

dpp_setprivate__ = 0;
dpp_setvirtual__ = 0;
if(!strcmp(funcdeclgroup2[1], "private"))
{
dpp_setprivate__ = 1;
}
if(!strcmp(funcdeclgroup2[1], "virtual"))
{
dpp_setvirtual__ = 1;
}

new arguments[2][1024];
strmid(arguments[0], tokengroup2[1], 0,256,256);
Expand Down Expand Up @@ -1443,7 +1448,7 @@ stock dpp_process(line[])
///////////////////////////////////////////////////////
////
////
//// NAMESPACE, OBJECT & CLASS SYS
//// NAMESPACE, CONSTEXPR, OBJECT & CLASS SYS
////
////
///////////////////////////////////////////////////////
Expand All @@ -1456,6 +1461,28 @@ stock dpp_process(line[])
return 1;
}

//dpp_parseline_2
if(!strcmp(tokengroup[0], "public"))
{
new funcgroup_inherit[2][64];
dpp_parseline_2(tokengroup[1],funcgroup_inherit,"->");
if(!isnull(funcgroup_inherit[0]) && !isnull(funcgroup_inherit[1]))
{
dpp_inheritfunc(funcgroup_inherit[0],funcgroup_inherit[1]);
}
return 1;
}
if(!strcmp(tokengroup[0], "private"))
{
new funcgroup_inherit[2][64];
dpp_parseline_2(tokengroup[1],funcgroup_inherit,"->");
if(!isnull(funcgroup_inherit[0]) && !isnull(funcgroup_inherit[1]))
{
dpp_inheritfunc(funcgroup_inherit[0],funcgroup_inherit[1],.private=1);
}
return 1;
}

if(!strcmp(tokengroup[0], "constexpr"))
{
if(!strcmp(tokengroup[1], "namespace"))
Expand Down Expand Up @@ -3522,7 +3549,7 @@ stock dpp_process(line[])
///////////////////////////////////////////////////////
////
////
//// USER/INLINE FUNC SYS
//// USER/OBJECT/INLINE FUNC SYS
////
////
///////////////////////////////////////////////////////
Expand Down Expand Up @@ -4340,6 +4367,11 @@ stock dpp_process(line[])
dpp_funcfound = CallLocalFunction("dpp_processSAMP@GLOBAL", "sss", funcgroup_form,args_form,args_fconst);
}

if(dpp_funcfound == 0)
{
dpp_funcfound = CallLocalFunction("dpp_processobj", "sss", funcgroup_form,args_form,args_fconst);
}



///////////////////////////////////////////////////////
Expand All @@ -4351,7 +4383,7 @@ stock dpp_process(line[])
///////////////////////////////////////////////////////


CallRemoteFunction("dppcord_process", "ssssss", funcgroup_form,args_form,args_fconst,funcgroup,args,args_const);
//CallRemoteFunction("dppcord_process", "ssssss", funcgroup_form,args_form,args_fconst,funcgroup,args,args_const);

////////////////////
if(dpp_funcfound == 0)
Expand Down Expand Up @@ -4391,6 +4423,10 @@ public dpp_processuser(funcgroup[][],args[][],args_const[][])
{
return 1;
}
if(dpp_virtualfunc[i] == 1)
{
return 1;
}
if(dpp_hookform[i] == 0)
{
for(new argid; argid < dpp_maxformargs; argid++)
Expand Down Expand Up @@ -4494,6 +4530,82 @@ public dpp_processuser(funcgroup[][],args[][],args_const[][])
return 0;
}

dpp_processobj(funcgroup[][],args[][],args_const[][]);
public dpp_processobj(funcgroup[][],args[][],args_const[][])
{
new dpp_object_ID__ = -1;
for(new i; i < dpp_maxobj; i++)
{
if(!strcmp(dpp_objectname[i],funcgroup[0]) && dpp_validobject[i] == 1)
{
dpp_object_ID__ = i;
break;
}
}
if(dpp_object_ID__ == -1) return 0;

new object_func_name[64];
format(object_func_name,sizeof object_func_name,"DPPOf@%s_%s",funcgroup[0],funcgroup[1]);

for(new i; i < dpp_maxfuncs; i++)
{
if(!strcmp(dpp_funcname[i], object_func_name) && dpp_validfunc[i] == 1)
{
for(new argid; argid < dpp_maxformargs; argid++)
{
strmid(dpp_args[i][argid][dpp_argvalue],
args[argid],
0,
dpp_argcharsize/2,
dpp_argcharsize/2);
//dpp_error("ARG BACKTRACE :: dpp_args[i][argid][dpp_argvalue] : '%s'",dpp_args[i][argid][dpp_argvalue]);
}
if(dpp_lastdeco == dpp_deco_quiet)
{
dpp_subexecute(dpp_funccodeblock[i], i);
dpp_lastdeco = dpp_deco_invalid;
return 1;
}
dpp_returned[i] = 0;
dpp_processfunc = i;
//dpp_warning("#1 Func: '%s' | Code: '%s'",dpp_funcname[i],dpp_funccodeblock[i]);
dpp_subexecute(dpp_funccodeblock[i], i);
//dpp_warning("#2 Func: '%s' | Code: '%s'",dpp_funcname[i],dpp_funccodeblock[i]);
dpp_debug("dpp_funccodeblock[i]:%s",dpp_funccodeblock[i]);

dpp_clearformstack(dpp_processfunc);

dpp_deletestaticvars();


dpp_processfunc = DPP_INVALID_FORM_ID;

if(dpp_returntype[i] == dpp_rtn_type_int)
{
dpp_internal<return>(dpp_funcreturn_int[i]);
}
if(dpp_returntype[i] == dpp_rtn_type_bool)
{
dpp_internal<bool:return>(dpp_funcreturn_bool[i]);
}
if(dpp_returntype[i] == dpp_rtn_type_str)
{
dpp_internal<string:return>(dpp_funcreturn_str[i]<dpp_buffersize/2>);
}
if(dpp_returntype[i] == dpp_rtn_type_double)
{
dpp_internal<Float:return>(dpp_funcreturn_double[i]);
}
if(dpp_returntype[i] == dpp_rtn_type_char)
{
dpp_internal<char return>(dpp_funcreturn_char[i]);
}
dpp_internal<return>(1);
}
}
return 0;
}

dpp_processpragma(dirgroup[][],dirargs[][]);
public dpp_processpragma(dirgroup[][],dirargs[][])
{
Expand Down
2 changes: 1 addition & 1 deletion src/pawnscript.pwn
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ the Initial Developer. All Rights Reserved.
*/

#pragma dynamic 16108732
#pragma dynamic 94608116
#pragma warning disable 204
#pragma warning disable 211
#pragma option -;+
Expand Down
2 changes: 2 additions & 0 deletions src/ps_setup.pwn
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,9 @@ new dpp_hookform[dpp_maxfuncs__];
new dpp_structtype[dpp_maxfuncs__];
new dpp_methodform[dpp_maxfuncs__];
new dpp_privatefunc[dpp_maxfuncs__];
new dpp_virtualfunc[dpp_maxfuncs__];
new dpp_setprivate__ = 0;
new dpp_setvirtual__ = 0;
enum __dpp_argcache
{
dpp_argname[dpp_maxsymbolchar/2],
Expand Down

0 comments on commit 5b741de

Please sign in to comment.