[ create a new paste ] login | about

Link: http://codepad.org/uZ2KTm0y    [ raw code | output | fork ]

Ruby, pasted on May 18:
# -*- encoding: UTF-8 -*-

module Count_Lib
  # 0...1...2...3...4...5...6
  def self.count_limit_create  c , limit , add
#    start , limit = limit , start if add < 0
#    c = 
    if add > 0
    # plus
      return lambda do
        c += add
        c = limit if c >= limit
        return c
      end
    else
    # minus
      return lambda do
        c += add
        c = limit if c <= limit
        return c
      end
    end
  end
  # 0...1...2...3...4...0...1...2...3...4

  def self.count_loop_create  start , limit , add
    c = start
    start , limit = limit , start if add < 0
    lambda do
      c += add
      c = start if c >= limit
      return c
    end
  end
  # 0...1...2...3...4...3...2...1...0
  def self.count_loop_rev_create  start , limit , add
    c = start
    start , limit = limit , start if add < 0
    lambda do
      c += add
      add *= -1 if c >= limit || c <= start
      c = limit if c >= limit
      c = start if c <= start
      return c
    end
  end
  def self.count_select type
    case type
      when nil
        return lambda do | *h | lambda do | *hh | end  end
      when :default
        return lambda do | *h | count_limit_create *h end
      when :loop
        return lambda do | *h | count_loop_create *h end
      when :loop_rev
        return lambda do | *h | count_loop_rev_create *h end
    end
  end
  def self.__fead_inout_create_sub o , hs = Hash.new
     o.x      = hs[:x] 
     o.y      = hs[:y] 
     o.d      = hs[:d] 
     o.st.fade_z   = hs[:z] || 0
     hs_rot    = hs[:rot]    || Hash.new
     hs_scalex = hs[:scalex] || Hash.new
     hs_scaley = hs[:scaley] || Hash.new
     hs_alpha  = hs[:alpha]  || Hash.new
     
     o.st.rot_hik    = ({  type:  hs_rot[:type]     || :default , start:  hs_rot[:start]    || 0   , limit:  hs_rot[:limit]    || 0 , add: hs_rot[:add]    || 0 })
     o.st.scalex_hik = ({  type:  hs_scalex[:type]  || :default , start:  hs_scalex[:start] || 1   , limit:  hs_scalex[:limit] || 1 , add: hs_scalex[:add] || 0 })
     o.st.scaley_hik = ({  type:  hs_scaley[:type]  || :default , start:  hs_scaley[:start] || 1   , limit:  hs_scaley[:limit] || 1 , add: hs_scaley[:add] || 0 })
     o.st.alpha_hik  = ({  type:  hs_alpha[:type]   || :default , start:  hs_alpha[:start]  || 255 , limit:  hs_alpha[:limit]  || 0 , add: hs_alpha[:add]  || 0 })
     create_remilambda = lambda do | hs |
       self.count_select(hs[:type]).call   hs[:start] , hs[:limit] , hs[:add]
     end
     o.st.rotremi     =  create_remilambda[ o.st.rot_hik    ]
     o.st.scalexremi  =  create_remilambda[ o.st.scalex_hik ]
     o.st.scaleyremi  =  create_remilambda[ o.st.scaley_hik ]
     o.st.alpharemi   =  create_remilambda[ o.st.alpha_hik  ]

     lambda do 
        o.st.rot     = o.st.rotremi.call
        o.st.alpha   = o.st.alpharemi.call
        o.st.scalex  = o.st.scalexremi.call
        o.st.scaley  = o.st.scaleyremi.call
        Window.drawEx( o.x , o.y, o.d, ({ :angle => o.st.rot, :alpha => o.st.alpha,
             :scalex => o.st.scalex, :scaley => o.st.scaley , :z => o.st.fade_z }) ) 
     end 
  end # def
end


Output:
Line 69: odd number list for Hash
     o.st.rot_hik    = ({  type:  hs_rot[:type]     || :default , start:  hs_rot[:start]    || 0   , limit:  hs_rot[:limit]    || 0 , add: hs_rot[:add]    || 0 })
                                ^
Line 69: syntax error, unexpected ':', expecting '}'
     o.st.rot_hik    = ({  type:  hs_rot[:type]     || :default , start:  hs_rot[:start]    || 0   , limit:  hs_rot[:limit]    || 0 , add: hs_rot[:add]    || 0 })
                                ^
Line 69: syntax error, unexpected ',', expecting ')'
     o.st.rot_hik    = ({  type:  hs_rot[:type]     || :default , start:  hs_rot[:start]    || 0   , limit:  hs_rot[:limit]    || 0 , add: hs_rot[:add]    || 0 })
                                                                 ^
Line 69: syntax error, unexpected ',', expecting ')'
     o.st.rot_hik    = ({  type:  hs_rot[:type]     || :default , start:  hs_rot[:start]    || 0   , limit:  hs_rot[:limit]    || 0 , add: hs_rot[:add]    || 0 })
                                                                                                    ^
Line 69: syntax error, unexpected ',', expecting ')'
     o.st.rot_hik    = ({  type:  hs_rot[:type]     || :default , start:  hs_rot[:start]    || 0   , limit:  hs_rot[:limit]    || 0 , add: hs_rot[:add]    || 0 })
                                                                                                                                     ^
Line 69: syntax error, unexpected '}', expecting ')'
     o.st.rot_hik    = ({  type:  hs_rot[:type]     || :default , start:  hs_rot[:start]    || 0   , limit:  hs_rot[:limit]    || 0 , add: hs_rot[:add]    || 0 })
                                                                                                                                                                 ^
Line 70: odd number list for Hash
     o.st.scalex_hik = ({  type:  hs_scalex[:type]  || :default , start:  hs_scalex[:start] || 1   , limit:  hs_scalex[:limit] || 1 , add: hs_scalex[:add] || 0 })
                                ^
Line 70: syntax error, unexpected ':', expecting '}'
     o.st.scalex_hik = ({  type:  hs_scalex[:type]  || :default , start:  hs_scalex[:start] || 1   , limit:  hs_scalex[:limit] || 1 , add: hs_scalex[:add] || 0 })
                                ^
Line 70: syntax error, unexpected ',', expecting ')'
     o.st.scalex_hik = ({  type:  hs_scalex[:type]  || :default , start:  hs_scalex[:start] || 1   , limit:  hs_scalex[:limit] || 1 , add: hs_scalex[:add] || 0 })
                                                                 ^
Line 70: syntax error, unexpected ',', expecting ')'
     o.st.scalex_hik = ({  type:  hs_scalex[:type]  || :default , start:  hs_scalex[:start] || 1   , limit:  hs_scalex[:limit] || 1 , add: hs_scalex[:add] || 0 })
                                                                                                    ^
Line 70: syntax error, unexpected ',', expecting ')'
     o.st.scalex_hik = ({  type:  hs_scalex[:type]  || :default , start:  hs_scalex[:start] || 1   , limit:  hs_scalex[:limit] || 1 , add: hs_scalex[:add] || 0 })
                                                                                                                                     ^
Line 70: syntax error, unexpected '}', expecting ')'
     o.st.scalex_hik = ({  type:  hs_scalex[:type]  || :default , start:  hs_scalex[:start] || 1   , limit:  hs_scalex[:limit] || 1 , add: hs_scalex[:add] || 0 })
                                                                                                                                                                 ^
Line 71: odd number list for Hash
     o.st.scaley_hik = ({  type:  hs_scaley[:type]  || :default , start:  hs_scaley[:start] || 1   , limit:  hs_scaley[:limit] || 1 , add: hs_scaley[:add] || 0 })
                                ^
Line 71: syntax error, unexpected ':', expecting '}'
     o.st.scaley_hik = ({  type:  hs_scaley[:type]  || :default , start:  hs_scaley[:start] || 1   , limit:  hs_scaley[:limit] || 1 , add: hs_scaley[:add] || 0 })
                                ^
Line 71: syntax error, unexpected ',', expecting ')'
     o.st.scaley_hik = ({  type:  hs_scaley[:type]  || :default , start:  hs_scaley[:start] || 1   , limit:  hs_scaley[:limit] || 1 , add: hs_scaley[:add] || 0 })
                                                                 ^
Line 71: syntax error, unexpected ',', expecting ')'
     o.st.scaley_hik = ({  type:  hs_scaley[:type]  || :default , start:  hs_scaley[:start] || 1   , limit:  hs_scaley[:limit] || 1 , add: hs_scaley[:add] || 0 })
                                                                                                    ^
Line 71: syntax error, unexpected ',', expecting ')'
     o.st.scaley_hik = ({  type:  hs_scaley[:type]  || :default , start:  hs_scaley[:start] || 1   , limit:  hs_scaley[:limit] || 1 , add: hs_scaley[:add] || 0 })
                                                                                                                                     ^
Line 71: syntax error, unexpected '}', expecting ')'
     o.st.scaley_hik = ({  type:  hs_scaley[:type]  || :default , start:  hs_scaley[:start] || 1   , limit:  hs_scaley[:limit] || 1 , add: hs_scaley[:add] || 0 })
                                                                                                                                                                 ^
Line 72: odd number list for Hash
     o.st.alpha_hik  = ({  type:  hs_alpha[:type]   || :default , start:  hs_alpha[:start]  || 255 , limit:  hs_alpha[:limit]  || 0 , add: hs_alpha[:add]  || 0 })
                                ^
Line 72: syntax error, unexpected ':', expecting '}'
     o.st.alpha_hik  = ({  type:  hs_alpha[:type]   || :default , start:  hs_alpha[:start]  || 255 , limit:  hs_alpha[:limit]  || 0 , add: hs_alpha[:add]  || 0 })
                                ^
Line 72: syntax error, unexpected ',', expecting ')'
     o.st.alpha_hik  = ({  type:  hs_alpha[:type]   || :default , start:  hs_alpha[:start]  || 255 , limit:  hs_alpha[:limit]  || 0 , add: hs_alpha[:add]  || 0 })
                                                                 ^
Line 72: syntax error, unexpected ',', expecting ')'
     o.st.alpha_hik  = ({  type:  hs_alpha[:type]   || :default , start:  hs_alpha[:start]  || 255 , limit:  hs_alpha[:limit]  || 0 , add: hs_alpha[:add]  || 0 })
                                                                                                    ^
Line 72: syntax error, unexpected ',', expecting ')'
     o.st.alpha_hik  = ({  type:  hs_alpha[:type]   || :default , start:  hs_alpha[:start]  || 255 , limit:  hs_alpha[:limit]  || 0 , add: hs_alpha[:add]  || 0 })
                                                                                                                                     ^
Line 72: syntax error, unexpected '}', expecting ')'
     o.st.alpha_hik  = ({  type:  hs_alpha[:type]   || :default , start:  hs_alpha[:start]  || 255 , limit:  hs_alpha[:limit]  || 0 , add: hs_alpha[:add]  || 0 })
                                                                                                                                                                 ^
Line 89: syntax error, unexpected kEND, expecting ')'
  end # def
     ^


Create a new paste based on this one


Comments: