Author Topic: Suggest on changing the Variables name in Tokenizer  (Read 12208 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Suggest on changing the Variables name in Tokenizer
« on: March 11, 2009, 02:40:11 am »
In the Tokenizer class include Tokenizer.cpp and Tokenizer.h.

I think these member names should be changed to confirm the coding style.

Code
    
m_peek             ->  m_PeekToken
m_curtoken        -> m_CurToken
m_peekavailable  -> m_PeekAvailable

I do think it is necessary, really? :D
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Suggest on changing the Variables name in Tokenizer
« Reply #1 on: March 11, 2009, 08:41:52 am »
Code
    
m_peek             ->  m_PeekToken
m_curtoken        -> m_CurToken
m_peekavailable  -> m_PeekAvailable
No objections. Could you provide a patch?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Suggest on changing the Variables name in Tokenizer
« Reply #2 on: March 11, 2009, 12:12:38 pm »
Ok.
I have created a patch. See the attachment file. (I have successfully built them in my windows svn 5482)
I change the m_curtoken   -> m_Token
So that there are three groups members. Also, I change the Tokenizer.cpp's encoding to UTF8 without BOM.

Current:
m_Token XXX 
......
Undo:
m_UndoTokenXXX
......
Peek:
m_PeekTokenXXX
......

Also, I change the sequence of initial member list in the constructor to avoid compiling warnings.

[attachment deleted by admin]
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Suggest on changing the Variables name in Tokenizer
« Reply #3 on: March 11, 2009, 02:34:36 pm »
I have created a patch.
Thanks. Give me some days to test it...


BTW, this:
Also, I change the Tokenizer.cpp's encoding to UTF8 without BOM.
...caused a comment to be not readable anymore. So I am not going to apply the UTF8 change. Be careful with such. ;-)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Suggest on changing the Variables name in Tokenizer
« Reply #4 on: March 11, 2009, 02:40:19 pm »
OK
The reason I change it's encoding is that by default, the "search thread" can't do search on this file( a messagebox will jump to say "can't open this file  :(), but after changing to UTF8 with out BOM( I converted it by NotePad++), then it can be searched correctly. :D
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Suggest on changing the Variables name in Tokenizer
« Reply #5 on: March 11, 2009, 02:51:45 pm »
the "search thread" can't do search on this file
If you mean the thread search plugin - this works fine for me (see image attached). Hence I have applied a couple of patches - so probably it's not working in trunk, indeed.

changing to UTF8 with out BOM( I converted it by NotePad++)
Hehe - what Notepad++ did was "converting" the characters in question to something else, but different. So the conversion is in fact kind of broken and just "works" because the problematic chars (² and ³) are no more. ;-)

[attachment deleted by admin]
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Suggest on changing the Variables name in Tokenizer
« Reply #6 on: March 11, 2009, 05:43:36 pm »
If you mean the thread search plugin - this works fine for me (see image attached). Hence I have applied a couple of patches - so probably it's not working in trunk, indeed.
Thank you!
I can see your image, I'm looking forward to the new nightly build version that all these patches were applied to trunk. :D
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Suggest on changing the Variables name in Tokenizer
« Reply #7 on: April 11, 2009, 05:11:53 pm »
@MortenMacFly

Just a reminder, are all the patches on code completion still in testing phase? (It seems one months passed, I can't wait :D...)

Thanks.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Suggest on changing the Variables name in Tokenizer
« Reply #8 on: April 11, 2009, 08:22:54 pm »
Just a reminder, are all the patches on code completion still in testing phase? (It seems one months passed, I can't wait :D...)
Yes, they are. We (the devs) do still testing. Hence the release schedule is like that:
- merge wxaui branch
- create CC branch for official testing
- merge CC branch (won't take as long as wxaui branch though)
All I can say: Please be patient. Good things won't get lost - I promise. Keep in mind that these are hard times for all of us. Time is limited. But again: Nothing will get lost. For sure.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Suggest on changing the Variables name in Tokenizer
« Reply #9 on: April 12, 2009, 02:52:33 am »
Thanks for explanation. :D
Thanks for all your efforts!
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.