From 64e064330c5c595d0b8553028e0c5ca95c5e5392 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Tue, 19 Jun 2012 18:32:22 +0200 Subject: Lua: Remove Lua --- lib/CMakeLists.txt | 1 - lib/core/gen_idx.lua | 261 ---------------------------------------- lib/core/init.lua | 9 -- lib/core/objects.lua | 8 -- lib/core/player.lua | 16 --- lib/core/util.lua | 37 ------ lib/mods/theme/core/gen_idx.lua | 261 ---------------------------------------- lib/mods/theme/core/init.lua | 9 -- lib/mods/theme/core/objects.lua | 8 -- lib/mods/theme/core/player.lua | 16 --- lib/mods/theme/core/util.lua | 37 ------ 11 files changed, 663 deletions(-) delete mode 100644 lib/core/gen_idx.lua delete mode 100644 lib/core/init.lua delete mode 100644 lib/core/objects.lua delete mode 100644 lib/core/player.lua delete mode 100644 lib/core/util.lua delete mode 100644 lib/mods/theme/core/gen_idx.lua delete mode 100644 lib/mods/theme/core/init.lua delete mode 100644 lib/mods/theme/core/objects.lua delete mode 100644 lib/mods/theme/core/player.lua delete mode 100644 lib/mods/theme/core/util.lua (limited to 'lib') diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 245d98f8..f6e7748c 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -5,7 +5,6 @@ INSTALL(FILES INSTALL(DIRECTORY apex cmov - core data dngn edit diff --git a/lib/core/gen_idx.lua b/lib/core/gen_idx.lua deleted file mode 100644 index 5f3af435..00000000 --- a/lib/core/gen_idx.lua +++ /dev/null @@ -1,261 +0,0 @@ --- Place here the list of files to parse -files = -{ - "birth.txt", - "experien.hlp", - "gods.txt", - "explore.hlp", - "newbie.hlp", - "advanced.hlp", - "help.hlp", - "general.txt", - "whattome.txt", - "dungeon.txt", - "spoiler.hlp", - "g_melkor.txt", - "skills.txt", - "c_bard.txt", - "c_druid.txt", - "c_lorema.txt", - "c_mage.txt", - "c_mimic.txt", - "c_mindcr.txt", - "c_monk.txt", - "c_palad.txt", - "c_posses.txt", - "c_pr_drk.txt", - "c_pr_eru.txt", - "c_pr_man.txt", - "c_symbia.txt", - "c_alchem.txt", - "c_archer.txt", - "c_assass.txt", - "c_axemas.txt", - "c_demono.txt", - "c_geoman.txt", - "c_hafted.txt", - "c_necro.txt", - "c_polear.txt", - "c_ranger.txt", - "c_rogue.txt", - "c_runecr.txt", - "c_sorcer.txt", - "c_swordm.txt", - "c_thaum.txt", - "c_unbel.txt", - "c_warper.txt", - "c_warrio.txt", - "m_meta.txt", - "rm_skel.txt", - "rm_zomb.txt", - "luckspoi.txt", - "m_air.txt", - "dunspoil.txt", - "g_eru.txt", - "g_manwe.txt", - "g_tulkas.txt", - "m_divin.txt", - "m_mimic.txt", - "m_water.txt", - "magic.txt", - "r_drkelf.txt", - "r_dwarf.txt", - "r_elf.txt", - "r_hielf.txt", - "r_hobbit.txt", - "r_pettyd.txt", - "r_wodelf.txt", - "rm_spec.txt", - "tome_faq.txt", - "ability.txt", - "automat.txt", - "c_summon.txt", - "command.txt", - "corspoil.txt", - "debug.txt", - "m_music.txt", - "rm_barb.txt", - "macrofaq.txt", - "m_necrom.txt", - "m_mindcr.txt", - "m_symbio.txt", - "m_thaum.txt", - "magic.hlp", - "m_convey.txt", - "m_fire.txt", - "m_mana.txt", - "m_mind.txt", - "m_nature.txt", - "m_tempo.txt", - "m_udun.txt", - "m_geoman.txt", - "essences.txt", - "r_ent.txt", - "g_yavann.txt", - "defines.txt", - "rm_vamp.txt", - "inscrip.txt", - "m_earth.txt", - "option.txt", - "attack.txt", - "version.txt", - "m_demono.txt", - "r_beorn.txt", - "r_deathm.txt", - "r_rohank.txt", - "r_hafogr.txt", - "r_human.txt", - "r_kobold.txt", - "r_maia.txt", - "r_orc.txt", - "r_thlord.txt", - "r_troll.txt", - "r_yeek.txt", - "rm_class.txt", - "rm_herm.txt", - "rm_lsoul.txt", - "wishing.txt", - "c_priest.txt", - "fatespoi.txt", - "gambling.txt", - "r_dunad.txt", - "r_gnome.txt", - "r_hafelf.txt", - "c_merch.txt", - "spoil_faq.txt", -} - -out_file = "index.txt" - -index = {} - -function parse_file(file) - local fff = openfile(path_build(ANGBAND_DIR_HELP, file), "r") - local line - - line = read(fff, "*l") - while line do - local i, j, anchor, name, subname = strfind(line, "~~~~~(%d+)|([%d%a -]+)|([%d%a -]+)") - if not i then - i, j, anchor, name = strfind(line, "~~~~~(%d+)|([%d%a -]+)") - - subname = nil - end - - if i then - if not index[name] then - index[name] = {} - end - if subname then - tinsert(index[name], { __name__ = subname, __file__ = file, __anchor__ = anchor}) - else - tinsert(index[name], { __name__ = "__primary__", __file__ = file, __anchor__ = anchor}) - end - end - - line = read(fff, "*l") - end - - closefile(fff) -end - -function sort_fct(a, b) - local i, len - - a = a.__name__ - b = b.__name__ - - if strlen(a) > strlen(b) then len = strlen(b) else len = strlen(a) end - - for i = 1, len do - local ac = strbyte(a, i) - local bc = strbyte(b, i) - - if ac < bc then - return not nil - elseif ac > bc then - return nil - end - end - if strlen(a) > strlen(b) then return nil else return not nil end -end - -function generate_index() - local k, e, index_list - for _, e in files do - parse_file(e) - end - - index_list = {} - for k, e in index do - -- Ok either my sort function or lua sort function sucks ass .. - sort(e, sort_fct) - sort(e, sort_fct) - sort(e, sort_fct) - sort(e, sort_fct) - sort(e, sort_fct) - tinsert(index_list, {__name__= k, __table__ = e}) - end - - -- Ok either my sort function or lua sort function sucks ass .. - sort(index_list, sort_fct) - sort(index_list, sort_fct) - sort(index_list, sort_fct) - sort(index_list, sort_fct) - sort(index_list, sort_fct) - index = index_list -end - -function out_link(fff, space, name, file, anchor) - write(fff, space.."*****"..file.."*"..anchor.."["..name.."]\n") -end - -function print_index() - local i, j, c, new_c - local fff = openfile(path_build(ANGBAND_DIR_HELP, out_file), "w") - - write(fff, -[[|||||oy -#####R /----------------------------------------\ -#####R < Help Index > -#####R \----------------------------------------/ - -This is the index of everything in the T.o.M.E. documentation. - -#####BHit a letter key to jump to the entries for that letter. - -Some entries in the index link to the same place as other entries. This is -intentional, so that the information you want is easy to find. - -Don't forget you can browse the help from the *****help.hlp*02[Main menu]. - -#####sSpotted a problem with the help files, or some content thats missing? -#####sContact fearoffours@t-o-m-e.net . - -]]) - - c = ' ' - for i = 1, getn(index) do - new_c = strbyte(index[i].__name__, 1) - if c ~= new_c then - c = new_c - write(fff, "~~~~~"..c.."\n") - write(fff, "*****/"..strchar(c)..out_file.."*"..c.."["..strchar(c).."]\n") - end - for j = 1, getn(index[i].__table__) do - if index[i].__table__[j].__name__ == "__primary__" then - out_link(fff, " ", index[i].__name__, index[i].__table__[j].__file__, index[i].__table__[j].__anchor__) - end - end - for j = 1, getn(index[i].__table__) do - if index[i].__table__[j].__name__ ~= "__primary__" then - out_link(fff, " ", index[i].__table__[j].__name__, index[i].__table__[j].__file__, index[i].__table__[j].__anchor__) - end - end - end - closefile(fff) -end - -generate_index() - -print_index() diff --git a/lib/core/init.lua b/lib/core/init.lua deleted file mode 100644 index 44ef9a7a..00000000 --- a/lib/core/init.lua +++ /dev/null @@ -1,9 +0,0 @@ --- --- This file is loaded at the initialisation of ToME --- Load the system functions --- - --- various vital helper code -tome_dofile_anywhere(ANGBAND_DIR_CORE, "util.lua") -tome_dofile_anywhere(ANGBAND_DIR_CORE, "player.lua") -tome_dofile_anywhere(ANGBAND_DIR_CORE, "objects.lua") diff --git a/lib/core/objects.lua b/lib/core/objects.lua deleted file mode 100644 index fa77c57b..00000000 --- a/lib/core/objects.lua +++ /dev/null @@ -1,8 +0,0 @@ --- SYSTEM FILE --- --- Lua object funtions --- - -function get_kind(obj) - return k_info[obj.k_idx + 1] -end diff --git a/lib/core/player.lua b/lib/core/player.lua deleted file mode 100644 index deec2e21..00000000 --- a/lib/core/player.lua +++ /dev/null @@ -1,16 +0,0 @@ --- SYSTEM FILE --- --- Lua player funtions --- - --------- skill stuff --------- - --- Easy skill access -function skill(i) - return s_info[i + 1] -end - --- easier inventory access -function player.inventory(i) - return player.inventory_real[i + 1] -end diff --git a/lib/core/util.lua b/lib/core/util.lua deleted file mode 100644 index c3387401..00000000 --- a/lib/core/util.lua +++ /dev/null @@ -1,37 +0,0 @@ --- various stuff to make scripters life easier - --- Beware of the scary undefined globals -function safe_getglobal(x) - local v = rawget(globals(), x) - - if v then - return v - else - error("undefined global variable '"..x.."'") - end -end - -function set_safe_globals() - settagmethod(tag(nil), "getglobal", safe_getglobal) -end -function unset_safe_globals() - settagmethod(tag(nil), "getglobal", nil) -end - -set_safe_globals() - --- Wrapper for the real msg_print and cmsg_print --- it understands if we want color or not -function msg_print(c, m) - if type(c) == "number" then - cmsg_print(c, m) - else - call(%msg_print, { c }) - end -end - - --- Strings -function msg_format(...) - msg_print(call(format, arg)) -end diff --git a/lib/mods/theme/core/gen_idx.lua b/lib/mods/theme/core/gen_idx.lua deleted file mode 100644 index 5f3af435..00000000 --- a/lib/mods/theme/core/gen_idx.lua +++ /dev/null @@ -1,261 +0,0 @@ --- Place here the list of files to parse -files = -{ - "birth.txt", - "experien.hlp", - "gods.txt", - "explore.hlp", - "newbie.hlp", - "advanced.hlp", - "help.hlp", - "general.txt", - "whattome.txt", - "dungeon.txt", - "spoiler.hlp", - "g_melkor.txt", - "skills.txt", - "c_bard.txt", - "c_druid.txt", - "c_lorema.txt", - "c_mage.txt", - "c_mimic.txt", - "c_mindcr.txt", - "c_monk.txt", - "c_palad.txt", - "c_posses.txt", - "c_pr_drk.txt", - "c_pr_eru.txt", - "c_pr_man.txt", - "c_symbia.txt", - "c_alchem.txt", - "c_archer.txt", - "c_assass.txt", - "c_axemas.txt", - "c_demono.txt", - "c_geoman.txt", - "c_hafted.txt", - "c_necro.txt", - "c_polear.txt", - "c_ranger.txt", - "c_rogue.txt", - "c_runecr.txt", - "c_sorcer.txt", - "c_swordm.txt", - "c_thaum.txt", - "c_unbel.txt", - "c_warper.txt", - "c_warrio.txt", - "m_meta.txt", - "rm_skel.txt", - "rm_zomb.txt", - "luckspoi.txt", - "m_air.txt", - "dunspoil.txt", - "g_eru.txt", - "g_manwe.txt", - "g_tulkas.txt", - "m_divin.txt", - "m_mimic.txt", - "m_water.txt", - "magic.txt", - "r_drkelf.txt", - "r_dwarf.txt", - "r_elf.txt", - "r_hielf.txt", - "r_hobbit.txt", - "r_pettyd.txt", - "r_wodelf.txt", - "rm_spec.txt", - "tome_faq.txt", - "ability.txt", - "automat.txt", - "c_summon.txt", - "command.txt", - "corspoil.txt", - "debug.txt", - "m_music.txt", - "rm_barb.txt", - "macrofaq.txt", - "m_necrom.txt", - "m_mindcr.txt", - "m_symbio.txt", - "m_thaum.txt", - "magic.hlp", - "m_convey.txt", - "m_fire.txt", - "m_mana.txt", - "m_mind.txt", - "m_nature.txt", - "m_tempo.txt", - "m_udun.txt", - "m_geoman.txt", - "essences.txt", - "r_ent.txt", - "g_yavann.txt", - "defines.txt", - "rm_vamp.txt", - "inscrip.txt", - "m_earth.txt", - "option.txt", - "attack.txt", - "version.txt", - "m_demono.txt", - "r_beorn.txt", - "r_deathm.txt", - "r_rohank.txt", - "r_hafogr.txt", - "r_human.txt", - "r_kobold.txt", - "r_maia.txt", - "r_orc.txt", - "r_thlord.txt", - "r_troll.txt", - "r_yeek.txt", - "rm_class.txt", - "rm_herm.txt", - "rm_lsoul.txt", - "wishing.txt", - "c_priest.txt", - "fatespoi.txt", - "gambling.txt", - "r_dunad.txt", - "r_gnome.txt", - "r_hafelf.txt", - "c_merch.txt", - "spoil_faq.txt", -} - -out_file = "index.txt" - -index = {} - -function parse_file(file) - local fff = openfile(path_build(ANGBAND_DIR_HELP, file), "r") - local line - - line = read(fff, "*l") - while line do - local i, j, anchor, name, subname = strfind(line, "~~~~~(%d+)|([%d%a -]+)|([%d%a -]+)") - if not i then - i, j, anchor, name = strfind(line, "~~~~~(%d+)|([%d%a -]+)") - - subname = nil - end - - if i then - if not index[name] then - index[name] = {} - end - if subname then - tinsert(index[name], { __name__ = subname, __file__ = file, __anchor__ = anchor}) - else - tinsert(index[name], { __name__ = "__primary__", __file__ = file, __anchor__ = anchor}) - end - end - - line = read(fff, "*l") - end - - closefile(fff) -end - -function sort_fct(a, b) - local i, len - - a = a.__name__ - b = b.__name__ - - if strlen(a) > strlen(b) then len = strlen(b) else len = strlen(a) end - - for i = 1, len do - local ac = strbyte(a, i) - local bc = strbyte(b, i) - - if ac < bc then - return not nil - elseif ac > bc then - return nil - end - end - if strlen(a) > strlen(b) then return nil else return not nil end -end - -function generate_index() - local k, e, index_list - for _, e in files do - parse_file(e) - end - - index_list = {} - for k, e in index do - -- Ok either my sort function or lua sort function sucks ass .. - sort(e, sort_fct) - sort(e, sort_fct) - sort(e, sort_fct) - sort(e, sort_fct) - sort(e, sort_fct) - tinsert(index_list, {__name__= k, __table__ = e}) - end - - -- Ok either my sort function or lua sort function sucks ass .. - sort(index_list, sort_fct) - sort(index_list, sort_fct) - sort(index_list, sort_fct) - sort(index_list, sort_fct) - sort(index_list, sort_fct) - index = index_list -end - -function out_link(fff, space, name, file, anchor) - write(fff, space.."*****"..file.."*"..anchor.."["..name.."]\n") -end - -function print_index() - local i, j, c, new_c - local fff = openfile(path_build(ANGBAND_DIR_HELP, out_file), "w") - - write(fff, -[[|||||oy -#####R /----------------------------------------\ -#####R < Help Index > -#####R \----------------------------------------/ - -This is the index of everything in the T.o.M.E. documentation. - -#####BHit a letter key to jump to the entries for that letter. - -Some entries in the index link to the same place as other entries. This is -intentional, so that the information you want is easy to find. - -Don't forget you can browse the help from the *****help.hlp*02[Main menu]. - -#####sSpotted a problem with the help files, or some content thats missing? -#####sContact fearoffours@t-o-m-e.net . - -]]) - - c = ' ' - for i = 1, getn(index) do - new_c = strbyte(index[i].__name__, 1) - if c ~= new_c then - c = new_c - write(fff, "~~~~~"..c.."\n") - write(fff, "*****/"..strchar(c)..out_file.."*"..c.."["..strchar(c).."]\n") - end - for j = 1, getn(index[i].__table__) do - if index[i].__table__[j].__name__ == "__primary__" then - out_link(fff, " ", index[i].__name__, index[i].__table__[j].__file__, index[i].__table__[j].__anchor__) - end - end - for j = 1, getn(index[i].__table__) do - if index[i].__table__[j].__name__ ~= "__primary__" then - out_link(fff, " ", index[i].__table__[j].__name__, index[i].__table__[j].__file__, index[i].__table__[j].__anchor__) - end - end - end - closefile(fff) -end - -generate_index() - -print_index() diff --git a/lib/mods/theme/core/init.lua b/lib/mods/theme/core/init.lua deleted file mode 100644 index 44ef9a7a..00000000 --- a/lib/mods/theme/core/init.lua +++ /dev/null @@ -1,9 +0,0 @@ --- --- This file is loaded at the initialisation of ToME --- Load the system functions --- - --- various vital helper code -tome_dofile_anywhere(ANGBAND_DIR_CORE, "util.lua") -tome_dofile_anywhere(ANGBAND_DIR_CORE, "player.lua") -tome_dofile_anywhere(ANGBAND_DIR_CORE, "objects.lua") diff --git a/lib/mods/theme/core/objects.lua b/lib/mods/theme/core/objects.lua deleted file mode 100644 index fa77c57b..00000000 --- a/lib/mods/theme/core/objects.lua +++ /dev/null @@ -1,8 +0,0 @@ --- SYSTEM FILE --- --- Lua object funtions --- - -function get_kind(obj) - return k_info[obj.k_idx + 1] -end diff --git a/lib/mods/theme/core/player.lua b/lib/mods/theme/core/player.lua deleted file mode 100644 index deec2e21..00000000 --- a/lib/mods/theme/core/player.lua +++ /dev/null @@ -1,16 +0,0 @@ --- SYSTEM FILE --- --- Lua player funtions --- - --------- skill stuff --------- - --- Easy skill access -function skill(i) - return s_info[i + 1] -end - --- easier inventory access -function player.inventory(i) - return player.inventory_real[i + 1] -end diff --git a/lib/mods/theme/core/util.lua b/lib/mods/theme/core/util.lua deleted file mode 100644 index c3387401..00000000 --- a/lib/mods/theme/core/util.lua +++ /dev/null @@ -1,37 +0,0 @@ --- various stuff to make scripters life easier - --- Beware of the scary undefined globals -function safe_getglobal(x) - local v = rawget(globals(), x) - - if v then - return v - else - error("undefined global variable '"..x.."'") - end -end - -function set_safe_globals() - settagmethod(tag(nil), "getglobal", safe_getglobal) -end -function unset_safe_globals() - settagmethod(tag(nil), "getglobal", nil) -end - -set_safe_globals() - --- Wrapper for the real msg_print and cmsg_print --- it understands if we want color or not -function msg_print(c, m) - if type(c) == "number" then - cmsg_print(c, m) - else - call(%msg_print, { c }) - end -end - - --- Strings -function msg_format(...) - msg_print(call(format, arg)) -end -- cgit v1.2.3