# Created: 5-Sept-2000
# RCS-ID: $Id$
# Copyright: (c) 2000 by Total Control Software
-# Licence: wxWindows license
+# Licence: wxWindows licence
#----------------------------------------------------------------------------
'void %s(const wxString& text);',
'''void %s(const wxString& text) {
- wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
- SendMsg(%s, strlen(buf), (sptr_t)(const char*)buf);''',
+ const wxWX2MBbuf buf = wx2stc(text);
+ SendMsg(%s, wx2stclen(text, buf), (sptr_t)(const char*)buf);''',
0),
'AddStyledText' : (0,
'void %s(const wxString& text);',
'''void %s(const wxString& text) {
- wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
- SendMsg(%s, strlen(buf), (sptr_t)(const char*)buf);''',
+ const wxWX2MBbuf buf = wx2stc(text);
+ SendMsg(%s, wx2stclen(text, buf), (sptr_t)(const char*)buf);''',
0),
'GetViewWS' : ( 'GetViewWhiteSpace', 0, 0, 0),
const wxColour& background) {
SendMsg(%s, markerNumber, markerSymbol);
- if (foreground.Ok())
+ if (foreground.IsOk())
MarkerSetForeground(markerNumber, foreground);
- if (background.Ok())
+ if (background.IsOk())
MarkerSetBackground(markerNumber, background);''',
('Set the symbol used for a particular marker number,',
TextToFind ft;
ft.chrg.cpMin = minPos;
ft.chrg.cpMax = maxPos;
- wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
+ const wxWX2MBbuf buf = wx2stc(text);
ft.lpstrText = (char*)(const char*)buf;
return SendMsg(%s, flags, (sptr_t)&ft);''',
'wxString %s();',
'''wxString %s() {
- long start;
- long end;
-
- GetSelection(&start, &end);
- int len = end - start;
+ const int len = SendMsg(SCI_GETSELTEXT, 0, (sptr_t)0);
if (!len) return wxEmptyString;
wxMemoryBuffer mbuf(len+2);
'''
int %s(const wxString& text) {
- wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
- return SendMsg(%s, strlen(buf), (sptr_t)(const char*)buf);''',
+ const wxWX2MBbuf buf = wx2stc(text);
+ return SendMsg(%s, wx2stclen(text, buf), (sptr_t)(const char*)buf);''',
0),
'ReplaceTargetRE' :
'''
int %s(const wxString& text) {
- wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
- return SendMsg(%s, strlen(buf), (sptr_t)(const char*)buf);''',
+ const wxWX2MBbuf buf = wx2stc(text);
+ return SendMsg(%s, wx2stclen(text, buf), (sptr_t)(const char*)buf);''',
0),
'SearchInTarget' :
'''
int %s(const wxString& text) {
- wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
- return SendMsg(%s, strlen(buf), (sptr_t)(const char*)buf);''',
+ const wxWX2MBbuf buf = wx2stc(text);
+ return SendMsg(%s, wx2stclen(text, buf), (sptr_t)(const char*)buf);''',
0),
# not sure what to do about these yet
curDocStrings = []
elif op == 'cat ':
- if string.strip(line[4:]) == 'Deprecated':
+ if line[4:].strip() == 'Deprecated':
break # skip the rest of the file
elif op == 'evt ':
pass
else:
- print '***** Unknown line type: ', line
+ print('***** Unknown line type: %s' % line)
# process templates
def joinWithNewLines(values):
- return string.join(values, '\n')
+ return '\n'.join(values)
#----------------------------------------------------------------------------
def checkMethodOverride(name, number, docs):
theDef = theImp = None
- if methodOverrideMap.has_key(name):
+ if name in methodOverrideMap:
item = methodOverrideMap[name]
try:
if item[3] != 0:
docs = item[3]
except:
- print "*************", name
+ print("************* " + name)
raise
return name, theDef, theImp, docs
#----------------------------------------------------------------------------
def parseVal(line, values, docs):
- name, val = string.split(line, '=')
+ name, val = line.split('=')
# remove prefixes such as SCI, etc.
for old, new in valPrefixes:
def parseFun(line, methods, docs, values, is_const):
def parseParam(param):
- param = string.strip(param)
+ param = param.strip()
if param == '':
param = None
else:
- param = tuple(string.split(param))
+ param = tuple(param.split())
return param
mo = funregex.match(line)
if mo is None:
- print "***** Line doesn't match! : " + line
+ print("***** Line doesn't match! : %s" % line)
retType, name, number, param1, param2 = mo.groups()
param2 = parseParam(param2)
# Special case. For the key command functions we want a value defined too
- num = string.atoi(number)
+ num = int(number)
for v in cmdValues:
if (type(v) == type(()) and v[0] <= num <= v[1]) or v == num:
- parseVal('CMD_%s=%s' % (string.upper(name), number), values, docs)
+ parseVal('CMD_%s=%s' % (name.upper(), number), values, docs)
# if we are not also doing a function for CMD values, then
# just return, otherwise fall through to the append blow.
# TODO: parse command line args to replace default input/output files???
if not os.path.exists(IFACE):
- print 'Please run this script from src/stc subdirectory.'
+ print('Please run this script from src/stc subdirectory.')
sys.exit(1)
# Now just do it