Class: Gdlc::GDLC

Inherits:
Object
  • Object
show all
Defined in:
lib/gdlc/gdlc.rb

Constant Summary collapse

GDLC_PATH =
'gdlc'
OUTDIR_PATH =
"C:/temp"
@@flags =

Compiler flags

[]
@@incdirs =

Include directories

[]
@@app_path =

Path to GDLC executable

GDLC_PATH

Class Method Summary collapse

Class Method Details

.add_flag(flg) ⇒ Object

Add a compiler flag

Duplicate flags are discarded.

flg - Flag to set.



50
51
52
# File 'lib/gdlc/gdlc.rb', line 50

def GDLC.add_flag(flg)
  @@flags << flg unless @@flags.include? flg
end

.add_include_dirs(dirs) ⇒ Object

Add include dir(s)

dirName - Name of directory



73
74
75
76
77
78
79
80
81
# File 'lib/gdlc/gdlc.rb', line 73

def GDLC.add_include_dirs(dirs)
  if(dirs.class == Array)
    dirs.each do |d|
      @@incdirs << d unless @@incdirs.include? d
    end
  else
    @@incdirs << dirs unless @@incdirs.include? dirs
  end
end

.app_pathObject

Class methods



30
31
32
# File 'lib/gdlc/gdlc.rb', line 30

def GDLC.app_path
  @@app_path
end

.app_path=(apppath) ⇒ Object



34
35
36
# File 'lib/gdlc/gdlc.rb', line 34

def GDLC.app_path=(apppath)
  @@app_path = apppath
end

.clear_flagsObject

clear all flags



40
41
42
# File 'lib/gdlc/gdlc.rb', line 40

def GDLC.clear_flags
  @@flags = []
end

.clear_include_dirsObject

Clear out the include directory list



96
97
98
99
# File 'lib/gdlc/gdlc.rb', line 96

def GDLC.clear_include_dirs
  @@incdirs.clear

end

.compile(srcfile, outname) ⇒ Object

Compile a guideline

srcfile - Name of source file to compile outname - Name of output file



106
107
108
# File 'lib/gdlc/gdlc.rb', line 106

def GDLC.compile(srcfile, outname)
  GDLC.execute_GDLC("#{GDLC.get_flags} #{GDLC.get_include_dirs} #{srcfile} #{outname}")
end

.get_flagsObject

Return a string containing all flags as input parameters

returns params - string containing all flags separated with space



59
60
61
# File 'lib/gdlc/gdlc.rb', line 59

def GDLC.get_flags
  return @@flags.join " "
end

.get_include_dirsObject

Return a string containing all include dirs as input parameters Formats string as ‘/Isome/dir/name /Isome/other/dir’

returns params - Parameter string



88
89
90
91
92
# File 'lib/gdlc/gdlc.rb', line 88

def GDLC.get_include_dirs
  @@incdirs
  params = @@incdirs.map { |d| "--I#{d}" }
  params.join ' '
end

.incdirsObject

Return compiler include dirs array



65
66
67
# File 'lib/gdlc/gdlc.rb', line 65

def GDLC.incdirs
  @@incdirs
end