Top Level Namespace

Defined Under Namespace

Modules: Dsl Classes: CLang

Instance Method Summary collapse

Instance Method Details

#char(varname) ⇒ Object



9
10
11
12
# File 'lib/dsl/clang/c_v1.rb', line 9

def char(varname)
  # Creamos la variable local en el contexto
  $BINDING.local_variable_set(varname, '')
end

#fgets(varname, size, stdin) ⇒ Object



14
15
16
# File 'lib/dsl/clang/c_v1.rb', line 14

def fgets(varname, size, stdin)
  varname = gets.chomp
end

#main(&block) ⇒ Object

module Dsl

module Clang
  class Error < StandardError; end
  # Your code goes here...
end

end



13
14
15
16
# File 'lib/dsl/clang.rb', line 13

def main(&block)
  modern_c = CLang.new
  modern_c.run(block)
end

#printf(*args) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/dsl/clang/c_v1.rb', line 18

def printf(*args)
  if args.count == 1
    puts args
  else 
    format = args.shift
    puts format % args
  end
end

#sizeof(varname) ⇒ Object



27
28
29
# File 'lib/dsl/clang/c_v1.rb', line 27

def sizeof(varname)
  varname.size
end