kompiler 0.3.0.pre.4 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,68 @@
1
+ class PackedBytes
2
+ def initialize bytes = ""
3
+ @bytes = bytes.dup
4
+ end
5
+
6
+ def uint8 n
7
+ n = [n] if n.is_a? Numeric
8
+ @bytes << n.pack("C*")
9
+ end
10
+
11
+ def uint16 n
12
+ n = [n] if n.is_a? Numeric
13
+ @bytes << n.pack("S<*")
14
+ end
15
+
16
+ def uint32 n
17
+ n = [n] if n.is_a? Numeric
18
+ @bytes << n.pack("L<*")
19
+ end
20
+
21
+ def uint64 n
22
+ n = [n] if n.is_a? Numeric
23
+ @bytes << n.pack("Q<*")
24
+ end
25
+
26
+ def bytes bytes, n_bytes=nil
27
+ if n_bytes == nil
28
+ if bytes.is_a? PackedBytes
29
+ @bytes += bytes.result
30
+ elsif bytes.is_a? String
31
+ @bytes += bytes
32
+ elsif bytes.is_a? Array
33
+ @bytes += bytes.pack("C*")
34
+ end
35
+ else
36
+ case n_bytes
37
+ when 1
38
+ self.uint8 bytes
39
+ when 2
40
+ self.uint16 bytes
41
+ when 4
42
+ self.uint32 bytes
43
+ when 8
44
+ self.uint64 bytes
45
+ end
46
+ end
47
+ end
48
+ alias_method :add, :bytes
49
+
50
+ def align n_bytes, pad_byte="\0"
51
+ if @bytes.size % n_bytes == 0
52
+ return
53
+ else
54
+ @bytes << pad_byte * (n_bytes - (@bytes.size % n_bytes))
55
+ end
56
+ end
57
+
58
+ def result
59
+ @bytes
60
+ end
61
+ alias_method :get_bytes, :result
62
+
63
+ def to_file filename
64
+ File.binwrite filename, self.result
65
+ end
66
+ alias_method :write, :to_file
67
+ alias_method :save, :to_file
68
+ end
@@ -0,0 +1 @@
1
+ require 'kompiler/wrappers/elf_wrapper'
data/lib/kompiler.rb CHANGED
@@ -19,4 +19,5 @@ require 'kompiler/compiler_functions.rb'
19
19
  require 'kompiler/architecture.rb'
20
20
  require 'kompiler/directives.rb'
21
21
  require 'kompiler/arch_manager.rb'
22
- require 'kompiler/math_ast.rb'
22
+ require 'kompiler/math_ast.rb'
23
+ require 'kompiler/wrappers'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kompiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.pre.4
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyryl Shyshko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-28 00:00:00.000000000 Z
11
+ date: 2025-04-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'Kompiler is a low-level, modular and extendable compiler for any architecture.
14
14
  By default Kompiler supports ARMv8-a, but other architecture extensions can be downloaded
@@ -30,6 +30,8 @@ files:
30
30
  - lib/kompiler/architectures/armv8a/instructions.rb
31
31
  - lib/kompiler/architectures/armv8a/load.rb
32
32
  - lib/kompiler/architectures/armv8a/registers.rb
33
+ - lib/kompiler/architectures/armv8a/simd_fp_instructions.rb
34
+ - lib/kompiler/architectures/armv8a/simd_fp_registers.rb
33
35
  - lib/kompiler/architectures/armv8a/sys_instructions.rb
34
36
  - lib/kompiler/architectures/armv8a/sys_registers.rb
35
37
  - lib/kompiler/compiler_functions.rb
@@ -38,6 +40,9 @@ files:
38
40
  - lib/kompiler/math_ast.rb
39
41
  - lib/kompiler/mc_builder.rb
40
42
  - lib/kompiler/parsers.rb
43
+ - lib/kompiler/wrappers.rb
44
+ - lib/kompiler/wrappers/elf_wrapper.rb
45
+ - lib/kompiler/wrappers/packed_bytes.rb
41
46
  homepage: https://github.com/kyryloshy/kompiler
42
47
  licenses:
43
48
  - Apache-2.0
@@ -59,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
64
  - !ruby/object:Gem::Version
60
65
  version: '0'
61
66
  requirements: []
62
- rubygems_version: 3.5.10
67
+ rubygems_version: 3.4.10
63
68
  signing_key:
64
69
  specification_version: 4
65
70
  summary: Kir's compiler for low-level machine code