Module: AutoC

Defined in:
lib/autoc.rb,
lib/autoc/code.rb,
lib/autoc/type.rb,
lib/autoc/collection.rb,
lib/autoc/collection/list.rb,
lib/autoc/collection/queue.rb,
lib/autoc/collection/vector.rb,
lib/autoc/collection/hash_map.rb,
lib/autoc/collection/hash_set.rb

Overview

AutoC is a host of Ruby modules related to automatic C source code generation.

  1. Code generic C multi-source module generator.

  2. Collection strongly-typed data structure generators similar to the C++ STL container classes.

Versioning scheme

AutoC adheres to simple major.minor versioning scheme.

Change in major number states incompatible changes in the code while change in minor number states (rather) small incremental changes that should not normally break things.

That said, release 1.0 is the first release of version 1 which is considered beta, not stable. Note that it is not necessary stable or feature complete. Releases 1.1+ will present incremental improvements, bugfixes, documentation updates etc. to version 1. Should the major incompatible changes be made, the new release 2.0 will be introduced and so forth.

Defined Under Namespace

Modules: Priority Classes: Code, Collection, HashMap, HashSet, List, Module, Queue, Reference, Type, UserDefinedType, Vector

Constant Summary collapse

VERSION =
"1.2"

Class Method Summary collapse

Class Method Details

.c_id(obj) ⇒ Object

Convert obj to string and return it. Throw NameError is resulting string is not a valid C identifier.



22
23
24
25
26
# File 'lib/autoc/code.rb', line 22

def self.c_id(obj)
  obj = obj.to_s
  #raise NameError.new("#{obj} is not a valid C identifier", obj) if (/^[_a-zA-Z]\w*$/ =~ obj).nil?
  obj
end

.priority_sort(entities, reverse = false) ⇒ Object



129
130
131
132
133
# File 'lib/autoc/code.rb', line 129

def self.priority_sort(entities, reverse = false)
  list = entities.to_a.sort! {|a,b| a.priority <=> b.priority}
  list.reverse! unless reverse
  list
end