Add --hateentry to perl-doc-parser.pl - format perl_hateentry.cpp

This commit is contained in:
Akkadius 2018-07-01 20:04:53 -05:00
parent 465071c2cf
commit 6faaff31be
2 changed files with 41 additions and 37 deletions

View File

@ -9,6 +9,7 @@ sub usage() {
print " --door - Prints methods for just door class methods\n"; print " --door - Prints methods for just door class methods\n";
print " --group - Prints methods for just group class methods\n"; print " --group - Prints methods for just group class methods\n";
print " --corpse - Prints methods for just corpse class methods\n"; print " --corpse - Prints methods for just corpse class methods\n";
print " --hateentry - Prints methods for just hateentry class methods\n";
print " --all - Prints methods for all classes\n"; print " --all - Prints methods for all classes\n";
exit(1); exit(1);
} }
@ -49,7 +50,7 @@ for my $file (@files) {
chomp; chomp;
$line = $_; $line = $_;
if ($line=~/Client::|Mob::|Corpse::|EntityList::|Doors::|Group::/i && $line=~/_croak/i) { if ($line=~/Client::|Mob::|Corpse::|EntityList::|Doors::|Group::|HateEntry::/i && $line=~/_croak/i) {
#::: Client export #::: Client export
if ($export=~/all|client/i) { if ($export=~/all|client/i) {
@ -87,6 +88,12 @@ for my $file (@files) {
$object_prefix = "\$group->"; $object_prefix = "\$group->";
} }
#::: Hateentry export
if ($export=~/all|hateentry/i) {
$split_key = "HateEntry::";
$object_prefix = "\$hate_entry->";
}
#::: Split on croak usage #::: Split on croak usage
@data = split($split_key, $line); @data = split($split_key, $line);
$usage = trim($data[1]); $usage = trim($data[1]);

View File

@ -18,7 +18,9 @@
#include "../common/features.h" #include "../common/features.h"
#include "client.h" #include "client.h"
#ifdef EMBPERL_XS_CLASSES #ifdef EMBPERL_XS_CLASSES
#include "../common/global_define.h" #include "../common/global_define.h"
#include "embperl.h" #include "embperl.h"
@ -34,8 +36,7 @@
#endif #endif
XS(XS_HateEntry_GetEnt); /* prototype to pass -Wmissing-prototypes */ XS(XS_HateEntry_GetEnt); /* prototype to pass -Wmissing-prototypes */
XS(XS_HateEntry_GetEnt) XS(XS_HateEntry_GetEnt) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: HateEntry::GetData(THIS)"); Perl_croak(aTHX_ "Usage: HateEntry::GetData(THIS)");
@ -46,8 +47,7 @@ XS(XS_HateEntry_GetEnt)
if (sv_derived_from(ST(0), "HateEntry")) { if (sv_derived_from(ST(0), "HateEntry")) {
IV tmp = SvIV((SV *) SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(struct_HateList *, tmp); THIS = INT2PTR(struct_HateList *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type tHateEntry"); Perl_croak(aTHX_ "THIS is not of type tHateEntry");
if (THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -60,8 +60,7 @@ XS(XS_HateEntry_GetEnt)
} }
XS(XS_HateEntry_GetHate); /* prototype to pass -Wmissing-prototypes */ XS(XS_HateEntry_GetHate); /* prototype to pass -Wmissing-prototypes */
XS(XS_HateEntry_GetHate) XS(XS_HateEntry_GetHate) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: HateEntry::GetHate(THIS)"); Perl_croak(aTHX_ "Usage: HateEntry::GetHate(THIS)");
@ -73,21 +72,20 @@ XS(XS_HateEntry_GetHate)
if (sv_derived_from(ST(0), "HateEntry")) { if (sv_derived_from(ST(0), "HateEntry")) {
IV tmp = SvIV((SV *) SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(struct_HateList *, tmp); THIS = INT2PTR(struct_HateList *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type tHateEntry"); Perl_croak(aTHX_ "THIS is not of type tHateEntry");
if (THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->stored_hate_amount; RETVAL = THIS->stored_hate_amount;
XSprePUSH; PUSHi((IV)RETVAL); XSprePUSH;
PUSHi((IV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_HateEntry_GetDamage); /* prototype to pass -Wmissing-prototypes */ XS(XS_HateEntry_GetDamage); /* prototype to pass -Wmissing-prototypes */
XS(XS_HateEntry_GetDamage) XS(XS_HateEntry_GetDamage) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: HateEntry::GetDamage(THIS)"); Perl_croak(aTHX_ "Usage: HateEntry::GetDamage(THIS)");
@ -99,14 +97,14 @@ XS(XS_HateEntry_GetDamage)
if (sv_derived_from(ST(0), "HateEntry")) { if (sv_derived_from(ST(0), "HateEntry")) {
IV tmp = SvIV((SV *) SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(struct_HateList *, tmp); THIS = INT2PTR(struct_HateList *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type tHateEntry"); Perl_croak(aTHX_ "THIS is not of type tHateEntry");
if (THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->hatelist_damage; RETVAL = THIS->hatelist_damage;
XSprePUSH; PUSHi((IV)RETVAL); XSprePUSH;
PUSHi((IV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
@ -116,8 +114,7 @@ extern "C"
#endif #endif
XS(boot_HateEntry); XS(boot_HateEntry);
XS(boot_HateEntry) XS(boot_HateEntry) {
{
dXSARGS; dXSARGS;
char file[256]; char file[256];
strncpy(file, __FILE__, 256); strncpy(file, __FILE__, 256);