Module: AutoC
- Defined in:
- lib/autoc.rb,
lib/autoc/type.rb,
lib/autoc/code.rb,
lib/autoc/collection.rb,
lib/autoc/collection/list.rb,
lib/autoc/collection/queue.rb,
lib/autoc/collection/vector.rb,
lib/autoc/collection/hash_set.rb,
lib/autoc/collection/hash_map.rb
Overview
AutoC is a host of Ruby modules related to automatic C source code generation.
-
Code generic C multi-source module generator.
-
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
- VERSION =
"1.2"
Class Method Summary (collapse)
-
+ (Object) c_id(obj)
Convert obj to string and return it.
- + (Object) priority_sort(entities, reverse = false)
Class Method Details
+ (Object) c_id(obj)
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 |
+ (Object) priority_sort(entities, reverse = false)
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 |