From b43b2eec3ba51ca30ba94e43f29da65a648f4537 Mon Sep 17 00:00:00 2001 From: GeneralGuy4872 Date: Mon, 7 Oct 2019 16:35:58 -0500 Subject: [PATCH] polish perl --- .gitattributes | 2 +- README.md | 4 ++-- src/iwannaflycurses.messy | 3 ++- src/modules/IWannaFly/Macro.pm | 8 ++++--- .../Types/Struct/classtyp/XSLIB/classtyp.xs | 22 ++++++++++++++----- .../Types/Struct/classtyp/classtyp.pm | 4 ++-- src/modules/IWannaFly/Types/free.pm | 1 + 7 files changed, 29 insertions(+), 15 deletions(-) diff --git a/.gitattributes b/.gitattributes index 54c74ab..882dd2d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -27,7 +27,7 @@ core.autocrlf=false *.pod = linguist-language=Pod # *.cl = linguist-language=Lisp # *.clp = linguist-language=Lisp -# *.scm = linguist-language=Scheme +*.scm = linguist-language=Scheme # *.sno = linguist-language=SNOBOL4 # *.bas = linguist-language=BASIC # *.apl = linguist-language=APL diff --git a/README.md b/README.md index 870db8b..d7ae5e8 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Iwannafly ========= -*roguelike game library written in C and Perl with extension interface useing minimal external propagating dependencies* +*roguelike game library written in C, Perl, and Guile, with extension interface useing minimal external propagating dependencies* Dependencies: @@ -71,8 +71,8 @@ Depends: - C library \ - C library "XSUB.h" - C library "INLINE.h" +- C library \ - Perl feature "switch" -- Perl module Safe - Perl module boolean - Perl module Exporter - Perl module optimize::int diff --git a/src/iwannaflycurses.messy b/src/iwannaflycurses.messy index 7a72387..527a8ca 100644 --- a/src/iwannaflycurses.messy +++ b/src/iwannaflycurses.messy @@ -203,8 +203,9 @@ #define PERL_NO_GET_CONTEXT #include #include -#include "XSUB.h" +/**guile command executor**/ +#include /**ncurses libraries**/ #include diff --git a/src/modules/IWannaFly/Macro.pm b/src/modules/IWannaFly/Macro.pm index c6b5c23..dc89550 100644 --- a/src/modules/IWannaFly/Macro.pm +++ b/src/modules/IWannaFly/Macro.pm @@ -1,4 +1,4 @@ -package IWannaFly; +package IWannaFly'Macro; use warnings; use strict; @@ -24,6 +24,8 @@ FILTER_ONLY code => sub { s/NIL/''/g }; FILTER_ONLY code => sub { s/¤/\$/g }; +FILTER_ONLY + code => sub { s/°/\$/g }; FILTER_ONLY code => sub { s/¢/\$/g }; FILTER_ONLY @@ -43,8 +45,8 @@ FILTER_ONLY FILTER_ONLY code => sub { s/ERR/-1/ig }; FILTER_ONLY - code => sub { s/«((?!»).*)»[\t]+:\(([\w]+)\)$/$1;\n\tgoto $2;\n/gm }; + code => sub { s/«((?!»).*)»[\t]+:\(([\w]+)\)$/$1;\n\tgoto $2;\n/g }; FILTER_ONLY - code => sub { s/«((?!»).*)»[\t]+:S\(([\w]+)\)F\(([\w]+)\)\n$/if ( $1 ) {\n\tgoto $2;\n} else {\n\tgoto $3;\n}/gm }; + code => sub { s/«((?!»).*)»[\t]+:S\(([\w]+)\)F\(([\w]+)\)\n$/if ( $1 ) {\n\tgoto $2;\n} else {\n\tgoto $3;\n}/g }; FILTER_ONLY code => sub { s/: int;/: optimize(int);/g }; diff --git a/src/modules/IWannaFly/Types/Struct/classtyp/XSLIB/classtyp.xs b/src/modules/IWannaFly/Types/Struct/classtyp/XSLIB/classtyp.xs index 7fd9a99..ad3a6da 100644 --- a/src/modules/IWannaFly/Types/Struct/classtyp/XSLIB/classtyp.xs +++ b/src/modules/IWannaFly/Types/Struct/classtyp/XSLIB/classtyp.xs @@ -51,10 +51,20 @@ iwfperl_sync_struct_classtype(input) HV* input CODE: - struct classtyp* ptr = hv_fetch(input,"Ptr",3,0); + SV** = hv_fetch(input,"Ptr",3,0); if (ptr != NULL) { - ((struct classtyp*)SvIV(*ptr))->role = hv_fetch(foo,"role",4,0); - ((struct classtyp*)SvIV(*ptr))->class = hv_fetch(foo,"class",5,0); - ((struct classtyp*)SvIV(*ptr))->align = hv_fetch(foo,"align",5,0); - ((struct classtyp*)SvIV(*ptr))->charismatic = hv_fetch(foo,"charismatic",11,0); - ((struct classtyp*)SvIV(*ptr))->scorned = hv_fetch(foo,"scorned",7,0); + if (hv_fetch(foo,"role",4,0) != NULL) { + ((struct classtyp*)SvIV(*ptr))->role = SvIV(*hv_fetch(foo,"role",4,0)); + } + if (hv_fetch(foo,"role",4,0) != NULL) { + ((struct classtyp*)SvIV(*ptr))->class = SvIV(*hv_fetch(foo,"class",5,0)); + } + if (hv_fetch(foo,"align",5,0) != NULL) { + ((struct classtyp*)SvIV(*ptr))->align = SvIV(*hv_fetch(foo,"align",5,0)); + } + if (hv_fetch(foo,"charismatic",11,0) != NULL) { + ((struct classtyp*)SvIV(*ptr))->charismatic = SvIV(*hv_fetch(foo,"charismatic",11,0)); + } + if (hv_fetch(foo,"scorned",7,0) != NULL) { + ((struct classtyp*)SvIV(*ptr))->scorned = SvIV(*hv_fetch(foo,"scorned",7,0)); + } diff --git a/src/modules/IWannaFly/Types/Struct/classtyp/classtyp.pm b/src/modules/IWannaFly/Types/Struct/classtyp/classtyp.pm index 4442454..49151c1 100644 --- a/src/modules/IWannaFly/Types/Struct/classtyp/classtyp.pm +++ b/src/modules/IWannaFly/Types/Struct/classtyp/classtyp.pm @@ -2,7 +2,7 @@ package IWannaFly::Types::Struct::classtyp use warnings; use strict; use Hash::Util; -use IWannaFly::Macro +use IWannaFly::Macro; use IWannaFly::Types::Struct::classtyp'xs; sub malloc { @@ -27,7 +27,7 @@ sub fetch($°) { my $self = shift; my °Ptr = shift; £struct = IWannaFly::Types::Struct::classtyp'xs::iwfperl_fetch_struct_classtyp(°Ptr); - £struct->{sync} = IWannaFly::Types::classtyp'xs::iwfperl_sync_struct_classtype(£struct->{Ptr}); + £struct->{SYNC} = IWannaFly::Types::classtyp'xs::iwfperl_sync_struct_classtype(£struct->{Ptr}); lock_keys(%£struct); bless £struct, $self; } diff --git a/src/modules/IWannaFly/Types/free.pm b/src/modules/IWannaFly/Types/free.pm index 2965860..c00a8e6 100644 --- a/src/modules/IWannaFly/Types/free.pm +++ b/src/modules/IWannaFly/Types/free.pm @@ -1,3 +1,4 @@ +package IWannaFly::Types::free use warnings; use strict; use IWannaFly'Macro;