Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DEntis-T committed Jul 2, 2024
1 parent f7337cb commit 04d2bd9
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 30 deletions.
Binary file modified scriptfiles/index.ps
Binary file not shown.
13 changes: 11 additions & 2 deletions src/components/data.inc
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,18 @@ public dpp_processdata(funcgroup[][],args[][],args_const[][])
dpp_internal<return>(dist);
}
//dpp_data__testfunc
if(!strcmp(funcgroup[1], "testfunc"))
if(!strcmp(funcgroup[1], "persistent"))
{
dpp_data__testfunc();
dpp_data__persistent(.methodused = 0);

if(!strcmp(funcgroup[2], "import"))
{
dpp_data__persistent(.methodused = 1, .methodid = 0);
}
if(!strcmp(funcgroup[2], "export"))
{
dpp_data__persistent(.methodused = 1, .methodid = 1);
}
dpp_internal<return>(1);
}

Expand Down
132 changes: 105 additions & 27 deletions src/core/component_impl.inc
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,11 @@ stock dpp_data__strdist(const a[], const b[])
return dist;
}

stock dpp_data__testfunc()
stock dpp_data__persistent(methodused = 0, methodid = 1)
{
if(dpp_lastdeco == dpp_deco_import)
if(methodused == 0) if(dpp_lastdeco == dpp_deco_import)
{
//dpp_info("dpp_data__testfunc IMPORT | typename : '%s' | to : '%s' | from : '%s'", dpp_typename__,dpp_to__,dpp_from__);
new mul2;
for(new i; i < strlen(dpp_from__); i++)
{
if(dpp_from__[i] == '\"') mul2++, strdel(dpp_from__, i, i+1);
}
if(mul2 == 0)
{
dpp_error("You need to use '\"' to start a string.",);
return 0;
}
if(mul2 != 2)
{
dpp_error("Argument error; [%i] \"%s\"", mul2, dpp_from__);
return 0;
}

new varid = -1;

Expand Down Expand Up @@ -126,24 +111,117 @@ stock dpp_data__testfunc()
return 1;
}

if(dpp_lastdeco == dpp_deco_export)
if(methodused == 0) if(dpp_lastdeco == dpp_deco_export)
{
//dpp_info("dpp_data__testfunc EXPORT | typename : '%s' | to : '%s' | from : '%s'", dpp_typename__,dpp_to__,dpp_from__);
new mul2;
for(new i; i < strlen(dpp_to__); i++)

new varid = -1;

for(new i; i < dpp_maxvar; i++)
{
if(dpp_to__[i] == '\"') mul2++, strdel(dpp_to__, i, i+1);
if(!strcmp(dpp_vardata[i][var_name], dpp_from__))
{
if(dpp_vardata[i][var_valid] == 1)
{
varid = i;
break;
}
}
}
if(mul2 == 0)

if(varid == -1)
{
dpp_error("You need to use '\"' to start a string.",);
return 0;
dpp_error("Invalid variable specified ('%s').",dpp_from__);
return 1;
}
if(mul2 != 2)

if(!strcmp(dpp_typename__, "int"))
{
dpp_error("Argument error; [%i] \"%s\"", mul2, dpp_to__);
return 0;
dpp_exportint(dpp_to__,dpp_vardata[varid][integervalue]);
return 1;
}
if(!strcmp(dpp_typename__, "bool"))
{
dpp_exportbool(dpp_to__,dpp_vardata[varid][boolvalue]);
return 1;
}
if(!strcmp(dpp_typename__, "str"))
{
dpp_exportstr(dpp_to__,dpp_vardata[varid][stringvalue]);
return 1;
}
if(!strcmp(dpp_typename__, "double"))
{
dpp_exportdouble(dpp_to__,dpp_vardata[varid][floatvalue]);
return 1;
}
if(!strcmp(dpp_typename__, "char"))
{
dpp_exportchar(dpp_to__,dpp_vardata[varid][charvalue]);
return 1;
}

dpp_error("Invalid data type specified.",);
return 1;
}
/********************************/
if(methodused == 1) if(methodid == 0)
{
//dpp_info("dpp_data__testfunc IMPORT | typename : '%s' | to : '%s' | from : '%s'", dpp_typename__,dpp_to__,dpp_from__);

new varid = -1;

for(new i; i < dpp_maxvar; i++)
{
if(!strcmp(dpp_vardata[i][var_name], dpp_to__))
{
if(dpp_vardata[i][var_valid] == 1)
{
varid = i;
break;
}
}
}

if(varid == -1)
{
dpp_error("Invalid variable specified ('%s').",dpp_to__);
return 1;
}

if(!strcmp(dpp_typename__, "int")) //if(!strcmp(structgroup[1],"int"))
{
dpp_importint(dpp_from__,varid);
return 1;
}
if(!strcmp(dpp_typename__, "bool")) //if(!strcmp(structgroup[1], "bool"))
{
dpp_importbool(dpp_from__,varid);
return 1;
}
if(!strcmp(dpp_typename__, "str")) //if(!strcmp(structgroup[1], "str"))
{
dpp_importstr(dpp_from__,varid);
return 1;
}
if(!strcmp(dpp_typename__, "double")) //if(!strcmp(structgroup[1], "double"))
{
dpp_importdouble(dpp_from__,varid);
return 1;
}
if(!strcmp(dpp_typename__, "char")) //if(!strcmp(structgroup[1], "char"))
{
dpp_importchar(dpp_from__,varid);
return 1;
}

dpp_error("Invalid data type specified.",);
return 1;
}

if(methodused == 1) if(methodid == 1)
{
//dpp_info("dpp_data__testfunc EXPORT | typename : '%s' | to : '%s' | from : '%s'", dpp_typename__,dpp_to__,dpp_from__);

new varid = -1;

Expand Down
2 changes: 1 addition & 1 deletion src/core/ver.inc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ dpp_genvers__()

void:dpp_verinfo__()
{
printf("\tPawnScript %s\tBrace Inc.", dpp_vers_string__);
printf("\tPawnScript %s\tBrace Software Co.", dpp_vers_string__);
printf("\tPawn %d.%02d.%02d\t\tITB CompuPhase", __Pawn >>> 8, __Pawn & 0xFF, __PawnBuild/*__pawn_build*/); // from YSI
}

Expand Down

0 comments on commit 04d2bd9

Please sign in to comment.