Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 19, 2008, 4:40:43 PM (16 years ago)
Author:
rgrieder
Message:

Cleaned up indentation chaos in tolua. There were tabs and 1 space indentations, even mixed in a single block.
It should now be possible to actually pimp these files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/buildsystem/src/tolua/lua/feature.lua

    r1755 r2229  
    4040-- check if it requires collection
    4141function classFeature:requirecollection (t)
    42  return false
     42    return false
    4343end
    4444
    4545-- build names
    4646function classFeature:buildnames ()
    47  if self.name and self.name~='' then
    48   local n = split(self.name,'@')
    49   self.name = n[1]
    50   if not n[2] then
    51    n[2] = applyrenaming(n[1])
    52   end
    53   self.lname = n[2] or gsub(n[1],"%[.-%]","")
    54   self.original_name = self.name
    55   self.lname = clean_template(self.lname)
    56  end
    57  if not self.is_parameter then
    58         self.name = getonlynamespace() .. self.name
    59  end
     47    if self.name and self.name~='' then
     48        local n = split(self.name,'@')
     49        self.name = n[1]
     50        if not n[2] then
     51            n[2] = applyrenaming(n[1])
     52        end
     53        self.lname = n[2] or gsub(n[1],"%[.-%]","")
     54        self.original_name = self.name
     55        self.lname = clean_template(self.lname)
     56    end
     57    if not self.is_parameter then
     58        self.name = getonlynamespace() .. self.name
     59    end
    6060
    61  local parent = classContainer.curr
    62  if parent then
    63         self.access = parent.curr_member_access
    64  else
    65  end
     61    local parent = classContainer.curr
     62    if parent then
     63        self.access = parent.curr_member_access
     64    else
     65    end
    6666end
    6767
    6868function classFeature:check_public_access()
    6969
    70         if self.access and self.access ~= 0 then
    71                 return false
    72         end
     70    if self.access and self.access ~= 0 then
     71        return false
     72    end
    7373
    74         local parent = classContainer.curr
    75         while parent do
    76                 if parent.access and parent.access ~= 0 then
    77                         return false
    78                 end
    79                 parent = parent.prox
    80         end
    81         return true
     74    local parent = classContainer.curr
     75    while parent do
     76        if parent.access and parent.access ~= 0 then
     77            return false
     78        end
     79        parent = parent.prox
     80    end
     81    return true
    8282end
    8383
    8484function clean_template(t)
    8585
    86         return string.gsub(t, "[<>:, %*]", "_")
     86    return string.gsub(t, "[<>:, %*]", "_")
    8787end
    8888
     
    9090-- it returns the container class name or nil.
    9191function classFeature:incontainer (which)
    92  if self.parent then
    93   local parent = self.parent
    94   while parent do
    95    if parent.classtype == which then
    96     return parent.name
    97    end
    98    parent = parent.parent
    99   end
    100  end
    101  return nil
     92    if self.parent then
     93        local parent = self.parent
     94        while parent do
     95            if parent.classtype == which then
     96                return parent.name
     97            end
     98            parent = parent.parent
     99        end
     100    end
     101    return nil
    102102end
    103103
    104104function classFeature:inclass ()
    105  return self:incontainer('class')
     105    return self:incontainer('class')
    106106end
    107107
    108108function classFeature:inmodule ()
    109  return self:incontainer('module')
     109    return self:incontainer('module')
    110110end
    111111
    112112function classFeature:innamespace ()
    113  return self:incontainer('namespace')
     113    return self:incontainer('namespace')
    114114end
    115115
     
    118118function classFeature:cfuncname (n)
    119119
    120  if self.parent then
    121   n = self.parent:cfuncname(n)
    122  end
     120    if self.parent then
     121        n = self.parent:cfuncname(n)
     122    end
    123123
    124   n = string.gsub(n..'_'.. (self.lname or self.name), "[<>:, \.%*&]", "_")
     124    n = string.gsub(n..'_'.. (self.lname or self.name), "[<>:, \.%*&]", "_")
    125125
    126   return n
     126    return n
    127127end
    128128
Note: See TracChangeset for help on using the changeset viewer.