wxwidgets/misc/languages/data/wx/wx_readversion.lua
utelle a20aa4de75 Improve generated process for the language database files
Fix some issues and streamline regeneration process:

- A few glitches (like duplicate language symbols, wrong Windows
  language ids etc) were fixed.
- Scripts were added to allow to regenerate the list of supported
  locales from the list of known Windows locales.
- Version info when language symbols became available was added to the
  documentation of the language symbol enum.
- Synonyms are no longer hard-coded in the script genlang.py.

See #23453.

Closes #23437.
2023-04-18 14:27:28 +02:00

32 lines
1,018 B
Lua

-- Retrieve current wxWidgets version
codeFileName = "../../../include/wx/version.h"
function trim(s)
return s:match'^%s*(.*%S)' or ''
end
fo2 = io.open('temp/wx_loadversion.sql','w')
fo2:write('-- Current wxWidgets version\n-- Date: ' .. os.date("%Y-%m-%d %H:%M") .. '\n\n')
fo2:write("create table if not exists wx_version (version char, primary key (version));\n")
fo2:write('delete from wx_version;\nbegin;\n')
count = 0
for line in io.lines(codeFileName) do
vkey = trim(string.sub(line,1,28))
vval = trim(string.sub(line,30,35))
if vkey == "#define wxMAJOR_VERSION" then
vmajor = vval
elseif vkey == "#define wxMINOR_VERSION" then
vminor = vval
elseif vkey == "#define wxRELEASE_NUMBER" then
vrelno = vval
elseif vkey == "#define wxSUBRELEASE_NUMBER" then
vsubno = vval
end
end
wxversion = vmajor .. "." .. vminor .. "." .. vrelno
print("wx version number=" .. wxversion)
fo2:write("insert into wx_version values('" .. wxversion .. "');\n")
fo2:write('commit;\n')
fo2:close()