Opened 10 months ago

Closed 10 months ago

Last modified 10 months ago

#15783 closed optimization (fixed)

Increase maintainability of code in 'stc' module (new approach)

Reported by: awi Owned by:
Priority: lowest Milestone:
Component: wxStyledText Version: 3.0.0
Keywords: Cc:
Blocked By: Blocking:
Patch: yes

Description

Ref. http://trac.wxwidgets.org/ticket/15782

In the code in stc.cpp file there are plenty of calls of SendMsg function.
In some of these calls first argument of the function (representing message code) is given as a symbol (defined in Scintilla.h) but in others as a plain numeric value what makes the code more difficult to analyse and to maintain.

Changes made:
Because std.cpp file is generated by script 'src/stc/gen_iface.py' so the script was modified in order to generate symbols of codes (taken from Scintilla.h) instead of numeric values:

  • Scintilla.h file is parsed first and dictionary containing (code, symbol) pairs is created (new processHeader function)
  • based on this dictionary all message codes are replaced with corresponding symbols when stc.cpp file is generated (in parseFun function)

Patch file attached.

Attachments (1)

gen-stc.patch download (6.5 KB) - added by awi 10 months ago.
Pathch to gen_iface.py

Download all attachments as: .zip

Change History (4)

Changed 10 months ago by awi

Pathch to gen_iface.py

comment:1 Changed 10 months ago by vadz

Very nice, thanks!

comment:2 Changed 10 months ago by VZ

  • Resolution set to fixed
  • Status changed from new to closed

(In [75443]) Use symbolic constants names in the generated wxSTC files.

Update the script generating stc.cpp to put the symbolic constants names and
not their raw numeric values into the generated code. This makes it much
easier to read and understand.

Closes #15783.

comment:3 Changed 10 months ago by VZ

(In [75444]) Update the generated file after gen_iface.py change.

Regenerate the file to use the symbolic constants instead of the raw values.

See #15783.

Note: See TracTickets for help on using tickets.