mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
Add --hateentry to perl-doc-parser.pl - format perl_hateentry.cpp
This commit is contained in:
parent
465071c2cf
commit
6faaff31be
@ -9,6 +9,7 @@ sub usage() {
|
||||
print " --door - Prints methods for just door class methods\n";
|
||||
print " --group - Prints methods for just group 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";
|
||||
exit(1);
|
||||
}
|
||||
@ -49,7 +50,7 @@ for my $file (@files) {
|
||||
chomp;
|
||||
$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
|
||||
if ($export=~/all|client/i) {
|
||||
@ -87,6 +88,12 @@ for my $file (@files) {
|
||||
$object_prefix = "\$group->";
|
||||
}
|
||||
|
||||
#::: Hateentry export
|
||||
if ($export=~/all|hateentry/i) {
|
||||
$split_key = "HateEntry::";
|
||||
$object_prefix = "\$hate_entry->";
|
||||
}
|
||||
|
||||
#::: Split on croak usage
|
||||
@data = split($split_key, $line);
|
||||
$usage = trim($data[1]);
|
||||
|
||||
@ -18,7 +18,9 @@
|
||||
|
||||
#include "../common/features.h"
|
||||
#include "client.h"
|
||||
|
||||
#ifdef EMBPERL_XS_CLASSES
|
||||
|
||||
#include "../common/global_define.h"
|
||||
#include "embperl.h"
|
||||
|
||||
@ -29,84 +31,80 @@
|
||||
#include "../common/linked_list.h"
|
||||
#include "hate_list.h"
|
||||
|
||||
#ifdef THIS /* this macro seems to leak out on some systems */
|
||||
#ifdef THIS /* this macro seems to leak out on some systems */
|
||||
#undef THIS
|
||||
#endif
|
||||
|
||||
XS(XS_HateEntry_GetEnt); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_HateEntry_GetEnt)
|
||||
{
|
||||
XS(XS_HateEntry_GetEnt) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: HateEntry::GetData(THIS)");
|
||||
{
|
||||
struct_HateList * THIS;
|
||||
Mob * RETVAL;
|
||||
struct_HateList *THIS;
|
||||
Mob *RETVAL;
|
||||
|
||||
if (sv_derived_from(ST(0), "HateEntry")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(struct_HateList *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(struct_HateList *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type tHateEntry");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->entity_on_hatelist;
|
||||
ST(0) = sv_newmortal();
|
||||
sv_setref_pv(ST(0), "Mob", (void*)RETVAL);
|
||||
sv_setref_pv(ST(0), "Mob", (void *) RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_HateEntry_GetHate); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_HateEntry_GetHate)
|
||||
{
|
||||
XS(XS_HateEntry_GetHate) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: HateEntry::GetHate(THIS)");
|
||||
{
|
||||
struct_HateList * THIS;
|
||||
struct_HateList *THIS;
|
||||
int32 RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if (sv_derived_from(ST(0), "HateEntry")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(struct_HateList *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(struct_HateList *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type tHateEntry");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->stored_hate_amount;
|
||||
XSprePUSH; PUSHi((IV)RETVAL);
|
||||
XSprePUSH;
|
||||
PUSHi((IV) RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_HateEntry_GetDamage); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_HateEntry_GetDamage)
|
||||
{
|
||||
XS(XS_HateEntry_GetDamage) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: HateEntry::GetDamage(THIS)");
|
||||
{
|
||||
struct_HateList * THIS;
|
||||
struct_HateList *THIS;
|
||||
int32 RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if (sv_derived_from(ST(0), "HateEntry")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(struct_HateList *,tmp);
|
||||
}
|
||||
else
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(struct_HateList *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type tHateEntry");
|
||||
if(THIS == nullptr)
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->hatelist_damage;
|
||||
XSprePUSH; PUSHi((IV)RETVAL);
|
||||
XSprePUSH;
|
||||
PUSHi((IV) RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
@ -116,24 +114,23 @@ extern "C"
|
||||
#endif
|
||||
|
||||
XS(boot_HateEntry);
|
||||
XS(boot_HateEntry)
|
||||
{
|
||||
XS(boot_HateEntry) {
|
||||
dXSARGS;
|
||||
char file[256];
|
||||
strncpy(file, __FILE__, 256);
|
||||
file[255] = 0;
|
||||
|
||||
if(items != 1)
|
||||
if (items != 1)
|
||||
fprintf(stderr, "boot_quest does not take any arguments.");
|
||||
char buf[128];
|
||||
|
||||
//add the strcpy stuff to get rid of const warnings....
|
||||
|
||||
XS_VERSION_BOOTCHECK ;
|
||||
XS_VERSION_BOOTCHECK;
|
||||
|
||||
newXSproto(strcpy(buf, "GetEnt"), XS_HateEntry_GetEnt, file, "$");
|
||||
newXSproto(strcpy(buf, "GetDamage"), XS_HateEntry_GetDamage, file, "$");
|
||||
newXSproto(strcpy(buf, "GetHate"), XS_HateEntry_GetHate, file, "$");
|
||||
newXSproto(strcpy(buf, "GetEnt"), XS_HateEntry_GetEnt, file, "$");
|
||||
newXSproto(strcpy(buf, "GetDamage"), XS_HateEntry_GetDamage, file, "$");
|
||||
newXSproto(strcpy(buf, "GetHate"), XS_HateEntry_GetHate, file, "$");
|
||||
|
||||
XSRETURN_YES;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user