Compare commits

..

No commits in common. "f6d552766ba57f721dd617205e3b15496f2f757e" and "62c6d43ca327dcbf8832b3a210a41e1b822da593" have entirely different histories.

9 changed files with 562 additions and 579 deletions

View File

@ -20,6 +20,7 @@ include (AddThreads)
find_package (Termo QUIET NO_MODULE) find_package (Termo QUIET NO_MODULE)
option (USE_SYSTEM_TERMO option (USE_SYSTEM_TERMO
"Don't compile our own termo library, use the system one" ${Termo_FOUND}) "Don't compile our own termo library, use the system one" ${Termo_FOUND})
if (USE_SYSTEM_TERMO) if (USE_SYSTEM_TERMO)
if (NOT Termo_FOUND) if (NOT Termo_FOUND)
message (FATAL_ERROR "System termo library not found") message (FATAL_ERROR "System termo library not found")
@ -44,6 +45,7 @@ set (project_libraries ${Unistring_LIBRARIES}
pkg_search_module (lua lua53 lua5.3 lua-5.3 lua>=5.3) pkg_search_module (lua lua53 lua5.3 lua-5.3 lua>=5.3)
option (WITH_LUA "Enable support for Lua plugins" ${lua_FOUND}) option (WITH_LUA "Enable support for Lua plugins" ${lua_FOUND})
if (WITH_LUA) if (WITH_LUA)
if (NOT lua_FOUND) if (NOT lua_FOUND)
message (FATAL_ERROR "Lua library not found") message (FATAL_ERROR "Lua library not found")
@ -63,18 +65,6 @@ if (WITH_LUA)
endif () endif ()
endif () endif ()
pkg_check_modules (x11 x11 xrender xft fontconfig)
option (WITH_X11 "Build with X11 support" ${x11_FOUND})
if (WITH_X11)
if (NOT x11_FOUND)
message (FATAL_ERROR "Some X11 libraries were not found")
endif ()
list (APPEND project_libraries ${x11_LIBRARIES})
include_directories (${x11_INCLUDE_DIRS})
link_directories (${x11_LIBRARY_DIRS})
endif ()
include_directories (${Unistring_INCLUDE_DIRS} include_directories (${Unistring_INCLUDE_DIRS}
${Ncursesw_INCLUDE_DIRS} ${Termo_INCLUDE_DIRS}) ${Ncursesw_INCLUDE_DIRS} ${Termo_INCLUDE_DIRS})
@ -84,6 +74,8 @@ set (CMAKE_REQUIRED_LIBRARIES ${Ncursesw_LIBRARIES})
CHECK_FUNCTION_EXISTS ("resizeterm" HAVE_RESIZETERM) CHECK_FUNCTION_EXISTS ("resizeterm" HAVE_RESIZETERM)
# Generate a configuration file # Generate a configuration file
set (HAVE_LUA "${WITH_LUA}")
configure_file (${PROJECT_SOURCE_DIR}/config.h.in configure_file (${PROJECT_SOURCE_DIR}/config.h.in
${PROJECT_BINARY_DIR}/config.h) ${PROJECT_BINARY_DIR}/config.h)
include_directories (${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR}) include_directories (${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR})
@ -97,10 +89,6 @@ add_threads (${PROJECT_NAME})
include (GNUInstallDirs) include (GNUInstallDirs)
install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR}) install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
if (WITH_X11)
install (FILES ${PROJECT_NAME}.desktop
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
endif ()
# Generate documentation from text markup # Generate documentation from text markup
find_program (ASCIIDOCTOR_EXECUTABLE asciidoctor) find_program (ASCIIDOCTOR_EXECUTABLE asciidoctor)

View File

@ -1,4 +1,4 @@
Copyright (c) 2016 - 2023, Přemysl Eric Janouch <p@janouch.name> Copyright (c) 2016 - 2017, Přemysl Eric Janouch <p@janouch.name>
Permission to use, copy, modify, and/or distribute this software for any Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted. purpose with or without fee is hereby granted.

View File

@ -3,7 +3,7 @@ hex
'hex' is yet another hex viewer. It automatically interprets fields within 'hex' is yet another hex viewer. It automatically interprets fields within
files using a set of Lua scripts, colorizing them and showing descriptions on files using a set of Lua scripts, colorizing them and showing descriptions on
the side. It also runs equally well in the terminal, or as an X11 client. the side.
At the moment there aren't that many features and we only have a few decoders. At the moment there aren't that many features and we only have a few decoders.
@ -24,7 +24,6 @@ Building and Running
Build dependencies: CMake, pkg-config, awk, liberty (included), Build dependencies: CMake, pkg-config, awk, liberty (included),
termo (included), asciidoctor or asciidoc (recommended but optional) + termo (included), asciidoctor or asciidoc (recommended but optional) +
Runtime dependencies: ncursesw, libunistring, Lua >= 5.3 (for highlighting) Runtime dependencies: ncursesw, libunistring, Lua >= 5.3 (for highlighting)
Optional runtime dependencies: x11, xft
$ git clone --recursive https://git.janouch.name/p/hex.git $ git clone --recursive https://git.janouch.name/p/hex.git
$ mkdir hex/build $ mkdir hex/build

View File

@ -5,8 +5,7 @@
#define PROGRAM_VERSION "${PROJECT_VERSION}" #define PROGRAM_VERSION "${PROJECT_VERSION}"
#cmakedefine HAVE_RESIZETERM #cmakedefine HAVE_RESIZETERM
#cmakedefine WITH_LUA #cmakedefine HAVE_LUA
#cmakedefine WITH_X11
#endif // ! CONFIG_H #endif // ! CONFIG_H

View File

@ -38,10 +38,6 @@ _G_=1024M, and _GB_=1000M. The default value is 1G.
*-d*, *--debug*:: *-d*, *--debug*::
Run in debug mode. Run in debug mode.
*-x*, *--x11*::
Use an X11 interface even when run from a terminal.
Note that the application may be built with this feature disabled.
*-h*, *--help*:: *-h*, *--help*::
Display a help message and exit. Display a help message and exit.

1096
hex.c

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +0,0 @@
[Desktop Entry]
Type=Application
Name=hex
GenericName=Interpreting hex viewer
Icon=hex
Exec=hex %f
NoDisplay=true
StartupNotify=false
Categories=Utility;

@ -1 +1 @@
Subproject commit d01a1ff0348174f91bb2d3ba53145cc2c9f50a7f Subproject commit 34f86651f6220038c0ee07d3f422a52d9b081f02

View File

@ -63,7 +63,7 @@ local decode_ph = function (elf, c)
ph.vaddr = elf.uwide (c, "virtual address: %#x") ph.vaddr = elf.uwide (c, "virtual address: %#x")
ph.paddr = elf.uwide (c, "physical address: %#x") ph.paddr = elf.uwide (c, "physical address: %#x")
ph.filesz = elf.uwide (c, "size in file: %d") ph.filesz = elf.uwide (c, "size in file: %d")
ph.memsz = elf.uwide (c, "size in memory: %d") ph.memsz = elf.uwide (c, "sise in memory: %d")
if elf.class == 1 then ph.flags = c:u32 ("flags: %s", xform_ph_flags) end if elf.class == 1 then ph.flags = c:u32 ("flags: %s", xform_ph_flags) end
ph.align = elf.uwide (c, "alignment: %d") ph.align = elf.uwide (c, "alignment: %d")
return ph return ph