ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/cfperl.xs
(Generate patch)

Comparing deliantra/server/server/cfperl.xs (file contents):
Revision 1.374 by root, Thu Apr 15 06:05:52 2010 UTC vs.
Revision 1.375 by root, Sun Apr 18 05:08:14 2010 UTC

477 || (SvSTASH (SvRV (sv)) != stash_cf_object_wrap 477 || (SvSTASH (SvRV (sv)) != stash_cf_object_wrap
478 && SvSTASH (SvRV (sv)) != stash_cf_object_player_wrap 478 && SvSTASH (SvRV (sv)) != stash_cf_object_player_wrap
479 && SvSTASH (SvRV (sv)) != stash_cf_arch_wrap 479 && SvSTASH (SvRV (sv)) != stash_cf_arch_wrap
480 && !sv_derived_from (sv, "cf::object"))) 480 && !sv_derived_from (sv, "cf::object")))
481 croak ("object of type cf::object expected"); 481 croak ("object of type cf::object expected");
482
483 return SvPTR_nc (sv);
484}
485
486static long noinline
487SvPTR_ornull_maptile (SV *sv)
488{
489 if (expect_false (!SvOK (sv))) return 0;
490
491 if (!SvROK (sv)
492 || (SvSTASH (SvRV (sv)) != stash_cf_map_wrap
493 && !sv_derived_from (sv, "cf::map")))
494 croak ("object of type cf::map expected");
482 495
483 return SvPTR_nc (sv); 496 return SvPTR_nc (sv);
484} 497}
485 498
486static long noinline 499static long noinline
563static inline void sv_to (SV *sv, unsigned long &v) { v = SvUV (sv); } 576static inline void sv_to (SV *sv, unsigned long &v) { v = SvUV (sv); }
564static inline void sv_to (SV *sv, signed long long &v) { v = ( signed long long)SvVAL64 (sv); } 577static inline void sv_to (SV *sv, signed long long &v) { v = ( signed long long)SvVAL64 (sv); }
565static inline void sv_to (SV *sv, unsigned long long &v) { v = (unsigned long long)SvVAL64 (sv); } 578static inline void sv_to (SV *sv, unsigned long long &v) { v = (unsigned long long)SvVAL64 (sv); }
566static inline void sv_to (SV *sv, float &v) { v = SvNV (sv); } 579static inline void sv_to (SV *sv, float &v) { v = SvNV (sv); }
567static inline void sv_to (SV *sv, double &v) { v = SvNV (sv); } 580static inline void sv_to (SV *sv, double &v) { v = SvNV (sv); }
568static inline void sv_to (SV *sv, client * &v) { v = (client *) (attachable *)SvPTR_ornull_client (sv); } 581static inline void sv_to (SV *sv, client * &v) { v = (client *) (attachable *)SvPTR_ornull_client (sv); }
569static inline void sv_to (SV *sv, player * &v) { v = (player *) (attachable *)SvPTR_ornull_player (sv); } 582static inline void sv_to (SV *sv, player * &v) { v = (player *) (attachable *)SvPTR_ornull_player (sv); }
570static inline void sv_to (SV *sv, object * &v) { v = (object *) (attachable *)SvPTR_ornull_object (sv); } 583static inline void sv_to (SV *sv, object * &v) { v = (object *) (attachable *)SvPTR_ornull_object (sv); }
584static inline void sv_to (SV *sv, maptile * &v) { v = (maptile *) (attachable *)SvPTR_ornull_maptile (sv); }
571static inline void sv_to (SV *sv, archetype * &v) { v = (archetype *)(attachable *)SvPTR_ornull (sv, "cf::arch"); } 585static inline void sv_to (SV *sv, archetype * &v) { v = (archetype *)(attachable *)SvPTR_ornull (sv, "cf::arch"); }
572static inline void sv_to (SV *sv, maptile * &v) { v = (maptile *) (attachable *)SvPTR_ornull (sv, "cf::map"); }
573static inline void sv_to (SV *sv, region * &v) { v = (region *) (attachable *)SvPTR_ornull (sv, "cf::region"); } 586static inline void sv_to (SV *sv, region * &v) { v = (region *) (attachable *)SvPTR_ornull (sv, "cf::region"); }
574static inline void sv_to (SV *sv, attachable * &v) { v = (attachable *)SvPTR_ornull (sv, "cf::attachable"); } 587static inline void sv_to (SV *sv, attachable * &v) { v = (attachable *)SvPTR_ornull (sv, "cf::attachable"); }
575static inline void sv_to (SV *sv, partylist * &v) { v = (partylist *) SvPTR_ornull (sv, "cf::party"); } 588static inline void sv_to (SV *sv, partylist * &v) { v = (partylist *) SvPTR_ornull (sv, "cf::party"); }
576static inline void sv_to (SV *sv, living * &v) { v = (living *) SvPTR_ornull (sv, "cf::living"); } 589static inline void sv_to (SV *sv, living * &v) { v = (living *) SvPTR_ornull (sv, "cf::living"); }
577static inline void sv_to (SV *sv, mapspace * &v) { v = (mapspace *) SvPTR_ornull (sv, "cf::mapspace"); } 590static inline void sv_to (SV *sv, mapspace * &v) { v = (mapspace *) SvPTR_ornull (sv, "cf::mapspace"); }
693template<class type> 706template<class type>
694static void noinline 707static void noinline
695cf_obj_to (SV *arg, type &var) 708cf_obj_to (SV *arg, type &var)
696{ 709{
697 sv_to (arg, var); 710 sv_to (arg, var);
698 if (!var) 711 if (expect_false (!var))
699 croak ("must not pass invalid/null cf_obj here"); 712 croak ("must not pass invalid/null cf_obj here");
700} 713}
701 714
702template<class object> 715template<class object>
703static void noinline 716static void noinline
704cf_obj_ornull_to (SV *arg, object *&var) 717cf_obj_ornull_to (SV *arg, object *&var)
705{ 718{
706 if (SvOK (arg)) 719 if (SvOK (arg))
707 { 720 {
708 sv_to (arg, var); 721 sv_to (arg, var);
709 if (!var) 722 if (expect_false (!var))
710 croak ("unable to convert perl object to C++ object"); 723 croak ("unable to convert perl object to C++ object");
711 } 724 }
712 else 725 else
713 var = 0; 726 var = 0;
714} 727}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines