Opened 4 years ago

Closed 4 years ago

Last modified 4 years 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



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/' 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 4 years ago.
Pathch to

Download all attachments as: .zip

Change History (4)

Changed 4 years ago by awi

Pathch to

comment:1 Changed 4 years ago by vadz

Very nice, thanks!

comment:2 Changed 4 years 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 4 years ago by VZ

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

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

See #15783.

Note: See TracTickets for help on using tickets.