From 7ef6a533ec6c73d5815ace42168067a6f8c26e3a Mon Sep 17 00:00:00 2001 From: Ray Date: Sat, 6 Jun 2009 14:56:30 -0400 Subject: [PATCH] Removed obsolete perl6 files. --- ignore-me_perl6/LibFpdbImport.pm | 178 ------------------------------- ignore-me_perl6/LibFpdbShared.pm | 84 --------------- ignore-me_perl6/LibFpdbView.pm | 17 --- ignore-me_perl6/RunFpdbCLI.perl6 | 29 ----- 4 files changed, 308 deletions(-) delete mode 100644 ignore-me_perl6/LibFpdbImport.pm delete mode 100644 ignore-me_perl6/LibFpdbShared.pm delete mode 100644 ignore-me_perl6/LibFpdbView.pm delete mode 100644 ignore-me_perl6/RunFpdbCLI.perl6 diff --git a/ignore-me_perl6/LibFpdbImport.pm b/ignore-me_perl6/LibFpdbImport.pm deleted file mode 100644 index ac7db336..00000000 --- a/ignore-me_perl6/LibFpdbImport.pm +++ /dev/null @@ -1,178 +0,0 @@ -#!/usr/bin/pugs - -#Copyright 2008 Steffen Jobbagy-Felso -#This program is free software: you can redistribute it and/or modify -#it under the terms of the GNU Affero General Public License as published by -#the Free Software Foundation, version 3 of the License. -# -#This program is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. -# -#You should have received a copy of the GNU Affero General Public License -#along with this program. If not, see . -#In the "official" distribution you can find the license in -#agpl-3.0.txt in the docs folder of the package. - -module LibFpdbImport; -use v6; -#use strict; -use LibFpdbShared; -#use LibFpdbImport2; - -class Player { - has Str $name; - has Int $start_cash; - has Card @.cards; - has Char $position; - - submethod BUILD (Str @strings) { - say "todo: implement Player.BUILD"; - }#end Player.BUILD - - our Player method find_players(@strings) { - #todo: i think this should be sub since its a class method not an instance method - say "todo: implement Player.find_players"; - } -}#end class Player - -class Line { - has Str $line; - has Bool $processed; - - our protected submethod BUILD() { - say "todo: implement Line.BUILD?" - }#end Line.BUILD - - our Line method recognise_and_parse(@strings) { - #todo: i think this should be sub since its a class method not an instance method - say "todo: implement Line.recognise_and_parse"; - }#end Line.recognise_and_parse -}#end class Line - -class ActionLine is Line { - has Player $player; - has Str $type; - has Int $amount; - has Bool $all_in; - has Int $action_no; -}#end class ActionLine - -class WinLine is Line { - has Player $player; - has Int $amount; -}#end class WinLine - -class RakeLine is Line { - has Int $amount; -}#end class RakeLine - -class CardLine is Line { - has Bool $board_line; - has Player $player; - has Card @cards; -}#end class CardLine - -#for useless lines -class CrapLine is Line { - has Str $type; -}#end class CrapLine - -class Hand { - has Line @.lines; - #has Str @strings; - has Site $site; - has Str $currency; - - has Str $type; - has Str $category; - has Str $limit_type;#todo: above ; missing causes error, but that doesnt list ; as a possibility - has Player @.players; - has Card @.board; - has Int $db_id; - - submethod BUILD(Str @strings) { - Util.debug("running Hand.BUILD"); - say "strings:",@strings; - #this contructor automatically parses the hand. call .store for storing - - @.players=Player.find_players(@strings); - @.lines=Line.recognise_and_parse(@strings); - - for @strings -> $line { - if class_of(line)==CardLine { - if line.board { - board=line.cards; - } else { - for player in players { - if line.player==player { - player.cards=line.cards; - } - } - } - } - } - }#end Hand.BUILD - - our Bool method is_holdem(){ - if category==("holdem"|"omahahi"|"omahahilo") { - return True; - } else { - return False; - } - }#end Hand.is_holdem - - our Bool method is_stud(){ - return not is_holdem(); - }#end Hand.is_stud - - our Bool method store($db) { - say "todo: Hand.store"; - }#end Hand.store -}#end class Hand - -class Importer { -#todo: be Thread? - submethod BUILD (Database $db, Str $filename) { - Util.debug("running Importer.BUILD"); - if (not ($db.is_connected())) { - Util.fatal("not connected to DB"); - } - - my IO $?filehandle=$filename; - #for =$filehandle -> $line {say $line} - my Str @lines =$filehandle; - - my Int $hand_start=0; - my Int $hand_end=0; - my Int $loopcount=0; - loop {#one loop of this per hand - $loopcount++; - say "loopcount", $loopcount; - my Int $current_line_index=$hand_end+1; #previous hand end is new hand start - for (my Int $i, $i<5, $i++) {#remove blank hands - if (@lines[$current_line_index].bytes) < 6 { - $current_line_index++; - } else { - $hand_start=$current_line_index; - break; - } - } - my Bool $continue=True; #todo: this is dumb, find out correct loop - while $continue {#loop through the lines to find end of hand - $current_line_index++; - if (@lines[$current_line_index].bytes) < 6 { - $hand_end=$current_line_index; - $continue=False; - } - }#end of find end of hand loop - my Str @handlines=@lines[$hand_start..$hand_end]; - my Hand $hand .= new(:lines(@handlines)); - $hand.store($db); - say "todo: record \$db_id"; - say "todo: terminate on EOF"; - } - }#end new Importer -}#end class Importer - diff --git a/ignore-me_perl6/LibFpdbShared.pm b/ignore-me_perl6/LibFpdbShared.pm deleted file mode 100644 index abf2eb69..00000000 --- a/ignore-me_perl6/LibFpdbShared.pm +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/pugs - -#Copyright 2008 Steffen Jobbagy-Felso -#This program is free software: you can redistribute it and/or modify -#it under the terms of the GNU Affero General Public License as published by -#the Free Software Foundation, version 3 of the License. -# -#This program is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. -# -#You should have received a copy of the GNU Affero General Public License -#along with this program. If not, see . -#In the "official" distribution you can find the license in -#agpl-3.0.txt in the docs folder of the package. - -module LibFpdbShared; -use v6; -#use strict; - -class Util { - method debug(Str $string) { - #todo: i think this should be sub since its a class method not an instance method - say "debug notice: ", $string; - }#end debug_msg - - sub warn(Str $string) { - say "todo: Util.warning"; - }#end warning - - sub fatal(Str $string, Database $db) { - say "todo: Util.fatal_error"; - }#end fatal_error -}#end class Util - -class Database { - has Str $backend; - has Str $host; - has Str $name; - has Str $user; - my Str $password; - submethod BUILD (Str $!backend, Str $!host, Str $!name, Str $!user, Str $!password) { - Util.debug("running Database.BUILD"); - self.connect(); - }#end new Database - - our method connect() { - say "todo: db.connect"; - }#end connect - - method disconnect() { - say "todo: db.disconnect"; - }#end disconnect - - method cancel_import() { - say "todo: db.cancel_import"; - }#end cancel_import - - my method drop_tables() { - #todo: make this one private - say "todo: db.drop_tables"; - }#end drop_tables - - method recreate_tables() { - say "todo: db.recreate_tables"; - }#end recreate_tables - - #returns the id of the insert - our Int method insert(Str $sql_command) { - #todo: is it a bug that i need the "our" above? - say "todo: db.insert"; - return 0; - }#end insert - - our Str method fetch(Str $sql_command) { - say "todo: db.fetch"; - }#end fetch - - our Bool method is_connected() { - say "todo: db.is_connected"; - }#end -}#end class Database - diff --git a/ignore-me_perl6/LibFpdbView.pm b/ignore-me_perl6/LibFpdbView.pm deleted file mode 100644 index e4f994d1..00000000 --- a/ignore-me_perl6/LibFpdbView.pm +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/pugs - -#Copyright 2008 Steffen Jobbagy-Felso -#This program is free software: you can redistribute it and/or modify -#it under the terms of the GNU Affero General Public License as published by -#the Free Software Foundation, version 3 of the License. -# -#This program is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. -# -#You should have received a copy of the GNU Affero General Public License -#along with this program. If not, see . -#In the "official" distribution you can find the license in -#agpl-3.0.txt in the docs folder of the package. - diff --git a/ignore-me_perl6/RunFpdbCLI.perl6 b/ignore-me_perl6/RunFpdbCLI.perl6 deleted file mode 100644 index dbbad9a7..00000000 --- a/ignore-me_perl6/RunFpdbCLI.perl6 +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/pugs - -#Copyright 2008 Steffen Jobbagy-Felso -#This program is free software: you can redistribute it and/or modify -#it under the terms of the GNU Affero General Public License as published by -#the Free Software Foundation, version 3 of the License. -# -#This program is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. -# -#You should have received a copy of the GNU Affero General Public License -#along with this program. If not, see . -#In the "official" distribution you can find the license in -#agpl-3.0.txt in the docs folder of the package. - -use v6; -#use strict; -use LibFpdbImport; -use LibFpdbShared; - - -my Database $db .= new(:backend, :host, :database, :user, :password); -#todo: below doesnt work -my Importer $imp .= new(:db($db), :filename); -#perlbug?: adding another named argument that isnt listed in the constructor gave very weird error. -say $imp; -