add --questitem to perl-doc-parser.pl - format and add usage doc to perl_questitem.cpp

This commit is contained in:
Akkadius 2018-07-01 20:52:56 -05:00
parent 9e03d76211
commit 595138679d
2 changed files with 101 additions and 102 deletions

View File

@ -11,6 +11,7 @@ sub usage() {
print " --object - Prints methods for just object class methods\n"; print " --object - Prints methods for just object class methods\n";
print " --group - Prints methods for just group class methods\n"; print " --group - Prints methods for just group class methods\n";
print " --raid - Prints methods for just raid class methods\n"; print " --raid - Prints methods for just raid class methods\n";
print " --questitem - Prints methods for just questitem 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 " --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";
@ -45,6 +46,8 @@ for my $file (@files) {
} }
@methods = (); @methods = ();
$split_key = "";
$object_prefix = "";
#::: Open File #::: Open File
print "\nOpening '" . $file . "'\n"; print "\nOpening '" . $file . "'\n";
@ -53,7 +56,7 @@ for my $file (@files) {
chomp; chomp;
$line = $_; $line = $_;
if ($line=~/Client::|Mob::|Corpse::|EntityList::|Doors::|Group::|HateEntry::|NPC::|Object::|Raid::/i && $line=~/_croak/i) { if ($line=~/Perl_croak/i && $line=~/Usa/i && $line=~/::/i) {
#::: Client export #::: Client export
if ($export=~/all|client/i && $line=~/Client::/i) { if ($export=~/all|client/i && $line=~/Client::/i) {
@ -115,6 +118,12 @@ for my $file (@files) {
$object_prefix = "\$hate_entry->"; $object_prefix = "\$hate_entry->";
} }
#::: Hateentry export
if ($export=~/all|questitem/i && $line=~/QuestItem::/i) {
$split_key = "QuestItem::";
$object_prefix = "\$quest_item->";
}
#::: 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"
@ -45,24 +47,24 @@ XS(XS_QuestItem_GetName) {
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV *) SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *, tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if (THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetItem()->Name; RETVAL = THIS->GetItem()->Name;
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; sv_setpv(TARG, RETVAL);
XSprePUSH;
PUSHTARG;
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_QuestItem_SetScale); XS(XS_QuestItem_SetScale);
XS(XS_QuestItem_SetScale) XS(XS_QuestItem_SetScale) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: QuestItem::SetScale(THIS, scale factor)"); Perl_croak(aTHX_ "Usage: QuestItem::SetScale(THIS, float scale_multiplier)");
{ {
EQEmu::ItemInstance *THIS; EQEmu::ItemInstance *THIS;
float Mult; float Mult;
@ -70,8 +72,7 @@ XS(XS_QuestItem_SetScale)
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV *) SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *, tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if (THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -86,11 +87,10 @@ XS(XS_QuestItem_SetScale)
} }
XS(XS_QuestItem_ItemSay); XS(XS_QuestItem_ItemSay);
XS(XS_QuestItem_ItemSay) XS(XS_QuestItem_ItemSay) {
{
dXSARGS; dXSARGS;
if (items != 2 && items != 3) if (items != 2 && items != 3)
Perl_croak(aTHX_ "Usage: QuestItem::ItemSay(THIS, text [, language])"); Perl_croak(aTHX_ "Usage: QuestItem::ItemSay(THIS, string text [int language_id])");
{ {
EQEmu::ItemInstance *THIS; EQEmu::ItemInstance *THIS;
Const_char *text; Const_char *text;
@ -99,8 +99,7 @@ XS(XS_QuestItem_ItemSay)
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV *) SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *, tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if (THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -115,8 +114,7 @@ XS(XS_QuestItem_ItemSay)
} }
XS(XS_QuestItem_IsType); /* prototype to pass -Wmissing-prototypes */ XS(XS_QuestItem_IsType); /* prototype to pass -Wmissing-prototypes */
XS(XS_QuestItem_IsType) XS(XS_QuestItem_IsType) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: QuestItem::IsType(THIS, type)"); Perl_croak(aTHX_ "Usage: QuestItem::IsType(THIS, type)");
@ -128,8 +126,7 @@ XS(XS_QuestItem_IsType)
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV *) SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *, tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if (THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -142,8 +139,7 @@ XS(XS_QuestItem_IsType)
} }
XS(XS_QuestItem_IsAttuned); /* prototype to pass -Wmissing-prototypes */ XS(XS_QuestItem_IsAttuned); /* prototype to pass -Wmissing-prototypes */
XS(XS_QuestItem_IsAttuned) XS(XS_QuestItem_IsAttuned) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: QuestItem::IsAttuned(THIS)"); Perl_croak(aTHX_ "Usage: QuestItem::IsAttuned(THIS)");
@ -154,8 +150,7 @@ XS(XS_QuestItem_IsAttuned)
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV *) SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *, tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if (THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -168,8 +163,7 @@ XS(XS_QuestItem_IsAttuned)
} }
XS(XS_QuestItem_GetCharges); /* prototype to pass -Wmissing-prototypes */ XS(XS_QuestItem_GetCharges); /* prototype to pass -Wmissing-prototypes */
XS(XS_QuestItem_GetCharges) XS(XS_QuestItem_GetCharges) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: QuestItem::GetCharges(THIS)"); Perl_croak(aTHX_ "Usage: QuestItem::GetCharges(THIS)");
@ -181,24 +175,23 @@ XS(XS_QuestItem_GetCharges)
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV *) SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *, tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if (THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetCharges(); RETVAL = THIS->GetCharges();
XSprePUSH; PUSHi((IV)RETVAL); XSprePUSH;
PUSHi((IV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_QuestItem_GetAugment); /* prototype to pass -Wmissing-prototypes */ XS(XS_QuestItem_GetAugment); /* prototype to pass -Wmissing-prototypes */
XS(XS_QuestItem_GetAugment) XS(XS_QuestItem_GetAugment) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: QuestItem::GetAugment(THIS, augment_id)"); Perl_croak(aTHX_ "Usage: QuestItem::GetAugment(THIS, int16 slot_id)");
{ {
EQEmu::ItemInstance *THIS; EQEmu::ItemInstance *THIS;
int16 slot_id = (int16) SvIV(ST(1)); int16 slot_id = (int16) SvIV(ST(1));
@ -207,8 +200,7 @@ XS(XS_QuestItem_GetAugment)
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV *) SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *, tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if (THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
@ -221,8 +213,7 @@ XS(XS_QuestItem_GetAugment)
} }
XS(XS_QuestItem_GetID); /* prototype to pass -Wmissing-prototypes */ XS(XS_QuestItem_GetID); /* prototype to pass -Wmissing-prototypes */
XS(XS_QuestItem_GetID) XS(XS_QuestItem_GetID) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: QuestItem::GetID(THIS)"); Perl_croak(aTHX_ "Usage: QuestItem::GetID(THIS)");
@ -234,14 +225,14 @@ XS(XS_QuestItem_GetID)
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV *) SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *, tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if (THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetItem()->ID; RETVAL = THIS->GetItem()->ID;
XSprePUSH; PUSHi((IV)RETVAL); XSprePUSH;
PUSHi((IV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
@ -251,8 +242,7 @@ extern "C"
#endif #endif
XS(boot_QuestItem); XS(boot_QuestItem);
XS(boot_QuestItem) XS(boot_QuestItem) {
{
dXSARGS; dXSARGS;
char file[256]; char file[256];
strncpy(file, __FILE__, 256); strncpy(file, __FILE__, 256);